Repository navigation
Description
Summary
#5729 migrates ToolHive from mark3labs/mcp-go to the go-sdk-backed mcpcompat shim (toolhive-core v0.0.27). An audit found functional regressions in the shim — tracked with fixes in stacklok/toolhive-core#156. To guarantee the migration lands with zero functional loss, ToolHive needs regression tests that pin the current (mcp-go) behavior: they should fail against shim v0.0.27 and pass once #5729 bumps to the fixed toolhive-core release.
These tests are the acceptance gate for toolhive-core#156 and merge-blocking evidence for #5729.
Test matrix
1. stdio bridge notification forwarding (end-to-end)
Backend emits → client of the bridge receives, over pkg/transport/bridge.go:
-
notifications/progress(withprogressTokencorrelation) -
notifications/message(logging) -
notifications/tools/list_changed— and a subsequenttools/listthrough the bridge reflects the changed tool set -
notifications/resources/list_changed,notifications/prompts/list_changed
Currently ALL of these are dropped end-to-end under the shim (client half never registers progress/logging handlers; server half cannot send list_changed).
2. vMCP session lifecycle
- Per-request session validation: terminate a session out-of-band (auth-failure path or cross-pod
Terminatevia shared Redis storage), then verify the origin pod rejects the next request on thatMcp-Session-Id(today the shim skipsValidatefor local sessions). - DELETE termination still evicts cache, closes backend connections, and returns the spec status.
- Session identity binding: a second principal reusing a session ID is rejected.
3. Per-session tool projection (security-relevant)
Runtime validation that the shim's per-session go-sdk Server + live tool reconciliation preserves vMCP behavior:
- Two concurrent sessions with different authz outcomes see different
tools/listresults. - A tool filtered for session A cannot be invoked by session A via
tools/callwhile remaining callable in session B. -
SetSessionToolsreconciliation mid-session is reflected in the nexttools/list.
4. SSE keep-alive
- An idle long-lived
text/event-streamresponse from the vMCP server carries periodic keep-alive bytes (SSE comments or pings) at the configuredWithHeartbeatIntervalcadence (currently a silent no-op under the shim).
5. Pagination behavior
- A vMCP server exposing >1000 tools: verify downstream clients receive the complete set (go-sdk paginates at 1000; mcp-go returned everything). Either the server page size is raised or the test documents/exercises cursor-following.
6. Local proxy Host-header behavior
- Localhost-bound proxy accessed with a non-localhost
Hostheader behaves as before the migration (go-sdk's DNS-rebinding protection defaults on and returns 403; decide and pin the intended behavior).
7. Remote auth error mapping
- 401 from a remote backend surfaces
ErrUnauthorized/ErrAuthorizationRequiredsentinels consumed bypkg/vmcp/clientauth discovery. - 403-on-initialize maps to the legacy-SSE fallback path as it did under mcp-go.
Notes
- Prefer e2e tests where the behavior crosses process/transport boundaries (bridge, sessions), unit/integration where a fake backend suffices (Ginkgo/Gomega per repo conventions;
t.Context()in unit tests). - Land the tests before or together with the toolhive-core bump in feat: migrate from mark3labs/mcp-go to toolhive-core/mcpcompat (go-sdk) #5729 so the fixes are demonstrably verified.
- Related: Close mcpcompat functional gaps vs mcp-go for a loss-free migration toolhive-core#156 (shim fixes), feat: migrate from mark3labs/mcp-go to toolhive-core/mcpcompat (go-sdk) #5729 (migration PR).
Generated with Claude Code
Activity
JAORMX commentedon Jul 8, 2026
Additional test cases from the second verification pass
The independent second audit (see stacklok/toolhive-core#156, second-pass comment) found further regressions; extend the matrix:
8. Capability advertisement (CRITICAL — U1)
capabilities.toolsandcapabilities.resourcesin the initialize result. Under shim v0.0.27 vMCP advertises only{logging}because per-session tools register after initialize — clients that gatetools/liston capabilities see zero tools. Test must assert on the raw initialize response, not callListToolsunconditionally.9. Concurrent-request context isolation (security — U3)
tools/callPOSTs on the sameMcp-Session-Ideach get audited/attributed with their own request context (no bleed of identity/BackendInfo between them).10. Backend session continuity (U2)
Mcp-Session-Idand the backend resumes the session rather than minting a new one.11. Mid-call elicitation delivery (U4)
tools/callreaches a client that has NOT opened a standalone GET stream (or the documented requirement is enforced with a fail-fast, not a hang-to-timeout).12. Tool schema fidelity (U6)
"type":"object"(e.g. onlyproperties/required, oroneOf) is projected through vMCP with its schema intact — not replaced by a bare{"type":"object"}.13. Auth-error classification precision (U7)
14. Sliding session TTL (U5 refinement of §2)
tools/listtraffic does not expire while active (per-request Validate/GETEX semantics restored for local sessions).Fix codespell: rename rIn/wIn to pipeR/pipeW in bridge test
Add regression tests gating the mcp-go to go-sdk migration (#5772)
Add regression tests gating the mcp-go to go-sdk migration (#5772)
Add regression tests gating the mcp-go to go-sdk migration (#5772)
feat: migrate from mark3labs/mcp-go to toolhive-core/mcpcompat (go-sd…
Add vMCP per-session security regression tests (#5974)
Add regression pins for TTL, DNS-rebind, bridge, schema (#5977)
Pin tools/list pagination completeness for >1000-tool vMCP sets (#6021)