Skip to content

Forward resource-read _meta in vMCP and the transport bridge #6028

Description

@jhrozek

Part of #6027. Blocked on stacklok/toolhive-core#194 landing and being released.

Work

Once mcpcompat exposes a result-returning resource handler, consume it at the
two sites that currently discard backend resource _meta:

  1. vMCP Serve pathpkg/vmcp/server/serve_handlers.go:
    coreResourceHandler and coreResourceTemplateHandler return a bare
    []mcp.ResourceContents and drop result.Meta. Route it through
    conversion.ToMCPMeta(result.Meta) so it gets the same reserved-key strip
    every other Legacy egress already gets (Strip reserved io.modelcontextprotocol/* keys from backend response _meta (shared Legacy+Modern helper) #5986 / Strip reserved io.modelcontextprotocol/* keys from responses #6024).

  2. Transport bridgepkg/transport/bridge.go:226,241, same shape, same
    loss.

The client side needs no change: vmcp.ResourceReadResult.Meta is already
populated on both the Legacy and Modern paths
(pkg/vmcp/client/client.go legacyReadResource / modernReadResource).

Also fix the stale comment

pkg/vmcp/client/meta_integration_test.go:217 says resource _meta is
impossible "Due to MCP SDK constraints". That is wrong — go-sdk supports it;
the gap was mcpcompat's mcp-go-shaped handler signature. Update the comment and
turn the test into a real preservation assertion.

Why it matters

Closes the Legacy/Modern fork introduced by #6024: Modern preserves-and-strips
resource _meta (its hand-rolled envelope bypasses the SDK handler), Legacy
drops it. Same backend, same request, different client-visible metadata
depending on the negotiated revision.

Also finishes the resource half of #2640, which shipped tools/call and
prompts/get and closed with this item open.

Acceptance

Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions