MCP Servers
poo runs Model Context Protocol (MCP) servers as session-owned stdio child processes. Loading an mcp.json manifest declares which servers exist; a profile's mcp_servers list selects which ones a session actually starts.
The model calls server tools through call_mcp, searches them beside CLI registry commands with find_tool, and can receive asynchronous messages from server resources through poo resource feeds.
Loading mcp.json manifests
poo reads standard mcp.json files (the same mcpServers format used by Claude Code and other harnesses) from:
- Default user directory:
$XDG_CONFIG_HOME/poo/mcp/(typically~/.config/poo/mcp/), loaded whenmcp.defaultsis absent ortrue. A missing directory is not an error. - Configured paths:
mcp.pathsin settings (files or directories), plusPOO_MCP_PATH(OS path-list separated) and repeatable--mcp-pathflags onpoo run,poo serve, andpoo prompt.
Directories contribute their .json files and skip non-.json files; an explicit file path that is not .json fails the load. Relative paths resolve against the working directory; ~/ resolves under the home directory.
mcp:
paths:
- examples/avenor-mcp
defaults: false # ignore ~/.config/poo/mcp/A profile can override mcp.defaults with mcp_defaults.
Manifest rules
- Top-level
mcpServersis required. Each key is the server name (letters, digits,-, and_). pooreadscommand(required),args,env,type, andurl. Other top-level keys and entry fields are ignored so onemcp.jsoncan be shared across harnesses.- Only
stdiotransport is supported. Entries withtypeset tohttp,sse, orstreamable-http(or aurlwith notype) are skipped with a warning naming the server. Any othertypevalue fails the load. - Duplicate server names across files and duplicate JSON object keys within a file both fail the load.
Profile opt-in (mcp_servers)
Loading a manifest starts nothing. A session starts only the servers named in its profile's mcp_servers list:
profiles:
avenor:
base: code
mcp_servers: [avenor]
profile: avenormcp_servers adds to the base profile's selection, deduplicated in order of first appearance. Selecting a server name that no loaded manifest defines produces a warning and skips it. A binary that does not link call_mcp fails the build if a profile selects any server.
Process lifecycle and trust
- Session-owned: Each selected server starts when the session is created or resumed (with the session's ID and working directory) and stops when the session closes.
- Startup budget: Startup is bounded at 30 seconds per server, including the MCP handshake and initial tool listing. A server that fails to start fails session creation or resume.
- Unsandboxed host process: MCP servers start directly on the host — not through the session's executor or sandbox — and run as the user running
poo. They inherit the host environment minustools.env.scrub, plus the manifest's resolvedenv. Select an MCP server with the same trust boundary as installing a program.
Launch template variables
command, each element of args, and each env value support template expansion, resolved at server launch (not when settings load):
| Syntax | Resolution |
|---|---|
${NAME} | Host environment variable NAME. Missing variable fails launch naming the server and variable. Can re-introduce a variable removed by tools.env.scrub. |
${NAME:-default} | Host environment variable NAME, or default if unset. |
${session:id} | The session's ID (stable across session resume). Cannot take a default. |
$$ | Literal $. |
Syntax errors — unterminated ${, empty variable name, a default on session:id, or any session: variable other than id — fail manifest load.
Calling tools: call_mcp and find_tool
The model reaches MCP tools through a single dispatcher, call_mcp, using <server>/<tool> qualified names:
{
"name": "avenor/spawn",
"args": {
"prompt": "Run the test suite and report failures.",
"dir": "/path/to/repo"
}
}- Permissions:
call_mcpisside_effectingand its primary argument isname. A permission rule can allow or deny an entire server by prefix (for examplecommand_prefix: "avenor/") without listing individual tools. - Hints vs. permissions: MCP tool annotations (
readOnlyHint,destructiveHint) appear in the prompt catalog andfind_toolresults as(read-only)or(destructive)hints for the model. They never change the call's permission class. - Background jobs:
call_mcpsupportsbackground: trueand/bgpromotion in the REPL. - Outputs: Text responses are elided in the middle if they exceed the observation cap.
structuredContentrides along when it is valid JSON under the same cap (otherwise omitted with a note). Returned images become attachments when the active model acceptsimageinput and the image fits within 5 MB. Otherwise, a note explains what was omitted. - Errors: Unknown
<server>/<tool>names are refused before calling. A stopped server returnsserver <name> is downas a recoverable error. A transport failure mid-call is reported and never retried, because the server may already have executed side effects.
find_tool integration
When a session has a decision model:
- If the MCP offering exceeds 30 tools, the prompt points the model at
find_toolinstead of listing every tool inline. find_toolsearches MCP tools and CLI registry commands together over a live snapshot of the session's offering. Each hit includes the tool's argument schema and tells the model which dispatcher (call_mcporcall_cli) and argument (nameorcommand) to use.- Because the snapshot is live, a down or relaunching server contributes no stale hits. Once it relaunches, its newly listed tools are immediately searchable.
Resource feeds (poo block)
A manifest can include a top-level poo block to turn an MCP resource into a session feed. Unlike mcpServers, the poo block is strict: unknown fields fail the load.
{
"mcpServers": {
"avenor": {
"command": "avenor",
"args": ["mcp", "--bind-host", "poo", "--bind-session", "${session:id}"]
}
},
"poo": {
"servers": {
"avenor": {
"feeds": {
"avenor-inbox": {
"resource": "avenor://inbox",
"on_idle": "wake",
"description": "Messages from Avenor children.",
"filter": {
"command": ["jq", "-c", ".text | fromjson | .messages[] | {from, text}"]
}
}
}
}
}
}
}Fields under poo.servers.<server>.feeds.<feed>:
resource(required): Resource URI to subscribe to.description: Shown in thejobsprompt section.on_idle:wakeorhold(inheritsjobs.on_idlewhen omitted).filter: Optional feed filter using eithercommandorquestion. Acommandfilter fans one resource read into zero, one, or many inputs. Aquestionfilter screens each record with the decision model.
How resource feeds run:
- The server must advertise
resources/subscribein its handshake, or session creation fails. - After subscribing,
pooreads the resource once immediately (draining any backlog queued before subscription) and reads it again on each resource-updated notification. - Each text content block is emitted as a record with the server name as
fromand the text verbatim (empty text and binary contents are skipped). Reads are drained at-most-once. - Declared
commandfilters run through the session's executor and working directory. Standard feed caps apply: 1 MiB per record, and 4 MiB or 256 records per filter run. - Feed names must be lowercase letters, digits,
-, and_, and must be unique across all MCP servers and configured command feeds. Two feeds cannot subscribe to the same server resource. - Running resource feeds appear in
jobsasfeed:<name>and can be stopped withcancel_job.
Bounded auto-relaunch
If a running MCP server exits unexpectedly during a session, poo relaunches it automatically:
- Backoff: First retry waits 1 second, doubling on each consecutive failure up to 30 seconds.
- Reset: A generation that stays up for at least 60 seconds resets the failure counter.
- Exhaustion: After 5 consecutive failures, the server is marked down for the remainder of the session:
call_mcpcalls to that server returnserver <name> is down.- Any resource feeds attached to that server suspend with fault
filter_exited(server <name> stopped after 5 relaunches). - The session itself keeps running; resuming the session starts with a fresh relaunch budget.
- Re-sync: On a successful relaunch,
poore-lists the server's tools (updatingcall_mcpandfind_toollive; the initial prompt catalog is not re-rendered) and re-subscribes its resource feeds.
Example: Avenor over MCP
The repository includes a complete working example in examples/avenor-mcp/:
examples/avenor-mcp/mcp.jsonlaunchesavenor mcp --bind-host poo --bind-session ${session:id}and subscribes toavenor://inboxwith ajqfilter that fans out batched messages and attaches reply instructions for asks.examples/avenor-mcp/settings.yamlloadsexamples/avenor-mcp, selectsmcp_servers: [avenor]on a profile, and disables ambientmcp,feeds, andcli_registrydefaults so the MCP inbox does not contend with the older CLI+feed example inexamples/avenor/.
poo run --settings examples/avenor-mcp/settings.yaml \
"spawn a child to run the test suite, then answer its questions"Related
- CLI Registry & Script Tools — wrap local CLIs and scripts without an MCP server
- Feeds & Daemon — command feeds, filters, and idle wake behavior
- Built-in Tools & Jobs —
jobs,cancel_job, and background execution - Manifests Reference — complete manifest reference
