# VS Code & GitHub Copilot

Use the Data MCP server from GitHub Copilot's agent mode in VS Code. VS Code can prompt for your API key once and store it securely, so the key never appears in a file.

## Prerequisites

- VS Code with GitHub Copilot and agent mode enabled.
- For an API key: a key from **API keys** in the console. Start with a test key.

VS Code reads MCP servers from your user configuration (**MCP: Open User Configuration** in the Command Palette) or from a workspace `.vscode/mcp.json`. The top-level key is `servers`.

## Connect with an API key

```json
{
  "inputs": [
    {
      "type": "promptString",
      "id": "autouncle-api-key",
      "description": "AutoUncle Data Services API key",
      "password": true
    }
  ],
  "servers": {
    "autouncle-data": {
      "type": "http",
      "url": "https://data-services.autouncle.com/mcp",
      "headers": { "Authorization": "Bearer ${input:autouncle-api-key}" }
    }
  }
}
```

The first time the server starts, VS Code asks for the key and stores it securely. Paste your `au_test_...` key. You can share this file with your team because it contains no secret.

## Connect with OAuth

Leave out `inputs` and `headers`:

```json
{
  "servers": {
    "autouncle-data": {
      "type": "http",
      "url": "https://data-services.autouncle.com/mcp"
    }
  }
}
```

When the server starts, VS Code discovers AutoUncle's authorization server, registers itself through dynamic client registration and opens the sign-in page. Choose the organization and approve the scopes. OAuth valuations are **live** and use the organization's credits.

## Verify the connection

Open Copilot Chat in agent mode, check that the `autouncle-data` tools are enabled in the tools picker, and ask:

> Use autouncle-data get_account and tell me the key mode and remaining credits.

## Troubleshooting

| Symptom | Fix |
| --- | --- |
| `401 invalid_api_key` | You entered a wrong key. Clear the stored input value and start the server again to be prompted anew. |
| Server fails to start | Check that `type` is `http` and the URL is exactly `https://data-services.autouncle.com/mcp`. |
| Results are live | You are using OAuth or a live key. Use a test key for free results. |
| `insufficient_scope` | The key or OAuth grant lacks the tool's scope. |

## Next steps

- [Agent prompts & examples](/docs/mcp/examples)
- [Safety & spend control](/docs/mcp/safety)

Sources: [VS Code MCP configuration reference](https://code.visualstudio.com/docs/agents/reference/mcp-configuration), [VS Code MCP servers](https://code.visualstudio.com/docs/copilot/customization/mcp-servers), [VS Code 1.103 release notes](https://code.visualstudio.com/updates/v1_103).
