Skip to content

feat!: add support for schema version 2025-03-26 #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ body:
id: version
attributes:
label: Version
description: Specify which version of rust-mcp-schema you're using (e.g., latest, draft, or a specific version number).
description: Specify which version of rust-mcp-schema you're using.
render: text
validations:
required: false
- type: textarea
id: version
attributes:
label: MCP Schema Version
description: Specify which version of mcp schema specification you're using (e.g., latest, draft, 2024_11_05).
description: Specify which version of mcp schema specification you're using.
render: text
validations:
required: false
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ features = ["latest", "schema_utils"]
default = ["latest", "schema_utils"] # Default features

# activates the latest MCP schema version, this will be updated once a new version of schema is published
latest = ["2024_11_05"]
latest = ["2025_03_26"]

# enables the draft version of the mcp schema
draft = []
# enabled mcp schema version 2025_03_26
2025_03_26 = []
# enabled mcp schema version 2024_11_05
2024_11_05 = []
# Enables `schema_utils`, which provides utility types that simplify communication with MCP messages, improving ease of use while reducing potential mistakes ane errors when constructing messages.
Expand Down
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
[<img alt="build status" src="https://img.shields.io/github/actions/workflow/status/rust-mcp-stack/rust-mcp-schema/ci.yml?style=for-the-badge" height="22">
](https://github.com/rust-mcp-stack/rust-mcp-schema/actions/workflows/ci.yml)

A 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, supporting both the `2024_11_05` and `2025_03_26` versions.

The MCP schemas in this repository are [automatically generated](#how-are-schemas-generated) from the official Model Context Protocol, ensuring they are always up-to-date and aligned with the latest official specifications.

---

**Note:** This crate **only** provides an implementation of the MCP schema.

<img align="top" src="assets/rust-mcp-stack-icon.png" width="24" style="border-radius:0.2rem;"> If you are looking for a high-performance, asynchronous toolkit for building MCP servers and clients, checkout [rust-mcp-sdk](https://crates.io/crates/rust-mcp-sdk).
Expand All @@ -27,7 +28,6 @@ Focus on your app's logic while [rust-mcp-sdk](https://crates.io/crates/rust-mcp
- [How can this crate be used?](#how-can-this-crate-be-used)

- [Schema Versions](#schema-versions)
- [Currently available versions](#currently-available-versions)
- [How to switch between different schema versions?](#how-to-switch-between-different-schema-versions)
- [How are Schemas generated?](#how-are-schemas-generated)
- [What is `schema_utils`?](#what-is-schema_utils)
Expand All @@ -46,7 +46,7 @@ Focus on your app's logic while [rust-mcp-sdk](https://crates.io/crates/rust-mcp

- 🧩 Type-safe implementation of the MCP protocol specification.
- πŸ’Ž Auto-generated schemas are always synchronized with the official schema specifications.
- πŸ“œ Includes all schema versions, including draft versions for early adoption.
- πŸ“œ Includes both schema versions : `2024_11_05` and `2025_03_26`.
- πŸ›  Complimentary schema utility module (schema_utils) to boost productivity and ensure development integrity.

## How can this crate be used?
Expand All @@ -68,25 +68,23 @@ For more information on the MCP architecture, refer to the [official documentati

## Schema Versions

This repository provides all versions of the schema, including draft versions, enabling you to prepare and adapt your applications ahead of upcoming official schema releases.

### Currently available versions
This repository provides all versions of the schema, which can be selected using Cargo features:

- [2024_11_05](src/generated_schema/2024_11_05)
- [Draft](src/generated_schema/draft)
- [2025_03_26](src/generated_schema/2025_03_26)

### How to switch between different schema versions?

Each schema version has a corresponding Cargo feature that can be enabled in your project's Cargo.toml.
By default, the latest version of the schema is active.
By default, the version `2024_11_05` of the schema is active.

Example: enable `draft` version of the shema:
Example: enable `2025_03_26` version of the shema:

<!-- x-release-please-start-version -->

```toml
# Cargo.toml
rust-mcp-schema = { version: 0.2.2 , features=["draft"] }
rust-mcp-schema = { version: 0.2.2 , features=["2025_03_26"] }
```

Example: enable `latest` version of the shema:
Expand Down
2 changes: 1 addition & 1 deletion scripts/run_clippy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
COMMON_FEATURES=("schema_utils")

# schema versions features (passed to clippy one at a time)
SCHEMA_VERSION_FEATURES=("2024_11_05" "draft")
SCHEMA_VERSION_FEATURES=("2025_03_26", "2024_11_05")

# space-separated string
COMMON_FEATURES_STR="${COMMON_FEATURES[*]}"
Expand Down
2 changes: 1 addition & 1 deletion scripts/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
COMMON_FEATURES=("schema_utils")

# schema versions features (tested one at a time)
SCHEMA_VERSION_FEATURES=("2024_11_05" "draft")
SCHEMA_VERSION_FEATURES=("2025_03_26", "2024_11_05")

# space-separated string
COMMON_FEATURES_STR="${COMMON_FEATURES[*]}"
Expand Down
30 changes: 15 additions & 15 deletions src/generated_schema.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/// Schema Version : Draft
#[cfg(feature = "draft")]
#[path = "generated_schema/draft/mcp_schema.rs"]
mod schema_draft;
#[cfg(feature = "draft")]
pub use schema_draft::*;

#[cfg(all(feature = "schema_utils", feature = "draft"))]
#[path = "generated_schema/draft/schema_utils.rs"]
pub mod schema_utils;

/// Schema Version : 2024_11_05
#[cfg(feature = "2024_11_05")]
#[cfg(not(feature = "draft"))]
#[path = "generated_schema/2024_11_05/mcp_schema.rs"]
mod schema_2024_11_05;

#[cfg(feature = "2024_11_05")]
#[cfg(not(feature = "draft"))]
pub use schema_2024_11_05::*;

#[cfg(all(feature = "schema_utils", feature = "2024_11_05"))]
#[cfg(not(feature = "draft"))]
#[path = "generated_schema/2024_11_05/schema_utils.rs"]
pub mod schema_utils;

/// Schema Version : 2025_03_26
#[cfg(feature = "2025_03_26")]
#[cfg(not(feature = "2024_11_05"))]
#[path = "generated_schema/2025_03_26/mcp_schema.rs"]
mod schema_2025_03_26;

#[cfg(feature = "2025_03_26")]
#[cfg(not(feature = "2024_11_05"))]
pub use schema_2025_03_26::*;

#[cfg(all(feature = "schema_utils", feature = "2025_03_26"))]
#[cfg(not(feature = "2024_11_05"))]
#[path = "generated_schema/2025_03_26/schema_utils.rs"]
pub mod schema_utils;
6 changes: 3 additions & 3 deletions src/generated_schema/2024_11_05/mcp_schema.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/// ----------------------------------------------------------------------------
/// This file is auto-generated by mcp-schema-gen v0.1.15.
/// This file is auto-generated by mcp-schema-gen v0.1.16.
/// WARNING:
/// It is not recommended to modify this file directly. You are free to
/// modify or extend the implementations as needed, but please do so at your own risk.
///
/// Generated from : <https://github.com/modelcontextprotocol/specification.git>
/// Hash : eb4abdf2bb91e0d5afd94510741eadd416982350
/// Generated at : 2025-03-23 16:07:00
/// Hash : 72516795d9a7aacdcf9b87624feb05229e10c950
/// Generated at : 2025-04-03 19:11:35
/// ----------------------------------------------------------------------------
///
/// MCP Protocol Version
Expand Down
Loading