# Connecting MCP clients

> Connect Claude Code, Cursor, VS Code or any Streamable HTTP MCP client to the Neurouter gateway with OAuth 2.1 sign-in or an API key.

Source: https://neurouter.com/docs/connecting-clients · Last updated: 2026-11-24

Every client connects to the same endpoint, `PUBLIC_URL/mcp`, over Streamable HTTP. Neurouter supports MCP specification versions **2026-07-28** and **2025-11-25**. The portal's *Connect a client* page generates these snippets with your URL filled in.

## Two ways to authenticate

| | OAuth 2.1 | API key |
|---|---|---|
| Best for | People using an interactive client | Scripts, CI and headless agents |
| How | The client discovers Neurouter's authorization server and opens a browser to sign in and approve access | Create a key for an agent in the portal and send it as `Authorization: Bearer …` |
| Revoking | From the agent's *Authorized apps* tab | Revoke the key; it stops working immediately on every replica |

API keys look like `nr_live_<10-character id>_<43-character secret>`. The fixed prefix lets secret scanners match them, for example with a GitHub custom pattern `nr_live_[0-9A-Z]{10}_[0-9A-Za-z]{43}`. Only an HMAC of the secret is stored.

## Client guides

- [Claude Code](https://neurouter.com/integrations/claude-code)
- [Cursor](https://neurouter.com/integrations/cursor)
- [VS Code](https://neurouter.com/integrations/vscode)

## Any other MCP client

Any client that supports remote MCP servers over Streamable HTTP can connect:

```text
URL:        https://mcp.example.com/mcp
Transport:  Streamable HTTP (POST)
Protocol:   MCP-Protocol-Version: 2026-07-28 | 2025-11-25
Auth:       OAuth 2.1 (discover via 401 WWW-Authenticate →
            /.well-known/oauth-protected-resource)
            or Authorization: Bearer <YOUR_API_KEY>
```

An unauthenticated request gets a `401` with a `WWW-Authenticate` header pointing at the protected resource metadata (RFC 9728). From there a client finds the authorization server metadata (RFC 8414) at `/.well-known/oauth-authorization-server`. Neurouter supports client ID metadata documents, dynamic client registration for compatibility (an admin can turn it off), PKCE with S256, audience-bound tokens (RFC 8707) and rotating refresh tokens.

## What clients see

Clients get two meta-tools, `search_tools` and `call_tool`. `search_tools` runs a hybrid keyword and vector search over the tools the caller may use (access control is applied before ranking) and returns their schemas; `call_tool` calls one by name. Tool names are prefixed with the server's slug, as `<server>__<tool>`, so tools from different servers never collide.

## Long-running calls

Calls to a tool that requires [human approval](https://neurouter.com/docs/approvals) are held open until someone decides. Clients that time out sooner should send a `progressToken`; Neurouter sends a progress notification every 10 seconds while the call is held.

## Browser-based clients

`/mcp` checks the `Origin` header against `PUBLIC_URL`. Add other allowed origins with `MCP_ALLOWED_ORIGINS`.
