Reference

Endpoint and behavior reference

Protected resources

EndpointStatusPurpose
/mcp/oauthMounted by defaultCanonical OAuth-protected MCP JSON-RPC endpoint
/mcp/bearer-tokenMounted by defaultStatic bearer-token MCP JSON-RPC endpoint
/mcp/oauth-v2-client-credsSource-defined, not mounted by app.pyDedicated client-credentials MCP resource from mcp/oauth_v2_2l.py
/mcp/device-flowSource-defined, not mounted by app.pyDedicated device-grant MCP resource from mcp/device_flow.py
/mcp/oauth-v21Source-defined, not mounted by app.pyDedicated OAuth 2.1 MCP resource from mcp/oauth_v21.py

OAuth authorization server endpoints

EndpointPurpose
/.well-known/oauth-protected-resourceProtected resource metadata
/.well-known/oauth-authorization-serverAuthorization server metadata
/oauth/authorizeAuthorization endpoint for auth-code + PKCE
/oauth/authorize/consentConsent form handler for the shared auth-code flow
/oauth/tokenToken endpoint for auth-code, refresh, client-credentials, and device grants
/oauth/device/authorizeDevice authorization endpoint
/oauth/device/verifyMock verification UI
/oauth/device/verify/consentVerification form handler
/oauth/registerDynamic client registration
/debug/authorizationsRedacted issued authorization-code state
/debug/approvalsRecorded approval decisions and consent modes
/debug/tokensRedacted issued access-token state
/debug/clientsSeeded and dynamically registered client metadata
/debug/auditStructured audit trail across OAuth and MCP activity

Shared OAuth behavior

  • PKCE S256 only
  • implicit grant rejected
  • resource required for auth-code exchanges
  • issuer propagated on authorization redirects
  • issuer and audience preserved on issued and refreshed tokens
  • /mcp/oauth validates both token audience and issuer before serving MCP requests

Policy and scope

The shared tool catalog is declared in mcp/tools.py. Scope metadata exists in the tool definitions even though the default mounted handlers do not currently pass token scopes into BaseMCPHandler, so argument policies are active today while per-tool scope denials are not fully wired on the mounted routes.

Declared tool scopes

Tool or methodDeclared scope
tools/listmcp:tools:list
echomcp:tools:echo
pingmcp:tools:echo
whoamimcp:tools:read
read_notemcp:tools:read
write_notemcp:tools:write
dangerous_deletemcp:tools:admin

Argument and environment policies

ToolPolicy
write_noteRequires content, caps it at 1000 characters, and blocks patterns such as rm -rf, DROP TABLE, and <script>
dangerous_deleteRequires confirm=true and the MCP_ALLOW_DANGEROUS environment variable

dangerous_delete is the current environment-gated tool in the catalog.

CIMD fixture clients

The in-memory token store seeds three well-known dev-* clients so you can run repeatable flows without dynamic registration.

Client IDProfileAuth methodGrantsNotes
dev-public-clientpublicnoneauthorization_codeLocalhost and dev redirect URIs for auth-code testing
dev-confidential-clientconfidentialclient_secret_postauthorization_code, client_credentialsShared dev secret: dev-confidential-secret
dev-admin-clientadminclient_secret_postclient_credentialsIncludes admin scope and uses dev-admin-secret

These coexist with RFC 7591 dynamic registration at /oauth/register; the repo supports both the CIMD-style fixed-client model and the DCR test-harness model. On the mounted shared /oauth/authorize path, auth-code requests still expect a public client, so dev-public-client is the matching seeded fixture there.

Debug endpoints

EndpointWhat it exposes
/debug/authorizationsIssued authorization codes as redacted hashes with client, scope, resource, and expiry metadata
/debug/approvalsApproval decisions with mode, timestamp, and admin confirmation state
/debug/tokensIssued access tokens as redacted hashes with grant, audience, issuer, scope, and expiry metadata
/debug/clientsRegistered client metadata with secrets reduced to summary fields
/debug/auditStructured audit events for registration, approval, authorization-code issuance, token issuance, and MCP requests

Standalone CLI behavior

  • Resource-centric login rather than server-centric login
  • Profile persistence for later reuse
  • Automatic refresh for refreshable auth-code and device profiles
  • Automatic token reacquisition for client-credentials profiles
  • No automatic refresh for manual bearer profiles

Typical discovery chain

  1. Call the protected resource.
  2. Fetch /.well-known/oauth-protected-resource.
  3. Follow the advertised authorization_servers.
  4. Fetch /.well-known/oauth-authorization-server.
  5. Start the appropriate login flow.

What this project does not try to cover

  • Implicit grant
  • Resource Owner Password Credentials
  • Token exchange
  • No built-in token introspection or revocation
  • PAR, JAR, JARM
  • DPoP
  • mTLS sender-constrained tokens
  • OIDC userinfo or ID tokens

Built with SvelteKit + mdsvex. Deployable as a static site on GitHub Pages.