> ## Documentation Index
> Fetch the complete documentation index at: https://docs.2extract.com/llms.txt
> Use this file to discover all available pages before exploring further.

# VS Code

> Connect the 2extract MCP server to GitHub Copilot in VS Code, keeping your API key out of the repository.

VS Code supports MCP servers through Copilot's agent mode. Its config has one feature the others lack: **inputs**, which prompt for a secret at first use instead of storing it in the file.

***

## Add the server

Create `.vscode/mcp.json` in your workspace:

```json .vscode/mcp.json icon="brackets-curly" theme={null}
{
  "servers": {
    "2extract": {
      "type": "http",
      "url": "https://mcp.2extract.com/mcp",
      "headers": {
        "Authorization": "Bearer ${input:2extract-key}"
      }
    }
  },
  "inputs": [
    {
      "id": "2extract-key",
      "type": "promptString",
      "description": "2extract API key",
      "password": true
    }
  ]
}
```

<Check>
  Because the key comes from `inputs`, this file is safe to commit. VS Code prompts each person for their own key the first time the server starts, and stores it in the OS keychain rather than in the repository.
</Check>

Note the top-level key is `servers`, not `mcpServers` as in most other clients.

***

## Verify

<Steps>
  <Step title="Start the server">
    Open `.vscode/mcp.json`. VS Code shows a **Start** action above the server entry - click it, and enter your API key when prompted.
  </Step>

  <Step title="Switch Copilot to Agent mode">
    Open Chat and select **Agent** from the mode dropdown. Tools only run in agent mode.
  </Step>

  <Step title="Ask something read-only">
    > What is my 2extract balance?

    Copilot asks for permission to run the tool, then reports the number.
  </Step>
</Steps>

You can see everything that is registered with **MCP: List Servers** from the Command Palette.

***

## User-level instead of workspace

To make the server available in every workspace, run **MCP: Open User Configuration** from the Command Palette and put the same `servers` block there. The `inputs` mechanism works the same way.

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="No Start action above the server entry">
    The JSON is malformed, or the top-level key is wrong. VS Code expects `servers`, not `mcpServers` - that is the most common mistake when copying a config from another client.
  </Accordion>

  <Accordion title="It asks for the key again">
    The stored value was cleared. Run **MCP: Reset Cached Tools** or restart the server from `.vscode/mcp.json` and enter the key again.
  </Accordion>

  <Accordion title="Tools are visible but never called">
    Copilot must be in **Agent** mode. Ask and Edit modes do not call MCP tools.
  </Accordion>

  <Accordion title="Unauthorized on every call">
    The key entered at the prompt is wrong or expired. Reset the input and re-enter it - the value is not in the JSON, so editing the file will not help.
  </Accordion>
</AccordionGroup>

***

## Next steps

<CardGroup cols={2}>
  <Card title="Tools" icon="wrench" href="/ai/mcp-server/tools">
    Everything the agent can call.
  </Card>

  <Card title="Usage Examples" icon="terminal" href="/ai/mcp-server/usage-examples">
    Sessions from request to connection string.
  </Card>
</CardGroup>
