MCP OAuth
Tokencraft hosts a remote MCP server athttps://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?
| Use case | Auth |
|---|---|
| Cursor, Claude remote MCP, Figma plugin | OAuth (this page) |
| CI/CD, GitHub Actions, scripts | API key (tkc_…) — Authentication |
- 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:| Endpoint | Purpose |
|---|---|
GET /.well-known/oauth-authorization-server | Authorization server metadata (RFC 8414) |
GET /.well-known/oauth-protected-resource | Protected resource metadata for /api/mcp |
/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
-
Authorize — Client redirects the user to
/api/oauth/mcp/authorizewith:client_id,redirect_uri,response_type=codescope(space-separated scopes)state(CSRF protection)code_challenge+code_challenge_method=S256(PKCE, recommended)
-
Consent — User reviews the request on
/mcp/authorizeand approves or denies. -
Code exchange — Client posts to
/api/oauth/mcp/token:
- Use token — Include the access token in MCP requests:
Scopes
| Scope | Access |
|---|---|
read:tokens | List and read workspaces, tokensets, modes, tokens |
write:tokens | Create, update, delete resources (subject to workspace permissions) |
export:tokens | Export tokensets and modes (JSON, CSS, iOS, Android) |
Dynamic client registration
MCP clients can register automatically (RFC 7591):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_tokenstable and namedMCP 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:- Dashboard — API Settings → delete the
MCP OAuth — …token - API —
POST /api/oauth/mcp/revokewith the token value
Connect a remote MCP client
Cursor
- Open Cursor Settings → MCP
- Add a remote server with URL:
https://app.tokencraft.dev/api/mcp - On first use, Cursor opens the browser for OAuth consent
- 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:- Plugin opens
/api/oauth/mcp/authorizein the system browser (client_id=figma-plugin-v1) - User logs in and consents
- Browser redirects to
/mcp/figma-callback?code=…&state=… - Plugin polls
GET /api/oauth/figma-plugin/poll?state=…until the code is available - Plugin exchanges the code at
/api/oauth/mcp/tokenwith PKCE
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