Skip to content

GitHub Copilot

Connect GitHub Copilot to Margin

Copilot's agent mode reads Margin comments in VS Code and fixes the code, with the token kept out of your repository.

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 GitHub Copilot

    Create .vscode/mcp.json. The `inputs` entry makes VS Code ask for the token once and store it securely, instead of writing it into the file.

    .vscode/mcp.json
    {
      "inputs": [
        { "type": "promptString", "id": "margin-token", "description": "Margin token", "password": true }
      ],
      "servers": {
        "margin": {
          "type": "http",
          "url": "https://app.margin-comments.com/mcp",
          "headers": { "Authorization": "Bearer ${input:margin-token}" }
        }
      }
    }

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

  3. 3. Check the connection

    Run the command MCP: List Servers from the Command Palette. Margin should be listed and running.

  4. 4. Ask for the fix

    Prompts that work:

    • “In agent mode: list open Margin comments for this website and fix the first one.”
    • “Look up Margin comment #3, read its screenshot and update the button styles.”

What GitHub Copilot 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 GitHub Copilot

With `password: true` on the input, VS Code asks once and keeps the value in its secret storage, not in mcp.json.

MCP tools are used by Copilot's agent mode. Switch the chat to agent mode before you ask it to read Margin comments.