MCP Adapter
Token-efficient MCP proxy with lazy server startup and on-demand tool discovery.
What it does
MCP (Model Context Protocol) servers expose tools to AI agents — databases, file systems, APIs, search engines, and more. The problem is that each connected server adds its full tool list to the context window on every turn, burning tokens even when those tools aren't used.
Pi-MCP-Adapter solves this by proxying all connected MCP servers through a single mcp tool that costs around 200 tokens. Tools are discovered on demand: the agent asks "what tools does server X have?" and the adapter fetches them only when needed. Servers are started lazily — they spin up on first use, not at session start.
For tools you use frequently, a direct-tool mode bypasses the proxy and exposes them as first-class tools — no extra round-trip. You can toggle this per-tool from the /mcp panel.
Why it's included
MCP is how Pi connects to the outside world. Without an adapter, each connected server adds hundreds or thousands of tokens of tool definitions on every single turn. For a session with multiple MCP servers, this makes long conversations significantly more expensive. The adapter is the correct architectural solution: pay for tools when you use them, not by default.
Commands
| Command | What it does |
|---|---|
/mcp |
Open the interactive panel — view servers, connection status, tools, toggle direct/proxy mode, reconnect, handle OAuth |
/mcp reconnect <server> |
Force reconnect a specific MCP server |