Skip to content
Back to search

pi-mcp-adapter

Token-efficient MCP adapter for Pi coding agent

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/nicobailon/pi-mcp-adapter with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/nicobailon/pi-mcp-adapter'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/nicobailon--pi-mcp-adapter/badge.svg)](/listings/nicobailon--pi-mcp-adapter)

HTML

<a href="/listings/nicobailon--pi-mcp-adapter"><img src="/api/listings/nicobailon--pi-mcp-adapter/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

pi install npm:pi-mcp-adapter

Restart Pi after installation.

> **DeepSeek Harness (third-party bridge):** Run the unmodified adapter in DSH via [pi2dsh](https://github.com/weijiafu14/pi2dsh); see the [verified dsh-TUI and Web MCP guide](https://github.com/weijiafu14/pi2dsh/tree/main/examples/tui-mcp).

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 200 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. <p>
  2. <img src="banner.png" alt="pi-mcp-adapter" width="1100">
  3. </p>
  4. # Pi MCP Adapter
  5. Use MCP servers with [Pi](https://github.com/badlogic/pi-mono/) without burning your context window.
  6. https://github.com/user-attachments/assets/4b7c66ff-e27e-4639-b195-22c3db406a5a
  7. ## What's new in 7.0
  8. https://github.com/user-attachments/assets/a3fc7834-2540-45b6-a80e-d9c17125a66c
  9. On servers that support MCP Tasks, add `"protocolVersion": "auto"` and slow tools run in the background while the agent keeps working. Tool search can rank tools by meaning and send full schemas only for the ones that fit. And `extract` hands the agent just the values it asked for from a long result. Everything else is in the [changelog](CHANGELOG.md).
  10. ## Why This Exists
  11. Mario wrote about [why you might not need MCP](https://mariozechner.at/posts/2025-11-02-what-if-you-dont-need-mcp/). The problem: tool definitions are verbose. A single MCP server can burn 10k+ tokens, and you're paying that cost whether you use those tools or not. Connect a few servers and you've burned half your context window before the conversation starts.
  12. His take: skip MCP entirely, write simple CLI tools instead.
  13. But the MCP ecosystem has useful stuff - databases, browsers, APIs. This adapter gives you access without the bloat. One proxy tool (~200 tokens) instead of hundreds. The agent discovers what it needs on-demand. Servers only start when you actually use them.
  14. ## pi-mcp-adapter vs Pi's built-in MCP
  15. Since then, Pi 0.99 added MCP support of its own, which also keeps tool definitions out of context. Installing the adapter replaces it in Pi sessions. What you get by switching:
  16. - **Install many servers without paying for idle ones.** The built-in starts every enabled server in every Pi session and keeps it running until the session ends. By default, the adapter starts a server when the model first calls it and stops it after 10 idle minutes.
  17. - **More servers work fully.** Servers can ask you questions through forms, show interactive UIs, offer prompt templates as slash commands, and run long jobs in the background while the agent keeps working. The built-in doesn't handle these.
  18. - **Find tools by what you mean.** The built-in's tool search only matches words. The adapter can also rank tools by meaning with a classifier model you can already use in Pi, such as Jev or Cloudflare's Clef: in a test of 12 everyday requests across 95 tools, Jev put the right tool first in 10 of 11, where word search did in 5.
  19. - **Sign-in tokens go in your OS keychain** by default (an encrypted file is opt-in), not in a plain JSON file under `~/.pi/agent`.
  20. - **Adding servers is easier.** Give the agent a server's URL and it installs it and checks its tools in the same session, opening sign-in first if the server needs it, with no shell command or `/reload`. Servers already configured in Cursor, Claude Code, Codex, or VS Code can be imported with `/mcp-adapter setup`, which also adds presets such as Figma and GitHub.
  21. The built-in turns `codemode` on by itself; with the adapter, add `"+codemode"` to `defaultTools` in Pi's settings. Pi's `codemode` works with both.
  22. | | Pi's built-in MCP | pi-mcp-adapter |
  23. |---|---|---|
  24. | Servers running | Every enabled server, for the whole session | Only servers in use; each stops after 10 idle minutes |
  25. | Server memory (100 installed, 3 in use) | 7.0 GB at start, 5.9 GB after 15 minutes | Only the 3 in use, then none once they're idle |
  26. | How the model reaches tools | Default: `codemode` scripts. Per server: direct, or loaded by `tool_search` | Default: one `mcp` proxy tool. Per server: direct, or loaded by `tool_search`. Scripts: Pi's `codemode`, opt-in (add `"+codemode"` to `defaultTools`) ([MCP scripting](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/scripting.md#scripting-mcp-calls-with-pis-codemode)) |
  27. | Token cost | By default, every call is a `codemode` script | Single lookups cost about the same as the built-in's default. Bulk tasks cost up to 5.5× more without scripts, and up to 2.9× more with Pi's `codemode` turned on ([measured](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/pi-builtin-comparison.md#measured-token-cost)) |
  28. | Tool search | `tool_search`, ranked by words | `mcp({ search })` ranked by words or regex. With a classifier model in Pi, such as Jev through `/login` to OpenRouter, semantic search ranks tools by meaning ([setup](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/scripting.md#semantic-search)) |
  29. | Long tool results | A `codemode` script can filter a result before the model sees it | Opt-in per server: `mcp({ tool, args, extract: { total: "number" } })` returns only the values you name, as numbers and dates read by Cloudflare's Clairic model with your Cloudflare credentials in Pi; the full result is saved to a file ([Typed values](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/scripting.md#typed-values-from-tool-results)) |
  30. | Saved workflows as tools | No | A workflow you repeat becomes one tool with fixed inputs: a saved script that calls MCP and Pi tools, found by search and called like any other tool (`scriptTools`, [Script tools](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/scripting.md#script-tools)) |
  31. | Executor app tools | Only Executor's own six tools; the model reaches app tools through Executor's `search` and `call` | Each tool of your [Executor](https://executor.sh) apps is a Pi tool, found by search and called by name with Pi's approvals ([Executor app tools](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/prompts-and-ui.md#executor-app-tools)) |
  32. | OAuth tokens | JSON file in `~/.pi/agent` | OS keychain |
  33. | MCP prompts, elicitation, sampling, Tasks | No | Yes; Tasks run in the background and need `"protocolVersion": "auto"` |
  34. | MCP UI apps | Left out | Native window or browser |
  35. | Add a server | `pi mcp add` in a shell, then `/reload` | Give the agent the URL: `mcp({ action: "install", url })` connects it and checks its tools in the current session; for an OAuth server it opens sign-in first and checks the tools once you approve |
  36. | Configs from Cursor, Claude Code, Codex, VS Code | Convert by hand | Imported |
  37. | Guided setup in a session | No; `/mcp` manages servers that are already configured | `/mcp-adapter setup` overlay: imports configs found on your machine, adds presets (Figma desktop and RepoPrompt when installed, GitHub, Notion, Context7, DeepWiki, Parallel Search, Tavily Search, Chrome DevTools), and previews each file change before writing |
  38. | Ask before risky tools | Through a permission extension, which sees every MCP call | Built in (`approveTools`); permission extensions also see each MCP call under the tool's own name |
  39. | Roots (session directory sent to servers) | Yes | Yes |
  40. | Shell commands | `pi mcp add`, `remove`, `list` | `pi-mcp-adapter init`, `doctor` |
  41. | Transports | stdio, streamable HTTP | stdio, streamable HTTP, legacy SSE, `rmcp-mux` socket |
  42. Over a session, measured on Pi 0.99.2 with 100 small local servers:
  43. | 100 servers installed, 3 used | Pi's built-in MCP | pi-mcp-adapter |
  44. |---|---|---|
  45. | Servers running at session start | 100 | 0 |
  46. | While you use 3 | 100 | 3 |
  47. | After the idle timeout (10 min) | 100 | 0 |
  48. Stopping a server doesn't take its tools away: the model can still search them, and a stopped server starts again on its next call (0.1–0.3 s for a small local server). For a server that must keep state between calls, set `"lifecycle": "lazy-keep-alive"`. The first session briefly starts new servers, 10 at a time, to read their tool lists. [Measurements and details](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/pi-builtin-comparison.md#measured-with-100-servers).
  49. The [full comparison](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/pi-builtin-comparison.md) has every row with sources, as of Pi 1.3.0.
  50. When you install or update the adapter, it turns Pi's built-in MCP off in Pi's settings for you (the same switch as `pi config` → Built-in), so the two don't both run. If you remove the adapter, turn the built-in back on there ([details](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/configuration.md#pis-built-in-mcp)).
  51. ## Install
  52. ```bash
  53. pi install npm:pi-mcp-adapter
  54. ```
  55. Restart Pi after installation.
  56. > **DeepSeek Harness (third-party bridge):** Run the unmodified adapter in DSH via [pi2dsh](https://github.com/weijiafu14/pi2dsh); see the [verified dsh-TUI and Web MCP guide](https://github.com/weijiafu14/pi2dsh/tree/main/examples/tui-mcp).
  57. ## What happens on first run
  58. The adapter reads standard MCP files automatically. No extra setup needed if you already have them.
  59. | You already have... | What happens |
  60. |---------------------|--------------|
  61. | `.mcp.json` or `~/.config/mcp/mcp.json` | Pi uses it immediately. Use `.mcp.json` for project/team sharing and `~/.config/mcp/mcp.json` for all projects. |
  62. | Servers added with `pi mcp add` (`~/.pi/agent/mcp.json`, `.pi/mcp.json`) | On Pi 0.99 and later, the adapter uses them and replaces Pi's built-in MCP extension, which Pi reports at startup; see [Pi's built-in MCP](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/configuration.md#pis-built-in-mcp). |
  63. | Host-specific configs (Cursor, Claude Code, Codex, etc.) but no standard MCP files | Run `/mcp-adapter setup` to adopt those host configs into Pi. The setup flow shows exactly what it found, lets you pick which ones to import, and previews the exact file changes before writing. |
  64. | Nothing configured yet | Run `/mcp-adapter setup`, choose project `.mcp.json` or global `~/.config/mcp/mcp.json`, then scaffold a minimal config, add a curated known server, quick-add RepoPrompt, or inspect what the adapter discovered on your machine. |
  65. If you prefer the terminal, you can also run `pi-mcp-adapter init` after install to scan for host-specific configs and add missing compatibility imports to the adapter config (`~/.pi/agent/mcp-adapter.json` by default, or `$PI_CODING_AGENT_DIR/mcp-adapter.json` when set).
  66. ## Quick Start
  67. Add a server to `.mcp.json` in your project:
  68. ```json
  69. {
  70. "mcpServers": {
  71. "chrome-devtools": {
  72. "command": "npx",
  73. "args": ["-y", "chrome-devtools-mcp@1.6.0"]
  74. }
  75. }
  76. }
  77. ```
  78. Servers are **lazy by default** — they won't connect until you actually call one of their tools. The adapter caches tool metadata so search and describe work without live connections.
  79. ```
  80. mcp({ search: "screenshot" })
  81. ```
  82. ```
  83. chrome_devtools_take_screenshot
  84. Take a screenshot of the page or element.
  85. Parameters:
  86. format (enum: "png", "jpeg", "webp") [default: "png"]
  87. fullPage (boolean) - Full page instead of viewport
  88. ```
  89. ```
  90. mcp({ tool: "chrome_devtools_take_screenshot", args: { format: "png" } })
  91. ```
  92. Two calls instead of 26 tools cluttering the context.
  93. ## Common tasks
  94. | Want | Do | Details |
  95. |------|----|---------|
  96. | Add a server without editing JSON | `/mcp-adapter setup`, or `mcp({ action: "install", url: "..." })` | [Configuration](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/configuration.md#setup-panel), [Install from one URL](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/servers.md#install-from-one-url) |
  97. | Use servers from Cursor, Claude Code, or Codex | `/mcp-adapter setup` or `pi-mcp-adapter init` | [Import existing configs](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/configuration.md#import-existing-configs) |
  98. | Sign in to an OAuth server | `/mcp-auth <server>` | [Authentication](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/auth.md) |
  99. | Put a few tools directly in the model's tool list | `"directTools": ["tool_a"]` on the server | [Direct tools](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/tools.md#direct-tools) |
  100. | Ask before a risky tool runs | `"approveTools": "destructive"` | [Tool approval](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/tools.md#tool-approval) |
  101. | Keep a server running | `"lifecycle": "keep-alive"` | [Lifecycle modes](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/configuration.md#lifecycle-modes) |
  102. | Hide noisy tools | `includeTools` / `excludeTools` on the server | [Search-activated direct tools](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/tools.md#search-activated-direct-tools) |
  103. | Chain many MCP calls in one step | `"+codemode"` in Pi's `defaultTools`, then `codemode` | [MCP scripting](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/scripting.md#scripting-mcp-calls-with-pis-codemode) |
  104. | Use Figma | `/mcp-adapter setup`, add Figma (desktop) | [Setup panel](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/configuration.md#setup-panel) |
  105. ## Commands
  106. | Command | What it does |
  107. |---------|--------------|
  108. | `/mcp-adapter` | Interactive panel and first-run onboarding surface |
  109. | `/mcp` | Same as `/mcp-adapter` |
  110. | `/mcp-adapter setup` | Guided setup for imports, a minimal `.mcp.json`, curated known servers, RepoPrompt quick-add, and config-path inspection |
  111. | `/mcp-adapter semantic setup` | Choose which servers may share tool names and descriptions with semantic search, save that choice for the project, and reload Pi |
  112. | `/mcp-adapter edit [project\|global]` | Open `.mcp.json` (default) or `~/.config/mcp/mcp.json` in an editor; Ctrl+G opens `$EDITOR`; saves a valid JSONC object and reloads |
  113. | `/mcp-adapter tools` | List all tools |
  114. | `/mcp-adapter prompts` | List all MCP prompts registered as slash commands |
  115. | `/mcp-adapter tasks [stop <server>/<taskId>]` | List long-running MCP tasks still working in the background, or stop one |
  116. | `/mcp-adapter reconnect` | Reconnect all servers |
  117. | `/mcp-adapter reconnect <server>` | Connect or reconnect a single server |
  118. | `/mcp-adapter disable <server>` | Disable a server in the project-local `.pi/mcp-adapter.json` (requires `/reload` to apply) |
  119. | `/mcp-adapter enable <server>` | Enable through the project-local override layer (requires `/reload` to apply) |
  120. | `/mcp-adapter logout <server>` | Clear stored OAuth credentials for a server and disconnect it |
  121. | `/mcp-auth` | Open an OAuth server picker in interactive UI sessions |
  122. | `/mcp-auth <server>` | OAuth setup for a specific server |
  123. If `settings.autoAuth` is `true`, `mcp({ connect: ... })`, `mcp({ tool: ... })`, and direct tool calls automatically run OAuth when needed and retry once.
  124. In interactive sessions, you can also authenticate from `/mcp-adapter` with `ctrl+a` or Enter on a server that needs auth. `/mcp-auth` without a server only opens a picker in the interactive UI. For gateway authorization and manual callback completion, see [Remote/headless authentication](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/auth.md#remoteheadless-authentication).
  125. On Pi 0.99 and later, servers you already signed in to with Pi's built-in MCP can reuse that sign-in: the adapter asks once per server, and `/mcp-adapter` offers `ctrl+p` to import them. See [Import a sign-in from Pi's built-in MCP](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/auth.md#import-a-sign-in-from-pis-built-in-mcp).
  126. ## How It Works
  127. - One `mcp` tool in context (~200 tokens) instead of hundreds
  128. - Servers are lazy by default — they connect on first tool call, not at startup
  129. - Tool metadata is cached to disk so search/list/describe work without live connections
  130. - Idle servers disconnect after 10 minutes (configurable), reconnect automatically on next use
  131. - npx-based servers resolve to direct binary paths, skipping the ~143 MB npm parent process
  132. - MCP server validates arguments, not the adapter
  133. - Remote keep-alive servers force-refresh their tool catalog during health checks, before user input, and before adapter-triggered turns, with bounded reconnect backoff
  134. - Specific tools can be promoted from the proxy to first-class Pi tools via `directTools` config, so the LLM sees them directly instead of having to search
  135. ## Limitations
  136. - Each Pi session runs its own server processes; [rmcp-mux](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/servers.md#shared-mcp-processes-with-rmcp-mux) can share one across sessions
  137. - Compact MCP result rendering summarizes text, but inline images are still controlled by Pi's image display settings and may render below the compact text summary.
  138. - Pi still owns one separator row before self-rendered tool output, so compact mode reduces adapter rendering height but cannot promise true zero-gap rows.
  139. - MCP sampling support is text-only; context inclusion, tools, stop sequences, audio, and image content are rejected with explicit errors.
  140. ## Documentation
  141. The full reference lives in `docs/`:
  142. | Doc | What's in it |
  143. |-----|--------------|
  144. | [Configuration](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/configuration.md) | The setup panel, config files and precedence, imports from other hosts, project server trust, lifecycle modes, and every `settings` key. |
  145. | [Server options](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/servers.md) | Every server field, custom HTTPS trust, macOS local-network access, protocol negotiation, MCP Tasks, stdio environment, rmcp-mux, and URL install. |
  146. | [Authentication](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/auth.md) | OAuth setup, remote and headless sign-in, token storage, headers, bearer tokens, and secret commands. |
  147. | [pi-mcp-adapter vs Pi's built-in MCP](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/pi-builtin-comparison.md) | Every difference, with sources, as of Pi 1.3.0. |
  148. | [Using MCP tools](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/tools.md) | The `mcp` tool, search and search keywords, direct tools, tool approval, and the output guard. |
  149. | [MCP scripting](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/scripting.md) | Semantic tool search, and scripting MCP calls with Pi's `codemode`. |
  150. | [Prompts, elicitation, and MCP UI](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/prompts-and-ui.md) | MCP prompts as slash commands, servers asking for input, and interactive MCP UI windows. |
  151. | [Extension API, plugins, and SDK](https://github.com/nicobailon/pi-mcp-adapter/blob/main/docs/extension-api.md) | Agent Plugins, Claude plugin bundles, Pi package manifests, runtime registration and tool calls, `createMcpAdapter`, host-managed embedding, and status events. |

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.