Files
claude-code/mcp
OpenCode Test fb4cf1b035 fix(external-llm): correct opencode CLI syntax and gemini routing
- OpenCode: use `opencode run -m MODEL "prompt"` syntax
- OpenCode: set correct binary path (/home/linuxbrew/.linuxbrew/bin/opencode)
- Gemini: route long-context to gemini-2.5-pro (gemini-3 not available yet)

Tested working:
- opencode/big-pickle
- github-copilot/claude-sonnet-4.5
- zai-coding-plan/glm-4.7
- gemini/gemini-2.5-pro
- gemini/gemini-2.5-flash

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 13:46:38 -08:00
..

MCP Integrations

Model Context Protocol servers and delegation helpers.

Directory Structure

mcp/
├── gmail/              # Gmail OAuth setup and venv
│   ├── venv/           # Python virtual environment
│   └── ...
└── delegation/         # Tiered delegation helpers
    ├── gmail_delegate.py
    └── gcal_delegate.py

Gmail Integration

Setup

The Gmail integration uses a Python virtual environment with gmail-mcp:

# Create venv (one time)
cd ~/.claude/mcp/gmail
python3 -m venv venv
source venv/bin/activate
pip install gmail-mcp

# Credentials
# OAuth credentials at: ~/.gmail-mcp/credentials.json
# Token cached at: ~/.gmail-mcp/token.json

Usage

Skills reference the venv directly:

~/.claude/mcp/gmail/venv/bin/python script.py

Delegation Helpers

Helpers that implement tiered model delegation:

Helper Purpose Tiers
gmail_delegate.py Gmail operations Haiku (list), Sonnet (summarize)
gcal_delegate.py Calendar operations Haiku (list), Sonnet (analyze)

Pattern

GMAIL_PY=~/.claude/mcp/gmail/venv/bin/python
HELPER=~/.claude/mcp/delegation/gmail_delegate.py

# Haiku tier - no LLM, just fetch
$GMAIL_PY $HELPER check-unread --days 7

# Sonnet tier - spawns claude --model sonnet
$GMAIL_PY $HELPER summarize --query "from:github.com"

Adding MCP Servers

For proper MCP servers (vs. delegation helpers):

  1. Create server in mcp/server-name/
  2. Add to .mcp.json or plugin.json:
{
  "mcpServers": {
    "server-name": {
      "command": "node",
      "args": ["${CLAUDE_PLUGIN_ROOT}/mcp/server-name/index.js"]
    }
  }
}

Note

Current integrations use direct Python API calls rather than MCP protocol. This works but doesn't leverage MCP's tool registration and permissions.

Future improvement: Convert to proper MCP servers.