cpal
Provides a read-only Git tool that lets Claude inspect repository commit history (e.g., git log, git show) during autonomous exploration, with access to the full repository even when started in a subdirectory.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
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 (Fable/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
π¦ Batch API β fire-and-forget processing at 50% cost discount
π’ Token counting β free endpoint to estimate costs before sending
ποΈ Effort control β tune output effort from "low" to "max"
π 1M context β opt-in extended context window (beta, requires Anthropic API tier 4+)
Related MCP server: agent-shuttle-mcp
Install
Requires uv.
git clone https://github.com/tobert/cpal && cd cpal
uv tool install .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_keyOption B: Environment variable
export ANTHROPIC_API_KEY="sk-ant-..."If both are set, --key-file takes priority over the environment variable.
Configure
Pick the method that matches your MCP client:
Gemini CLI
gemini mcp add cpal --scope user -- cpal --key-file ~/.config/cpal/api_keyClaude Code
Useful for getting a second opinion from a different Claude instance, or delegating tasks to a specific model tier (e.g. using Opus for deep analysis while running Claude Code on Sonnet).
claude mcp add cpal --scope user -- cpal --key-file ~/.config/cpal/api_keyManual (Cursor, etc.)
Add to your MCP config (~/.cursor/mcp.json, etc.):
{
"mcpServers": {
"cpal": {
"command": "cpal",
"args": ["--key-file", "/home/you/.config/cpal/api_key"]
}
}
}Or with env var:
{
"mcpServers": {
"cpal": {
"command": "cpal",
"env": { "ANTHROPIC_API_KEY": "sk-ant-..." }
}
}
}Usage
Your AI host calls these MCP tools automatically based on your prompts. The examples below show the tool signatures β you don't call them directly, you just ask your AI to consult Claude.
"Ask Claude to review src/server.py for bugs" triggers
consult_claude(query="...", file_paths=[...])"Have Claude design a caching strategy" triggers
consult_claude(query="...")
Cost note: Opus is the default model and the most expensive. Use model="haiku" or model="sonnet" for lower costs.
Tool Reference
# Basic (uses Opus)
consult_claude(query="Design a caching strategy for this API")
# Extended thinking is enabled by default (extended_thinking=True)
# Control the thinking budget (default 10000, max ~100000)
consult_claude(query="Analyze this algorithm", thinking_budget=50000)
# Disable thinking for simple queries
consult_claude(query="What does this function do?", extended_thinking=False)
# Vision
consult_claude(query="What's wrong with this UI?", media_paths=["screenshot.png"])
# Different models
consult_claude(query="Hardest problem", model="fable") # most capable, premium cost
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
# Effort control β tune output depth (low, medium, high, max)
consult_claude(query="Quick summary", effort="low")
consult_claude(query="Exhaustive analysis", effort="max")
# 1M context window (beta, tier 4+, premium pricing above 200K tokens)
consult_claude(query="Analyze this large codebase", context_1m=True)
# Per-call tool call cap (override the default 1000)
consult_claude(query="Quick scan", max_tool_calls=50)Utility Tools
# List available models and their resolved IDs
list_models()
# Count tokens before sending (free β no API cost)
count_tokens(query="Review this code: ...", model="opus")
count_tokens(query="...", file_paths=["src/server.py"]) # includes file contentHow It Works
MCP Client (Gemini, Cursor, etc.)
β
βΌ MCP
βββββββββββ
β cpal β βββΆ Anthropic API βββΆ Claude
βββββββββββ
β
cpal gives Claude these tools to
autonomously explore your codebase:
β’ list_directory
β’ read_file
β’ search_projectCustom System Prompts
Customize what Claude "knows" about you, your project, or your workflow by composing system prompts from multiple sources.
Config file (~/.config/cpal/config.toml):
# Files loaded in order and concatenated
system_prompts = [
"~/.config/cpal/CLAUDE.md",
]
# Inline text appended after files
system_prompt = "εΈΈγ«ζ₯ζ¬θͺγ§εηγγ¦γγ γγ (Always respond in Japanese)"
# Set to false to fully replace the built-in prompt with your own
include_default_prompt = truePaths support ~ and $ENV_VAR expansion, so you can use $WORKSPACE/CLAUDE.md etc.
CLI flags (repeatable, concatenated in order):
# Append additional prompt files
cpal --system-prompt /path/to/project-context.md
# Multiple files
cpal --system-prompt ~/CLAUDE.md --system-prompt ./PROJECT.md
# Replace the built-in prompt entirely
cpal --system-prompt ~/my-prompt.md --no-default-promptComposition order:
Built-in cpal system prompt (unless
include_default_prompt = falseor--no-default-prompt)Files from
system_promptsin config.tomlInline
system_promptfrom config.tomlFiles from
--system-promptCLI flags
Check what's active via resource://server/info β it shows which sources contributed and the total prompt length.
Security
All file access is sandboxed to the directory where cpal was started
Path traversal and symlink attacks are blocked
Sessions are isolated per
session_idFile size limits: 10MB text, 20MB media
Secret-file denylist: Built-in patterns block reads of common secret files (
.env*,*.pem,*.key,*_key,id_rsa*,.git/config, etc.) across all read surfaces. Extend the list viadenied_path_patternsin~/.config/cpal/config.tomlβ config patterns add to built-ins, they never replace them. The.envfile is never auto-loaded for the API key; use--key-fileorANTHROPIC_API_KEY.Note: the read-only git tool can still reveal whole-repository commit history (e.g.
git logorgit showwithout a path argument), even when cpal is started in a subdirectory of a larger repository, because git operates on the full repository from any subdirectory.
Batch API
These are MCP tools your AI host can call β same as consult_claude, but for async bulk processing at 50% cost discount. Batches complete within 24 hours.
# Submit a batch (any tier works β including Fable)
create_batch(queries=[
{"custom_id": "review-1", "query": "Review this code: ..."},
{"custom_id": "review-2", "query": "Review this other code: ..."},
], model="fable")
# Check status
list_batches()
get_batch(batch_id="msgbatch_...")
# Get results when done
get_batch_results(batch_id="msgbatch_...")
# Cancel a processing batch
cancel_batch(batch_id="msgbatch_...")No delete API β Anthropic does not provide an endpoint to delete batch results. Batches are automatically purged after 29 days.
No tool use β batch queries are single-shot (no agentic file exploration). Parameters like file_paths and media_paths are not available in batch mode β paste content directly into the query string.
MCP Resources
Read-only introspection endpoints for MCP clients that support resources:
URI | Description |
| Server version, capabilities, and feature list |
| Available models with IDs, descriptions, and defaults |
| Safety limits (file sizes, search caps, session TTL) |
| List all active sessions |
| Details for a specific session (message count, preview) |
| Tools Claude uses for autonomous exploration |
Models
Model aliases are resolved automatically to the latest version per tier via the Anthropic API. Use list_models() to see current mappings. Fallback IDs if the API is unreachable:
Alias | Fallback ID | Best For |
|
| Most capable β frontier intelligence, premium cost |
|
| Deep reasoning, hard problems (default) |
|
| Balanced reasoning, code review |
|
| Fast exploration, quick questions |
Claude can make up to 1000 autonomous tool calls per query by default. Override globally with the CPAL_MAX_TOOL_CALLS environment variable, or per-call with max_tool_calls=N on consult_claude.
Notes
Sessions are in-memory β history is lost when the server restarts. Sessions are eligible for expiry after 1 hour of inactivity; cleanup runs when the active session count exceeds 100.
Models cost money β Opus is the default and the most expensive. See Anthropic pricing. Use
haikuorsonnetfor lower costs.Vision β Supports PNG, JPEG, GIF, WebP, and PDF (max 20MB).
1M context β Requires Anthropic API tier 4+. Premium pricing applies above 200K tokens. The standard context window is 200K tokens; pass
context_1m=Trueto access the 1M window via the beta endpoint.
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
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
Talk to your public-facing AI from any MCP client β Claude, ChatGPT, Cursor, Cline, Windsurf.
Connect ChatGPT and Claude to your Mac, Windows or Linux with secure MCP remote access.
One MCP endpoint for Claude, GPT & Gemini: 100+ tools + no-code connectors + agent workers.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables any MCP client to request an independent second opinion from a fresh Claude Code session without blocking, useful for plans, architecture, debugging, security reviews, and final checks.8 npmMIT
- AlicenseBqualityBmaintenanceEnables MCP clients to delegate prompts to locally configured Codex, Antigravity, OpenCode, and Claude Code agents, fetch live model catalogs and quotas, and maintain stateful multi-turn sessions with selectable tool policies.19MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to send prompts to configured OpenAI- or Anthropic-compatible models and receive answers for code reviews, design checks, and fact verification.1MIT
- AlicenseAqualityBmaintenanceEnables MCP clients such as Claude Code to ask the Qwen Code CLI questions, delegate tasks, and continue conversations across calls with configurable approval modes and session handling.4ISC