Connect your coding agent over MCP
redline-mcp is an MCP server that gives your coding agent the review
comments directly. The agent reads what reviewers left, replies, and moves
each comment to in progress, resolved or won't fix. Reviewers see all of it in
the panel, with the agent's replies labelled Agent. Connected to a review in
Redline Cloud or running in local mode, it needs Node.js 20 or later.
Anyone who can comment on a review can write to your agent. Don't pair an
open: true review with an agent on a site that strangers can reach.
Quick start (local)
In your project folder, register the server with your coding agent. Local mode requires Node.js 20 or later.
Claude Code:
claude mcp add redline -- npx -y -p @perpetio/redline@latest redline-mcpCodex:
codex mcp add redline -- npx -y -p @perpetio/redline@latest redline-mcpInside a project that already depends on
@perpetio/redline,npx redline-mcpworks too.It starts a review backend for the folder on
127.0.0.1:7335, and keeps its data in.annotate/in the project folder. That folder has its own.gitignore, so nothing is committed.Open the page you are developing, on
localhostor127.0.0.1, with any Redline snippet that has nodata-review-id:<script src="https://unpkg.com/@perpetio/redline"></script>Click Settings (the gear) in the Redline toolbar and turn on Send comments to my coding agent. The switch is remembered for that site, and the status next to Coding agent shows whether the agent's server is running. To turn it on from code instead, add
data-review-id="local".Leave some comments, then tell the agent: "work through the Redline comments".
A second agent session in the same folder attaches to the first one's backend. The address is fixed, so one project at a time can use local mode; use a Redline Cloud review for another project.
Other clients
Any MCP client that can start a stdio server works. The usual JSON config:
{
"mcpServers": {
"redline": {
"command": "npx",
"args": ["-y", "-p", "@perpetio/redline@latest", "redline-mcp"]
}
}
}
Local mode keeps its data in .annotate/ in the folder the client starts the
server in. Clients that don't start servers in the project folder (Claude
Desktop starts them in /) need the folder given explicitly:
"args": ["-y", "-p", "@perpetio/redline@latest", "redline-mcp", "--data-dir", "/absolute/path/to/project/.annotate"],
or the client's cwd setting.
Tools
| Tool | What it does |
|---|---|
annotate_list_pending |
Open and in-progress comments, oldest first, as Markdown plus JSON. Optional page filter. |
annotate_get_comment |
One comment in full: styles, position, replies and activity. |
annotate_reply |
Adds a reply to a comment thread. |
annotate_set_status |
Sets in_progress, resolved, wont_fix or open. A note is posted as a reply first, and wont_fix needs one. |
annotate_watch |
Waits for new or changed comments, then returns them. |
Remote mode
To work against a review in Redline Cloud instead of the local one, pass the review and the review's agent invite:
npx -y -p @perpetio/redline@latest redline-mcp --review rvw_… --invite agt_…
REDLINE_REVIEW and REDLINE_INVITE work in place of the flags. Create the agent token in the review's Agent tab at app.redlinejs.com; it shows this command ready to copy.
Settings → Coding agent on the review's pages shows whether your agent is
running right now, or when it last was.
Troubleshooting
Run npx -y -p @perpetio/redline@latest redline-mcp doctor in the same folder (with
the same flags or variables in remote mode). It prints a line per check, starting with the
mode, and exits 1 if one fails.
127.0.0.1:7335 is used by redline-mcp for another project folder: one project at a time can use local mode. Stop the other agent session, or use a Redline Cloud review.127.0.0.1:7335 is in use by another program: local mode needs that port. Stop the program, or use a Redline Cloud review.--port,--hostand--apiwere removed in 2.0. Local mode always runs on127.0.0.1:7335, and remote mode always connects to Redline Cloud.
Element identification and AI agents
Every new comment records the element it is about: a readable label
(Button "Start free trial"), a stable selector that prefers ids and
data-testid, the nearest heading, its classes and size, computed styles,
and, in React, Vue or Svelte development builds, the component chain and
source file (src/components/PlanCard.tsx:42:7). The Pin tool outlines the
element under the cursor before you click, and the click never reaches the
page.
Copy → Copy for AI agent puts Markdown made for coding agents on the
clipboard, at Compact, Standard or Detailed level. Press M for the same.
Paste it into Claude Code, Cursor or any agent:
## 1. Button "Start free trial"
Pin · open · Jane Doe
> Should say "Start 14-day trial", legal asked for it.
- Selector: `[data-testid="start-trial"]`
- Component: `<Pricing> <PlanCard> <Button>` · `src/components/PlanCard.tsx:42:7`
- Under heading: "Pricing"
Resolved and won't-fix comments are left out. From code:
Redline.markdown({ detail: "detailed" }) returns the text and
Redline.copy() copies it.
