pub enum ProtocolVersion {
V2025_06_18,
V2025_11_25,
Draft,
Unknown(String),
}Expand description
MCP protocol version.
Represents a known or unknown MCP specification version. Known versions get
first-class enum variants; unknown version strings are preserved via
Unknown for forward compatibility (e.g. proxies
and protocol analyzers that handle arbitrary versions).
§Ordering
Known versions are ordered by specification release date.
Unknown sorts after all known versions.
§Serialization
Serializes to/from the canonical version string (e.g. "2025-11-25").
Variants§
V2025_06_18
MCP specification 2025-06-18.
V2025_11_25
MCP specification 2025-11-25 (current stable).
Draft
Draft specification (DRAFT-2026-v1).
Unknown(String)
Unknown / future protocol version (preserved for forward compatibility).
Implementations§
Source§impl ProtocolVersion
impl ProtocolVersion
Sourcepub const LATEST: ProtocolVersion = Self::V2025_11_25
pub const LATEST: ProtocolVersion = Self::V2025_11_25
The latest stable protocol version.
Sourcepub const STABLE: &'static [ProtocolVersion]
pub const STABLE: &'static [ProtocolVersion]
Sourcepub fn is_draft(&self) -> bool
pub fn is_draft(&self) -> bool
Whether this is the named draft specification (DRAFT-2026-v1).
Note: only the named DRAFT-2026-v1 enum variant returns true. Future or other
draft strings (e.g. DRAFT-2026-v2) are routed to Unknown(_) by From<&str>
and will not match. Use Self::is_any_draft to detect any string starting with
DRAFT-.
Sourcepub fn is_any_draft(&self) -> bool
pub fn is_any_draft(&self) -> bool
Whether this version is any draft — the named DRAFT-2026-v1 variant or
an Unknown(s) whose string starts with DRAFT-.
Trait Implementations§
Source§impl Clone for ProtocolVersion
impl Clone for ProtocolVersion
Source§fn clone(&self) -> ProtocolVersion
fn clone(&self) -> ProtocolVersion
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProtocolVersion
impl Debug for ProtocolVersion
Source§impl Default for ProtocolVersion
impl Default for ProtocolVersion
Source§fn default() -> ProtocolVersion
fn default() -> ProtocolVersion
Source§impl<'de> Deserialize<'de> for ProtocolVersion
impl<'de> Deserialize<'de> for ProtocolVersion
Source§fn deserialize<D>(
deserializer: D,
) -> Result<ProtocolVersion, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<ProtocolVersion, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl Display for ProtocolVersion
impl Display for ProtocolVersion
Source§impl From<&str> for ProtocolVersion
impl From<&str> for ProtocolVersion
Source§fn from(s: &str) -> ProtocolVersion
fn from(s: &str) -> ProtocolVersion
Source§impl From<String> for ProtocolVersion
impl From<String> for ProtocolVersion
Source§fn from(s: String) -> ProtocolVersion
fn from(s: String) -> ProtocolVersion
Source§impl Hash for ProtocolVersion
impl Hash for ProtocolVersion
Source§impl Ord for ProtocolVersion
impl Ord for ProtocolVersion
Source§fn cmp(&self, other: &ProtocolVersion) -> Ordering
fn cmp(&self, other: &ProtocolVersion) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq<&str> for ProtocolVersion
impl PartialEq<&str> for ProtocolVersion
Source§impl PartialEq<ProtocolVersion> for &str
impl PartialEq<ProtocolVersion> for &str
Source§fn eq(&self, other: &ProtocolVersion) -> bool
fn eq(&self, other: &ProtocolVersion) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialEq for ProtocolVersion
impl PartialEq for ProtocolVersion
Source§fn eq(&self, other: &ProtocolVersion) -> bool
fn eq(&self, other: &ProtocolVersion) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for ProtocolVersion
impl PartialOrd for ProtocolVersion
Source§impl Serialize for ProtocolVersion
impl Serialize for ProtocolVersion
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl Eq for ProtocolVersion
impl StructuralPartialEq for ProtocolVersion
Auto Trait Implementations§
impl Freeze for ProtocolVersion
impl RefUnwindSafe for ProtocolVersion
impl Send for ProtocolVersion
impl Sync for ProtocolVersion
impl Unpin for ProtocolVersion
impl UnsafeUnpin for ProtocolVersion
impl UnwindSafe for ProtocolVersion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.