Plug for validating and extracting the MCP-Protocol-Version header.
This plug ensures that incoming HTTP requests carry a protocol version the server actually supports.
Behavior
- If no header is present, the configured default
(
ExMCP.Internal.VersionRegistry.preferred_version/0) is assumed - If an unsupported version is provided, returns 400 Bad Request
- Adds the validated version to conn.assigns[:mcp_version]
The supported list and the default both come from
ExMCP.Internal.VersionRegistry, which is the single source of truth for
protocol versions across the client, the server transports, and this plug.
Usage
plug ExMCP.Plugs.ProtocolVersion