/ Annuaire / Playground / pi-mcp-adapter
● Communauté nicobailon ⚡ Instantané

pi-mcp-adapter

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

Pourquoi l'utiliser

Fonctionnalités clés

Démo en direct

Aperçu en pratique

pi-mcp-adapter.replay ▶ prêt
0/0

Installer

Choisissez votre 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
    }
  }
}

Ouvrez Claude Desktop → Settings → Developer → Edit Config. Redémarrez après avoir enregistré.

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

Cursor utilise le même schéma mcpServers que Claude Desktop. La config projet l'emporte sur la globale.

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

Cliquez sur l'icône MCP Servers dans la barre latérale Cline, puis "Edit Configuration".

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

Même format que Claude Desktop. Redémarrez Windsurf pour appliquer.

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

Continue utilise un tableau d'objets serveur plutôt qu'une map.

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

Ajoutez dans context_servers. Zed recharge à chaud à la sauvegarde.

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

Une seule ligne. Vérifiez avec claude mcp list. Supprimez avec claude mcp remove.

Cas d'usage

Usages concrets : pi-mcp-adapter

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

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

Quand l'utiliser : You want filesystem, git, github, postgres, playwright, fetch, firecrawl — more than Pi can eagerly load.

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

Résultat : Full MCP ecosystem available inside Pi, with a tiny context footprint.

Pièges
  • 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

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

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

Résultat : Faster agent loop + lower token spend on repetitive tool discovery.

Pièges
  • 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

Quand l'utiliser : Your MCP server requires OAuth and you'd rather not hand-craft token refresh.

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

Résultat : OAuth-protected MCP integrations 'just work' in Pi.

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

Combinaisons

Associez-le à d'autres MCPs pour un effet X10

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.✓ Copié

Outils

Ce que ce MCP expose

OutilEntréesQuand appelerCoût
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

Coût et limites

Coût d'exécution

Quota d'API
None of its own — proxies to underlying MCPs
Tokens par appel
~200 tokens eager overhead vs N*~500 for full tool listing
Monétaire
Free, open source
Astuce
Start lazy. Only promote tools to direct when telemetry shows Pi calls them ≥5× per session.

Sécurité

Permissions, secrets, portée

Stockage des identifiants : OAuth tokens in ~/.pi/mcp-adapter/ — treat as sensitive
Sortie de données : Depends on configured upstream MCPs

Dépannage

Erreurs courantes et correctifs

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.

Vérifier : pi-mcp-adapter logs

Alternatives

pi-mcp-adapter vs autres

AlternativeQuand l'utiliserCompromis
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

Plus

Ressources

📖 Lire le README officiel sur GitHub

🐙 Voir les issues ouvertes

🔍 Parcourir les 400+ serveurs MCP et Skills