Examples and Usage Instructions
December 15, 2024 ยท View on GitHub
Claude Desktop Setup
-
Locate the Configuration File
Mac: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json -
Add Gemini MCP Configuration
{ "mcpServers": { "gemini": { "command": "npx", "args": ["-y", "github:aliargun/mcp-server-gemini"], "env": { "GEMINI_API_KEY": "your_api_key_here" } } } } -
Restart Claude Desktop
- Close Claude Desktop completely
- Relaunch the application
- The Gemini provider should now be available
Example Interactions
Basic Usage
Claude: I can now access Gemini through the MCP connection. Would you like me to compare our responses to a question?
Human: Yes, please compare how we respond to: "Explain quantum computing in simple terms."
Claude: I'll use both my own knowledge and ask Gemini through the MCP connection...
Advanced Features
-
Parameter Control
{ "method": "generate", "params": { "prompt": "Your prompt here", "temperature": 0.7, "maxTokens": 1000 } } -
Streaming Responses
{ "method": "generate", "params": { "prompt": "Your prompt here", "stream": true } }
Troubleshooting Common Setup Issues
-
Config File Not Found
- Make sure Claude Desktop has been run at least once
- Check the path for your operating system
- Create the file if it doesn't exist
-
API Key Issues
- Get your API key from Google AI Studio
- Ensure the key has proper permissions
- Check for any whitespace in the key
-
Connection Issues
- Verify Claude Desktop is running
- Check if port 3005 is available
- Look for any firewall restrictions
Best Practices
-
API Key Security
- Never share your API key
- Use environment variables when possible
- Rotate keys periodically
-
Resource Management
- Monitor API usage
- Implement rate limiting
- Handle long responses appropriately
Advanced Configuration
Custom Port Configuration
{
"mcpServers": {
"gemini": {
"command": "npx",
"args": ["-y", "github:aliargun/mcp-server-gemini"],
"env": {
"GEMINI_API_KEY": "your_api_key_here",
"PORT": "3006"
}
}
}
}
Development Setup
{
"mcpServers": {
"gemini": {
"command": "node",
"args": ["/path/to/local/mcp-server-gemini/dist/index.js"],
"env": {
"GEMINI_API_KEY": "your_api_key_here",
"DEBUG": "true"
}
}
}
}
Using with Other MCP Servers
Multiple Providers Example
{
"mcpServers": {
"gemini": {
"command": "npx",
"args": ["-y", "github:aliargun/mcp-server-gemini"],
"env": {
"GEMINI_API_KEY": "your_gemini_key"
}
},
"openai": {
"command": "npx",
"args": ["-y", "@mzxrai/mcp-openai@latest"],
"env": {
"OPENAI_API_KEY": "your_openai_key"
}
}
}
}
Verification Steps
- Check Server Status
curl -I http://localhost:3005
- Test WebSocket Connection
wscat -c ws://localhost:3005
- Verify MCP Integration
Ask Claude: "Can you verify if the Gemini MCP connection is working?"