NP

nicobailon/pi-mcp-adapter

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

1635 stars 392 forks 品質 79 トレンド 48MIT

Pi符号化エージェント向けのトークン効率MCPアダプター

概要

コンテキストウィンドウを消費せずにPiでMCPサーバーを使うのが良いです。 https://github.com/user-attachments/assets/4b7c66ff-e27e-4639-b195-22c3db406a5a マリオはなぜMCPが不要かもしれないと書いています。問題は、ツールの定義が冗長すぎることです。単一のMCPサーバーは1万+トークンを消費し、そのコストを使いうかどうかに関わらず支払うことになります。いくつかのサーバーを接続すれば、会話が始まる前にコンテキストウィンドウの半分を消費してしまいます。 彼の見解は、MCPを完全に飛ばして、シンプルなCLIツールを書くべきだということです。 しかしMCPエコシステムには便利な機能があります。データベース、ブラウザ、APIです。このアダプターは冗長なアクセスなしにアクセスを提供します。プロキシツール(~200トークン)で数百トークンを使えなくなります。エージェントは必要に応じて必要なものを発見します。サーバーは実際に使うまで起動しません。 アダプターは標準のMCPファイルを自動で読み込みます。すでに持っているなら追加のセットアップは不要です。

概要(AI 翻訳)

コンテキストウィンドウを消費せずにPiでMCPサーバーを使うのが良いです。

https://github.com/user-attachments/assets/4b7c66ff-e27e-4639-b195-22c3db406a5a

なぜこれが存在するのか

マリオはなぜMCPが不要かもしれないと書いています。問題は、ツールの定義が冗長すぎることです。単一のMCPサーバーは1万+トークンを消費し、そのコストを使いうかどうかに関わらず支払うことになります。いくつかのサーバーを接続すれば、会話が始まる前にコンテキストウィンドウの半分を消費してしまいます。

彼の見解は、MCPを完全に飛ばして、シンプルなCLIツールを書くべきだということです。

しかしMCPエコシステムには便利な機能があります。データベース、ブラウザ、APIです。このアダプターは冗長なアクセスなしにアクセスを提供します。プロキシツール(~200トークン)で数百トークンを使えなくなります。エージェントは必要に応じて必要なものを発見します。サーバーは実際に使うまで起動しません。

pi-mcp-adapter と Pi 内蔵 MCP の違い

その後、Pi 0.99は独自のMCPサポートを追加し、ツール定義が文脈から外れています。アダプターをインストールするとPiセッションで置き換えられます。切り替えで得られるもの:

  • 多くのサーバーを設置し、アイドルサーバーに料金を払わずに。 組み込みはすべてのPiセッションで有効なサーバーを起動し、セッション終了まで稼働を維持します。

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

Pi MCP Adapter

Use MCP servers with Pi without burning your context window.

https://github.com/user-attachments/assets/4b7c66ff-e27e-4639-b195-22c3db406a5a

What’s new in 7.0

https://github.com/user-attachments/assets/a3fc7834-2540-45b6-a80e-d9c17125a66c

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.

Why This Exists

Mario wrote about why you might not 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.

His take: skip MCP entirely, write simple CLI tools instead.

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.

pi-mcp-adapter vs Pi’s built-in MCP

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:

  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
GitHub で README 全文を見る

インストール

npx -y [email protected]
MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "chrome-devtools": { "command": "npx", "args": ["-y", "[email protected]"] } } }