# MCP server

`oak mcp` runs a [Model Context Protocol](https://modelcontextprotocol.io) server over stdio, so an agent's MCP client can read and, if you allow it, change a repository through Oak. Each tool runs the matching `oak` command in the checkout the server was started in, so it uses the CLI's usual credentials. Some tool output is reshaped, so it is not byte-for-byte the CLI's `--json`.

Add it to a client as the command `oak mcp`, started in the repository. For example, with Claude Code:

```bash
claude mcp add oak -- oak mcp
```

## Read-only by default

With no flags the tools only read: agent state, status, diff, log, branch list, triage and review, and CI status, runs and logs (`oak_agent_state`, `oak_status`, `oak_diff`, `oak_log`, `oak_branch_list`, `oak_branch_triage`, `oak_branch_review`, `oak_ci_status`, `oak_ci_runs`, `oak_ci_logs`). `oak_ci_status` reports each CI service on `main`, never your branch, so it is not evidence about a candidate: for that, use `oak ci status --head` or `oak ci wait RUN_ID --commit FULL_HASH` from the CLI. `--allow-write` also offers three more: `oak_commit`, `oak_desc` and `oak_push`.

```bash
oak mcp --allow-write
```

Merging and closing branches are never exposed, with or without the flag. An agent that should merge does it with [`oak merge`](/docs/cli#oak-merge) under your control.

## Instead of the CLI

Agents that can run shell commands usually do better with the CLI and the bundled skill (`oak skill install`; see [Working with agents](/docs/agents)): the commands and their `--json` output cover the same ground. `oak mcp` is for clients that can speak MCP but can't run commands.

See the [CLI reference](/docs/cli#oak-mcp).
