Skip to content

Reject MCP list cursors the server never issued - #10447

Merged
tim-smart merged 2 commits into
Effect-TS:mainfrom
nmnmcc:codex/mcp-core-utilities
Nov 9, 2026
Merged

tim-smart merged 2 commits into
Effect-TS:mainfrom
nmnmcc:codex/mcp-core-utilities

Conversation

@nmnmcc

@nmnmcc nmnmcc commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Reject supplied cursors, including the empty string, on tools/list, resources/list, resources/templates/list, and prompts/list across all five MCP adapters. These lists return a complete page and never issue continuation cursors.

Reuse the existing skills cursor rejection helper in internal/mcpProtocol.ts, returning -32602 InvalidParams with Unknown cursor. Skills behavior and existing method-availability precedence are preserved.

This replaces the earlier stacked proposal with a standalone cursor fix on main. It includes no sampling-history validation, handler-input features, transport changes, subscription/progress changes, or AI-doc additions. The original proposal is preserved locally at backup/10447-full-stack-3a4f24d917; the implementation credits NMNM.CC as co-author.

Verification

  • One shared conformance test exercises all four methods with omitted, nonempty and empty cursors on every adapter. It failed on main in the preceding test-only commit; tests were unchanged during implementation.
  • MCP server suite: 14 files passed, 1,123 tests passed, 50 skipped.
  • pnpm check, pnpm check-tsc, pnpm lint, pnpm jsdocs --check, full deno check ., and git diff --check pass. Toolchain commands use nix develop -c.
  • One effect patch changeset; public API signatures remain unchanged.

Closes EFF-3476

@changeset-bot

changeset-bot Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 190d428

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

@effect-janitor effect-janitor Bot added the 4.0 label Nov 7, 2026
@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.61 KB 39.61 KB 0.00 KB (0.00%)
basic.ts 7.31 KB 7.31 KB 0.00 KB (0.00%)
batching.ts 11.21 KB 11.21 KB 0.00 KB (0.00%)
brand.ts 7.00 KB 7.00 KB 0.00 KB (0.00%)
cache.ts 11.73 KB 11.73 KB 0.00 KB (0.00%)
config.ts 23.06 KB 23.06 KB 0.00 KB (0.00%)
differ.ts 22.20 KB 22.20 KB 0.00 KB (0.00%)
http-client.ts 27.42 KB 27.42 KB 0.00 KB (0.00%)
http-router.ts 37.15 KB 37.15 KB 0.00 KB (0.00%)
logger.ts 12.19 KB 12.19 KB 0.00 KB (0.00%)
metric.ts 9.64 KB 9.64 KB 0.00 KB (0.00%)
optic.ts 7.21 KB 7.21 KB 0.00 KB (0.00%)
pubsub.ts 16.21 KB 16.21 KB 0.00 KB (0.00%)
queue.ts 13.09 KB 13.09 KB 0.00 KB (0.00%)
schedule.ts 11.99 KB 11.99 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 14.29 KB 14.29 KB 0.00 KB (0.00%)
schema-binary.ts 42.44 KB 42.44 KB 0.00 KB (0.00%)
schema-class.ts 21.96 KB 21.96 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 29.89 KB 29.89 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 28.22 KB 28.22 KB 0.00 KB (0.00%)
schema-string-transformation.ts 15.54 KB 15.54 KB 0.00 KB (0.00%)
schema-string.ts 12.50 KB 12.50 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.42 KB 16.42 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 39.16 KB 39.16 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 26.36 KB 26.36 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 21.11 KB 21.11 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 21.28 KB 21.28 KB 0.00 KB (0.00%)
schema-toFormatter.ts 21.37 KB 21.37 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 26.38 KB 26.38 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 21.45 KB 21.45 KB 0.00 KB (0.00%)
schema.ts 21.05 KB 21.05 KB 0.00 KB (0.00%)
stm.ts 14.40 KB 14.40 KB 0.00 KB (0.00%)
stream.ts 10.56 KB 10.56 KB 0.00 KB (0.00%)

@effect-bot
effect-bot force-pushed the codex/mcp-core-utilities branch from 3a4f24d to 190d428 Compare November 9, 2026 23:41
@effect-bot effect-bot changed the title Reject invalid MCP cursors and sampling histories Reject MCP list cursors the server never issued Nov 9, 2026
@tim-smart
tim-smart enabled auto-merge (squash) November 9, 2026 23:46
@tim-smart
tim-smart merged commit 79af760 into Effect-TS:main Nov 9, 2026
14 of 15 checks passed
laithalsaadoon added a commit to memhtml/memhtml that referenced this pull request Nov 22, 2026
## What moves

- The Effect catalog set goes from 4.1.2 to 4.1.4 as one version: `effect`, `@effect/platform-node`, `@effect/platform-node-shared`, `@effect/vitest`.
- The lockfile follows: the four Effect packages, plus `undici` 8.12.3 -> 8.12.4 under `@effect/platform-node`, which asks for `^8.12.4`. Nothing else in the lockfile changes; `ws` stays at 8.22.1, and the docs site's own `undici` 8.12.3 (under `unifont`) stays where it is.
- No source change was needed. The only source edits are comments and prose that name the pin.

## Behavior changes memhtml reaches

Effect 4.1.3 changed behavior that memhtml reaches, and 4.1.4 keeps all but one of those changes. A user or operator moving from 4.1.2 to 4.1.4 can observe five things:

1. **`memhtml-mcp` exits with code 0 instead of 130 when its client closes stdin.** Anything that spawns the server and reads its exit code sees the new value. ([#10475](Effect-TS/effect#10475))
2. **A list request with a cursor the server never issued is refused.** `tools/list`, `resources/list`, `resources/templates/list` and `prompts/list` now answer `-32602 "Unknown cursor"`; before, they ignored the cursor and returned the full list. memhtml never issues a `nextCursor`, so a conforming client never sends one. ([#10447](Effect-TS/effect#10447))
3. **MCP request spans are renamed, only when `OTEL_EXPORTER_OTLP_ENDPOINT` is set.** A span such as `McpServer.@effect/mcp/2025-06-18/tools/call` becomes `tools/call memory_search`, and its attributes move from `rpc.*`, `tool` and `parameters` to `mcp.*`, `gen_ai.*`, `jsonrpc.request.id` and `network.transport`. Tool arguments are no longer exported on the span. Dashboards or queries keyed on the old names need updating. ([#10304](Effect-TS/effect#10304))
4. **Successful spans carry status Unset instead of Ok, under the same condition.** This applies to every span the MCP server and the CLI export. ([#10440](Effect-TS/effect#10440))
5. **`memhtml head serve` stops at once after SIGTERM when a local client had sent an HTTP `Upgrade` request.** Before, it waited the full two-second shutdown grace. memhtml's own client never sends `Upgrade`, so this needs a foreign client on the socket. Replies are unchanged. ([#10360](Effect-TS/effect#10360))

One 4.1.3 change does not carry over: 4.1.3 answered three malformed Skills requests with `-32601` instead of `-32602`, and 4.1.4 restores `-32602` ([#10540](Effect-TS/effect#10540)). Those replies are identical on 4.1.2 and 4.1.4.

None of the other 4.1.4 entries is reached: they cover `HttpApi`, `effect/cli`, the AI provider clients, `SchemaRepresentation` and `TestClock` internals.

## Proofs

- **Typecheck:** `turbo run typecheck` passes, 35 of 35 tasks, 0 errors (tsc 7.0.2).
- **Emit comparison:** every project was rebuilt with `tsc -b --force` and compared with a build of `main`: 418 `.js` and `.d.ts` files, 414 byte-identical. Three of the other four (`apps/mcp/dist/server.js`, `tools.js`, `server.d.ts`) differ only in the restated comment lines. The fourth, `apps/mcp/dist/tools.d.ts`, gains a third type argument (`Tool.Execution`) on the 15 tool types; that file is not part of the published bundle. No executable line differs.
- **Tests:** the `apps/mcp` suite passes 163 of 163. `apps/cli` `head-server.test.ts` passes 26 of 27 in a run with a long temp directory; the one failure is the socket-path-limit case, whose own precondition failed by one byte before any server code ran, and the file passes in the full gate. `catalog.test.ts` passes 4 of 4, `packages/eval` `corpus.test.ts` 26 of 26, `packages/llm` `structured.test.ts` 45 of 45. The full local gate (`mise run check`) passes 76 of 76 tasks on this head.
- **MCP stdio harness**, the `main` build against this branch's build, same fixture store:
  - 50 requests: 46 replies identical, 4 differ (the four cursor requests in item 2).
  - `tools/list` is identical: 41,197 bytes, same sha256.
  - Requests sent before `initialize` (9) and requests with bad header fields (8) are all identical.
  - All seven Skills requests are identical.
  - Exit code at stdin close: 130 before, 0 after.
- **Telemetry probe** against a local collector: 49 MCP spans and 22 CLI spans on both builds, with the name, attribute and status differences in items 3 and 4. Batch timing is unchanged.
- **Head server probe:** 17 replies equal on both builds apart from a duration, a pid and the store path. Stop time after an `Upgrade` request: 2,027 ms before, 27 ms after.
- **Advisories:** none affects Effect 4.1.2, 4.1.3 or 4.1.4, or undici 8.12.3 or 8.12.4. 4.1.4 is the newest release of all four packages.

## Restated sentences

- `apps/mcp/src/server.ts`: two comments now name effect 4.1.4 (the `instructions` option, the five protocol adapters).
- `apps/mcp/src/tools.ts`: one comment now names effect 4.1.4.
- `docs/backlog.md`: the `instructions` entry names the 4.1.4 pin and adds the 2026-11-16 probe.
- `CLAUDE.md`: the adapters sentence names 4.1.4. The "differs from recall" paragraph is reworded, not just renumbered: `Schema.d.ts` changed in 4.1.3 (it adds `Rational` and `RationalFromString` and changes the `isAnyOf` and `Iso` types), so the paragraph now says the claims it names were checked again against the installed 4.1.4, where `Effect.d.ts` is byte-identical to 4.1.2's.

## Merge

This PR is left open for the maintainer. It compiles and the emitted code is unchanged, but it changes an exit code, one MCP error path and the exported telemetry, and those are a maintainer's call.

This branch is waiting to be deployed

1 waiting deployment
fork — 190d428a Waiting Nov 9, 2026 by effect-bot via approval-gate #25684
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.

3 participants