MCP Auth not working

I followed this guide to build a MCP with auth https://developers.cloudflare.com/agents/guides/remote-mcp-server/

However the example project doesn't work, it keep giving me error after I approve:

⎔ Starting local server...
[wrangler:inf] Ready on http://localhost:8788
[ERROR] OAuth error response: 401 invalid_token - Missing or invalid access token


[wrangler:inf] POST /sse 401 Unauthorized (6ms)
[wrangler:inf] GET /.well-known/oauth-authorization-server 200 OK (1ms)
[wrangler:inf] GET /authorize 302 Found (68ms)
[wrangler:inf] GET /callback 302 Found (871ms)
[wrangler:inf] GET /.well-known/oauth-authorization-server 200 OK (2ms)
[ERROR] OAuth error response: 401 invalid_client - Client not found


[wrangler:inf] POST /token 401 Unauthorized (3ms)
Cloudflare Docs
This guide will show you how to deploy your own remote MCP server on Cloudflare, with two options:
Was this page helpful?