Skip to content

Commit b837b6c

Browse files
test: LegacyTestClient + statelessAcceptance(HTTP) + conformance dispatchV2 target
NEW test/integration/__fixtures__/testClient.ts: LegacyTestClient — advertises only pre-2026 versions so connect() skips discover probe. NEW statelessAcceptance.test.ts (HTTP scenarios): Server stateless dispatch, SubscriptionBackend, handleHttp, StreamableHTTP zero-change consumer, audit invariants. conformance: extract everythingServerSetup.ts; add everythingServerDispatchV2.ts target wired to run-server-conformance.sh.
1 parent e79bf92 commit b837b6c

10 files changed

Lines changed: 1027 additions & 866 deletions

.changeset/stateless-2026-06.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
'@modelcontextprotocol/core': major
3+
'@modelcontextprotocol/server': major
4+
'@modelcontextprotocol/client': major
5+
---
6+
7+
2026-06 stateless protocol support (SEP-2575, SEP-2567, SEP-2322).
8+
9+
`Server` and `Client` now support the 2026-06 stateless connection model
10+
alongside the existing pre-2026 model. They remain the same classes (still
11+
extending `Protocol`); the new behavior is additive.
12+
13+
- `Client.connect()` auto-probes `server/discover` and falls back to the
14+
legacy `initialize` handshake.
15+
- `Server` gained `subscriptions` and `statelessHandlers()`; transports route
16+
per-message via the `MCP-Protocol-Version` header / `_meta` key.
17+
- `handleHttp(server, opts)` is a new Fetch-API entry point: one shared
18+
`Server` instance, no `Transport`, no `connect()`.
19+
- `client.subscribe(filter)` opens a `subscriptions/listen` stream.
20+
- `Transport` interface gained optional `setStatelessHandlers?` and
21+
`sendAndReceive?` for custom transports.
22+
- Prefer `ctx.mcpReq.{elicitInput, requestSampling, listRoots, log}` inside
23+
handlers; works under both protocols (MRTR under 2026-06).
24+
25+
See `docs/migration.md` for the full guide.

test/conformance/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
"test:conformance:server": "scripts/run-server-conformance.sh --expected-failures ./expected-failures.yaml",
3535
"test:conformance:server:all": "scripts/run-server-conformance.sh --suite all --expected-failures ./expected-failures.yaml",
3636
"test:conformance:server:run": "npx tsx ./src/everythingServer.ts",
37+
"test:conformance:server:dispatchv2": "PORT=3036 SERVER_ENTRY=./src/everythingServerDispatchV2.ts scripts/run-server-conformance.sh --expected-failures ./expected-failures.yaml",
38+
"test:conformance:server:dispatchv2:run": "PORT=3036 npx tsx ./src/everythingServerDispatchV2.ts",
3739
"test:conformance:all": "pnpm run test:conformance:client:all && pnpm run test:conformance:server:all"
3840
},
3941
"devDependencies": {

test/conformance/scripts/run-server-conformance.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ set -e
66

77
PORT="${PORT:-3000}"
88
SERVER_URL="http://localhost:${PORT}/mcp"
9+
SERVER_ENTRY="${SERVER_ENTRY:-./src/everythingServer.ts}"
910

1011
# Navigate to the repo root
1112
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1213
cd "$SCRIPT_DIR/.."
1314

1415
# Start the server in the background
15-
echo "Starting conformance test server on port ${PORT}..."
16-
npx tsx ./src/everythingServer.ts &
16+
echo "Starting conformance test server (${SERVER_ENTRY}) on port ${PORT}..."
17+
PORT="${PORT}" npx tsx "${SERVER_ENTRY}" &
1718
SERVER_PID=$!
1819

1920
# Function to cleanup on exit

0 commit comments

Comments
 (0)