pi-cli-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| PI_MCP_BIN | No | Path to the pi binary. | pi |
| PI_MCP_WRAP | No | Command prefix, e.g. sandbox-exec -f profile.sb. | |
| PI_MCP_MODEL | No | Default model for every call. | |
| PI_MCP_STATE | No | Session → cwd map. | ~/.local/state/pi-mcp/sessions.json |
| PI_MCP_MAX_LINE | No | Longest single event line from pi before it is dropped. | 8000000 |
| PI_MCP_THINKING | No | Default thinking level. | |
| PI_MCP_MAX_FRAME | No | Longest single JSON-RPC frame from the client. | 8000000 |
| PI_MCP_TRANSPORT | No | Default transport: rpc or print. | rpc |
| PI_MCP_MAX_OUTPUT | No | Cap on the answer. Unset means no truncation. | |
| PI_MCP_TIMEOUT_MS | No | Default wall clock; timeout_ms overrides it per call. | 1800000 |
| PI_MCP_MAX_CAPTURE | No | Read-buffer guard against a runaway stream. | 16000000 |
| PI_MCP_MAX_SESSIONS | No | Remembered sessions before the oldest is dropped. | 200 |
| PI_MCP_STDERR_LIMIT | No | stderr tail included in the response. | 1500 |
| PI_MCP_KILL_GRACE_MS | No | SIGTERM → SIGKILL grace period. | 5000 |
| PI_MCP_ABORT_GRACE_MS | No | How long abort gets before signals (rpc only). | 5000 |
| PI_MCP_MAX_CONCURRENT | No | Concurrent pi processes. | 4 |
| PI_MCP_MAX_TIMEOUT_MS | No | Ceiling on what timeout_ms may ask for. | 86400000 |
| PI_MCP_STDERR_KEEP_EVENTS | No | 1 forwards stderr verbatim, event lines included. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| piA | Start a NEW task in the local pi agent — a separate CLI coding agent with its own read/bash/edit/write tools and its own context window. Blocks until pi settles, then returns only its final answer plus stats, prefixed [session: ]; continue that session later with pi_reply.
Good for: a second opinion from a different model, work kept out of this context, or parallel investigation.
Caution: pi has no permission system. With its default tools it edits files and runs shell commands as your user inside |
| pi_replyA | Send a new turn to an existing pi session that is not executing right now — including one that timed out or was cancelled: the session survives, so resume it here instead of restarting with |
| pi_modelsA | List the models pi can actually reach right now — provider, model id, context window, max output, thinking and image support — read from the live catalog. Use it to pick |
| pi_sendA | Deliver a message into a pi turn that is executing right now. Works only on runs started with transport 'rpc' — 'print' runs cannot be reached, and a session that already finished takes pi_reply, not pi_send. Returns immediately; pi's reaction appears in the answer of the pi/pi_reply call still waiting on that turn. |
| pi_runningA | List pi turns executing at this moment — the ones pi_send can reach — with session id, working directory, elapsed time, and messages already sent in. Only rpc-transport runs appear; 'print' runs are unreachable mid-run. For past sessions use pi_sessions. |
| pi_sessionsA | List all pi sessions started through this server, newest first, with their working directory — running or finished, including runs that timed out. Use it to recover an id for pi_reply. For turns still executing (pi_send targets), use pi_running. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 6 tools
Each tool maps to a distinct lifecycle stage: starting a session, messaging a running session, messaging an idle/finished one, listing running sessions, listing all sessions, and listing models. pi_reply and pi_send both send messages, but their descriptions clearly separate them by execution state and transport, so an agent should not confuse them.
Tool names are consistently lowercase snake_case with a pi_ prefix, which makes the namespace predictable. The slight inconsistency is that pi is a bare root command, and pi_running/pi_sessions/pi_models are noun-style list commands rather than verb-style names, but the pattern is still easy to follow.
Six tools is well-scoped for a server that manages an external CLI agent. Each tool handles a necessary interaction point—start, continue, interrupt, list live sessions, list historical sessions, and inspect available models—without redundancy or bloat.
The core session lifecycle is covered: create, resume, message mid-run, list running, list all, and check models. There is no explicit cancel/stop tool or read-only session history viewer, but pi_reply can resume any non-running session, so agents are not blocked by the omissions.