Skip to content

Retire the hand-rolled Modern wire shim in vMCP #6018

Description

@JAORMX

Part of #5743. Split out of #6002 (item 6) so that issue can close — this item is blocked on an upstream change and does not belong in a list of otherwise-actionable follow-ups.

Context

vMCP hand-rolls the MCP 2026-07-28 ("Modern") wire shape across roughly 1,600 lines (measured on main):

File Lines
pkg/vmcp/client/modern.go 441
pkg/vmcp/server/modern_envelope.go 562
pkg/mcp/revision.go 627

Five code comments justified that on the grounds that go-sdk v1.6.1 could not express the revision — a premise #5993 (go-sdk v1.7 adoption) invalidated and #5997 corrected in place.

Why the shim is still required

The reason is now much narrower than those comments implied: mcpcompat's public Client API exposes no no-initialize primitive — only the private, Legacy-shaped resumeCall. go-sdk itself implements the revision fine; TestListCapabilities_MisCachedLegacy_SelfHealsViaSDKNegotiation shows its client negotiating Modern unaided, and #5997's in-band self-heal reads the negotiated version straight off InitializeResult.

Note also that the server-side envelope cannot simply be deleted even on a newer go-sdk: modern_envelope.go documents that the Modern result types remain unexported in v1.7.0-pre.3, and that resultType / _meta.serverInfo are set by unexported SDK functions (setCompleteResultType, annotateServerInfo) which run inside the exact ServerSession dispatch the Modern stateless path bypasses. So this is not a pure deletion.

Work, in order

  1. Upstream: add a no-initialize primitive to toolhive-core's mcpcompat public client API.
  2. In-repo: retire the client-side shim in favour of it — deleting the hand-rolled egress envelope, the raw modernCall path, and the revision-classification machinery that exists only to choose between the two shims.

Scope caveat

Confirm step 2's true scope before committing. Part of revision.go serves the ingress classifier (hasModernSignal, ValidateHeaderConsistency) and survives regardless; the split of ReservedModernMetaKeys vs modernSignalMetaKeys is likewise ingress/egress infrastructure, not shim. The client-side egress duplication looks squarely deletable; the server-side envelope likely does not, for the reason above.

Blocked on

Step 1 landing in toolhive-core.

Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageIssue needs initial triage by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions