Skip to content

Preserve per-item ResourceContents._meta in vMCP #6190

Open

Description

@JAORMX

Part of #5743. Surfaced in jhrozek's review of #6180.

Problem

The spec puts _meta on ResourceContents items too (it's the MCP-UI carrier), and mcpcompat models it (mcpcompat/mcp/resources.go), but vMCP drops it: vmcp.ResourceContent has no Meta field, so both the Legacy conversion (pkg/vmcp/conversion/content.go, ToMCPResourceContents/ConvertMCPResourceContents) and the Modern rebuild (pkg/vmcp/client/client.go modernReadResource) lose it. Legacy and Modern are equally blind, so there's no revision fork — but a backend that sets per-item meta (e.g. MCP-UI payloads) has it silently stripped.

Work

  1. Add Meta map[string]any to vmcp.ResourceContent (pkg/vmcp/types.go).
  2. Populate it in both client paths (Legacy legacyReadResource via conversion.FromMCPMeta on each item; Modern rebuild similarly).
  3. Forward it in the Serve-path conversion, with the same reserved-key strip every other egress gets (mcpparser.StripReservedMeta via conversion.ToMCPMeta) — a backend can smuggle reserved io.modelcontextprotocol/* keys at the item level too.
  4. Extend the meta-preservation tests to cover per-item meta on both revisions.

Related: #6027 (result-level resource _meta, shipped in toolhive-core v0.0.38 + #6180).

Activity

  1. added
    needs-triage
    on Aug 4, 2026
  2. suantea commented on Oct 10, 2026

    @suantea

    I'd like to work on this. Plan: add Meta map[string]any to vmcp.ResourceContent, populate it in ConvertMCPResourceContents (legacy) and in modernReadResource's wire struct (modern), and forward it on egress through ToMCPResourceContents with the usual reserved-key strip. Will extend the meta-preservation tests for per-item meta on both revisions.

  3. removed
    needs-triage
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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