# Agent setup (/docs/agents)

marmot works the same for a coding agent as for a person, with output an agent can act on
without opening files.

## Register the MCP server [#register-the-mcp-server]

`marmot mcp` serves `build`, `run`, `test`, `check`, `fix` and `explain` over the Model Context
Protocol on stdin and stdout. Each tool takes a directory and returns marmot's JSON output.

```sh
claude mcp add marmot -- marmot mcp
```

Other agents take the same command: `marmot mcp`, with no arguments.

## As a plain command [#as-a-plain-command]

When one of these variables is set (to anything but `0`) and `MARMOT_OUTPUT` is not, marmot
writes its diagnostics as JSON Lines: `CLAUDECODE`, `AI_AGENT`, `CODEX_SANDBOX`, `GEMINI_CLI`,
`CURSOR_AGENT`, `OPENCODE`, `GOOSE_TERMINAL`. `MARMOT_OUTPUT=json` asks for it anywhere.

Each diagnostic carries its spans, the enclosing function, the source lines around it, the fixes
as edits with how safe each is, and `rendered`, the exact text a person would see. See
[JSON output](/docs/diagnostics/json) for the schema and [Error codes](/docs/diagnostics/codes)
for every code.

## These docs, for agents [#these-docs-for-agents]

Every page has a Markdown twin, linked as View as Markdown under its title. The whole site is
also available as plain text:

- [`/llms.txt`](/llms.txt): an index of every page.
- [`/llms-full.txt`](/llms-full.txt): every page in one file.