AnyRouter MCP with Claude Code
Add the AnyRouter MCP server to Claude Code with one command or .mcp.json.
Register the AnyRouter MCP server in Claude Code with one command.
-
Add the server (add
--scope projectto write.mcp.jsonin the project instead of the user config):claude mcp add --transport http anyrouter https://anyrouter.dev/api/v1/mcp -
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. -
Check it:
claude mcp listshowsanyrouterconnected.
Or edit .mcp.json and restart Claude Code:
{
"mcpServers": {
"anyrouter": {
"type": "http",
"url": "https://anyrouter.dev/api/v1/mcp"
}
}
}anyr claude connects the gateway for you when Auto-connect in coding agents is on in the dashboard. Turn it off with --no-mcp, anyr mcp auto off, or the dashboard.
Revoke
claude mcp remove anyrouter deletes the local registration. To revoke the token server-side, use the MCP dashboard; later tool calls return 401 Unauthorized until you reconnect.
Troubleshooting
| Symptom | Fix |
|---|---|
localhost:NNNNN refused to connect after consent | The local callback listener had exited. Retry in one continuous flow. If it persists, run rm -rf ~/.mcp-auth, re-run claude mcp add, and trigger a tool call. |
anyrouter missing from claude mcp list | You likely added it with --scope project in another directory. Check .mcp.json and the user config. |
AnyRouter routes requests to third-party models. Models and outputs are provided as is, with no warranty; you use them at your own risk. Disclaimer