CHATGPT-SETUP.mdā¢4.32 kB
# ChatGPT + MCP Integration Setup Guide
š **Your ChatGPT integration is now ready!**
## š Current Status
ā
**MCP Server**: Running on port 3000
ā
**ChatGPT Proxy**: Running on port 3001
ā
**Web Interface**: Ready to use
ā
**OpenAI API**: Configured
## š How to Use ChatGPT with MCP
### Option 1: Web Interface (Recommended)
1. **Open the ChatGPT interface**: `chatgpt-interface.html` (should have opened automatically)
2. **Start chatting**: The interface connects to your local ChatGPT proxy
3. **Use MCP tools**: Ask ChatGPT to perform file operations, get system info, etc.
### Option 2: API Integration
```bash
# Send a POST request to the ChatGPT proxy
curl -X POST http://localhost:3001/chat \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "user", "content": "List the files in my MCP directory"}
]
}'
```
## š ļø Available MCP Tools via ChatGPT
When you chat with the AI, it can automatically use these tools:
- **š read_file** - Read any file on your system
- **āļø write_file** - Create or modify files
- **š list_directory** - Browse directories
- **š» get_system_info** - Get system information
- **š fetch_url** - Download web content
- **ā” execute_command** - Run system commands (with security controls)
## š¬ Example Conversations
Try asking ChatGPT:
```
"List the files in my MCP directory"
"Read my README.md file and summarize it"
"Create a new file called test.txt with some sample content"
"Get my current system information"
"Fetch the content from https://api.github.com and show me the structure"
```
## šÆ How It Works
1. **Your message** ā ChatGPT Web Interface
2. **Interface** ā ChatGPT Proxy Server (localhost:3001)
3. **Proxy** ā OpenAI GPT-4 API (with MCP tools)
4. **GPT-4** ā Decides which MCP tools to use
5. **Proxy** ā Calls MCP Server (localhost:3000) for tool execution
6. **MCP Server** ā Executes the requested operations
7. **Results** ā Back to you via the web interface
## š§ Management Commands
### Start/Stop Services
```powershell
# Start MCP Server
.\start-mcp-server.ps1
# Start ChatGPT Proxy
.\start-chatgpt-proxy.ps1
# Or start both manually
node server.js # Terminal 1 (MCP Server)
node chatgpt-proxy.js # Terminal 2 (ChatGPT Proxy)
```
### Check Status
```powershell
# Check MCP Server
curl http://localhost:3000/health
# Check ChatGPT Proxy
curl http://localhost:3001/health
```
## š Security Features
- **Sandbox Mode**: File operations restricted to safe directories
- **Command Validation**: System commands require confirmation
- **API Key Protection**: Stored securely in environment variables
- **CORS Protection**: Web interface can only access designated endpoints
## š ļø Troubleshooting
### Common Issues
1. **"Proxy Disconnected"**
- Check if ChatGPT proxy is running: `curl http://localhost:3001/health`
- Restart proxy: `node chatgpt-proxy.js`
2. **"OpenAI API Error"**
- Verify API key in `.env` file
- Check API key has sufficient credits
- Ensure key has GPT-4 access
3. **"MCP Tools Not Working"**
- Verify MCP server is running: `curl http://localhost:3000/health`
- Check server logs for errors
4. **"CORS Error in Browser"**
- Make sure you're opening the HTML file directly (not serving via HTTP)
- Check browser console for detailed error messages
### Debug Mode
```powershell
# Enable debug logging
$env:DEBUG = "mcp:*"
node chatgpt-proxy.js
```
## š Integration Benefits
**Compared to regular ChatGPT:**
- ā
Can read/write your local files
- ā
Can browse your file system
- ā
Can get real-time system information
- ā
Can fetch live web content
- ā
Can execute system commands safely
- ā
Works completely locally (privacy)
## š Next Steps
1. **Try the example prompts** in the web interface
2. **Explore file operations** - ask ChatGPT to help organize your files
3. **Use for development** - have ChatGPT read your code and make suggestions
4. **Automate tasks** - use command execution for system automation
5. **Extend functionality** - add custom MCP tools for your specific needs
---
**š Enjoy your enhanced ChatGPT experience with MCP tools!**
*Your AI assistant can now interact with your local system safely and powerfully.*