Passwordless OAuth 2.1 (6-Digit OTP) for Remote MCP Servers
Asking non-technical users to copy a 140-character LIC-... bearer token into claude_desktop_config.json kills conversion. Here is how to let users connect a remote MCP server with one URL and a 6-digit email code.
Why OAuth 2.1 + KeyFlint?
Modern MCP clients (Claude Desktop, Claude.ai Connectors, Cursor) support remote Streamable HTTP MCP servers protected by OAuth 2.1 with PKCE (RFC 8414 + RFC 9728). Instead of building a full user-password identity provider, your MCP edge router can map verified email addresses directly to KeyFlint Ed25519 licenses.
| Step | Protocol Endpoint | What happens |
|---|---|---|
| 1. Challenge | POST /<slug>/mcp → 401 | Returns WWW-Authenticate: Bearer resource_metadata=".../.well-known/oauth-protected-resource". |
| 2. Discovery & DCR | /.well-known/oauth-authorization-server, /oauth/register | MCP client registers dynamically and starts PKCE authorization (S256). |
| 3. 6-Digit Email OTP | GET /authorize | User enters their email and a 6-digit code sent via Resend. |
| 4. License Resolution | GET /api/v1/licenses/by-customer | Gateway returns the active licenses for that email. If there are none, the hub issues a 25-credit Community trial via POST /api/v1/licenses/issue. |
| 5. Token Exchange | Token endpoint | Issues a short-lived OAuth access token bound to that LIC-... license. Every subsequent tool call is metered atomically against it. |
Querying Active Licenses by Email
KeyFlint v1.2+ includes an admin-protected endpoint that resolves all active, non-expired, non-revoked licenses for a verified email address, sorted with paid tiers first and highest credit balance first:
GET https://licenses.your-domain.com/api/v1/licenses/by-customer?email=user%40company.com
X-Admin-Key: <YOUR_ADMIN_API_KEY>
Response:
{
"success": true,
"data": [
{
"key": "LIC-PRO-eyJ...",
"tier": "pro",
"status": "active",
"name": "Licencia PRO (3 puestos)",
"credits": 980,
"max_seats": 3,
"expires_at": "2027-11-09T00:00:00+00:00"
}
]
}
Zero-Click Trial Fallback
If /api/v1/licenses/by-customer returns an empty list, your OAuth authorize handler can either:
- Offer a 1-click 25 free credits button that calls
POST /api/v1/licenses/issuewithtier: "community"and immediately completes the OAuth redirect. - If the user has a single active paid license, skip the selection screen and redirect back to Claude immediately after the 6-digit OTP verification.
See It Live in Production
This exact architecture powers Flint by KeyFlint across 5 remote MCP servers, including our unified 17-tool accounting connector at https://mcp.keyflint.dev/despacho/mcp.