Rust MCP Schema

v1.0.0Developer Toolsstable

A type-safe implementation of the official Model Context Protocol (MCP) schema in Rust.

crates-iomcp-clientmcp-hostmcp-servermodel-context-protocol
Share:
75
Stars
0
Downloads
0
Weekly
0/5

What is Rust MCP Schema?

Rust MCP Schema is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to type-safe implementation of the official model context protocol (mcp) schema in rust.

A type-safe implementation of the official Model Context Protocol (MCP) schema in Rust.

This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • A type-safe implementation of the official Model Context Pro

Use Cases

Use type-safe Rust implementation of Model Context Protocol schema.
rust-mcp-stack

Maintainer

LicenseMIT
Languagerust
Versionv1.0.0
UpdatedMay 18, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx rust-mcp-schema

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Rust MCP Schema

rust-mcp-schema is a Rust crate that provides a complete, type-safe implementation of the official Model Context Protocol schema, enabling Rust developers to build MCP servers and clients without writing their own serialization or type definitions. It supports multiple MCP protocol versions — 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25, and draft — selectable via Cargo feature flags, and ships a schema_utils module for enhanced ergonomics when deserializing ClientMessage and ServerMessage types. It is a foundational library crate used by higher-level frameworks like rust-mcp-sdk, not a standalone MCP server you run directly.

Prerequisites

  • Rust toolchain (stable, 1.70+) and Cargo installed
  • A Rust project (new or existing) where you are building an MCP server or client
  • Basic familiarity with Rust's serde serialization ecosystem
  • An MCP-compatible client for testing your resulting server (Claude Desktop, Claude Code, etc.)
1

Add rust-mcp-schema to your Cargo.toml

Add the crate as a dependency in your Cargo.toml. By default it includes the latest stable MCP schema version (2025-11-25) and the schema_utils module.

[dependencies]
rust-mcp-schema = "0.10.1"
2

Select a specific MCP protocol version via feature flags

If you need a specific protocol version, disable default features and enable the version you target. This is important for compatibility with specific MCP clients.

[dependencies]
rust-mcp-schema = { version = "0.10.1", default-features = false, features = ["2025_06_18"] }
3

Import and use the schema types in your server or client

Import ClientMessage and ServerMessage from the crate to handle incoming and outgoing MCP protocol messages with full type safety and serde deserialization.

use rust_mcp_schema::{ClientMessage, ClientRequest, schema_utils::ResultFromServer};
use std::str::FromStr;

let message = ClientMessage::from_str(&message_payload)?;
if let ClientMessage::Request(req) = message {
    if let ClientRequest::InitializeRequest(init) = req {
        // Handle initialization
    }
}
4

Implement your MCP server logic using the schema types

Use the typed request and response structs to implement tool handlers, resource providers, and prompt handlers. The schema_utils module provides helper methods to construct valid ServerMessage responses.

5

Build and test your MCP server

Compile your project and test it against an MCP client. Use cargo test for unit tests and connect a real client like Claude Desktop for integration testing.

cargo build
cargo test

Rust MCP Schema Examples

Client configuration

Example claude_desktop_config.json for an MCP server you have built using rust-mcp-schema. Replace the command with your compiled binary path.

{
  "mcpServers": {
    "my-rust-mcp-server": {
      "command": "/path/to/target/release/my-rust-mcp-server"
    }
  }
}

Prompts to try

After building your MCP server with rust-mcp-schema, the prompts depend on the tools you implement. These generic prompts verify the protocol handshake and tool listing.

- "What tools does this MCP server expose?"
- "Initialize a connection to the Rust MCP server and list its capabilities."
- "Call the [your-tool-name] tool with these parameters: ..."
- "What MCP protocol version is this server using?"

Troubleshooting Rust MCP Schema

Compilation error: feature '2025_06_18' not found

Check the crate version. Feature flag names changed across releases. Run cargo search rust-mcp-schema to confirm the latest version and review the Cargo.toml features section in the repository for the exact feature flag names supported by your installed version.

Deserialization fails on incoming MCP messages

Ensure you are using ClientMessage::from_str() rather than serde_json::from_str() directly, as ClientMessage applies the schema_utils discriminator logic. Verify the raw message string is valid JSON and matches the protocol version your feature flag selects.

Type mismatch errors when upgrading crate versions

rust-mcp-schema tracks the evolving MCP specification, so types may change between minor versions as the protocol is updated. Pin to a specific version in Cargo.toml (e.g., version = "=0.10.1") and upgrade intentionally, reviewing the changelog for breaking type changes.

Frequently Asked Questions about Rust MCP Schema

What is Rust MCP Schema?

Rust MCP Schema is a Model Context Protocol (MCP) server that type-safe implementation of the official model context protocol (mcp) schema in rust. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Rust MCP Schema?

Follow the installation instructions on the Rust MCP Schema GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Rust MCP Schema?

Rust MCP Schema works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Rust MCP Schema free to use?

Yes, Rust MCP Schema is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Developer Tools MCP Servers

Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "rust-mcp-schema": { "command": "npx", "args": ["-y", "rust-mcp-schema"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Rust MCP Schema?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides