@chinchillaenterprises/mcp-chatgpt
v1.0.0
Published
MCP server for ChatGPT/OpenAI integration - collaborate between Claude and ChatGPT
Downloads
7
Readme
MCP ChatGPT - AI Collaboration Server
Enable seamless collaboration between Claude and ChatGPT through the Model Context Protocol
🚀 Features
- Multi-Conversation Management: Create and manage multiple ChatGPT conversations
- Model Selection: Choose between GPT-4, GPT-4 Turbo, and GPT-3.5 Turbo
- Specialized Analysis: Code review, security analysis, performance optimization
- Approach Comparison: Compare different solutions side-by-side
- Conversation History: Full access to conversation history and context
- System Prompts: Set custom system prompts for specialized contexts
📋 Prerequisites
- Node.js 18 or higher
- OpenAI API Key - Get yours at platform.openai.com
🛠️ Installation
Quick Install for Claude Code
# Install globally for all projects
claude mcp add chatgpt -s user -e OPENAI_API_KEY=your_api_key -- npx @chinchillaenterprises/mcp-chatgpt
# Or install for specific project
claude mcp add chatgpt -s project -e OPENAI_API_KEY=your_api_key -- npx @chinchillaenterprises/mcp-chatgptManual Installation
Install the package:
npm install -g @chinchillaenterprises/mcp-chatgptConfigure Claude Code (
~/.claude.json):{ "mcpServers": { "chatgpt": { "type": "stdio", "command": "npx", "args": ["-y", "@chinchillaenterprises/mcp-chatgpt"], "env": { "OPENAI_API_KEY": "your_openai_api_key_here" } } } }
🎯 Quick Start
Start a conversation:
Use chatgpt_start_conversation with title "Code Review Session" and model "gpt-4"Send a message:
Use chatgpt_send_message with "Can you help me optimize this Python function?"Analyze code:
Use chatgpt_analyze_code with the code and focus on "performance"Compare approaches:
Use chatgpt_compare_approaches to compare two different implementations
🔧 Available Tools
Conversation Management
| Tool | Description | Parameters |
|------|-------------|------------|
| chatgpt_start_conversation | Start a new ChatGPT conversation | title: string, model?: string, system_prompt?: string |
| chatgpt_send_message | Send a message in active conversation | message: string, system_prompt?: string |
| chatgpt_list_conversations | List all conversations | None |
| chatgpt_get_conversation | Get full conversation history | conversation_id: string |
| chatgpt_switch_conversation | Switch to different conversation | conversation_id: string |
| chatgpt_delete_conversation | Delete a conversation | conversation_id: string |
| chatgpt_clear_conversation | Clear messages but keep conversation | None |
Specialized Tools
| Tool | Description | Parameters |
|------|-------------|------------|
| chatgpt_analyze_code | Analyze code with specific focus | code: string, focus?: enum, language?: string |
| chatgpt_compare_approaches | Compare two different approaches | problem: string, approach1: string, approach2: string, criteria?: string[] |
| chatgpt_get_models | Get available OpenAI models | None |
📊 Usage Examples
Basic Conversation
// Start a new conversation
await chatgpt_start_conversation({
title: "Python Development",
model: "gpt-4",
system_prompt: "You are a Python expert"
})
// Send a message
await chatgpt_send_message({
message: "How do I implement async generators in Python?"
})Code Analysis
// Analyze code for security issues
await chatgpt_analyze_code({
code: `
def login(username, password):
query = f"SELECT * FROM users WHERE username='{username}' AND password='{password}'"
return db.execute(query)
`,
focus: "security",
language: "python"
})Compare Approaches
// Compare two sorting algorithms
await chatgpt_compare_approaches({
problem: "Sort a large list of integers",
approach1: "Use Python's built-in sorted() function",
approach2: "Implement quicksort from scratch",
criteria: ["performance", "maintainability", "memory usage"]
})🎨 Code Analysis Focus Options
performance- Optimization, complexity analysis, bottleneckssecurity- Vulnerabilities, input validation, authenticationbest practices- Style, patterns, maintainabilitybugs- Logic errors, edge cases, error handlinggeneral- Comprehensive analysis of all aspects
🔍 Example Outputs
Conversation List
[
{
"id": "conv_1234567890_abc123",
"title": "Python Development",
"model": "gpt-4",
"messageCount": 5,
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:45:00Z",
"isActive": true
}
]Code Analysis Response
Based on my security analysis of your Python login function:
**Critical Security Issues:**
1. **SQL Injection Vulnerability**: The code uses string formatting to build SQL queries, making it vulnerable to SQL injection attacks.
2. **Plain Text Passwords**: The code appears to compare passwords directly, suggesting passwords are stored in plain text.
**Recommendations:**
1. Use parameterized queries or prepared statements
2. Implement password hashing with bcrypt or similar
3. Add input validation and sanitization
...⚙️ Configuration
Environment Variables
| Variable | Description | Required |
|----------|-------------|----------|
| OPENAI_API_KEY | Your OpenAI API key | ✅ Yes |
Available Models
gpt-4- Most capable, best for complex tasksgpt-4-turbo-preview- Faster GPT-4 with 128k contextgpt-3.5-turbo- Fast and cost-effective
🚨 Error Handling
The server handles common errors gracefully:
- Missing API Key: Clear error message with setup instructions
- API Rate Limits: Passes through OpenAI error messages
- Invalid Model: Lists available models in error
- Network Issues: Descriptive connection errors
🧪 Development
Local Development Setup
# Clone the repository
git clone https://github.com/ChinchillaEnterprises/ChillMCP.git
cd ChillMCP/mcp-chatgpt
# Install dependencies
npm install
# Build the project
npm run build
# Test locally
claude mcp add chatgpt-local -s user -e OPENAI_API_KEY=your_key -- node $(pwd)/dist/index.jsTesting
# Run unit tests
npm test
# Run with coverage
npm run test:coverage
# Watch mode for development
npm run test:watch🤝 Contributing
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature - Make your changes and add tests
- Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a pull request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🔗 Links
- NPM Package: @chinchillaenterprises/mcp-chatgpt
- GitHub Repository: ChillMCP
- OpenAI Documentation: platform.openai.com/docs
- Model Context Protocol: modelcontextprotocol.io
🆘 Support
- Issues: GitHub Issues
- Documentation: Claude Code Docs
Built with ❤️ by Chinchilla Enterprises for AI collaboration
