/ Verzeichnis / Playground / pi-mcp-adapter
● Community nicobailon ⚡ Sofort

pi-mcp-adapter

von 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.

Warum nutzen

Hauptfunktionen

Live-Demo

In der Praxis

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

Installieren

Wählen Sie Ihren 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
    }
  }
}

Öffne Claude Desktop → Settings → Developer → Edit Config. Nach dem Speichern neu starten.

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

Cursor nutzt das gleiche mcpServers-Schema wie Claude Desktop. Projektkonfiguration schlägt die globale.

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

Klicken Sie auf das MCP-Servers-Symbol in der Cline-Seitenleiste, dann "Edit Configuration".

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

Gleiche Struktur wie Claude Desktop. Windsurf neu starten zum Übernehmen.

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

Continue nutzt ein Array von Serverobjekten statt einer Map.

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

In context_servers hinzufügen. Zed lädt beim Speichern neu.

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

Einzeiler. Prüfen mit claude mcp list. Entfernen mit claude mcp remove.

Anwendungsfälle

Praxisnahe Nutzung: pi-mcp-adapter

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

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

Wann einsetzen: You want filesystem, git, github, postgres, playwright, fetch, firecrawl — more than Pi can eagerly load.

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

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

Fallstricke
  • 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

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

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

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

Fallstricke
  • 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

Wann einsetzen: Your MCP server requires OAuth and you'd rather not hand-craft token refresh.

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

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

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

Kombinationen

Mit anderen MCPs für 10-fache Wirkung

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.✓ Kopiert

Werkzeuge

Was dieses MCP bereitstellt

WerkzeugEingabenWann aufrufenKosten
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

Kosten & Limits

Was der Betrieb kostet

API-Kontingent
None of its own — proxies to underlying MCPs
Tokens pro Aufruf
~200 tokens eager overhead vs N*~500 for full tool listing
Kosten in €
Free, open source
Tipp
Start lazy. Only promote tools to direct when telemetry shows Pi calls them ≥5× per session.

Sicherheit

Rechte, Secrets, Reichweite

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

Fehlerbehebung

Häufige Fehler und Lösungen

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.

Prüfen: pi-mcp-adapter logs

Alternativen

pi-mcp-adapter vs. andere

AlternativeWann stattdessenKompromiss
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

Mehr

Ressourcen

📖 Offizielle README auf GitHub lesen

🐙 Offene Issues ansehen

🔍 Alle 400+ MCP-Server und Skills durchsuchen