You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add real-client integration tests for mcpcompat protocol-status handling #7034
Validate the mcpcompat protocol-status corrections with integration tests that use a real MCP client against a real server, not only unit tests.
Scenarios to cover
JSON-RPC errors are preserved (go-sdk v1.8 decodes JSON-RPC error bodies from non-2xx responses)
Method-not-found is distinguished from session termination
Auth challenges are retained (WWW-Authenticate and the numeric HTTP status, used for RFC 9728 discovery and error classification)
Subsequent requests on the same client still work after an error
Notes
Independent of any toolhive-core release; the runtime behavior is already in the pinned go-sdk v1.8.0 plus the shim's error-body capture (mcpcompat/client/errorbody.go).
Follow-up from the toolhive-core docs commit d8f6f06.
Done in stacklok/toolhive-core#522 (merged as 9008cfd). The tests drive the real mcpcompat client over real HTTP against a real go-sdk Streamable HTTP server. A thin handler in front injects faults only for chosen requests.
JSON-RPC errors are preserved: TestProtocolStatus_JSONRPCErrorPreserved (code, message and data survive HTTP 400/403/422) and TestProtocolStatus_TransientStatusBodyStillReachesCaller (the shim re-attaches the 503 body, which go-sdk does not decode).
Method-not-found vs session termination: TestProtocolStatus_MethodNotFoundVersusTerminatedSession and TestProtocolStatus_Bare404WithJSONRPCBody. The latter pins 404 → ErrSessionTerminated for ToolHive's proxy format (echoed id), the TypeScript SDK (id: null) and the Python SDK (id: "server-error"), since vMCP's session recovery depends on it.
Auth challenges are retained: TestProtocolStatus_AuthChallengeOnInitialize, TestProtocolStatus_AuthChallengeMidSession and TestProtocolStatus_CleanupResponseDoesNotOverwriteChallenge (401 status, WWW-Authenticate and the RFC 9728 resource_metadata URL survive, including a cleanup DELETE answered with a different status).
The same client works after an error: TestProtocolStatus_RecoveryAfterRecoverableErrors (five error kinds on one client, each checked for its own classification, session ID unchanged), TestProtocolStatus_ConcurrentCallsOnOneClient and TestProtocolStatus_TimeoutAndCancellation.
Known limits, both in go-sdk v1.8.0 rather than the shim:
go-sdk closes the connection on a 4xx without a JSON-RPC body (for example a bodiless 401), so recovery is only asserted where it keeps the session open.
go-sdk treats a server error with code -32003 or -32004 as its own "client/server closing" signal. It reports ErrConnectionClosed and drops the *jsonrpc.Error, although the connection stays usable.
Activity
mcpcompat/client: add real-client integration tests for protocol-stat…
rdimitrov commentedon Nov 20, 2026
Done in stacklok/toolhive-core#522 (merged as 9008cfd). The tests drive the real
mcpcompatclient over real HTTP against a real go-sdk Streamable HTTP server. A thin handler in front injects faults only for chosen requests.TestProtocolStatus_JSONRPCErrorPreserved(code, message and data survive HTTP 400/403/422) andTestProtocolStatus_TransientStatusBodyStillReachesCaller(the shim re-attaches the 503 body, which go-sdk does not decode).TestProtocolStatus_MethodNotFoundVersusTerminatedSessionandTestProtocolStatus_Bare404WithJSONRPCBody. The latter pins 404 →ErrSessionTerminatedfor ToolHive's proxy format (echoedid), the TypeScript SDK (id: null) and the Python SDK (id: "server-error"), since vMCP's session recovery depends on it.TestProtocolStatus_AuthChallengeOnInitialize,TestProtocolStatus_AuthChallengeMidSessionandTestProtocolStatus_CleanupResponseDoesNotOverwriteChallenge(401 status,WWW-Authenticateand the RFC 9728resource_metadataURL survive, including a cleanupDELETEanswered with a different status).TestProtocolStatus_RecoveryAfterRecoverableErrors(five error kinds on one client, each checked for its own classification, session ID unchanged),TestProtocolStatus_ConcurrentCallsOnOneClientandTestProtocolStatus_TimeoutAndCancellation.Known limits, both in go-sdk v1.8.0 rather than the shim:
ErrConnectionClosedand drops the*jsonrpc.Error, although the connection stays usable.