Overview
Pi MCP Adapter is an extension for the Pi coding agent that lets it use Model Context Protocol servers without filling its context window. The adapter installs as a Pi package from npm and adds a single `mcp` tool plus a set of `/mcp-adapter` slash commands.
The project exists because of a cost the README spells out: MCP tool definitions are verbose, a single server can burn 10k+ tokens, and you pay that cost whether the tools are used or not — connect a few servers and half the context window is gone before the conversation starts. The README cites a post by Mario Zechner arguing you might not need MCP at all and should write simple CLI tools instead. The adapter takes the other route: keep access to the MCP ecosystem (databases, browsers, APIs) but expose it through one proxy tool of roughly 200 tokens, and let the agent search for and describe the tools it needs on demand.
Servers are lazy by default: they connect on the first tool call, not at startup, and tool metadata is cached to disk so search, list and describe work without a live connection. Idle servers disconnect after 10 minutes (configurable) and reconnect on next use. The adapter reads the standard `.mcp.json` and `~/.config/mcp/mcp.json` files and can import server configs from Cursor, Claude Code and Codex. It is written in TypeScript and released under the MIT license.
What it does
- One `mcp` proxy tool (~200 tokens) in context instead of every server's tool definitions; the agent searches and describes tools on demand
- Lazy servers that start on first call, cached tool metadata, and idle disconnect after 10 minutes with automatic reconnect
- Reads `.mcp.json` / `~/.config/mcp/mcp.json` and imports existing configs from Cursor, Claude Code and Codex via `/mcp-adapter setup` or `pi-mcp-adapter init`
- Per-server controls: `directTools` to promote chosen tools to first-class Pi tools, `approveTools` to confirm risky calls, `includeTools` / `excludeTools`, and a keep-alive lifecycle
- OAuth sign-in with `/mcp-auth`, MCP prompts registered as slash commands, and an opt-in `mcpScript` tool for chaining many MCP calls in one step
- npx-based servers resolve to direct binary paths, skipping the ~143 MB npm parent process
Getting started
The adapter installs through Pi's own package command from npm. If you already keep MCP servers in a standard `.mcp.json`, Pi picks them up with no extra setup.
Install the extension
Restart Pi after installation.
pi install npm:pi-mcp-adapterAdd a server to .mcp.json
Put the file in your project for team sharing, or use ~/.config/mcp/mcp.json for all projects. With nothing configured yet, `/mcp-adapter setup` inside Pi can scaffold the file, import host configs or add a curated server.
{
"mcpServers": {
"chrome-devtools": {
"command": "npx",
"args": ["-y", "chrome-devtools-mcp@1.6.0"]
}
}
}Let the agent search for a tool
The agent searches the cached metadata instead of carrying every tool definition; the server does not need to be running yet.
mcp({ search: "screenshot" })Call it
The first call starts the server. Two calls replace the 26 Chrome DevTools tools that would otherwise sit in context.
mcp({ tool: "chrome_devtools_take_screenshot", args: { format: "png" } })Import configs from other hosts (optional)
From the terminal, scan for Cursor, Claude Code or Codex configs and add compatibility imports to the adapter config.
pi-mcp-adapter initCommands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Give a Pi agent browser, database or API access through existing MCP servers without spending thousands of tokens on tool definitions up front
- Reuse the MCP servers already configured for Cursor, Claude Code or Codex in Pi
- Connect OAuth-protected remote MCP servers and require approval before destructive tools run
- Promote a handful of frequently used MCP tools to first-class Pi tools while keeping the rest behind search
How Pi MCP Adapter compares
Pi MCP Adapter alongside other open-source coding-agent harnesses & runtimes tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| CC Switch | ★ 150k | A cross-platform desktop app that manages provider configuration for eight coding-agent CLIs from one place, with a local failover proxy, MCP and skill management, and spend tracking. |
| Oh My OpenAgent | ★ 70.5k | Opinionated agent bundle for OpenCode and Codex CLI that ships preconfigured sub-agents, lifecycle hooks and built-in MCP servers behind a single ultrawork command. |
| herdr | ★ 47k | A single-binary terminal multiplexer built for coding agents: persistent sessions across local and SSH machines, per-pane working/blocked/idle status, and a socket API agents drive themselves. |
| oh-my-claudecode | ★ 40.4k | A plugin and CLI that adds multi-agent orchestration to Claude Code: staged autopilot workflows, parallel tmux workers, and advisors that route a second opinion to Codex, Gemini, Grok or Cursor. |
| AionUi | ★ 33.9k | An open-source desktop workspace that pairs a built-in agent engine with dozens of external CLI agents, adding scheduled runs, MCP tools and remote access from a WebUI or chat apps. |
| cmux | ★ 28.6k | A Ghostty-based macOS terminal built around coding agents: vertical tabs that show git branch, PR status and ports, attention notifications when an agent needs you, and a scriptable built-in browser. |
| cc-connect | ★ 16.2k | A Go daemon that bridges local coding agents — Claude Code, Codex, Cursor Agent, Gemini CLI, OpenCode, Kimi CLI and more — to Feishu, DingTalk, Slack, Telegram, Discord, LINE and WeCom, so you drive them from chat. |
| Pi MCP Adapter | ★ 1.6k | Pi extension that puts MCP servers behind one small proxy tool instead of hundreds of tool definitions |
