fix: serve server/discover from the hand-rolled client-scenario mocks#347
Merged
Conversation
The SEP-2243, SEP-2322, and SEP-2106 client-direction scenarios build their own mock servers and did not answer server/discover, so a 2026-07-28 client that negotiates via discover before its scenario calls hit a -32601 or generic fallback and had to synthesize the response itself. The shared stateless mock and the request-metadata and auth scenarios already served it. BaseHttpScenario now answers server/discover with a valid DiscoverResult (supportedVersions, capabilities from an overridable discoverCapabilities(), serverInfo, plus the cacheable-result members) before delegating to handlePost; http-standard-headers overrides the capabilities to match the methods it serves. mrtr-client and json-schema-ref-no-deref answer it directly. New tests pin the response shape for all five scenarios.
commit: |
pcarleton
approved these changes
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The hand-rolled mock servers for the SEP-2243/2322/2106 client-direction scenarios now answer
server/discover, so a 2026-07-28 client that negotiates via discover before its scenario calls can proceed without intercepting the response at the transport layer.Motivation and Context
server/discoveris the recommended negotiation entry point at 2026-07-28 ("Clients MAY callserver/discover", server/discover); a client that does so against the suite's mocks should get a validDiscoverResult. The shared stateless mock (createServerStateless/validateStatelessRequest) and therequest-metadataand auth scenarios already serve it, but the hand-rolled servers used byhttp-standard-headers,http-custom-headers,http-invalid-tool-headers,sep-2322-client-request-state, andjson-schema-ref-no-derefdid not — discover hit their fallbacks (-32601for the MRTR mock, the generic empty result for the SEP-2243 scenarios, the bundled 1.x SDK's method-not-found for the SEP-2106 scenario). A client whose fixture negotiates via discover currently has to synthesize the response itself; the typescript-sdk's everythingClient carries exactly that workaround.Same family as #341: the mocks need to speak enough of the 2026-07-28 surface that a strictly-conforming client can connect and proceed.
What changed
BaseHttpScenarioanswersserver/discoveritself (before delegating tohandlePost) with a validDiscoverResult:supportedVersions: [DRAFT_PROTOCOL_VERSION],capabilitiesfrom a new overridablediscoverCapabilities()(default{ tools: {} }),serverInfo, and the requiredresultType/ttlMs/cacheScope.sendInitializedefaults its capabilities to the same hook so the legacy and modern paths advertise the same set.http-standard-headersoverridesdiscoverCapabilities()to{ tools: {}, resources: {}, prompts: {} }(the methods it actually serves).mrtr-clientadds aserver/discovercase to its method switch.json-schema-ref-no-derefanswersserver/discoverdirectly before handing the request to the bundled SDK transport (which predates the 2026-07-28 lifecycle).draft-result-fields.test.tsgains a parameterised test asserting each of the five scenarios returns a validDiscoverResultcarryingsupportedVersions: [draft], the expected capabilities, and the cacheable-result members.How Has This Been Tested?
npm run check,npm run build,npm test— all green (293 tests, including the 5 new discover assertions).node dist/index.js client --command "npx tsx examples/clients/typescript/everything-client.ts" --suite draftbefore and after the change: identical results (the bundled example client doesn't call discover on these scenarios, so this confirms no regression for clients that don't).Breaking Changes
None. The added
server/discoverhandling is purely additive; clients that don't call discover see no change.Types of changes
Checklist
Additional context
json-schema-ref-no-derefstill routes everything except discover through the bundled 1.x SDK transport (initialize handshake, no_metavalidation); fully reworking that scenario to a hand-rolled stateless server is a larger follow-up flagged in fix: include required result members in 2026-07-28 mock responses #341._metavalidation (unlike the shared stateless mock), so clients on either lifecycle can drive them; only the discover response was missing.BaseHttpScenarionow answers discover before delegating tohandlePost,http-standard-headersno longer emits its opportunisticMcp-Methodcheck forserver/discover(it was never in the scenario'sexpectedMethodslist, so no backfill or test changes). If we want SEP-2243 header coverage onserver/discover, the right place is the scenario's expected-methods list — separate question from this PR.