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.

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

    claude 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.

  3. Check it: claude mcp list shows anyrouter connected.

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

SymptomFix
localhost:NNNNN refused to connect after consentThe 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 listYou 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