ExMCP.Plugs.ProtocolVersion (ex_mcp v0.9.2)

View Source

Plug for validating and extracting the MCP-Protocol-Version header.

This plug ensures that incoming HTTP requests include a valid protocol version header as required by the MCP 2025-06-18 specification.

Behavior

  • If no header is present, defaults to "2025-06-18" (per spec)
  • If an unsupported version is provided, returns 400 Bad Request
  • Adds the validated version to conn.assigns[:mcp_version]

Usage

plug ExMCP.Plugs.ProtocolVersion

Summary

Functions

Get the default protocol version.

Get the list of supported protocol versions.

Functions

default_version()

@spec default_version() :: String.t()

Get the default protocol version.

supported_versions()

@spec supported_versions() :: [String.t()]

Get the list of supported protocol versions.