Skip to content

Commit 6a24f78

Browse files
authored
feat!: implement support for the MCP protocol version 2025-06-18 (#73)
* chore: implement support for mcp 2025-06-18 * fix: update macro version compability * fix: macro syntax * chore: remove unused import * chore: update macro tests * chore: update docs * chore: update readme * chore: update macros dev dependencies
1 parent fc4d664 commit 6a24f78

File tree

40 files changed

+534
-235
lines changed

40 files changed

+534
-235
lines changed

Cargo.lock

Lines changed: 94 additions & 88 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ rust-mcp-sdk = { path = "crates/rust-mcp-sdk", default-features = false }
2121
rust-mcp-macros = { version = "0.4.2", path = "crates/rust-mcp-macros", default-features = false }
2222

2323
# External crates
24-
rust-mcp-schema = { version = "0.6", default-features = false }
24+
rust-mcp-schema = { version = "0.7", default-features = false }
25+
2526

2627
futures = { version = "0.3" }
2728
tokio = { version = "1.4", features = ["full"] }

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ Focus on your app's logic while **rust-mcp-sdk** takes care of the rest!
1717
**rust-mcp-sdk** provides the necessary components for developing both servers and clients in the MCP ecosystem.
1818
Leveraging the [rust-mcp-schema](https://github.com/rust-mcp-stack/rust-mcp-schema) crate simplifies the process of building robust and reliable MCP servers and clients, ensuring consistency and minimizing errors in data handling and message processing.
1919

20+
21+
**rust-mcp-sdk** supports all three official versions of the MCP protocol.
22+
By default, it uses the **2025-06-18** version, but earlier versions can be enabled via Cargo features.
23+
24+
25+
2026
This project currently supports following transports:
2127
- **stdio** (Standard Input/Output)
2228
- **sse** (Server-Sent Events).
@@ -63,6 +69,7 @@ async fn main() -> SdkResult<()> {
6369
server_info: Implementation {
6470
name: "Hello World MCP Server".to_string(),
6571
version: "0.1.0".to_string(),
72+
title: Some("Hello World MCP Server".to_string()),
6673
},
6774
capabilities: ServerCapabilities {
6875
// indicates that server support mcp tools
@@ -106,6 +113,7 @@ let server_details = InitializeResult {
106113
server_info: Implementation {
107114
name: "Hello World MCP Server".to_string(),
108115
version: "0.1.0".to_string(),
116+
title: Some("Hello World MCP Server".to_string()),
109117
},
110118
capabilities: ServerCapabilities {
111119
// indicates that server support mcp tools
@@ -167,10 +175,7 @@ impl ServerHandler for MyServerHandler {
167175
async fn handle_call_tool_request( &self, request: CallToolRequest, runtime: &dyn McpServer, ) -> Result<CallToolResult, CallToolError> {
168176

169177
if request.tool_name() == SayHelloTool::tool_name() {
170-
Ok(CallToolResult::text_content(
171-
"Hello World!".to_string(),
172-
None,
173-
))
178+
Ok( CallToolResult::text_content( vec![TextContent::from("Hello World!".to_string())] ))
174179
} else {
175180
Err(CallToolError::unknown_tool(request.tool_name().to_string()))
176181
}
@@ -301,7 +306,8 @@ The `rust-mcp-sdk` crate provides several features that can be enabled or disabl
301306

302307
#### MCP Protocol Versions with Corresponding Features
303308

304-
- `2025_03_26` : Activates MCP Protocol version 2025-03-26 (enabled by default)
309+
- `2025_06_18` : Activates MCP Protocol version 2025-06-18 (enabled by default)
310+
- `2025_03_26` : Activates MCP Protocol version 2025-03-26
305311
- `2024_11_05` : Activates MCP Protocol version 2024-11-05
306312

307313
> Note: MCP protocol versions are mutually exclusive—only one can be active at any given time.

crates/rust-mcp-macros/Cargo.toml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ proc-macro2 = "1.0"
2323

2424
[dev-dependencies]
2525
rust-mcp-schema = { workspace = true, default-features = false }
26+
rust-mcp-sdk = { workspace = true, default-features = false, features = [
27+
"server",
28+
"client",
29+
] }
2630

2731
[lints]
2832
workspace = true
@@ -33,13 +37,27 @@ proc-macro = true
3337

3438
[features]
3539
# defalt features
36-
default = ["2025_03_26"] # Default features
40+
default = ["2025_06_18"] # Default features
3741

3842
# activates the latest MCP schema version, this will be updated once a new version of schema is published
39-
latest = ["2025_03_26"]
40-
41-
# enabled mcp schema version 2025_03_26
42-
2025_03_26 = ["rust-mcp-schema/2025_03_26","rust-mcp-schema/schema_utils"]
43-
# enabled mcp schema version 2024_11_05
44-
2024_11_05 = ["rust-mcp-schema/2024_11_05","rust-mcp-schema/schema_utils"]
43+
latest = ["2025_06_18"]
44+
45+
# enables mcp schema version 2025_06_18
46+
2025_06_18 = [
47+
"rust-mcp-schema/2025_06_18",
48+
"rust-mcp-schema/schema_utils",
49+
"rust-mcp-sdk/2025_06_18",
50+
]
51+
# enables mcp schema version 2025_03_26
52+
2025_03_26 = [
53+
"rust-mcp-schema/2025_03_26",
54+
"rust-mcp-schema/schema_utils",
55+
"rust-mcp-sdk/2025_03_26",
56+
]
57+
# enables mcp schema version 2024_11_05
58+
2024_11_05 = [
59+
"rust-mcp-schema/2024_11_05",
60+
"rust-mcp-schema/schema_utils",
61+
"rust-mcp-sdk/2024_11_05",
62+
]
4563
sdk = []

crates/rust-mcp-macros/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,31 @@ The `mcp_tool` macro generates an implementation for the annotated struct that i
1212

1313
- `name` - The name of the tool (required, non-empty string).
1414
- `description` - A description of the tool (required, non-empty string).
15+
- `title` - An optional human-readable and easily understood title.
16+
- `meta` - An optional JSON string that provides additional metadata for the tool.
17+
- `destructive_hint` – Optional boolean, indicates whether the tool may make destructive changes to its environment.
18+
- `idempotent_hint` – Optional boolean, indicates whether repeated calls with the same input have the same effect.
19+
- `open_world_hint` – Optional boolean, indicates whether the tool can interact with external or unknown entities.
20+
- `read_only_hint` – Optional boolean, indicates whether the tool makes no modifications to its environment.
21+
22+
1523

1624
## Usage Example
1725

1826
```rust
1927
#[mcp_tool(
2028
name = "write_file",
29+
title = "Write File Tool"
2130
description = "Create a new file or completely overwrite an existing file with new content."
2231
destructive_hint = false
2332
idempotent_hint = false
2433
open_world_hint = false
2534
read_only_hint = false
35+
meta = r#"{
36+
"key" : "value",
37+
"string_meta" : "meta value",
38+
"numeric_meta" : 15
39+
}"#
2640
)]
2741
#[derive(rust_mcp_macros::JsonSchema)]
2842
pub struct WriteFileTool {
@@ -38,8 +52,15 @@ fn main() {
3852

3953
let tool: rust_mcp_schema::Tool = WriteFileTool::tool();
4054
assert_eq!(tool.name, "write_file");
55+
assert_eq!(tool.title.as_ref().unwrap(), "Write File Tool");
4156
assert_eq!( tool.description.unwrap(),"Create a new file or completely overwrite an existing file with new content.");
4257

58+
let meta: &Map<String, Value> = tool.meta.as_ref().unwrap();
59+
assert_eq!(
60+
meta.get("key").unwrap(),
61+
&Value::String("value".to_string())
62+
);
63+
4364
let schema_properties = tool.input_schema.properties.unwrap();
4465
assert_eq!(schema_properties.len(), 2);
4566
assert!(schema_properties.contains_key("path"));

0 commit comments

Comments
 (0)