Skip to content

fix(codemode): use Workers-safe MCP validator#1555

Merged
threepointone merged 1 commit into
cloudflare:mainfrom
mattzcarey:fix/issue-1491
May 22, 2026
Merged

fix(codemode): use Workers-safe MCP validator#1555
threepointone merged 1 commit into
cloudflare:mainfrom
mattzcarey:fix/issue-1491

Conversation

@mattzcarey
Copy link
Copy Markdown
Contributor

@mattzcarey mattzcarey commented May 19, 2026

Summary

openApiMcpServer currently creates its underlying MCP McpServer without server options, which leaves the MCP SDK on its default AJV validator. AJV compiles schemas with runtime code generation, so elicitation accept responses can fail in Cloudflare Workers with Code generation from strings disallowed.

This PR defaults codemode's OpenAPI MCP server to the SDK's Workers-safe CfWorkerJsonSchemaValidator, avoiding AJV codegen for elicitation response validation.

Changes

  • Import and use CfWorkerJsonSchemaValidator when constructing the underlying McpServer in openApiMcpServer.
  • Add a regression test that asserts openApiMcpServer uses the Workers-safe validator by default.
  • Add a patch changeset for @cloudflare/codemode.

Fixes #1491.

Testing

  • npm test --workspace @cloudflare/codemode
  • npm run build --workspace @cloudflare/codemode
  • npm run build
  • npm run check — currently blocked by existing missing dependency/type resolution for @cloudflare/kumo in site/ai-playground/tsconfig.json; all other check steps pass, including sherif, export validation, format, lint, and 83/84 typecheck projects.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 19, 2026

🦋 Changeset detected

Latest commit: 7082991

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudflare/codemode Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mattzcarey mattzcarey changed the title fix(codemode): forward MCP server options fix(codemode): use Workers-safe MCP validator May 19, 2026
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 19, 2026

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@1555

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@1555

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@1555

hono-agents

npm i https://pkg.pr.new/hono-agents@1555

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@1555

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@1555

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@1555

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@1555

commit: 7082991

@threepointone threepointone merged commit 2d45abd into cloudflare:main May 22, 2026
4 checks passed
@github-actions github-actions Bot mentioned this pull request May 22, 2026
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.

openApiMcpServer does not forward jsonSchemaValidator to the underlying McpServer; AJV-by-default breaks elicit accept-action under Workers runtime

2 participants