Skip to content

Auth0 MCP Demo #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Apr 4, 2025
Merged

Conversation

sandrinodimattia
Copy link
Contributor

This demo illustrates how you can create a remote MCP Server with Cloudflare which supports authentication with Auth0.

An MCP Server will typically need to call an API on the user's behalf (eg: get a user's files, todos, ...) which is what we're showing in this demo. The MCP Server itself contains no logic, it simply proxies the request to a Protected API.

@threepointone threepointone self-assigned this Apr 4, 2025
@jmorrell-cloudflare jmorrell-cloudflare self-assigned this Apr 4, 2025
@threepointone threepointone removed their assignment Apr 4, 2025
@jmorrell-cloudflare
Copy link
Collaborator

@sandrinodimattia I am going to land this for dev week, though I have some concerns cc @andyjessop

  • This is a monorepo layout, but the cloudflare/ai repo is already a monorepo, so this does not mesh well. This should either be split into two subdirectories under demos or combined into one worker that contains both the API and the MCP endpoints. I suspect the latter has the benefit of being simpler for anyone trying to understand how this works.
  • Following the instructions for the TODO api I was not able to get it to work. I ended up with the error:
[wrangler:inf] GET /api/me 500 Internal Server Error (4ms)
✘ [ERROR] Error: internal error; reference = 74vtuiuculr7e6v8fnltdgpb

      at async fetchJwks
  (file:///Users/jmorrell/workspace/ai/demos/remote-mcp-auth0/node_modules/.pnpm/[email protected]/node_modules/jose/dist/webapi/jwks/remote.js:17:22)
      at async RemoteJWKSet.reload
  (file:///Users/jmorrell/workspace/ai/demos/remote-mcp-auth0/node_modules/.pnpm/[email protected]/node_modules/jose/dist/webapi/jwks/remote.js:143:9)
      at async RemoteJWKSet.getKey
  (file:///Users/jmorrell/workspace/ai/demos/remote-mcp-auth0/node_modules/.pnpm/[email protected]/node_modules/jose/dist/webapi/jwks/remote.js:110:13)
      at async flattenedVerify
  (file:///Users/jmorrell/workspace/ai/demos/remote-mcp-auth0/node_modules/.pnpm/[email protected]/node_modules/jose/dist/webapi/jws/flattened/verify.js:73:15)
      at async compactVerify
  (file:///Users/jmorrell/workspace/ai/demos/remote-mcp-auth0/node_modules/.pnpm/[email protected]/node_modules/jose/dist/webapi/jws/compact/verify.js:15:22)
      at async jwtVerify
  (file:///Users/jmorrell/workspace/ai/demos/remote-mcp-auth0/node_modules/.pnpm/[email protected]/node_modules/jose/dist/webapi/jwt/verify.js:5:22)
      at async jwt
  (file:///Users/jmorrell/workspace/ai/demos/remote-mcp-auth0/packages/todos-api/src/middlewares/jwt.ts:95:21)
      at async dispatch
  (file:///Users/jmorrell/workspace/ai/demos/remote-mcp-auth0/node_modules/.pnpm/[email protected]/node_modules/hono/dist/compose.js:22:17)
      at null.<anonymous> (async
  file:///Users/jmorrell/workspace/ai/demos/remote-mcp-auth0/packages/todos-api/.wrangler/tmp/dev-LpEL9V/index.js:925:25)
      at async jsonError
  (file:///Users/jmorrell/workspace/ai/demos/remote-mcp-auth0/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts:22:10)

@jmorrell-cloudflare jmorrell-cloudflare merged commit ae2dd2b into cloudflare:main Apr 4, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants