Skip to main content
The NeuroFusion Quest MCP Server implements the MCP 2026-07-28 Authorization Specification on top of NeuroFusion’s existing passwordless Nostr authentication. MCP clients obtain short-lived, audience-bound OAuth 2.1 access tokens without ever handling your Nostr private key or web session token.

Discovery Endpoints

Unauthenticated requests to POST /mcp return 401 Unauthorized with a WWW-Authenticate challenge pointing to the Protected Resource Metadata document:
Clients use the following discovery endpoints to configure OAuth automatically:

Protected Resource Metadata

Per MCP 2026-07-28, offline_access is intentionally omitted from Protected Resource Metadata and WWW-Authenticate headers, and is advertised only in Authorization Server Metadata.

Authorization Server Metadata

Client Registration

Two registration mechanisms are supported:
  1. OAuth Client ID Metadata Documents (CIMD — Primary):
    • Use an https:// URL with a non-root path as your client_id (for example, https://client.example.com/oauth/client-metadata.json).
    • The metadata document’s client_id must match the URL string-for-string and provide a non-empty client_name and redirect_uris (https:// or loopback http://localhost / http://127.0.0.1 / http://[::1]).
    • Symmetric client_secret_* auth methods are rejected for CIMD clients, and metadata fetches enforce SSRF protection (blocking loopback, private, and link-local IPs).
  2. Dynamic Client Registration (POST /oauth/register — RFC 7591):
    • Supported for backwards compatibility with clients that do not yet implement CIMD.
    • Supports application_type (web or native) and enforces HTTPS or loopback redirect URIs with no fragments or wildcards.
1

Start OAuth Authorization with PKCE S256

The client opens the browser to GET /oauth/authorize with response_type=code, client_id, redirect_uri, code_challenge, code_challenge_method=S256, resource=https://neurofusionbackendprd.azurewebsites.net/mcp, scope, and state.
2

Sign In with NeuroFusion Nostr Auth

If you are not signed in to NeuroFusion, the web app redirects you to https://usefusion.ai/auth/login to complete the standard Nostr NIP-04 / NIP-07 login flow, then returns you to https://usefusion.ai/oauth/authorize.
3

Review & Approve Scopes

The https://usefusion.ai/oauth/authorize consent screen displays the client name, client URI, registration method, redirect URI hostname (with an explicit warning banner for localhost/127.0.0.1 redirects), and interactive checkboxes so you can approve or narrow the requested scopes.
4

Exchange Code for Access Token

NeuroFusion redirects back to redirect_uri with code, state, and iss (RFC 9207 mix-up protection). The client exchanges the one-time code and code_verifier at POST /oauth/token with resource=https://neurofusionbackendprd.azurewebsites.net/mcp.
For native loopback clients (http://127.0.0.1:<port>/callback or http://localhost:<port>/callback), ephemeral port matching is supported per RFC 8252 Section 7.3 as long as the scheme, hostname, path, and query match a registered loopback redirect URI.

OAuth Scopes & Hierarchy

Each *:write scope automatically implies its corresponding *:read scope:

Step-Up Authorization (403 insufficient_scope)

If a client calls a tool or reads a resource that requires a scope not present in its current token, /mcp responds with 403 Forbidden and a standard RFC 6750 step-up challenge:
Clients can re-run authorization requesting the additional scope without disrupting other sessions.

Token Lifecycle, Rotation & Isolation

Transport & Header Security

Requests to POST /mcp enforce additional MCP 2026-07-28 safeguards:
  • Origin Validation (DNS Rebinding Protection): When an Origin header is present, it must match an allowed origin (configured FRONTEND_URL, server origin, https://usefusion.ai, or MCP_ALLOWED_ORIGINS; loopback origins are allowed in non-production). Untrusted origins receive 403 Forbidden.
  • Header-vs-Body Consistency: If MCP-Protocol-Version, Mcp-Method, or Mcp-Name headers are sent, they must match the JSON-RPC payload (params._meta["io.modelcontextprotocol/protocolVersion"], method, and params.name / params.uri); mismatches return 400 Bad Request.

Self-Hosting / Local Development Configuration

When running NeuroFusion locally or self-hosting, these optional server environment variables control the OAuth & MCP endpoints: