---
url: https://docs.mochiexec.io/guides/agents.md
description: >-
  Connect Claude Code, Codex, Cursor, OpenCode, or any MCP client to Mochi so
  agents run your real tasks, only in workspaces you trust, with every run
  recorded.
---

# Coding Agents

Coding agents run a lot of commands for you, quickly, and their transcript is gone when the
session ends. Mochi gives them a better way in:

* **They use your real tasks.** An agent sees the same tasks, descriptions and history you
  do, instead of guessing commands from a README.
* **They only run what you trust.** An agent can't run tasks from a workspace you haven't
  [trusted](/guides/workspace-trust).
* **Every run is kept.** Agent runs land in your [run history](/guides/history), labeled
  with the agent and session that started them.

## Connect an agent

`mochi mcp` is a Model Context Protocol server. Add it to your agent's MCP configuration:

```json
{
  "mcpServers": {
    "mochi": { "command": "mochi", "args": ["mcp"] }
  }
}
```

That's the whole setup. Through it, the agent can list and search your tasks, read their
details and past runs, and run them.

flow docs: [AI tools & MCP](https://flowexec.io/guides/ai-tools)

The full list of tools an agent gets, and setup for specific clients. `mochi mcp` and
`flow mcp` are the same server.

## See what your agents ran

Open **Runs → Agent runs** in the desktop app. Runs are grouped by agent session, so you can
go back through what a session did, read the output of any step, and
[diagnose](/guides/ai#diagnose-a-failed-run) whatever failed.

This works even when an agent skips MCP and types `mochi` commands in its own shell. Mochi
recognizes Claude Code, Codex and OpenCode, and credits their runs to the right session with
no setup. Any other agent that sets the `AI_AGENT` environment variable is credited by name.

## Decide what agents may run

When an agent asks to run a task from a workspace you haven't trusted, Mochi refuses and
tells the agent how you can trust it. The agent passes that on, and you decide. Commands
you type yourself are never blocked.

```sh
mochi trust set my-project trusted
```

You can also trust a workspace but still require a check for risky tasks, such as anything
that deploys. See [Workspace trust](/guides/workspace-trust).
