Skip to content

fix(host-cloudflare): route toolkit MCP endpoints - #1926

Open
donmasakayan wants to merge 5 commits into
UsefulSoftwareCo:mainfrom
donmasakayan:codex/host-cloudflare-toolkit-routes
Open

fix(host-cloudflare): route toolkit MCP endpoints#1926
donmasakayan wants to merge 5 commits into
UsefulSoftwareCo:mainfrom
donmasakayan:codex/host-cloudflare-toolkit-routes

Conversation

@donmasakayan

Copy link
Copy Markdown

Summary

  • Route /mcp/toolkits/:slug through the Cloudflare MCP Durable Object handler.
  • Record the targeted MCP resource in session metadata and verified headers.
  • Reject reuse of a session on a different MCP resource.
  • Keep the existing /mcp route and shared cloud host behavior working.

This fixes toolkit URLs emitted by the toolkit UI, which previously reached the worker but returned a route-not-found response. It also prevents a session created for one toolkit from being replayed against the default server or another toolkit.

Validation

  • bun run test -- src/mcp/resource.test.ts (10 passed)
  • bun run test -- src/worker.e2e.node.test.ts (12 passed)
  • bun run test -- src/mcp/agent-session-durable-object.test.ts (39 passed)
  • bun run test -- src/mcp-session.e2e.node.test.ts (4 passed)
  • root lint passed
  • root typecheck passed
  • formatting check passed

…-toolkit-routes

# Conflicts:
#	apps/host-cloudflare/src/mcp/agent-handler.ts
#	packages/hosts/cloudflare/src/mcp/agent-session-durable-object.test.ts
#	packages/hosts/cloudflare/src/mcp/agent-session-durable-object.ts
@donmasakayan

Copy link
Copy Markdown
Author

Runtime validation update from a self-hosted Cloudflare staging deployment:

  • Toolkit URL OAuth discovery and authorization succeeded.
  • MCP initialize, notifications/initialized, and tools/list succeeded over separate requests.
  • Toolkit tools/list returned Executor core tools including skills, execute, and resume.
  • skills({ name: "execute" }) succeeded.
  • execute({ code: "return { alive: true };" }) succeeded.
  • Read-only Google Calendar calendarList.list and Google Drive about.get calls succeeded through connections assigned to the toolkit.

The backport is deployed on NextFinancial staging. No additional route patch was required after this validation.

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.

1 participant