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}. As in Pi, a value that starts with ! is a shell command, run
each time the server is reached, and what it prints (trimmed) is the value: -H 'Authorization:
!vault read -field=token mcp/docs'. It has 10 seconds, and one that fails or prints nothing stops
the call.
Claude Code's headersHelper, in a snippet, add-json or a project's file, is a command that
prints a JSON object of headers when pic connects: {"type": "http", "url": "...", "headersHelper":
"~/bin/mcp-headers.sh"}. It runs with CLAUDE_CODE_MCP_SERVER_NAME and CLAUDE_CODE_MCP_SERVER_URL
set, has 10 seconds, and a header it prints replaces a fixed one of the same 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 mcp add-from-claude-desktop adds the servers in Claude Desktop's configuration
(~/Library/Application Support/Claude/claude_desktop_config.json on macOS, else
~/.config/Claude/claude_desktop_config.json), as add-json would, sealing their environment:
the names given, or every one. A name one of yours already has gets _1 (then _2), as Claude
Code does it.
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 tools
would share (of one server, or of two of yours), ends in a short hash; a project's tool never takes
a name one of your tools has, and is left out instead. 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 may only narrow what you set: each tool gets the narrower of
your exposure and the project's, in the order direct, deferred, codemode, hidden. A project
entry of null gives no opinion. Any other value that is not one of those words, a number
included, leaves the tool out (for exposure, the server's tools), 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. As in Claude Code, MAX_MCP_OUTPUT_TOKENS sets that limit in tokens (four
bytes each), and MCP_TOOL_TIMEOUT (milliseconds) how long any server's tool call may take, instead
of the server's --timeout.
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.
Prompts
A server may offer prompts: messages it writes for you, filled in with arguments. pic lists them
when the server is added or listed, and offers each as a slash command named as Claude Code names
it, /mcp__SERVER__PROMPT, beside your prompt templates, with its
arguments as the hint (<file> [focus]: file is required):
/mcp__github__review_pr 123 "security and tests"
The words after the name fill the prompt's arguments in order, a quoted phrase as one word and any words left over joined into the last argument. pic asks the server for the prompt as you send it, and the messages it gives, joined, are what you send. A prompt that cannot be had (the server down, a required argument missing) is not sent, and the message says why. A hidden or disabled server's prompts are not offered.
Instructions
A server may give instructions for its tools when pic connects. pic keeps what each server gave
when it was added or last listed, and puts them in the system prompt under # MCP Server
Instructions, one ## SERVER heading each, as Claude Code does: up to 8 KB of each enabled server
that is not hidden. --no-mcp leaves them out with the tools.
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:
list_mcp_resourceslists resources as JSON,{"resources": [{"server", "uri", "name", ...}]}. Withserverit lists one page of that server's, andcursor(the page'snextCursor) the next; without, every page of every server, witherrorsnaming a server that could not answer andcutsaying so when the listing stopped (at 1 MB, or 100 pages of one server).list_mcp_resource_templateslists the URI templates for resources a server does not list.read_mcp_resourcereads one byserveranduri. Text reaches the model as text and an image as an image; other binary content is named with its type and size, not shown.
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.
Mentions
As in Claude Code, @SERVER:URI in a message names a resource: Sum up @docs:file:///notes.txt.
pic reads each one (up to 16, from servers that have resources and are not hidden) as you send
the message, and adds it after your words as <resource server="docs" uri="file:///notes.txt">
with its text, cut in the middle like a tool's result; binary content is named, not shown. Your
words are sent as you typed them. A resource that cannot be read stops the message, and the error
names it. An @ inside a word, as in an email address, or before a name that is none of your
servers with resources, is left alone.
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. A project cannot define a server
under the name of one of yours (names alike once - is _ count as one): that entry is ignored,
and pic mcp get names the file and the server. An entry with no command, url or type changes
only your server of its name: "enabled": false turns it off in this project (it cannot turn on one
you turned off), and exposure and toolExposure narrow how its tools are offered
(exposure); when both files have such an entry, each narrows. An entry of that kind
naming none of your servers (nor one defined above it) changes nothing, and a third one for the same server is dropped; both get
a warning. readOnlyTools covers your own servers only, never a project's. A file that is not valid
JSON, or a toolExposure that is not an object (which leaves that server's tools out), gets a
warning from pic mcp list and pic mcp get, which also says when a project narrowed a tool and in
which file. 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.
For one run
As in Claude Code, --mcp-config FILE (or the JSON itself, --mcp-config '{"mcpServers": {...}}')
adds servers for one run, beside yours; give it again for more. A server there replaces one of
yours of the same name for that run, its values are used as written and never saved, and it is
listed the first time a run needs its tools (afterwards as a project's server is). With
--strict-mcp-config, only those servers are used: not yours, and not a project's. pic
--mcp-config FILE mcp list shows them, marked config; the terminal interface passes both flags
to each of its requests.
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
pic mcp listconnects to each server, lists its tools again and prints its state; it exits 1 when a server is not connected.pic mcp get NAMEshows a server: its address, the names of its sealed headers, its revision, whether it has resources, and its tools, with what happens to each after a crash and any exposure of its own.pic mcp exposure SERVER [TOOL] EXPOSUREsets a server's exposure or one tool's, andpic mcp exposure --unset SERVER [TOOL]takes it back; a project's server is set in its file.pic mcp remove NAMEforgets a server and its sealed values.pic mcp call SERVER TOOL '{"arg":...}'calls a tool directly and prints its result, to try a server out. It is not journaled.