Skip to main content

Authentication

Qoris MCP supports two authentication methods for connecting to your workspace:

API Key

Simple authentication using a project API key. Best for direct integration and scripting.

OAuth 2.0

User-delegated access via OAuth with consent. Best for MCP clients like Cursor and Claude Code.

API Key

API keys provide direct, project-scoped access. Each key is tied to a user and project. Generate keys from your project’s MCP tab in the Qoris dashboard.

Method 1: Query Parameter

Pass the API key as a query parameter in the MCP URL:
This is your personal MCP URL — each user has a different URL based on their API key. Convenient for quick setup and MCP clients that support URL-based auth. Pass the API key in the Authorization header:
More secure than query parameters (keys don’t appear in URLs or logs). Use this for production.

API Key Format

  • Prefix: qoris_ (keys starting with this are validated as API keys)
  • Length: 38 characters total (qoris_ + 32 random chars)
  • Storage: Keys are hashed; the raw key is only shown once at creation
API keys provide full access to your project. Keep them secure and never commit them to version control.

OAuth 2.0

OAuth 2.0 enables MCP clients (Cursor, Claude Code, etc.) to request access on behalf of users. Users sign in and approve access via a consent page. This flow supports apps that cannot securely store API keys.

Flow Overview

  1. Discovery — Client fetches OAuth metadata from well-known endpoints
  2. Client Registration — Client registers dynamically (DCR) or uses pre-registered client
  3. Authorization — User is redirected to consent page, signs in if needed, selects workspace, approves
  4. Token Exchange — Client exchanges authorization code (+ PKCE verifier) for access token
  5. MCP Access — Client uses access token as Bearer token for MCP requests

Discovery Endpoints

OAuth Authorization Server (RFC 8414):
Returns: issuer, authorization_endpoint, token_endpoint, registration_endpoint, scopes_supported, code_challenge_methods_supported, etc. OAuth Protected Resource (RFC 9728):
Returns: resource, authorization_servers, scopes_supported, bearer_methods_supported.

Endpoints

Dynamic Client Registration (DCR)

Clients register themselves with client_name and redirect_uris:
Response includes client_id. DCR deduplication: if a client with the same client_name and redirect_uris already exists, the existing client is returned (200) instead of creating a duplicate.

Authorization Code Flow with PKCE

  1. Generate code_verifier (random) and code_challenge (S256 hash)
  2. Redirect user to:
  3. User lands on consent page (https://app.qoris.ai/oauth/consent?client_id=...&...)
  4. User signs in (Clerk), selects project/workspace, approves
  5. Frontend calls /oauth/authorize/approve with code_challenge, project_id, etc.
  6. Backend returns redirect_uri with ?code=...&state=...
  7. Client exchanges code:

Access Tokens

  • Format: Opaque Bearer token (not JWT)
  • Expiration: Access tokens do not expire. They remain valid until explicitly revoked.
  • Revocation: User can revoke via Connected Apps in the Qoris dashboard, or via DELETE /oauth/connections/<token_id>
  • Refresh tokens: Issued with access tokens; 30-day expiration. Used to obtain new access token when rotating.
Access tokens have no expiration. Revoke them from Connected Apps when you want to disconnect an app.
The consent page (https://app.qoris.ai/oauth/consent) shows:
  • App name (from client_name)
  • Requested scopes (save_memories, get_memories, update_memories, delete_memories, search_knowledge)
  • Project/workspace selector
  • Approve / Deny buttons
Users must be signed in via Clerk. After sign-in/sign-up, they are redirected back to consent with redirect_url preserved in session storage.

Connected Apps UI

Users manage OAuth connections from Workspace settings → MCP tab → Connected Apps. Each connection shows: app name, workspace, scopes, “Connected” date. Users can revoke access at any time. There is no expiration display — connections stay active until revoked.

MCP Scopes

All scopes are granted by default when user approves. Clients may request a subset via the scope parameter.

Token Validation

  • Redis cache: Valid tokens are cached for 60 seconds to reduce DB load
  • Cache invalidation: On revoke, the token is removed from cache immediately
  • Bearer methods: Only header is supported (Authorization: Bearer <token>)

Choosing an Auth Method

Authentication and Knox

Authentication controls who can connect to Qoris MCP. Knox controls what an agent can safely do after it has access. Use Knox in addition to authentication when connected agents can:
  • run commands
  • write files
  • call MCP tools with untrusted input
  • create scheduled tasks
  • invoke subagents
  • perform actions that need audit or approval
For developer-agent workflows, start with the Knox Claude Code Plugin. For the broader governance model, see the Knox Overview.

Next Steps