Skip to content
pi-c MCP servers
Login

MCP servers

pic connects to Model Context Protocol servers and offers their tools to the model beside its own.

Add a server

pic mcp add takes the line a server's README gives for Pi or for Claude Code (the second line below), so a pasted line works:

pic mcp add docs --url https://example.com/mcp --bearer-token-env-var DOCS_TOKEN     # Pi's
pic mcp add --transport http docs https://example.com/mcp -H "Authorization: Bearer ..."
pic mcp add docs https://example.com/mcp                                    # a URL means HTTP
pic mcp add '{"mcpServers":{"docs":{"url":"https://example.com/mcp"}}}'     # a pasted snippet
pic mcp add-json docs '{"type":"http","url":"https://example.com/mcp"}'     # Claude Code's
pic mcp add files -- npx -y @modelcontextprotocol/server-filesystem .       # a program (stdio)
pic mcp add -e API_KEY=... tools uvx tools-mcp                              # Claude Code's stdio

add connects once and prints how many tools the server has, so a wrong URL or a missing token shows at once; a server that cannot be reached is kept, and pic mcp list tries again. Adding a name again replaces that server. Names are letters, digits, _ and -; two names that differ only in - and _ count as one.

Headers (-H "Name: value" or --header Name=value) and environment values (--env NAME=value) are sealed in the credential store, bound to the server and its address, and are never printed: pic mcp list and pic mcp get name them and say they are sealed. A value may name a variable as ${NAME}, read when the server is called; --bearer-token-env-var NAME is Authorization: Bearer ${NAME}. --timeout SECONDS (default 60) is how long a call may go without an answer, and --description keeps a line about the server. A program's arguments are kept as given, not sealed: give its secrets with --env.

pic keeps servers for you, not per project: -s user and -s local are accepted, and -s project and Pi's -l are refused, since pic does not write a project's files.

What pic speaks

Streamable HTTP, answered with JSON or with an event stream: an address is https://, or http:// to this machine only. And stdio: a program pic starts, given after -- (or, in Claude Code's shape, after the name) with its arguments, --env NAME=value and --cwd DIR (a relative one is the workspace's; with none it starts in the workspace). A leading ~/ names your home directory. pic speaks the current MCP revision (2026-07-28) first and the 2025 handshake when the server does not, and remembers which one the server spoke. The old HTTP+SSE transport is refused (--transport sse); most servers that document it also offer streamable HTTP, often at /mcp instead of /sse.

A stdio server is started when a request first calls one of its tools and stopped when the request ends: its stdin is closed, then its process group is sent SIGTERM and SIGKILL, so a server started through npx or uvx goes too. While it runs, pic ps lists it. The calls of one reply to a stdio server run one after another, since they share its pipe. A build of pic that cannot start programs refuses stdio servers.

pic does not sign in to servers (OAuth) itself yet. A server that answers 401 needs a token given as a header; the message says so.

Tools

Each server's tools are offered as mcp__SERVER__TOOL, as Pi and Claude Code name them, so hooks written for Claude Code and --tools 'mcp__docs__*' match them. Characters other than letters, digits and _ become _, and a name that would be longer than 64 characters, or that two of a server's tools would share, ends in a short hash. They are on by default and the tool flags and defaultTools choose among them as among any tools. pic uses the tool list the server gave when it was added or last listed, so starting a request connects to nothing; a call connects to its server. --no-mcp leaves every server out of one run: no MCP tools and no resources.

Exposure

A server's exposure says how the model reaches its tools:

Exposure Its tools
direct (the default) declared in every request, like pic's own tools
deferred kept out of requests until tool_search finds them (deferred tools)
codemode called from codemode scripts only: not declared, and not listed in codemode's description; scripts find them with searchTools() or ALL_TOOLS
hidden left out

codemode-deferred is another name for codemode. A server with codemode tools turns codemode on, unless the codemode setting or PIC_CODEMODE says off; one with deferred tools turns tool_search on. Codemode scripts can call both kinds; tool_search finds only deferred tools, and the model cannot call a codemode tool itself.

Set it with --exposure when adding a server, or later; one tool takes its own with --tool-exposure TOOL=EXPOSURE (as often as needed) or pic mcp exposure, and --unset gives it back the server's. A tool may be a pattern where * is any characters; its exact name wins over a pattern, and among patterns the first one given wins:

pic mcp add gh https://example.com/mcp --exposure deferred --tool-exposure search_code=direct
pic mcp exposure gh 'delete_*' hidden     # leave these tools out
pic mcp exposure --unset gh 'delete_*'    # back to the server's exposure
pic mcp exposure gh codemode              # the whole server

In a project's file the same is "exposure" and "toolExposure": {"search_code": "direct", "delete_*": "hidden"}; a project's entries are added to yours, and it cannot offer a tool you left out. A value that is not an exposure leaves the tool out, and pic mcp get warns about it. pic mcp get marks each tool whose exposure is not its server's. A tool is named by its name on the server or as the model sees it, mcp__SERVER__TOOL.

A call is journaled like any tool call, and PreToolUse and PostToolUse hooks, required ones included, run on it (hooks). A tool the server marks read-only runs again if pic crashes while it runs; any other tool's call becomes "outcome unknown" and is never run again, because the server may already have acted on it. A server's error, a tool's own error and a call that gets no answer in time all reach the model as the tool's error. A result longer than 20 KB reaches the model with its middle cut out, and the whole text is kept: the notice names it, and the read tool reads it.

Deferred tools

A server with many tools costs every request the schema of each one. Add it with --exposure deferred (or "exposure": "deferred" in a project's file) and none of its tools is declared. The model gets one more tool instead, tool_search, which takes a query and an optional limit (8 by default), ranks the deferred tools by how well their names, descriptions and parameter names match, and declares the best ones. The result names them, and they are callable from the model's next request on:

pic mcp add github --url https://example.com/mcp --exposure deferred

What tool_search found stays declared for the rest of that branch of the conversation: later requests, a conversation you resume, and a fork made after it declare the same tools, and a branch from before the search does not have them. A search skips the tools already declared, so asking again finds more. tool_search is offered whenever a deferred server has tools, and --tools read,tool_search still reaches them; --exclude-tools 'mcp__github__*' hides them from the search, and a --tools list with an mcp__ entry chooses among them as it does among direct tools. The search is journaled with its result, so a search cut short by a crash is run again, and one that finished is not.

Under the offline setting MCP servers are still called: a server is something you added, not a request pic makes on its own.

Resources

A server may offer resources: files, records or pages it shares by URI. When it is added or listed, pic notes whether its capabilities say it has them, and while an enabled server that is not hidden has some, the model gets three more tools, which Pi and Codex give it too:

They take the widest exposure among those servers: direct, else deferred, else codemode, and run again after a crash. A permission mode counts them as changes, as any MCP call, unless readOnlyTools names each server the call reaches. A server's apps (ui:// resources) are left out, since pic does not show them.

A project's servers

In a trusted workspace pic also reads the project's own servers from .mcp.json (Claude Code's file) and .pic/mcp.json, in the mcpServers shape; a server in .pic/mcp.json wins over one of the same name in .mcp.json, and either replaces a server of yours with that name. An entry with no command, url or type changes only your server of its name: "enabled": false turns it off in this project, and exposure sets how its tools are offered. pic never writes these files, and its own commands cannot remove or turn off a project's server: change the file. Their headers and environment are the file's, so keep secrets out of them with ${NAME} references, read when the server is called. In a workspace that is not trusted they are ignored.

A project's server is listed, and its tools saved for that workspace, by pic mcp list or r in /mcp; until then, and again after its entry changes, its tools are not offered.

The /mcp screen

/mcp in the terminal interface shows the servers in the settings panel's frame: those that need attention first, then the connected ones with their tool count and MCP revision, then those turned off. Opening it connects to each server again in the background, and the rows change as they answer. Enter lists the selected server's tools with their exposure, where e leaves one out or offers it again and Esc goes back; r reconnects every server, e turns one off or on (its tools leave or join requests from the next one), d removes one after y, and a (or the last row) puts /mcp add in the editor: /mcp add takes the same arguments as pic mcp add and waits while it connects.

Commands