Pi Codemode
An MCP extension that allows coding agents to manage and compose MCP tools by executing JavaScript in a sandboxed environment. It features tools for listing ava

Установка Pi Codemode
У сервера нет опубликованного npm/PyPI-пакета — склонируй репозиторий и собери по его README, затем добавь получившуюся команду в свой клиент.
Открыть репозиторийОписание
An MCP extension that allows coding agents to manage and compose MCP tools by executing JavaScript in a sandboxed environment. It features tools for listing available MCP capabilities and a management command for handling authentication and tool policies.
README
Pi extension that exposes MCP through two tools:
list_mcp_tools— enumerates all MCP tools (shows first 20 inline, overflows full list to a temp file)call_mcp— runs JavaScript in a sandbox and lets the script call MCP servers
It also adds a /mcp command for status, enable/disable, reconnect, and auth setup.
Why?
This was an experiment to see if there is an efficiency benefit of allowing a coding agent interface with MCP in a way that allows composition. See this blog post.
The actual findings are that with how MCP works today, such efficiency gains are not useful. On the other hand an MCP server that uses code internally can be very helpful. See for instance an example MCP server that uses a JavaScript environment to call Google services. That one actually performs as well as a similar skill does.
Configuration files
Loaded in merge order (later overrides earlier):
~/.pi/agent/mcp.json~/.pi/agent/.mcp.json<cwd>/.pi/mcp.json<cwd>/.mcp.json
You can override with --mcp-config /path/to/file.json.
list_mcp_tools
Parameters:
query(optional): case-insensitive text match, or regex via/pattern/flags
The tool always shows the first 20 matches inline. If more matches exist, it writes the full list to a temp .tsv file so the agent can grep/rg it.
Each listed MCP tool includes a compact schema signature, with required fields marked by * and optional fields in brackets.
Only currently enabled MCP tools are listed.
/mcp command
Use /mcp to manage MCP from interactive mode:
/mcp— opens an interactive select menu (status, reconnect, auth, and per-server tool toggles)/mcp status— show server connection/auth state + enabled/disabled counts/mcp enable <server> <tool|all>— enable a specific MCP tool (or all tools for server)/mcp disable <server> <tool|all>— disable a specific MCP tool (or all tools for server)/mcp reconnect [server]— reconnect one/all servers and refresh metadata/mcp auth <server>— trigger auth setup flow
Tool enable/disable policies are persisted in:
~/.pi/agent/mcp-tool-policies.json
Auth behavior
- OAuth flow (standard MCP auth)
/mcp auth <server>starts an OAuth browser login flow with localhost callback (for URL-based servers).- received tokens are stored in:
~/.pi/agent/mcp-oauth/<server>/tokens.json - then the server is reconnected.
- if a server's auth metadata does not support dynamic client registration,
/mcp authfalls back to bearer setup for the current session (for GitHub Copilot MCP, it will trygh auth tokenautomatically).
- Bearer servers (
auth: "bearer"or bearer token config)- if
bearerTokenEnvis configured,/mcp auth <server>lets you paste a token into that env var for the current pi process. - if no
bearerTokenEnv, it stores token in memory for the current session.
- if
For OAuth servers that require pre-registered clients, you can provide:
oauthClientIdoauthClientSecret(optional)oauthClientMetadataUrl(optional)oauthTokenEndpointAuthMethod(optional)
in the server config entry.
call_mcp
call_mcp takes JavaScript code only (plus optional timeout/state reset). Prefer batching: solve each user task in one script and use Promise.all for independent calls. Inside the script:
await call(server, tool, args)await readResource(server, uri)listTools(query?)servers(array of configured server names)tools(map of server -> tool names)resources(map of server -> resources)state(persistent mutable object across calls)
Only tools currently enabled in MCP policy are visible/callable from call_mcp.
call(server, tool, args) throws on MCP tool errors (instead of returning nested isError) and includes parameter hints from schema. It also attempts one snake_case → camelCase retry for validation errors.
Example:
const screenshots = await call("chrome-devtools", "take_screenshot", { format: "png" });
const repos = await call("github", "search_repositories", { query: "pi-mono" });
return {
screenshot: screenshots,
repos,
knownServers: servers,
firstChromeTools: tools["chrome-devtools"]?.slice(0, 10)
};
FAQ
Pi Codemode MCP бесплатный?
Да, Pi Codemode MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Pi Codemode?
Нет, Pi Codemode работает без API-ключей и переменных окружения.
Pi Codemode — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Pi Codemode в Claude Desktop, Claude Code или Cursor?
Открой Pi Codemode на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
GitHub
GitHubPRs, issues, code search, CI status
Filesystem
Secure file operations with configurable access controls.
Memory
Knowledge graph-based persistent memory system.
Unyly Deploy
UnylyDeploy sites and MCP servers to Unyly straight from your AI agent
Template MCP Server
mcpdotdirectA CLI tool to create a new Model Context Protocol server project with TypeScript support, dual transport options, and an extensible structure
Server Sequential Thinking
GitHub ActionsMCP server for sequential thinking and problem solving
gnomancer
com.gnomancerLocal raw DNA analysis: haplogroups, traits, ClinVar, pharmacogenomics. Nothing is uploaded.
Amap Maps Mcp Server
duxiaohuiMCP server for using the AMap Maps API
PayMCP
blustAILightweight payments layer for MCP servers: turn tools into paid endpoints with a two-line decorator. [PyPI](https://pypi.org/project/paymcp/) · [npm](https://w
demo
yoojoohans-jpgdemo — MCP server via Smithery
Сравнить Pi Codemode с
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории development
