Commit 2e571ae
Alexander Doroshevich
feat: add version negotiation conformance tests (closes #102)
Implements the three checks from issue #102:
- version-echo (MUST): server echoes the requested protocolVersion when
the client sends a version the server supports.
- version-negotiate (MUST): server responds with a supported version, not
a JSON-RPC error, when the client sends an unsupported version.
- http-protocol-version-header (MUST): server accepts subsequent HTTP
requests that carry the MCP-Protocol-Version header.
Uses raw fetch() instead of connectToServer() because the TypeScript SDK
hard-codes the protocol version and provides no public API to override it.
The MCP StreamableHTTP transport responds with text/event-stream for all
POST requests and keeps the connection open. To avoid blocking on
response.text(), responses are read with a streaming reader that cancels
via reader.cancel() in a finally block after extracting the first JSON-RPC
message.
All sessions opened during testing are cleaned up with DELETE /mcp.
Scenario is registered in allClientScenariosList under lifecycle scenarios.
npm test passes (88/88).1 parent 050d9cf commit 2e571ae
2 files changed
+623
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| 87 | + | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| |||
0 commit comments