Skip to main content
This page is only relevant if you’re building an MCP client. End users don’t need to know any of this - their MCP client handles the OAuth flow automatically.

Overview

Mokaru’s MCP server implements OAuth 2.1 (RFC 6749, RFC 9700) with:
  • PKCE (RFC 7636, S256 only - plain is rejected)
  • Dynamic Client Registration (RFC 7591)
  • Authorization Server Metadata (RFC 8414)
  • Refresh Token Rotation with reuse detection

Discovery

Returns:
Then:
Returns:

Step 1: Register your client

Returns:
Allowed redirect URIs: https:// URIs or http://localhost / http://127.0.0.1 loopback. No http:// on public hosts.

Step 2: Authorize

Generate a PKCE pair:
Redirect the user’s browser to:
Mokaru shows the consent screen. After the user approves:
Errors: If the request is malformed or the user is not on a Plus plan, Mokaru shows an HTML error page (does not redirect, per OAuth 2.1).

Step 3: Exchange code for tokens

Returns:

Step 4: Call /mcp

Use the access token as a Bearer:

Step 5: Refresh

Returns a new access + refresh token pair. The old refresh token is invalidated immediately. Reuse detection: If you try to use a refresh token that has already been rotated, Mokaru detects this as a possible compromise and revokes every refresh token for that account. Treat your refresh tokens like passwords.

Token format

Access and refresh tokens are JWTs (HS256) with these claims:
Do not attempt to verify the signature client-side - the signing key is server-only. Treat tokens as opaque.

Error responses

OAuth errors follow RFC 6749:
Common error codes:

Reference implementations

  • MCP TypeScript SDK handles all of this automatically when given just the server URL.
  • MCP Python SDK ditto.
  • Claude Desktop, Claude.ai, Cursor, Continue: built-in MCP OAuth support.