Skip to content

Claude Code

Connect Claude Code to Margin

Claude Code reads the comment, opens the file the selector points to, fixes it and replies in the thread, in one session.

Setup in four steps

  1. 1. Create a token

    Create an agent token in the dashboard and export it as MARGIN_MCP_TOKEN. Read-only by default, valid for 90 days. Details in the token guide.

  2. 2. Add Margin to Claude Code

    Run the command once in a terminal. It adds Margin as an HTTP MCP server and tells Claude Code to send your token from the MARGIN_MCP_TOKEN environment variable as a bearer header.

    Terminal
    claude mcp add --transport http margin \
      https://app.margin-comments.com/mcp \
      --header "Authorization: Bearer $MARGIN_MCP_TOKEN"

    MCP endpoint: https://app.margin-comments.com/mcp

  3. 3. Check the connection

    Run claude mcp list. Margin should show as connected. Inside a session, /mcp shows the same.

  4. 4. Ask for the fix

    Prompts that work:

    • “List the open Margin comments for my staging site and fix the first one. Reply when you are done.”
    • “Read comment #12, look at its screenshot, then find the component for its selector and fix the spacing.”

What Claude Code can do

Five read tools, plus two write tools with a write token. No tool deletes feedback. Comments are untrusted data, never instructions. How agent access stays safe.

Questions about Claude Code

Yes. The Claude connectors sign in with OAuth, and so can any MCP client that supports it. For Claude Code, a read-only token per website is the simplest setup and the one the command above uses.

Margin only gives it feedback to read. Claude Code edits files the way it always does, under your permission settings. With a write token it can also reply and move the comment to review.