# Claude Code

> Connect Claude Code to the Neurouter MCP gateway with OAuth sign-in or an API key, so every tool call is governed, approved when needed and audited.

Source: https://neurouter.com/integrations/claude-code · Last updated: 2026-11-24

Claude Code connects to Neurouter as a remote MCP server over HTTP. You add one server, `neurouter`, and reach every tool you've been granted through it.

## Sign in with OAuth (interactive use)

```bash
claude mcp add --transport http neurouter https://mcp.example.com/mcp
```

Then run `/mcp` in Claude Code and choose **Authenticate**. Your browser opens Neurouter's sign-in and consent page. You can revoke the access later from the agent's *Authorized apps* tab in the portal.

## Use an API key (headless or CI)

Create an agent and an API key in the portal (*Portal → My agents*), put the key in an environment variable, and add the server with a header:

```bash
export NEUROUTER_API_KEY=nr_live_...
claude mcp add --transport http neurouter https://mcp.example.com/mcp \
  --header "Authorization: Bearer ${NEUROUTER_API_KEY}"
```

Don't commit the key. Keys have a fixed `nr_live_` prefix so secret scanners can detect leaks, and a revoked key stops working at once.

## What Claude Code sees

Neurouter exposes two meta-tools, `search_tools` and `call_tool`. Claude searches for the tools it needs (only tools you're allowed to use are returned) and calls them by name, for example `github__create_pull_request`.

If a tool requires [human approval](https://neurouter.com/docs/approvals), the call waits until an approver decides. Neurouter sends progress notifications every 10 seconds while it waits.

## Troubleshooting

- **401 on connect:** with OAuth, run `/mcp` and authenticate again; with an API key, check the header and that the key isn't revoked or expired.
- **A tool is "unknown":** you don't have a grant for it. Neurouter doesn't distinguish "forbidden" from "doesn't exist". Request access from the portal catalog.
- **Origin errors:** only browser-based clients send `Origin`; Claude Code doesn't need `MCP_ALLOWED_ORIGINS`.

The snippet format was checked against the [Claude Code MCP documentation](https://code.claude.com/docs/en/mcp). The portal's *Connect a client* page generates it with your URL filled in.
