/ Directory / Playground / pi-mcp-adapter
● Community nicobailon ⚡ Instant

pi-mcp-adapter

by nicobailon · nicobailon/pi-mcp-adapter

Hook 200 MCP tools into the Pi coding agent for ~200 tokens — one proxy tool lazy-loads servers only when you actually call them.

pi-mcp-adapter is an adapter for Pi (badlogic/pi-mono), a minimalist coding agent. Instead of eagerly loading every MCP tool's schema into Pi's context, it exposes a single mcp proxy tool (~200 tokens) that supports search, describe, and tool calls. Servers start lazily and auto-disconnect after idle.

Why use it

Key features

Live Demo

What it looks like in practice

pi-mcp-adapter.replay ▶ ready
0/0

Install

Pick your client

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "pi-mcp-adapter": {
      "command": "npx",
      "args": [
        "-y",
        "pi-mcp-adapter"
      ],
      "_inferred": true
    }
  }
}

Open Claude Desktop → Settings → Developer → Edit Config. Restart after saving.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "pi-mcp-adapter": {
      "command": "npx",
      "args": [
        "-y",
        "pi-mcp-adapter"
      ],
      "_inferred": true
    }
  }
}

Cursor uses the same mcpServers schema as Claude Desktop. Project config wins over global.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "pi-mcp-adapter": {
      "command": "npx",
      "args": [
        "-y",
        "pi-mcp-adapter"
      ],
      "_inferred": true
    }
  }
}

Click the MCP Servers icon in the Cline sidebar, then "Edit Configuration".

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "pi-mcp-adapter": {
      "command": "npx",
      "args": [
        "-y",
        "pi-mcp-adapter"
      ],
      "_inferred": true
    }
  }
}

Same shape as Claude Desktop. Restart Windsurf to pick up changes.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "pi-mcp-adapter",
      "command": "npx",
      "args": [
        "-y",
        "pi-mcp-adapter"
      ]
    }
  ]
}

Continue uses an array of server objects rather than a map.

~/.config/zed/settings.json
{
  "context_servers": {
    "pi-mcp-adapter": {
      "command": {
        "path": "npx",
        "args": [
          "-y",
          "pi-mcp-adapter"
        ]
      }
    }
  }
}

Add to context_servers. Zed hot-reloads on save.

claude mcp add pi-mcp-adapter -- npx -y pi-mcp-adapter

One-liner. Verify with claude mcp list. Remove with claude mcp remove.

Use Cases

Real-world ways to use pi-mcp-adapter

Run Pi with 10+ MCP servers without blowing the context window

👤 Power users of the Pi coding agent ⏱ ~20 min intermediate

When to use: You want filesystem, git, github, postgres, playwright, fetch, firecrawl — more than Pi can eagerly load.

Prerequisites
  • Pi installed — See badlogic/pi-mono
Flow
  1. Install the adapter
    Run pi install npm:pi-mcp-adapter and restart Pi.✓ Copied
    → Adapter listed in Pi's extensions
  2. Configure all your MCPs
    Add filesystem, git, github, postgres MCPs to pi-mcp-adapter in lazy mode.✓ Copied
    → Servers registered; no boot overhead
  3. Use via search
    Use mcp({search: 'list files'}) to find the right tool, then call it.✓ Copied
    → Relevant tool surfaced; then called

Outcome: Full MCP ecosystem available inside Pi, with a tiny context footprint.

Pitfalls
  • Search misses a tool because description is bad — Promote frequent tools to 'direct tools' so Pi sees them eagerly

Promote your 3 most-used MCP tools to first-class Pi tools

👤 Devs who use Pi daily ⏱ ~10 min beginner

When to use: You notice Pi calling mcp({search: ...}) every time before using filesystem read — add it as a direct tool to skip the dance.

Flow
  1. Identify hot tools
    Which mcp tool calls show up most in my recent Pi session logs?✓ Copied
    → Top-N list
  2. Mark as direct
    Configure these as direct tools in pi-mcp-adapter settings.✓ Copied
    → Tools now appear as first-class Pi tools

Outcome: Faster agent loop + lower token spend on repetitive tool discovery.

Pitfalls
  • Too many direct tools = defeats the purpose — Keep direct-tool count to ≤5; promote only if frequency is high

Use OAuth-protected MCP servers (e.g. Linear, Slack) with Pi

👤 Pi users on enterprise MCPs ⏱ ~15 min intermediate

When to use: Your MCP server requires OAuth and you'd rather not hand-craft token refresh.

Flow
  1. Enable autoAuth
    Set autoAuth: true in pi-mcp-adapter config for the linear server.✓ Copied
    → Pi opens browser on first use
  2. Authorize in browser
    Approve the scope request; tokens are persisted.✓ Copied
    → Subsequent calls use refreshed tokens automatically

Outcome: OAuth-protected MCP integrations 'just work' in Pi.

Pitfalls
  • Tokens stored unencrypted on disk — Use an encrypted home directory or OS keychain bridge

Combinations

Pair with other MCPs for X10 leverage

pi-mcp-adapter + filesystem + git-2 + github

Full dev loop inside Pi with lazy tool loading

Register filesystem, git, and github via pi-mcp-adapter in lazy mode.✓ Copied

Tools

What this MCP exposes

ToolInputsWhen to callCost
mcp {search?: str} | {describe?: str} | {tool?: str, args?: JSON-string} Universal proxy — the only tool Pi sees by default ~200 tokens eager + on-demand tool execution
/mcp-auth <server> server name Manually trigger OAuth for a specific server free

Cost & Limits

What this costs to run

API quota
None of its own — proxies to underlying MCPs
Tokens per call
~200 tokens eager overhead vs N*~500 for full tool listing
Monetary
Free, open source
Tip
Start lazy. Only promote tools to direct when telemetry shows Pi calls them ≥5× per session.

Security

Permissions, secrets, blast radius

Credential storage: OAuth tokens in ~/.pi/mcp-adapter/ — treat as sensitive
Data egress: Depends on configured upstream MCPs

Troubleshooting

Common errors and fixes

mcp({tool: ...}) says 'tool not found'

Tool name is case-sensitive and namespaced by server. Use describe first to get the exact name.

OAuth loop never completes

Adapter's local callback port may be blocked. Check the redirect URL matches what's registered with the provider.

Server starts but tool calls hang

Upstream MCP crashed silently. Switch to eager mode temporarily to see the boot error.

Verify: pi-mcp-adapter logs

Alternatives

pi-mcp-adapter vs others

AlternativeWhen to use it insteadTradeoff
Raw MCP integrationYou run Pi with only 1-2 MCP serversSimpler, but eats context as you add servers
mcp-gatewayYou need security/PII redaction across many MCPs (not just token efficiency)Python gateway; aimed at security more than token-saving

More

Resources

📖 Read the official README on GitHub

🐙 Browse open issues

🔍 Browse all 400+ MCP servers and Skills