Skip to content

Fix MCP serialization and transport cleanup - #10441

Open
nmnmcc wants to merge 2 commits into
Effect-TS:mainfrom
nmnmcc:codex/mcp-core-transports
Open

nmnmcc wants to merge 2 commits into
Effect-TS:mainfrom
nmnmcc:codex/mcp-core-transports

Conversation

@nmnmcc

@nmnmcc nmnmcc commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Malformed MCP messages could leave clients waiting, discard valid neighboring frames, or expose Effect RPC failure details. This fixes those paths and adds McpServer.makeSerialization and McpServer.layerSerialization, giving stdio and custom transports a shared serializer with JSON/NDJSON framing and revision-specific batch and request-ID rules.

Malformed JSON or UTF-8 now receives a ParseError with id: null; valid NDJSON frames around it remain usable. Responses preserve intentional protocol/application error.data while removing internal failure and control envelopes. Custom transports also keep Effect RPC control messages outside MCP, following the transport contract.

Disconnecting a client releases its pending work and reverse-request waits without requiring another message. Ending an individual HTTP response still preserves its legacy session. SSE responses disable proxy buffering, including rejected subscriptions and empty cancellation streams.

Existing server constructors remain compatible. .changeset/mcp-core-transports.md declares an effect patch for these fixes and additions to the unstable API.

Regression coverage: malformed stdio input previously produced no ParseError, custom sockets exposed a defect, and disconnected legacy clients remained available. The tests now cover those failures alongside fractional-ID rejection, mixed batches, cancellation, fragmented UTF-8, and client isolation.

Dependencies: none. Focused comparison.

Verification

Target: Effect-TS/effect:main. Validated head: dbd83ed10a3641f28486131ad44b8cbb570eb09f.

  • Passed: pnpm check, pnpm check-tsc, lint, JSDoc checks, full Tstyche/doctest suites, circular checks, AI-doc generation, package build with stripInternal: true, and distribution-type checks.
  • Full configured Node suite: Test Files 612 passed | 1 skipped (613); Tests 17390 passed | 15 expected fail | 108 skipped (17513).
  • Node 26.12.1 / pnpm 11.20.0; four Node workers and two doctest workers. Database integration tests enabled; MSSQL disabled as in CI; opt-in cluster suite excluded. Hosted CI results are separate.
  • Tests/doctests used --run with explicit files. Generated docs were unchanged; temporary build configuration was restored.

@changeset-bot

changeset-bot Bot commented Nov 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: dbd83ed

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

This PR includes changesets to release 33 packages
Name Type
effect Patch
@effect/opentelemetry Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-cloudflare Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/ai-typesafe Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-deno Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/docgen Patch
@effect/doctest Patch
@effect/graphql-generator Patch
@effect/openapi-generator 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

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
arbitrary-combinators.ts 39.55 KB 39.55 KB 0.00 KB (0.00%)
basic.ts 7.31 KB 7.31 KB 0.00 KB (0.00%)
batching.ts 11.13 KB 11.13 KB 0.00 KB (0.00%)
brand.ts 6.97 KB 6.97 KB 0.00 KB (0.00%)
cache.ts 11.61 KB 11.61 KB 0.00 KB (0.00%)
config.ts 22.98 KB 22.98 KB 0.00 KB (0.00%)
differ.ts 22.13 KB 22.13 KB 0.00 KB (0.00%)
http-client.ts 27.14 KB 27.14 KB 0.00 KB (0.00%)
http-router.ts 37.05 KB 37.05 KB 0.00 KB (0.00%)
logger.ts 12.07 KB 12.07 KB 0.00 KB (0.00%)
metric.ts 9.54 KB 9.54 KB 0.00 KB (0.00%)
optic.ts 7.17 KB 7.17 KB 0.00 KB (0.00%)
pubsub.ts 16.08 KB 16.08 KB 0.00 KB (0.00%)
queue.ts 12.96 KB 12.96 KB 0.00 KB (0.00%)
schedule.ts 11.86 KB 11.86 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 14.23 KB 14.23 KB 0.00 KB (0.00%)
schema-binary.ts 42.17 KB 42.17 KB 0.00 KB (0.00%)
schema-class.ts 21.87 KB 21.87 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 29.83 KB 29.83 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 28.14 KB 28.14 KB 0.00 KB (0.00%)
schema-string-transformation.ts 15.44 KB 15.44 KB 0.00 KB (0.00%)
schema-string.ts 12.43 KB 12.43 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.35 KB 16.35 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 39.09 KB 39.09 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 26.28 KB 26.28 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 21.05 KB 21.05 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 21.20 KB 21.20 KB 0.00 KB (0.00%)
schema-toFormatter.ts 21.30 KB 21.30 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 26.31 KB 26.31 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 21.37 KB 21.37 KB 0.00 KB (0.00%)
schema.ts 20.97 KB 20.97 KB 0.00 KB (0.00%)
stm.ts 14.27 KB 14.27 KB 0.00 KB (0.00%)
stream.ts 10.44 KB 10.44 KB 0.00 KB (0.00%)

This branch is waiting to be deployed

1 waiting deployment
fork — dbd83ed1 Waiting Nov 7, 2026 by nmnmcc via approval-gate #25353
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant