Skip to main content
Glama

pi-mcp

MCP 服务器,暴露 pi 编码代理工具:

read, bash, edit, write, grep, find, ls

使用 Bun 和 @modelcontextprotocol/server v2 构建。同时支持 2026-07-28 时代(server/discover)和 2025 时代的 initialize

要求

  • Bun >= 1.2

  • rgfdPATH 上(由 grep / find 使用;不下载)

安装

使用绝对路径。不要传递 . — Bun 的全局安装器可能会向 ~/.bun/install/global/package.json / bun.lock 写入重复的 pi-mcp 键和空的 "": "." 条目(oven-sh/bun#19559oven-sh/bun#24207)。

bun add -g /absolute/path/to/pi-mcp
# same thing from the checkout:
bun add -g "$(pwd)"

bun install -gbun add -g 的别名;路径才是关键。二进制文件以 pi-mcp 的形式出现在 PATH 上(~/.bun/bin)。

对于本地开发,请在此目录中改用 bun link

用法

pi-mcp                         # stdio (default)
pi-mcp --http --port 3000      # Streamable HTTP
pi-mcp --cwd /path/to/project
pi-mcp --readonly              # read, grep, find, ls
pi-mcp --tools read,grep,ls
pi-mcp --shell /bin/bash

Flag

Meaning

--stdio

通过 stdin/stdout 提供服务(默认)

--http

提供 Streamable HTTP 服务

--host <host>

HTTP 绑定主机(默认 127.0.0.1;隐含 HTTP)

--port <port>

HTTP 绑定端口(默认 3000;隐含 HTTP)

--cwd <dir>

工具工作目录

--readonly

仅注册只读工具

--tools <names>

逗号分隔的子集

--shell <path>

用于 bash 的 Bash 可执行文件

--allowed-hosts <h>

用于 HTTP DNS 重绑定保护的逗号分隔的 Host 名称

--stdio 不能与 --http / --host / --port 组合使用。

日志输出到 stderr。stdout 是 stdio 协议通道。

主机配置(stdio)

{
  "mcpServers": {
    "pi": {
      "command": "pi-mcp",
      "args": ["--cwd", "/path/to/project"]
    }
  }
}

HTTP

pi-mcp --http --host 127.0.0.1 --port 3000

向监听器发送 POST JSON-RPC。现代(2026-07-28)客户端使用 server/discover 以及每个请求的 _meta 信封和 Mcp-Method / MCP-Protocol-Version 头。2025 客户端使用 initialize

工具

Tool

Role

read

读取文本文件或图像(对于大文件使用 offset / limit

bash

--cwd 中运行 shell 命令

edit

精确文本替换(与 pi 相同的强制转换:JSON 字符串 edits、单个编辑对象、旧版 oldText/newText

write

创建/覆盖文件,并创建父目录

grep

使用 rg 搜索文件内容

find

使用 fd 匹配文件

ls

列出目录

执行行为取自 pi 的编码代理工具。不包括 TUI 渲染、photon 图像调整大小以及自动 rg/fd 下载。

开发

bun install
bun src/cli.ts --help

运行时依赖:@modelcontextprotocol/serverzoddiff

-
license - not tested
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • An MCP server that gives your AI access to the source code and docs of all public github repos

  • MCP server exposing the Backtest360 engine API as tools for AI agents.

  • A MCP server built for developers enabling Git based project management with project and personal…

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zhaob1n/pi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server