What is Model Context Protocol (MCP) Schema for Rust?
A type-safe Rust implementation of the official Model Context Protocol (MCP) schema, supporting all official MCP protocol versions (2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05, and draft). The schemas are automatically generated from the official MCP specification, ensuring alignment with the latest standards. This crate is intended for developers building MCP servers or clients in Rust who need strongly typed message structures.
How to use Model Context Protocol (MCP) Schema for Rust?
Add the crate to your Cargo.toml with a specific schema version feature (e.g., features = ["2025_06_18"]). The default feature selects the latest version. Use the provided structs and enums with serde for serialization/deserialization. Optionally enable schema_utils (default) to access ClientMessage and ServerMessage types for stronger type safety.
Key features of Model Context Protocol (MCP) Schema for Rust
- Type-safe implementation of the MCP protocol specification
- Auto-generated schemas synced with official specifications
- Supports all released versions plus a draft version
- Complementary
schema_utils module for improved developer productivity
- Simple feature flags to switch between schema versions
Use cases of Model Context Protocol (MCP) Schema for Rust
- Build an MCP server in Rust with strongly typed request/response handling
- Develop an MCP client that correctly parses and constructs protocol messages
- Integrate MCP message formatting into AI-powered IDEs or chat interfaces
- Experiment with upcoming protocol changes using the draft schema version
コメント