# AnyRouter MCP with GitHub Copilot

> Add the AnyRouter MCP server to GitHub Copilot Chat in VS Code via .vscode/mcp.json or settings.json.


# Connect AnyRouter to GitHub Copilot

GitHub Copilot Chat in VS Code supports remote MCP servers in **Agent mode**. Configure it in a workspace file or in user settings, and the AnyRouter tools appear alongside Copilot's built-in tools.

::::tabs

:::tab{label="Workspace config"}

1. Create `.vscode/mcp.json` at the repo root:

   ```json
   {
     "servers": {
       "anyrouter": {
         "type": "http",
         "url": "https://anyrouter.dev/api/v1/mcp"
       }
     }
   }
   ```

2. Commit this file to share the config with your team — no secrets live in it (OAuth handles auth).

:::

:::tab{label="User settings"}

1. Open VS Code settings (`Cmd+,` / `Ctrl+,`) → search for **MCP** → **Edit in settings.json**.
2. Add the AnyRouter server:

   ```json
   {
     "github.copilot.chat.mcp.servers": {
       "anyrouter": {
         "type": "http",
         "url": "https://anyrouter.dev/api/v1/mcp"
       }
     }
   }
   ```

:::

::::

## Activate

1. Open Copilot Chat and switch the mode dropdown to **Agent**.
2. Click the **Tools** icon and confirm `anyrouter` shows in the list.
3. On the first invocation, VS Code opens `anyrouter.dev/oauth/consent`. Pick a permission level (Read-only is the default and safest) and click **Allow**.

## Verify

In Copilot Chat (Agent mode), ask **"how many AnyRouter credits do I have left?"**. Copilot picks the `get_credits` tool and returns the balance.

## Revoke

- **Copilot side** — remove the entry from `mcp.json` or `settings.json`.
- **AnyRouter side** — revoke the OAuth token from the [MCP dashboard](https://anyrouter.dev/dashboard/mcp). Subsequent tool calls return `401 Unauthorized` until you reconnect.

## Related

- [MCP overview](/mcp) — what the server does and which tools are exposed
- [MCP API reference](/api-reference/mcp) — full tool schemas, scope tables, manual auth
