> ## Documentation Index
> Fetch the complete documentation index at: https://psychiatrist.sudo.la/llms.txt
> Use this file to discover all available pages before exploring further.

# The guard and MCP servers

> Every tool call passes the bot’s guard; your rules can refuse more, never allow what it refuses.

Every session's tool calls pass the guard the bot uses, before they run: no `git push`, no checkout or reset of a protected branch (`main`, `master`, `dev`, …), no bypassing git hooks, no `gh` and no writes to GitHub; a `readOnly` session also may not edit files or change the repository. A refused call goes back to the agent with the reason.

MCP tools pass it too: a server's tools run only when its entry lists them in `allowTools` (by the names the server gives them; Claude Code writes a server's name with `_` for characters such as `.`, and the guard matches them as it does), and any other MCP tool is refused, so a server that can write somewhere (a GitHub server, say) cannot post past the guard. A turn's report tools always run. The bot lists its own servers' tools this way: psychiatrist's `gather` for every agent and `apply` for those that change files, and codegraph's read tools.

```ts theme={null}
await start({
  agent: claudeCode("claude-opus-5-5"),
  mcpServers: { github: { type: "http", url: "https://api.githubcopilot.com/mcp/", allowTools: ["get_issue", "list_pull_requests"] } },
});
```

`guard` adds rules: each is `(toolName, input) => reason | undefined`, and a call runs only when the guard and every rule let it. A rule can refuse more, never allow what the guard refuses.

```ts theme={null}
const noDeletes = (toolName: string, input: Record<string, unknown>) =>
  toolName === "Bash" && /\brm\s+-rf\b/.test(String(input.command)) ? "Don't delete trees." : undefined;
await start({ agent: claudeCode("claude-opus-5-5"), guard: [noDeletes] });
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.