@phake/mcp server acts as an OAuth 2.1 authorization server. When a client authenticates, your server proxies the flow to an upstream provider (e.g., Google), maps the resulting provider token to an internal RS token, and returns that token to the client.
Your server must be publicly accessible for OAuth to work. Clients connect from their own infrastructure, and the provider’s callback must be able to reach your
/oauth/callback endpoint.Create an OAuth app with your provider
Register an OAuth application with your identity provider (e.g., Google Cloud Console, GitHub, etc.) and collect:Replace
- Client ID — the public identifier for your app
- Client Secret — the private credential for your app
your-server.com with your deployed server’s domain.Set the required environment variables
Configure the following environment variables in your deployment. For Cloudflare Workers, use
For Cloudflare Workers, set secrets via the CLI:For local development, add all variables to
wrangler secret put for secrets and wrangler.toml / wrangler.jsonc for non-sensitive values.| Variable | Description |
|---|---|
OAUTH_CLIENT_ID | The client ID issued to your MCP server (for clients connecting to your server) |
OAUTH_CLIENT_SECRET | The client secret for your MCP server |
OAUTH_SCOPES | Space-separated list of OAuth scopes your server requests |
OAUTH_REDIRECT_URI | The redirect URI registered with your provider (e.g., https://your-server.com/oauth/callback) |
PROVIDER_CLIENT_ID | The client ID from your upstream provider (e.g., Google) |
PROVIDER_CLIENT_SECRET | The client secret from your upstream provider |
PROVIDER_ACCOUNTS_URL | The provider’s account/userinfo endpoint URL |
.dev.vars:.dev.vars
Deploy your server publicly
Deploy your server so it is reachable from the internet. For Cloudflare Workers:Your server’s base URL will be something like
https://your-worker.your-subdomain.workers.dev.Connect your MCP client
Point your MCP client at the The client will redirect to
/authorize endpoint to begin the OAuth flow. For example, when configuring a Claude Web custom connector:/authorize, your server will proxy the request to the upstream provider, and after the user grants access the client receives an RS token it can use for subsequent MCP requests.OAuth endpoints
Your server exposes the following OAuth 2.1 endpoints automatically:| Path | Description |
|---|---|
/.well-known/oauth-authorization-server | OAuth discovery metadata |
/.well-known/oauth-protected-resource | Protected resource metadata |
/authorize | Authorization request — start the OAuth flow here |
/token | Token exchange |
/oauth/callback | OAuth callback (redirect URI for your provider) |
/oauth/provider-callback | Provider-specific callback handler |
/revoke | Token revocation |
/register | Dynamic client registration |