# Claude Code MCP Integration Setup Guide
This guide will help you set up the Claude-Gemini collaboration system so you can use it directly within Claude Code.
## Quick Setup
### 1. Ensure the Collaborative Server is Running
```bash
cd /Users/jamiearonson/Documents/claude-gemini-integration
source venv/bin/activate
python tools/mcp/collaborative-server.py &
```
### 2. Configure Claude Desktop for MCP
The MCP configuration has been placed at:
```
~/Library/Application Support/Claude/claude_desktop_config.json
```
### 3. Restart Claude Desktop
Close and reopen Claude Desktop application to load the new MCP configuration.
### 4. Verify MCP Tools are Available
In a new Claude Code session, you should see these tools available:
- `start_gemini_collaboration` - Start a new collaborative conversation with Gemini
- `consult_gemini` - Ask Gemini a question in the current collaboration context
- `get_collaboration_history` - Get the full conversation history
## How to Use in Claude Code
### Starting a Collaboration
In Claude Code, you can now say:
```
"Start a collaboration with Gemini about designing a REST API"
```
Claude Code will use the `start_gemini_collaboration` tool automatically.
### Having a Discussion
Once a collaboration is started, you can say:
```
"Ask Gemini what they think about using microservices vs monolith"
```
Claude Code will use the `consult_gemini` tool to get Gemini's input.
### Getting History
To see the full conversation:
```
"Show me the collaboration history with Gemini"
```
## Example Workflow
1. **You**: "I need to design a database schema for an e-commerce site. Start a collaboration with Gemini."
2. **Claude**: [Uses `start_gemini_collaboration` tool]
3. **You**: "Ask Gemini about the best approach for handling product variants"
4. **Claude**: [Uses `consult_gemini` tool, shows Gemini's response]
5. **You**: "What does Gemini think about our payment table design?"
6. **Claude**: [Continues the collaboration, building on previous context]
## Troubleshooting
### Tools Not Available
- Ensure Claude Desktop is restarted after config changes
- Check that the config file exists at `~/Library/Application Support/Claude/claude_desktop_config.json`
- Verify the collaborative server is running on port 8080
### Server Connection Issues
```bash
# Check if collaborative server is running
curl http://localhost:8080/health
# Restart if needed
cd /Users/jamiearonson/Documents/claude-gemini-integration
source venv/bin/activate
python tools/mcp/collaborative-server.py &
```
### Gemini CLI Issues
- Ensure Gemini CLI is installed: `gemini --version`
- Check that it's in your PATH
- Verify API key is configured
## Manual Configuration
If automatic setup didn't work, manually add this to your Claude Desktop config:
```json
{
"mcpServers": {
"gemini-collaboration": {
"command": "python3",
"args": ["/Users/jamiearonson/Documents/claude-gemini-integration/mcp_server.py"],
"env": {
"MCP_PORT": "8080"
}
}
}
}
```
## Testing
Run the test script to verify everything works:
```bash
cd /Users/jamiearonson/Documents/claude-gemini-integration
source venv/bin/activate
python test_mcp.py
```
## What You Can Collaborate On
- **Architecture Planning**: "Work with Gemini to design a microservices architecture"
- **Code Review**: "Have Gemini review this Python function"
- **Problem Solving**: "Brainstorm with Gemini about optimizing this algorithm"
- **Design Decisions**: "Discuss with Gemini whether to use REST or GraphQL"
- **Technical Strategy**: "Plan with Gemini how to implement real-time features"
The collaboration maintains context throughout the conversation, so Gemini remembers what you've discussed and can build on previous ideas.
## Benefits
- **Real-time Collaboration**: Actual back-and-forth discussion, not just comparison
- **Context Preservation**: Each message builds on the conversation history
- **Seamless Integration**: Works directly within Claude Code interface
- **Iterative Refinement**: Can go multiple rounds improving ideas together
- **Comprehensive Coverage**: Get perspectives from both Claude and Gemini on complex topics