Skip to content
/ cpal Public

cpal - your pal Claude. MCP server for stateful Claude access with extended thinking.

License

Notifications You must be signed in to change notification settings

tobert/cpal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cpal - your pal Claude

An MCP server that lets any AI consult Claude.

The inverse of gpal — where gpal lets Claude consult Gemini, cpal lets Gemini (or any MCP client) consult Claude.

Features

  • 🧠 Opus by default — deep reasoning (Sonnet/Haiku available)
  • 💭 Extended thinking — explicit chain-of-thought for complex analysis
  • 🔧 Autonomous exploration — Claude reads files and searches your codebase
  • 📸 Vision — analyze images and PDFs
  • 💬 Stateful sessions — conversation history preserved across calls

Install

git clone https://github.com/tobert/cpal && cd cpal
uv tool install -e .

API Key (choose one)

Option A: Key file (recommended)

mkdir -p ~/.config/cpal && chmod 700 ~/.config/cpal
echo "sk-ant-..." > ~/.config/cpal/api_key && chmod 600 ~/.config/cpal/api_key

Option B: Environment variable

export ANTHROPIC_API_KEY="sk-ant-..."

Configure

Gemini CLI

gemini mcp add cpal --scope user -- cpal --key-file ~/.config/cpal/api_key

Claude Code

claude mcp add cpal --scope user -- cpal --key-file ~/.config/cpal/api_key

Manual (Cursor, etc.)

Add to your MCP config (~/.cursor/mcp.json, etc.):

{
  "mcpServers": {
    "cpal": {
      "command": "cpal",
      "args": ["--key-file", "~/.config/cpal/api_key"]
    }
  }
}

Or with env var:

{
  "mcpServers": {
    "cpal": {
      "command": "cpal",
      "env": { "ANTHROPIC_API_KEY": "sk-ant-..." }
    }
  }
}

Usage

# Basic (uses Opus)
consult_claude(query="Design a caching strategy for this API")

# With extended thinking
consult_claude(
    query="Review for subtle bugs",
    file_paths=["src/server.py"],
    extended_thinking=True
)

# Vision
consult_claude(query="What's wrong with this UI?", media_paths=["screenshot.png"])

# Different models
consult_claude(query="Hard problem", model="opus")   # deep reasoning
consult_claude(query="Quick check", model="haiku")   # fast & cheap

# Multi-turn conversation
consult_claude(query="Explain the auth flow", session_id="review-123")
consult_claude(query="What about edge cases?", session_id="review-123")  # continues

How It Works

MCP Client (Gemini, Cursor, etc.)
         │
         ▼ MCP
    ┌─────────┐
    │  cpal   │ ──▶ Anthropic API ──▶ Claude
    └─────────┘
         │
    Claude autonomously uses tools:
    • list_directory
    • read_file
    • search_project

Security

  • Restricted to project directory
  • Validates file reads
  • Session isolation
  • File size limits: 10MB text, 20MB media

Notes

  • Sessions are in-memory — history is lost when the server restarts.
  • Models cost money — Opus is the default; use haiku or sonnet for lower costs.
  • Vision — Supports PNG, JPEG, GIF, WebP, and PDF (max 20MB).

Development

uv sync --all-extras
uv run pytest tests/test_tools.py -v  # unit tests (free)

⚠️ Running pytest tests/ with ANTHROPIC_API_KEY set will run integration tests that cost money. See CLAUDE.md for details.

License

MIT

About

cpal - your pal Claude. MCP server for stateful Claude access with extended thinking.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages