# AnyRouter MCP with Command Code

> Add the AnyRouter MCP server to Command Code with one command or .mcp.json.


# Connect AnyRouter to Command Code

Register the AnyRouter MCP server in [Command Code](https://commandcode.ai) with one command.

1. Add the server (add `--scope project` to write `.mcp.json` in the project instead of the local config):

   ```bash
   cmd mcp add --transport http anyrouter https://anyrouter.dev/api/v1/mcp
   ```

2. Approve the OAuth consent. The next tool call opens `anyrouter.dev/oauth/consent`. Pick a permission level (Read-only is the default) and click **Allow**. See [scopes and consent bundles](/api-reference/mcp#scopes-and-consent-bundles).
3. Check it: `cmd mcp list` shows `anyrouter` connected.

Or edit `.mcp.json` and restart Command Code:

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

## Revoke

`cmd mcp remove anyrouter` deletes the local registration. To revoke the token server-side, use the [MCP dashboard](https://anyrouter.dev/dashboard/mcp); later tool calls return `401 Unauthorized` until you reconnect.

## Troubleshooting

| Symptom | Fix |
|---|---|
| `anyrouter` missing from `cmd mcp list` | You likely added it with a different scope. Check `.mcp.json`, `~/.commandcode/mcp.json`, and `~/.commandcode/projects/<slug>/mcp.json`. |
| OAuth browser flow does not open | Run `cmd mcp auth anyrouter`, or open `/mcp` inside a Command Code session and authenticate there. |


## Related

- [AnyRouter MCP with Claude Code](/docs/mcp/claude-code.md)
- [AnyRouter MCP with OpenCode](/docs/mcp/opencode.md)
- [AnyRouter MCP with other clients](/docs/mcp/other-clients.md)
