Wymcp.Plugs.ProtocolFields (Wymcp v0.1.1)

View Source

Modern-lane enforcement of the protocol fields (docs/glossary.md, protocol fields). On a modern-classified request, params._meta must carry io.modelcontextprotocol/protocolVersion as a string and io.modelcontextprotocol/clientCapabilities as an object — a missing or wrong-typed field answers -32602 + 400 — and the version must be a modern revision wymcp serves — anything else answers -32022 + 400 with data.supported naming every version either era serves (so a legacy-capable client sees its initialize fall-back in the same answer) and data.requested echoing the offer.

Notifications are exempt: JSON-RPC forbids error responses to notifications, and the modern core defines no client→server notifications over HTTP — Wymcp.Plugs.Dispatch answers them 202 and drops them. Legacy-classified messages pass through untouched.

The MCP-Protocol-Version header is deliberately not read: the protocol fields are authoritative, and the whole header-binding family (-32020, Mcp-Method, Mcp-Name) is one coherent design, planned to land as a single future change. Until it lands, wymcp under-enforces headers but never rejects a compliant client.