Skip to main content

MCP OAuth

Tokencraft hosts a remote MCP server at https://app.tokencraft.dev/api/mcp. MCP clients such as Cursor, Claude (remote MCP), and the Figma plugin authenticate via OAuth instead of pasting an API key.
For CI/CD and automation scripts, use manual API tokens instead of OAuth.

Why OAuth?

OAuth benefits:
  • No token to copy into config files
  • Scoped consent per application (read:tokens, write:tokens, export:tokens)
  • Revocable from API Settings
  • 30-day access tokens, automatically renewed on re-authorization

Discovery endpoints

MCP clients discover OAuth metadata automatically: Example authorization server metadata:
When a client calls /api/mcp without a token, the server responds with 401 and a WWW-Authenticate header pointing to the protected-resource metadata. The client then starts the OAuth flow.

Authorization flow

Steps

  1. Authorize — Client redirects the user to /api/oauth/mcp/authorize with:
    • client_id, redirect_uri, response_type=code
    • scope (space-separated scopes)
    • state (CSRF protection)
    • code_challenge + code_challenge_method=S256 (PKCE, recommended)
  2. Consent — User reviews the request on /mcp/authorize and approves or denies.
  3. Code exchange — Client posts to /api/oauth/mcp/token:
  1. Use token — Include the access token in MCP requests:

Scopes

Dynamic client registration

MCP clients can register automatically (RFC 7591):
Response includes client_id and client_secret. Public clients using PKCE can authenticate with token_endpoint_auth_method: none.

Token lifecycle

  • Authorization codes expire after 10 minutes and are single-use.
  • Access tokens expire after 30 days.
  • Tokens are stored in the api_tokens table and named MCP OAuth — {client name}.
  • OAuth tokens are 64-character hex strings (no tkc_ prefix).
  • They authenticate identically to manual API tokens via Authorization: Bearer.

Revocation

Revoke a token in either way:
  1. DashboardAPI Settings → delete the MCP OAuth — … token
  2. APIPOST /api/oauth/mcp/revoke with the token value

Connect a remote MCP client

Cursor

  1. Open Cursor Settings → MCP
  2. Add a remote server with URL: https://app.tokencraft.dev/api/mcp
  3. On first use, Cursor opens the browser for OAuth consent
  4. Approve the requested scopes — no manual token needed

Claude (remote MCP)

Add the hosted URL in your client’s remote MCP configuration. The client discovers OAuth via the well-known endpoints.

Figma plugin OAuth

The Figma plugin cannot receive browser redirects directly. It uses a polling bridge:
  1. Plugin opens /api/oauth/mcp/authorize in the system browser (client_id=figma-plugin-v1)
  2. User logs in and consents
  3. Browser redirects to /mcp/figma-callback?code=…&state=…
  4. Plugin polls GET /api/oauth/figma-plugin/poll?state=… until the code is available
  5. Plugin exchanges the code at /api/oauth/mcp/token with PKCE
See Figma Integration for the full plugin guide.

Rate limits

OAuth tokens share the same rate limits as manual API tokens: 100 requests per minute per token.

Next steps

Configuration

Hosted vs local MCP setup

Authentication

Manual API tokens for CI/CD

Tools

Available MCP tools

Figma

Figma plugin OAuth flow