# Coding agents

> Connect a coding agent to VisualCI's MCP server, so it can read each change, check it against the code, and approve it or fix it.

Source: https://visualci.com/docs/agents/
All of VisualCI's documentation: https://visualci.com/llms.txt

Coding agents write most code now, and they fix most CI failures. VisualCI is built so the agent that wrote the code also reviews what it changed. It doesn't need a person to open a screenshot.

## Connect

The MCP server is at `https://mcp.visualci.com/mcp` (Streamable HTTP). Sign in with `Authorization: Bearer <token>`:

- a **personal access token** (`vcu_...`), created on your [account page](https://app.visualci.com/account): everything you can do, in every organization you belong to;
- or a **project token** (`vci_...`), from a project's **Tokens** tab: that one project. With a project token, tools take no `project` argument.

Claude Code:

```sh
claude mcp add --transport http visualci https://mcp.visualci.com/mcp \
  --header "Authorization: Bearer $VISUALCI_TOKEN"
```

Other agents take the same URL and header in their MCP settings.

## The review loop

1. CI sends a build and finishes. When something changed, the CI job still passes, and the pull request's VisualCI check stays pending.
2. The agent calls `list_builds` or `get_build` to see what needs attention: changed, added, removed and failed snapshots.
3. For each change, it calls `get_snapshot`. For PDFs and images that returns the base, head and diff images of the changed pages, the changed regions, the page's text diff, and lines that moved to another page. For text, JSON and HTML snapshots it returns the changes by JSON path (`items[3].price: 10 → 12`) and a unified diff.
4. The agent checks each change against the code and the task:
   - **Intended:** it calls `review` with `approve`. The approved snapshots become the baseline, and the check turns green. No new commit or CI run is needed.
   - **A bug:** it fixes the code and pushes again. The next build is compared with the same baseline.
5. `snapshot_history` shows one snapshot across recent builds, which helps find when a page started changing.

Every review is recorded on the build. A review made with a project token is recorded without a user.

Pages that legitimately render two ways can be accepted as a variant with `review_page` and `variant`. A change that should never count again can be ignored with `review_page` and `ignore`.

## Tools

**Builds**

- `list_builds`: a project's builds, newest first, optionally for one branch.
- `get_build`: a build's status and the snapshots that need attention.
- `get_snapshot`: one snapshot's comparison, page by page, with images.
- `snapshot_history`: one snapshot across recent builds.

**Reviews**

- `review`: approve or reject a build's changes, or some snapshots' changes.
- `review_page`: accept one page as a variant, or ignore one exact change in later builds too.

**Running a comparison**

- `create_build`, `upload_snapshots` (PDFs, PNG, JPEG and WebP images, or text, JSON and HTML, base64, up to 64 MB per call) and `finalize_build`. An agent can compare files without a CI run.

**Organizations and projects**

- `whoami`, `list_organizations`, `get_organization` (projects, plan, credits used this month and pack credits).
- `create_organization`, `create_project`, `get_project`, `update_project` (settings and [ignore rules](https://visualci.com/docs/reference/api.md#project-settings)), `create_project_token`, `delete_project_token`.

**Support**

- `support_send`: send feedback about VisualCI itself. See [Support](https://visualci.com/docs/support.md).

Choosing a plan and paying stay with a person, in the web app.
