Skip to main content

pi-mcp-py

An extension for pi-python. It connects the MCP servers that an ACP client (an editor such as Zed) passes to the agent, and gives their tools to the model.

The agent itself has no MCP client. Without this package, the servers that the editor passes are not connected, and the agent says so. With it, the agent connects them.

Install it into the environment of the agent:

pip install pi-mcp-py

The package is on PyPI from the 0.6.0 release of pi-python. In a checkout of the repository, use pip install -e ./packages/pi-mcp.

Nothing else to set up. The servers come from the editor (Zed: context_servers in the settings). It needs pi-agent-core-lc 0.6.0 or later: an older core does not hand over the servers of the client, and then the package logs a warning and does nothing.

What it does

  • Connects stdio, http (Streamable HTTP) and sse servers. One connection for each server and session. A server that does not start does not stop the session, nor the other servers.
  • Gives each tool to the model as mcp__<server>__<tool>. The prefix keeps an MCP tool from replacing a built-in tool of the same name. A name longer than 64 characters is cut and gets a hash at the end.
  • Tells the user when a server fails to start or is slow. It says nothing when all is well.
  • Connects a server again when it has stopped: the next tool call does it, at most 3 times in a row (a call that gets an answer starts the count again). A call that was already sent when the server died is not sent again, because the server may have run it. It fails with the reason.
  • /mcp shows the servers, their state and the number of tools. /mcp reconnect <name> connects one again, with no limit.
  • Ends every server process when the session ends (Windows and Linux).
  • Limits: a server may take 60 s to start and a call 120 s (see Settings). The first turn waits at most 10 s for a server that still starts. A tool result of more than 50 KB of text is cut, and a note says so.

Things to know

  • Permissions. A tool call is asked about in the ask mode of the CLI, unless the server marks the tool with a hint that says it is harmless (readOnlyHint). The hints are taken as the server gives them: you chose the server.
  • Environment of a stdio server. It gets the safe list of the MCP SDK, the proxy and certificate variables of the agent (HTTP_PROXY, SSL_CERT_FILE, ...), and the env of the editor. It does not get the other variables of the agent, the LLM keys among them. ${VAR} in a value is not expanded.
  • Secrets. The env, headers, args and url of a server are not written to a log, a notice, the /mcp output or an error text.
  • Logs. The stderr of a stdio server goes to <PI_HOME>/logs/mcp/<name>.log (PI_HOME is ~/.pi-python when it is not set). The file is appended to, and started over when it is larger than 512 KB. The text of the file is what the server wrote: it may hold what the server was given.
  • Servers on this machine. An http or sse server at localhost, 127.0.0.1 or ::1 is reached directly, not through the proxy of the system (httpx would send it there).
  • Not supported: MCP resources, prompts, sampling, roots, elicitation, OAuth, tools/list_changed, websocket servers.

Settings

Environment variables only:

Variable Default Meaning
PI_MCP_STARTUP_TIMEOUT 60 Seconds a server may take to start. Then it counts as failed.
PI_MCP_CALL_TIMEOUT 120 Seconds a tool call may take.

The design is in docs/specs/2026-10-23-mcp-extension-design.md of the repository.

Metadata

Release files for pi-mcp-py 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pi-mcp-py 0.1.0
File Size Uploaded Provenance Actions
pi_mcp_py-0.1.0.tar.gz 39.4 kB Without provenance Details for pi_mcp_py-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pi-mcp-py 0.1.0
File Interpreter ABI Platform Actions
pi_mcp_py-0.1.0-py3-none-any.whl Python 3 none any Details for pi_mcp_py-0.1.0-py3-none-any.whl

Total release size: 62.4 kB

Release files / pi_mcp_py-0.1.0.tar.gz

Download URL pi_mcp_py-0.1.0.tar.gz
Size 39.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a0f667883fb18d2fc87c9d3a13b548346d096031d88d11a103bd5cce9a986f0c
BLAKE2b-256 checksum
How to use checksums
0bc2a48bff3bcae6281afd0e232f0babab911e90cc6d84a6ea9a74b5ae3bdcf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pi_mcp_py-0.1.0-py3-none-any.whl

Download URL pi_mcp_py-0.1.0-py3-none-any.whl
Size 22.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea46463db63793b2dd6b5542f5745add292689e1d86f39f520ddb2fcef92d407
BLAKE2b-256 checksum
How to use checksums
47432e5ab159318ded7e98fc28cb39cbae2620a1f43366a227bb4fe97ef7bff4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for pi-mcp-py 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page