Docs MCP gateway
DocsCore conceptsMCP gateway

Stateless MCP gateway

How Norilu authenticates every MCP request on its own, in both directions, with no session to pin, restore or leak between customers.

View Markdown
On this page

Norilu speaks MCP Streamable HTTP in two directions, and neither keeps an MCP session:

  • Your MCP client calls Norilu. Claude Code, Codex, Cursor or any Streamable HTTP client connects to https://app.norilu.com/mcp with a Norilu OAuth access token.
  • Norilu calls your MCP server. An agent serving one of your customers calls a tool on your shared MCP server. Norilu signs that request with a short-lived JWT naming the verified customer and user.

In both directions, each HTTP request carries its own credential and is verified on its own. No request relies on an earlier one, so any Worker instance can serve it and a restart loses nothing.

Your client calls Norilu

Each POST to /mcp goes through the same steps before any tool runs:

  1. Verify the access token. The bearer must be a signed Norilu access token whose issuer is Norilu and whose audience is exactly https://app.norilu.com/mcp. It must not be expired and must include norilu:read. If the token is bound to a DPoP key, the request’s DPoP proof is checked too.
  2. Check the authorization is still live. The token’s user, sign-in session, OAuth client and consent grant must all still exist. Revoking the application’s access in Norilu invalidates its tokens, even ones that haven’t expired.
  3. Resolve the workspace. Without a header, requests use your personal workspace. X-Norilu-Workspace: ws_... selects a shared workspace, and your current membership and role are checked on that request.
  4. Run one JSON-RPC message. Norilu creates a fresh MCP server for the request, with no session ID, and closes it after replying. Write tools also need norilu:write and a workspace role that allows the change.

Calls into the agent engine carry only identity headers that Norilu builds from the verified workspace. Your client’s Authorization header and cookies are never forwarded.

Access tokens last five minutes. Request offline_access so your client can refresh them without asking you to sign in again.

OAuth discovery

A request without a valid token gets 401 with a WWW-Authenticate challenge that points to the protected-resource metadata. MCP clients that implement MCP authorization follow it automatically:

EndpointPurpose
/.well-known/oauth-protected-resourceResource metadata for /mcp, also at /.well-known/oauth-protected-resource/mcp
/.well-known/oauth-authorization-serverAuthorization server metadata, also at /.well-known/oauth-authorization-server/api/auth
/api/auth/oauth2/registerDynamic client registration, no pre-registered secret required
/api/auth/oauth2/authorizeBrowser sign-in and consent
/api/auth/oauth2/tokenAuthorization code and refresh token exchange
ScopeGrants
norilu:readRead tools. A client that doesn’t request scopes receives this
norilu:writeTools that create or change workspace state, within your role
offline_accessA refresh token

You can inspect the challenge yourself:

curl -i https://app.norilu.com/mcp \
  -H 'content-type: application/json' \
  -H 'accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"curl","version":"1"}}}'

curl https://app.norilu.com/.well-known/oauth-protected-resource

Errors

Norilu rejects a request it can’t verify. There is no anonymous or cached fallback.

StatusWhen
400X-Norilu-Workspace isn’t a valid workspace ID
401Missing, malformed, expired or wrong-audience token, a failed DPoP proof, or an authorization that was revoked
403The token lacks norilu:write for a write tool, or you no longer have access to the selected workspace
405An authenticated request uses a method Streamable HTTP doesn’t define, such as PUT or PATCH
413The request body is larger than 4 MiB
429Returned as a tool error with code rate_limited when the engine throttles the call. Wait before retrying the same call

A 403 for missing scope carries a WWW-Authenticate challenge naming the scope to request. Role checks inside a tool, such as approving actions without the approve capability, return a tool error with a code and a suggested fix rather than an HTTP error.

Configure your client

These configurations start read-only. Every client signs in through your browser. Never paste a token into a config file.

Claude Code

claude mcp add-json --scope user norilu '{"type":"http","url":"https://app.norilu.com/mcp","oauth":{"scopes":"norilu:read"}}'

In Claude Code, run /mcp, select norilu and choose Authenticate.

Cursor

Add the server to ~/.cursor/mcp.json, or to .cursor/mcp.json in a project:

{
  "mcpServers": {
    "norilu": {
      "url": "https://app.norilu.com/mcp"
    }
  }
}

Open Cursor’s MCP settings and sign in to norilu when prompted. A client registration that doesn’t request scopes receives norilu:read, so tools that change state stay unavailable until the client is authorized with norilu:write.

Any Streamable HTTP client

Point the client at https://app.norilu.com/mcp with HTTP (Streamable HTTP) transport. It needs to support MCP authorization: protected-resource discovery, dynamic client registration and authorization code with PKCE. Send JSON-RPC as POST with Accept: application/json, text/event-stream. Norilu never issues an Mcp-Session-Id, so don’t wait for one.

{
  "mcpServers": {
    "norilu": {
      "type": "http",
      "url": "https://app.norilu.com/mcp",
      "headers": { "X-Norilu-Workspace": "ws_your_workspace_id" }
    }
  }
}

Leave out headers to use your personal workspace. For Codex, the setup prompt, write access and the onboarding skill, see Connect a coding agent.

Norilu calls your MCP server

If your product exposes its own MCP server, you can register it once and let agents in every Customer Space use it. Choose Norilu identity as the server’s authentication. For each POST, Norilu signs a fresh Ed25519 JWT that expires after 60 seconds. It names your payer workspace, the customer’s space, the end user as sub, and the executing agent_id, turn_id and call_id.

Those claims come from stored records: the thread, its Customer Space, the payer binding and the saved agent. They never come from the model’s tool arguments. A thread created with your server key needs a user before it can call your server this way. A request with no verified end user or signed-in operator fails before Norilu sends anything.

Your server must also be stateless. Norilu never sends Mcp-Session-Id, doesn’t open the background GET event stream, won’t follow redirects, and stops if your server returns a session ID. A streamed response to an individual POST is still supported.

Error from NoriluMeaning
mcp_context_requiredThe customer, user, agent or turn couldn’t be verified. Nothing was sent
mcp_stateless_requiredYour server asked for an MCP session or a non-POST request before a tool ran
mcp_signing_unavailableSigning keys aren’t provisioned in this environment. There is no unsigned fallback
mcp_unavailableA session appeared after the tool call was sent. Check your server for the outcome

Verify every request on your server and return a fixed 401 when verification fails. Pin the issuer, audience, algorithm and an allowlist of payer workspace IDs. Then scope data access to the verified workspace, space and sub together. The shared MCP server reference has the claim contract, key rotation and a jose verifier you can copy. The public keys are at https://app.norilu.com/.well-known/norilu-mcp-jwks.json.

Write tools still pause for approval. Norilu signs the request only after it has verified the decision for that exact call. Use call_id to deduplicate writes, since a JWT can be replayed within its 60-second lifetime. Signed tokens never appear in model input, streams, stored traces or connection records, and Norilu redacts them if your server echoes one back.

Still have a question? Talk to usRead as Markdown

Search documentation

Find a guide, endpoint or concept.

↑ ↓ to navigate · ↵ to openSearch stays in your browser