FastestMCP.Protocol (fastest_mcp v0.3.0)

Copy Markdown View Source

Central protocol version and capability helpers. Keep the active MCP protocol baseline in one place so server responses, client handshakes, and tests do not drift.

This module keeps one focused piece of FastestMCP behavior in a dedicated place so builders, runtimes, transports, and providers can share the same rules without duplicating logic.

Unless you are extending FastestMCP itself, you will usually meet this module indirectly through higher-level APIs rather than calling it first.

Summary

Functions

Reads one capability value from a capability map.

Returns whether the given capability path is advertised and enabled.

Returns whether the capability path is the boolean value true.

Returns whether the capability path contains an advertised capability object.

Returns the preferred MCP protocol version supported by the library.

Normalizes capability input into a stable map.

Returns the implementation profile for a protocol version.

Returns the implementation profile for a supported protocol version.

Returns whether the exact protocol version is supported.

Returns supported MCP protocol versions in preference order, newest first.

Returns the protocol version string for the given input.

Types

profile()

@type profile() :: :modern | :legacy | :unsupported

version()

@type version() :: String.t()

Functions

capability(capabilities, path, default \\ nil)

Reads one capability value from a capability map.

capability?(capabilities, path)

Returns whether the given capability path is advertised and enabled.

capability_flag?(capabilities, path)

Returns whether the capability path is the boolean value true.

capability_object?(capabilities, path)

Returns whether the capability path contains an advertised capability object.

current_version()

@spec current_version() :: version()

Returns the preferred MCP protocol version supported by the library.

normalize_capabilities(capabilities)

Normalizes capability input into a stable map.

profile(version)

@spec profile(term()) :: profile()

Returns the implementation profile for a protocol version.

profile!(version)

@spec profile!(term()) :: :modern | :legacy

Returns the implementation profile for a supported protocol version.

supported_version?(version)

@spec supported_version?(term()) :: boolean()

Returns whether the exact protocol version is supported.

supported_versions()

@spec supported_versions() :: [version()]

Returns supported MCP protocol versions in preference order, newest first.

version(metadata_or_server, default \\ "2026-07-28")

Returns the protocol version string for the given input.