Skip to content

Cursor

Connect Cursor to Margin

Cursor's agent reads your client's comments next to your code and edits the component the selector points to.

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 Cursor

    Create .cursor/mcp.json in the project, or the global file in your home folder. The `${env:MARGIN_MCP_TOKEN}` syntax reads the token from your environment.

    .cursor/mcp.json
    {
      "mcpServers": {
        "margin": {
          "url": "https://app.margin-comments.com/mcp",
          "headers": { "Authorization": "Bearer ${env:MARGIN_MCP_TOKEN}" }
        }
      }
    }

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

  3. 3. Check the connection

    Open Cursor Settings, then MCP. Margin should be listed with a green dot and its tools.

  4. 4. Ask for the fix

    Prompts that work:

    • “Check Margin for open comments on the pricing page and fix them.”
    • “Read the latest Margin comment, find the element by its selector and make the change.”

What Cursor 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 Cursor

Use the project file when only this website needs Margin. A token belongs to one website anyway, so a project file keeps the right token with the right repository.

Yes, because it contains no secret. Every teammate sets their own MARGIN_MCP_TOKEN.