# Pi MCP Adapter

> Token-efficient MCP adapter for the Pi coding agent that exposes MCP servers through a single lazy-loading proxy tool.

Pi MCP Adapter is an open-source extension by nicobailon that connects Model Context Protocol (MCP) servers to the Pi coding agent. Instead of loading every tool definition into the model's context, it exposes one `mcp` proxy tool (about 200 tokens, per the README) and lets the agent discover tools on demand. The latest release listed is v5.3.0.

## What It Is

The adapter is a Pi package installed with `pi install npm:pi-mcp-adapter`. It reads standard MCP configuration files such as `.mcp.json` and `~/.config/mcp/mcp.json`, and can import host configs from Cursor, Claude Code, Codex, and VS Code. The agent searches tool metadata, inspects parameters, and calls tools through the proxy, so a few calls replace dozens of tool definitions in context.

## How Servers Are Managed

Servers are lazy by default: they connect on the first tool call and disconnect after 10 idle minutes, a setting that is configurable. Tool metadata is cached to disk so search and describe work without live connections. Lifecycle modes such as `keep-alive` and `lazy-keep-alive` cover servers that need to hold state. Specific tools can be promoted to direct Pi tools with `directTools`, and risky tools can require approval via `approveTools`.

## Comparison with Pi's Built-in MCP

The README compares the adapter with the MCP support added in Pi 0.99. It says the adapter starts only the servers in use, stores OAuth tokens in the OS keychain, and supports MCP prompts, elicitation, sampling, Tasks, and interactive MCP UI apps. It also lists what it lacks: roots are not sent to servers, and permission extensions see calls as proxy calls. Installing the adapter turns Pi's built-in MCP off in settings.

## Setup and Configuration

The `/mcp-adapter setup` command offers a guided flow that imports existing configs, scaffolds a minimal `.mcp.json`, and adds presets such as GitHub, Notion, Context7, and Chrome DevTools. An agent can also install a server from a URL with `mcp({ action: "install", url })`. OAuth sign-in runs through `/mcp-auth`. Optional scripting through `mcpScript` chains many MCP calls in one step, and semantic tool search requires a System One key. Supported transports are stdio, streamable HTTP, legacy SSE, and an `rmcp-mux` socket.

## Documented Limitations

Each Pi session runs its own server processes unless rmcp-mux is used to share them. MCP sampling support is text-only.

## Features
- Single mcp proxy tool (~200 tokens) instead of many tool definitions
- Lazy server startup with idle shutdown after 10 minutes
- On-disk tool metadata cache for search and describe
- Tool search by words or regex, with optional semantic search
- Import of Cursor, Claude Code, Codex, and VS Code MCP configs
- Guided setup panel with presets
- Install a server from a single URL
- OAuth sign-in with OS keychain token storage
- Tool approval for risky tools
- Direct tool promotion and include/exclude filters
- MCP prompts as slash commands, elicitation, and MCP UI apps
- Optional MCP scripting to chain calls
- Transports: stdio, streamable HTTP, legacy SSE, rmcp-mux

## Integrations
Pi coding agent, Cursor, Claude Code, Codex, VS Code, Figma, GitHub, Notion, Context7, DeepWiki, Chrome DevTools, RepoPrompt, Tavily Search, Parallel Search, rmcp-mux

## Platforms
WINDOWS, MACOS, WEB, API, VSC_EXTENSION, CLI

## Pricing
Open Source

## Version
v5.3.0

## Links
- Website: https://github.com/nicobailon/pi-mcp-adapter
- Documentation: https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/configuration.md
- Repository: https://github.com/nicobailon/pi-mcp-adapter
- EveryDev.ai: https://www.everydev.ai/tools/pi-mcp-adapter
