Expand description
Protocol version management and compatibility checking.
§Protocol Versioning and Compatibility
This module provides comprehensive protocol version management and compatibility checking for MCP implementations.
§Supported Versions
TurboMCP supports two MCP specification versions:
- MCP 2025-06-18 (see [
Version::current]) - Stable, production-ready - MCP 2025-11-25 (see [
Version::draft]) - Draft with experimental features
§Version Negotiation
The MCP protocol uses a client-request, server-decide negotiation model:
use turbomcp_protocol::versioning::{Version, VersionManager};
// Server setup
let manager = VersionManager::with_default_versions();
// Client requests draft features
let client_versions = vec![Version::draft(), Version::current()];
// Server negotiates (picks highest mutually supported version)
let negotiated = manager.negotiate_version(&client_versions);
assert_eq!(negotiated, Some(Version::draft()));§Feature Flags vs Runtime Negotiation
Feature flags (compile-time) control what types are available:
# Enable draft types at compile time
turbomcp-protocol = { version = "2.2", features = ["mcp-draft"] }Runtime negotiation determines what protocol version is used for a session:
ⓘ
use turbomcp_protocol::{InitializeRequest, InitializeResult};
// Client asks for draft
let request = InitializeRequest { protocol_version: "2025-11-25".into(), ..Default::default() };
// Server responds with actual version (may downgrade)
let response = InitializeResult { protocol_version: "2025-06-18".into(), ..Default::default() };Key Principle: Compile with draft features if you might use them, negotiate at runtime based on what the other party supports.
Modules§
- utils
- Utility functions for version management
Structs§
- Version
- Semantic version representation
- Version
Manager - Version manager for handling protocol versions
Enums§
- Version
Compatibility - Version compatibility result
- Version
Error - Version-related errors
- Version
Requirement - Version requirement specification