payload icon indicating copy to clipboard operation
payload copied to clipboard

MCP plugin on Cloudflare workers is not working

Open promentol opened this issue 4 months ago • 1 comments

Describe the Bug

MCP plugin is not working on Cloudflare workers

After debugging locally the issue is following

[wrangler:info] POST /api/mcp 500 Internal Server Error (359ms)
✘ [ERROR] Uncaught Error: The Workers runtime canceled this request because it detected that your Worker's code had hung and would never generate a response. Refer to: https://developers.cloudflare.com/workers/observability/errors/ 

Theoretically, there is some action or unresolved promise, which needs to be wrapped inside ctx.waitUntil or just awaited

Link to the code that reproduces this issue

https://github.com/promentol/payload-mcp-cloudflare-demo

Reproduction Steps

Start Cloudflare worker template Integrate MCP servier MCP server works fine with next dev After building and running with wrangler dev or when deploying to workers, it throws error when connecting to MCP server

Which area(s) are affected? (Select all that apply)

plugin: other

Environment Info

Node.js v24.1.0

Binaries:
  Node: 24.1.0
  npm: 11.3.0
  Yarn: N/A
  pnpm: 9.11.0
Relevant Packages:
  payload: 3.64.0
  next: 15.4.7
  @payloadcms/db-d1-sqlite: 3.64.0
  @payloadcms/drizzle: 3.64.0
  @payloadcms/graphql: 3.64.0
  @payloadcms/next/utilities: 3.64.0
  @payloadcms/plugin-cloud-storage: 3.64.0
  @payloadcms/plugin-mcp: 3.64.0
  @payloadcms/richtext-lexical: 3.64.0
  @payloadcms/storage-r2: 3.64.0
  @payloadcms/translations: 3.64.0
  @payloadcms/ui/shared: 3.64.0
  react: 19.1.0
  react-dom: 19.1.0
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.4.0: Wed Feb 21 21:44:54 PST 2024; root:xnu-10063.101.15~2/RELEASE_ARM64_T6030
  Available memory (MB): 36864
  Available CPU cores: 12

promentol avatar Nov 23 '25 15:11 promentol

Thank you for reporting this.

kendelljoseph avatar Nov 25 '25 17:11 kendelljoseph