ProtocolVersion

Enum ProtocolVersion 

Source
pub enum ProtocolVersion {
    V2024_11_05,
    V2025_03_26,
    V2025_06_18,
    V2025_11_25,
}
Expand description

MCP protocol versions in chronological order.

The ordering is: V2024_11_05 < V2025_03_26 < V2025_06_18 < V2025_11_25

This enum implements Ord, so you can compare versions:

use mcpkit_core::protocol_version::ProtocolVersion;

assert!(ProtocolVersion::V2025_11_25 > ProtocolVersion::V2024_11_05);
assert!(ProtocolVersion::V2025_03_26 >= ProtocolVersion::V2024_11_05);

Variants§

§

V2024_11_05

Original MCP specification (November 2024).

Features: HTTP+SSE transport, tools, resources, prompts.

§

V2025_03_26

OAuth 2.1 and Streamable HTTP update (March 2025).

New features:

  • OAuth 2.1 authorization framework
  • Streamable HTTP transport (replaces HTTP+SSE)
  • JSON-RPC batching (removed in 2025-06-18)
  • Tool annotations (readOnly, destructive)
  • Audio content type
  • Completions capability
§

V2025_06_18

Security and elicitation update (June 2025).

New features:

  • Elicitation (server requesting user input)
  • Structured tool output
  • Resource links in tool results
  • Protected resource metadata
  • _meta field in messages
  • title field for display names

Breaking changes:

  • Removed JSON-RPC batching
  • MCP-Protocol-Version header required
§

V2025_11_25

Tasks and parallel tools update (November 2025).

New features:

  • Tasks with async status tracking
  • Parallel tool calls
  • Server-side agent loops
  • Tool calling in sampling requests

Implementations§

Source§

impl ProtocolVersion

Source

pub const LATEST: Self = Self::V2025_11_25

The latest supported protocol version.

Source

pub const DEFAULT: Self = Self::LATEST

The default version used when not specified.

Source

pub const ALL: &'static [Self]

All supported versions in chronological order.

Source

pub const fn as_str(&self) -> &'static str

Returns the string representation used in the protocol.

This matches the format expected in MCP messages (e.g., "2025-11-25").

Source

pub const fn supports_sse_transport(&self) -> bool

Whether this version uses HTTP+SSE transport (original spec).

Only V2024_11_05 uses the original HTTP+SSE transport. Later versions use Streamable HTTP.

Source

pub const fn supports_streamable_http(&self) -> bool

Whether this version supports Streamable HTTP transport.

Added in 2025-03-26, replacing HTTP+SSE.

Source

pub const fn supports_batching(&self) -> bool

Whether this version supports JSON-RPC batching.

Only available in 2025-03-26. Removed in 2025-06-18.

Source

pub const fn requires_version_header(&self) -> bool

Whether the MCP-Protocol-Version header is required in HTTP requests.

Required from 2025-06-18 onwards.

Source

pub const fn supports_audio_content(&self) -> bool

Whether this version supports audio content type.

Added in 2025-03-26.

Source

pub const fn supports_tool_annotations(&self) -> bool

Whether this version supports tool annotations.

Tool annotations describe behavior like readOnly, destructive, idempotent. Added in 2025-03-26.

Source

pub const fn supports_structured_tool_output(&self) -> bool

Whether this version supports structured tool output.

Allows tools to return structured data alongside text. Added in 2025-06-18.

Whether this version supports resource links in tool results.

Allows tool results to reference resources. Added in 2025-06-18.

Source

pub const fn supports_parallel_tools(&self) -> bool

Whether this version supports parallel tool calls.

Allows multiple tools to be called concurrently. Added in 2025-11-25.

Source

pub const fn supports_oauth(&self) -> bool

Whether this version supports OAuth 2.1 authorization.

Added in 2025-03-26.

Source

pub const fn supports_protected_resources(&self) -> bool

Whether this version supports protected resource metadata.

Enables discovery of OAuth authorization servers. Added in 2025-06-18.

Source

pub const fn supports_elicitation(&self) -> bool

Whether this version supports elicitation.

Elicitation allows servers to request additional information from users. Added in 2025-06-18.

Source

pub const fn supports_tasks(&self) -> bool

Whether this version supports tasks with async status tracking.

Tasks allow tracking long-running operations. Added in 2025-11-25.

Source

pub const fn supports_agent_loops(&self) -> bool

Whether this version supports server-side agent loops.

Enables sophisticated multi-step reasoning on the server. Added in 2025-11-25.

Source

pub const fn supports_sampling_tools(&self) -> bool

Whether this version supports tool calling in sampling requests.

Allows servers to include tool definitions in sampling. Added in 2025-11-25.

Source

pub const fn supports_meta_field(&self) -> bool

Whether this version supports the _meta field in messages.

Provides metadata for messages. Added in 2025-06-18.

Source

pub const fn supports_title_field(&self) -> bool

Whether this version supports the title field for display names.

Separate from name which is the programmatic identifier. Added in 2025-06-18.

Source

pub const fn supports_completion_context(&self) -> bool

Whether this version supports the context field in completion requests.

Provides previously-resolved variable values. Added in 2025-06-18.

Source

pub const fn supports_completions_capability(&self) -> bool

Whether this version supports the completions capability.

Explicitly indicates support for argument autocompletion. Added in 2025-03-26.

Source

pub fn negotiate(requested: &str, supported: &[Self]) -> Option<Self>

Negotiate the best protocol version between requested and supported versions.

Returns the highest version that is:

  1. Less than or equal to the requested version
  2. In the supported versions list

Returns None if no compatible version exists.

§Arguments
  • requested - The version string requested by the client
  • supported - List of versions supported by the server
§Example
use mcpkit_core::protocol_version::ProtocolVersion;

// Server supports all versions, client requests latest
let negotiated = ProtocolVersion::negotiate(
    "2025-11-25",
    ProtocolVersion::ALL
);
assert_eq!(negotiated, Some(ProtocolVersion::V2025_11_25));

// Client requests older version
let negotiated = ProtocolVersion::negotiate(
    "2024-11-05",
    ProtocolVersion::ALL
);
assert_eq!(negotiated, Some(ProtocolVersion::V2024_11_05));

// Client requests unknown future version
let negotiated = ProtocolVersion::negotiate(
    "2026-01-01",
    ProtocolVersion::ALL
);
// Returns latest supported version
assert_eq!(negotiated, Some(ProtocolVersion::V2025_11_25));
Source

pub const fn is_compatible_with(&self, client_version: Self) -> bool

Check if this version can communicate with another version.

Newer servers can communicate with older clients using backward compatibility.

§Arguments
  • client_version - The version the client supports
§Example
use mcpkit_core::protocol_version::ProtocolVersion;

let server = ProtocolVersion::V2025_11_25;

// Server can talk to older clients
assert!(server.is_compatible_with(ProtocolVersion::V2024_11_05));

// Server can talk to same version
assert!(server.is_compatible_with(ProtocolVersion::V2025_11_25));

Trait Implementations§

Source§

impl Clone for ProtocolVersion

Source§

fn clone(&self) -> ProtocolVersion

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProtocolVersion

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ProtocolVersion

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ProtocolVersion

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for ProtocolVersion

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<ProtocolVersion> for String

Source§

fn from(version: ProtocolVersion) -> Self

Converts to this type from the input type.
Source§

impl FromStr for ProtocolVersion

Source§

type Err = VersionParseError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for ProtocolVersion

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for ProtocolVersion

Source§

fn cmp(&self, other: &ProtocolVersion) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for ProtocolVersion

Source§

fn eq(&self, other: &ProtocolVersion) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for ProtocolVersion

Source§

fn partial_cmp(&self, other: &ProtocolVersion) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for ProtocolVersion

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<&str> for ProtocolVersion

Source§

type Error = VersionParseError

The type returned in the event of a conversion error.
Source§

fn try_from(s: &str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<String> for ProtocolVersion

Source§

type Error = VersionParseError

The type returned in the event of a conversion error.
Source§

fn try_from(s: String) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Copy for ProtocolVersion

Source§

impl Eq for ProtocolVersion

Source§

impl StructuralPartialEq for ProtocolVersion

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<D> OwoColorize for D

Source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
Source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
Source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
Source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
Source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
Source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
Source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
Source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
Source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
Source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
Source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
Source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
Source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
Source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
Source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
Source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
Source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
Source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
Source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
Source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
Source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
Source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
Source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
Source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
Source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
Source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
Source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
Source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
Source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
Source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
Source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
Source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
Source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
Source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
Source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
Source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
Source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
Source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
Source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
Source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
Source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
Source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
Source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
Source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
Source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
Source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
Source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
Source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
Source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
Source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
Source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> ToString for T
where T: Display + ?Sized,

§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,