Add regression tests gating the mcp-go to go-sdk migration#5772
Open
JAORMX wants to merge 4 commits into
Open
Conversation
Pin current mcpcompat shim behavior for session lifecycle,
capability advertisement, tool schema fidelity, and concurrent
context isolation so the go-sdk migration can be validated.
Fix bridge to re-fetch tools/resources/prompts when a list_changed
notification arrives, keeping the local stdio server's advertised set
in sync with the upstream backend.
Two real regressions found and pinned with documented assertions:
- Initialize response advertises only {logging:{}} instead of
capabilities.tools and capabilities.resources (toolhive-core#156 U1)
- normalizeObjectSchema replaces schemas without type:object with
a bare {type:object}, dropping properties and required fields
(toolhive-core#156 U6)
Refs #5742
Pin current mcpcompat shim behavior for auth error classification and local proxy Host-header rewriting. Add configurable HeartbeatInterval to ServerConfig for testable SSE keep-alive. Tests cover 401 to ErrAuthenticationFailed, 403-on-initialize to legacy SSE fallback, tool errors with auth-looking messages not being misclassified as auth failures, and Host-header rewriting in the transparent proxy. Key finding: the streamable-HTTP transport does not return transport.ErrLegacySSEServer for 403 responses (only the SSE transport does), so the sentinel is not in the error chain. The error is still classified as ErrBackendUnavailable via string matching. Pinned with documented assertions. Refs #5742
Pin current mcpcompat shim behavior for SSE keep-alive cadence, tool pagination, per-session tool projection with Cedar authz, and sliding session TTL so the go-sdk migration can be validated. Tests cover keep-alive bytes on idle SSE streams, >1000 tool listing behavior (skipped — known pagination gap), two sessions with different authz outcomes seeing different tools, filtered tools being uncallable, session tool sets being fixed at initialize, and active sessions not expiring despite TTL elapsing. Add WithSessionTTL helper option for integration tests. Refs #5742
Pin the current mcpcompat shim behavior for the stdio bridge's list_changed re-fetch fix and document known shim limitations. Test covers the forwardAll re-sync when a tools/list_changed notification arrives from the upstream backend, verifying the bridge's local server picks up the updated tool set. Skipped test documents that progress and logging notifications are dropped by the mcpcompat client shim (no ProgressNotificationHandler or LoggingMessageHandler installed) and that list_changed notifications cannot be forwarded downstream (SendNotificationToAllClients only handles progress and message). Serves as regression anchor for when the shim is fixed. Refs #5742
Contributor
There was a problem hiding this comment.
Large PR Detected
This PR exceeds 1000 lines of changes and requires justification before it can be reviewed.
How to unblock this PR:
Add a section to your PR description with the following format:
## Large PR Justification
[Explain why this PR must be large, such as:]
- Generated code that cannot be split
- Large refactoring that must be atomic
- Multiple related changes that would break if separated
- Migration or data transformationAlternative:
Consider splitting this PR into smaller, focused changes (< 1000 lines each) for easier review and reduced risk.
See our Contributing Guidelines for more details.
This review will be automatically dismissed once you add the justification section.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/remove-mcp-go #5772 +/- ##
======================================================
+ Coverage 70.77% 70.84% +0.07%
======================================================
Files 683 683
Lines 69194 69208 +14
======================================================
+ Hits 48970 49033 +63
+ Misses 16625 16585 -40
+ Partials 3599 3590 -9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Open
4 tasks
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.
Summary
Adds a comprehensive regression test suite that pins the current
mcpcompatshim behavior so the mcp-go → go-sdk migration (#5729) can be validated against it. The tests are written againsttoolhive-core/mcpcompatimports (notmark3labs/mcp-go) so they compile on this branch and survive the import swap.Closes #5742.
What's tested
pkg/transport/bridge_test.gopkg/transport/bridge_test.gopkg/transport/bridge_test.gopkg/vmcp/server/session_lifecycle_regression_test.gotest/integration/vmcp/per_session_projection_regression_test.gopkg/vmcp/server/sse_keepalive_regression_test.gotest/integration/vmcp/pagination_regression_test.gopkg/transport/proxy/transparent/host_header_regression_test.gopkg/vmcp/client/auth_error_mapping_regression_test.gopkg/vmcp/server/capability_regression_test.go{logging:{}}advertised (#5769)pkg/vmcp/server/context_isolation_regression_test.gopkg/vmcp/server/schema_fidelity_regression_test.gotype:objectare normalized to{"type":"object"}(#5770)pkg/vmcp/client/auth_error_mapping_regression_test.gotest/integration/vmcp/sliding_ttl_regression_test.goCodebase changes
pkg/transport/bridge.go): Re-fetch tools/resources/prompts when a*_list_changednotification arrives (previously only fetched once at startup)pkg/vmcp/server/server.go,serve.go,derive.go): Make SSE keep-alive interval configurable for testing (defaults to 30s in production, 100ms in tests)test/integration/vmcp/helpers/vmcp_server.go): Allow integration tests to configure short session TTLsReal regressions found and documented
{logging:{}}instead ofcapabilities.toolsandcapabilities.resources(CRITICAL — breaks spec-compliant clients)type:objectis absentVerification
Notes
github.com/stacklok/toolhive-core/mcpcompat/*— no directmark3labs/mcp-goimportsencoding/json) and toolhive's own types (pkg/vmcp) where possible to minimize SDK couplingRelated