This server is now configured for production-style multi-user auth:
- MCP clients authenticate via OAuth endpoints on this Worker.
- Users authorize with Spotify using their own Spotify app credentials (BYO Client ID/Secret).
- User refresh tokens and BYO client credentials are stored in encrypted OAuth props.
- MCP API:
/mcp - OAuth authorize:
/authorize - OAuth token:
/token - OAuth client registration:
/register - Spotify callback:
/callback
cd /Users/omshah/Desktop/MCP/spotify-mcp-cloudflare
npm installnpx wrangler kv namespace create OAUTH_KVCopy the returned ID into wrangler.jsonc at:
kv_namespaces[0].id
npx wrangler secret put COOKIE_ENCRYPTION_KEY
npx wrangler secret put ALLOWED_MCP_CLIENT_IDSCOOKIE_ENCRYPTION_KEY should be a long random string.
ALLOWED_MCP_CLIENT_IDS is optional (comma-separated). If set, only those MCP OAuth client IDs can authorize.
Optional fallback secrets (only if you want a default app instead of strict BYO):
npx wrangler secret put SPOTIFY_CLIENT_ID
npx wrangler secret put SPOTIFY_CLIENT_SECRETEach user should create a Spotify app in Spotify Developer Dashboard and set redirect URI to:
- Local:
http://localhost:8788/callback - Production:
https://<your-worker>.workers.dev/callback
The redirect URI in Spotify must exactly match the environment you are using.
npm run devnpm run deploy- This version removes raw refresh-token tool input.
- Tokens are tied to authenticated OAuth sessions.
- Keep
COOKIE_ENCRYPTION_KEYsecret and rotate if compromised. - Debug auth scope tool is disabled by default. Enable only temporarily with
ENABLE_DEBUG_TOOLS=true.