Skip to content

Fix invalid JSON-RPC request errors#2000

Open
Genmin wants to merge 3 commits intomodelcontextprotocol:mainfrom
Genmin:codex/fix-invalid-json-rpc-errors
Open

Fix invalid JSON-RPC request errors#2000
Genmin wants to merge 3 commits intomodelcontextprotocol:mainfrom
Genmin:codex/fix-invalid-json-rpc-errors

Conversation

@Genmin
Copy link
Copy Markdown

@Genmin Genmin commented Apr 30, 2026

Summary

  • return JSON-RPC -32600 Invalid Request for valid JSON bodies that fail JSON-RPC message schema validation in the streamable HTTP transport
  • preserve the parsed raw stdio message on schema validation errors so the server can recover a request id
  • make stdio send an Invalid Request error response for malformed requests with an id, while leaving malformed notifications response-less

Fixes #563.

Validation

  • pnpm --filter @modelcontextprotocol/core test -- test/shared/stdio.test.ts
  • pnpm --filter @modelcontextprotocol/server test -- test/server/stdio.test.ts test/server/streamableHttp.test.ts
  • pnpm --filter @modelcontextprotocol/node test -- test/streamableHttp.test.ts
  • pnpm --filter @modelcontextprotocol/core typecheck
  • pnpm --filter @modelcontextprotocol/server typecheck
  • pnpm --filter @modelcontextprotocol/node typecheck
  • pnpm --filter @modelcontextprotocol/core lint
  • pnpm --filter @modelcontextprotocol/server lint
  • pnpm --filter @modelcontextprotocol/node lint
  • pre-push hook: pnpm run build:all, pnpm run lint:all, pnpm run typecheck:all

@Genmin Genmin requested a review from a team as a code owner April 30, 2026 22:00
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 30, 2026

🦋 Changeset detected

Latest commit: bb65fb9

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

This PR includes changesets to release 6 packages
Name Type
@modelcontextprotocol/core Patch
@modelcontextprotocol/node Patch
@modelcontextprotocol/server Patch
@modelcontextprotocol/express Patch
@modelcontextprotocol/fastify Patch
@modelcontextprotocol/hono 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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 30, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/@modelcontextprotocol/client@2000

@modelcontextprotocol/server

npm i https://pkg.pr.new/@modelcontextprotocol/server@2000

@modelcontextprotocol/express

npm i https://pkg.pr.new/@modelcontextprotocol/express@2000

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/@modelcontextprotocol/fastify@2000

@modelcontextprotocol/hono

npm i https://pkg.pr.new/@modelcontextprotocol/hono@2000

@modelcontextprotocol/node

npm i https://pkg.pr.new/@modelcontextprotocol/node@2000

commit: bb65fb9

@Genmin
Copy link
Copy Markdown
Author

Genmin commented Apr 30, 2026

Added the missing changeset for @modelcontextprotocol/core, @modelcontextprotocol/node, and @modelcontextprotocol/server. Local validation on push passed the repo pre-push hook: typecheck, build, and lint.

@Genmin
Copy link
Copy Markdown
Author

Genmin commented Apr 30, 2026

The only red check after the changeset push was the known transient Cloudflare Workers/Miniflare failure in on the Node 20 shard. I don't have permission to rerun failed jobs directly (), so I pushed an empty retry commit with no code changes.

@Genmin
Copy link
Copy Markdown
Author

Genmin commented Apr 30, 2026

The only red check after the changeset push was the known transient Cloudflare Workers/Miniflare Network connection lost failure in test/server/cloudflareWorkers.test.ts on the Node 20 shard. I do not have permission to rerun failed jobs directly, so I pushed an empty retry commit with no code changes.

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.

Invalid JSON RPC requests do not respond with an error

1 participant