diff options
Diffstat (limited to 'mcp/README.md')
| -rw-r--r-- | mcp/README.md | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/mcp/README.md b/mcp/README.md index d9c6c52..51a53af 100644 --- a/mcp/README.md +++ b/mcp/README.md @@ -118,35 +118,41 @@ locations (Homebrew, nvm, volta, n). If yours is somewhere else, put it on the P The [pi](https://pi.dev) agent reaches this same server, so both your agents share one definition of the browser, one extension and one set of tools. -**1. Give pi an MCP client.** +**1. Register this server** in `~/.pi/agent/mcp.json`, with the absolute path to `run.sh`. pi's +built-in MCP support reads that file; no package is needed for it: ```bash -pi install npm:pi-mcp-adapter +pi mcp add my-chrome -- "$PWD/run.sh" ``` -**2. Register this server** in `~/.pi/agent/mcp.json`, with the absolute path to `run.sh`: +which adds an entry like: ```json { "mcpServers": { "my-chrome": { - "command": "/absolute/path/to/pi-chrome-mcp/run.sh", - "approveTools": true + "command": "/absolute/path/to/pi-chrome-mcp/run.sh" } } } ``` -**3. Add the session gate.** Copy `pi/browser-gate.ts` from this repo into +`pi mcp list` should then show `my-chrome: connected, 21 tools`. + +**2. Add the session gate.** Copy `pi/browser-gate.ts` from this repo into `~/.pi/agent/extensions/`. The first browser call in a pi session asks once — for the session, for 15 minutes, or deny — and `/browser authorize`, `/browser revoke` and `/browser` manage it from there. For headless runs (`pi -p`), `PI_BROWSER_AUTHORIZE=indefinite` grants it up front; without -it, a headless call is denied. +it, a headless call is denied. Calls made from codemode scripts are gated the same way. + +Why the gate: pi has no permission prompts of its own. Every MCP call passes through pi's tool +pipeline, and an extension's `tool_call` handler is the only thing that can stop one. **Nothing +backs the gate up:** if it fails to load, browser calls run unchecked. Run `/browser` in a new +session to confirm it is there. -Why the gate: pi has no permission prompts of its own, and the adapter's own approval remembers a -grant only for identical arguments, which for a browser means a prompt on nearly every call. Keep -`approveTools: true` as well — if the gate ever fails to load, the adapter asks per call and fails -closed headless, rather than running unchecked. +If an extension that replaces pi's MCP support is installed — `pi-mcp-adapter`, for one — pi's +built-in support does not load, and this gate sees none of its calls. Use one or the other; this +setup assumes the built-in. That is all pi needs: no `pi install npm:pi-chrome`, and no `/chrome authorize`. |
