rust-mcp-schema logo

rust-mcp-schema

by rust-mcp-stack

A type-safe implementation of the official Model Context Protocol (MCP) schema in Rust, supporting both the `2024_11_05` and `2025_03_26` versions. The schemas are automatically generated from the official Model Context Protocol, ensuring they are always up-to-date.

View on GitHub

Last updated: N/A

What is rust-mcp-schema?

This crate provides a Rust implementation of the official Model Context Protocol (MCP) schema. MCP is an open protocol that enables seamless integration between LLM applications and external data sources and tools.

How to use rust-mcp-schema?

This crate can be used for developing an MCP Server or MCP Client in Rust. It includes the schema with serialization/deserialization support via serde_json, along with a minimal implementation of the necessary traits for structs and enums. You can select different schema versions using Cargo features.

Key features of rust-mcp-schema

  • Type-safe implementation of the MCP protocol specification.

  • Auto-generated schemas synchronized with the official schema specifications.

  • Includes both schema versions: 2024_11_05 and 2025_03_26.

  • Complimentary schema utility module (schema_utils) to boost productivity and ensure development integrity.

Use cases of rust-mcp-schema

  • Building AI-powered IDEs.

  • Enhancing chat interfaces.

  • Creating custom AI workflows.

  • Developing MCP servers and clients in Rust.

FAQ from rust-mcp-schema

What is Model Context Protocol (MCP)?

MCP is an open protocol that enables seamless integration between LLM applications and external data sources and tools.

What does this crate provide?

This crate provides a Rust implementation of the official Model Context Protocol (MCP) schema.

How are the schemas generated?

Schemas are generated from the official schema.ts and schema.json files available in the original Model Context Protocol (MCP) repository.

What is schema_utils?

schema_utils divides JsonrpcMessage into two distinct categories: ClientMessage and ServerMessage. Each category includes the relevant types for both standard and custom messages to enhance type safety and usability.

How do I switch between different schema versions?

Each schema version has a corresponding Cargo feature that can be enabled in your project's Cargo.toml.

rust-mcp-schema - MCP Server | MCP Directory