pi has no built-in MCP; the pi-mcp-adapter extension adds it.

## 1 · Install the adapter

Run this and restart pi:

```bash
pi install npm:pi-mcp-adapter
```

## 2 · Add the server

Create `~/.pi/agent/mcp.json`:

```json
{
  "mcpServers": {
    "brain": { "url": "https://brain.levirge.com/mcp", "auth": "oauth" }
  }
}
```

## 3 · Sign in

Ask pi to *"authorize the brain MCP server"* and sign in when the browser opens.

## 4 · Verify

Ask for a read-only call: `kb_overview` returns your workspace's knowledge
summary.

## Using a token instead

For machines that cannot open a browser (CI, a server). Get a
[token](/brain/docs/install/mcp#auth) first and put it in an environment
variable, for example `export BRAIN_TOKEN=<your-token>`. Then use bearer auth
instead of oauth in `mcp.json`:

```json
{
  "mcpServers": {
    "brain": { "url": "https://brain.levirge.com/mcp", "auth": "bearer", "bearerTokenEnv": "BRAIN_TOKEN" }
  }
}
```

## Troubleshooting

**pi does not know about the mcp tool.** Restart pi after
`pi install npm:pi-mcp-adapter`. Extensions load at startup.

**The server is not listed.** Check the file is at `~/.pi/agent/mcp.json` (or
`.pi/mcp.json` in the project) and is valid JSON.

**"401" or "Unauthorized" with a token.** Check `BRAIN_TOKEN` is set in the shell
that starts pi, and that the token has not been revoked on
[Profile → MCP Tokens](https://brain.levirge.com/profile).

## Other clients

Every guide is listed under [any MCP client](/brain/docs/install/mcp). No
workspace yet? [Request access](/contact).
