Skip to content

Commit 819d113

Browse files
authored
feat: upgrade to rust-mcp-schema v0.4.0 (#21)
* feat: upgrade to rust-mcp-schema v0.4.0 * chore: updated crate readme file
1 parent c0d05ab commit 819d113

File tree

9 files changed

+21
-20
lines changed

9 files changed

+21
-20
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ rust-mcp-sdk = { path = "crates/rust-mcp-sdk", default-features = false }
1717
rust-mcp-macros = { version = "0.2.0", path = "crates/rust-mcp-macros" }
1818

1919
# External crates
20-
rust-mcp-schema = { version = "0.3" }
20+
rust-mcp-schema = { version = "0.4" }
2121
futures = { version = "0.3" }
2222
tokio = { version = "1.4", features = ["full"] }
2323
serde = { version = "1.0", features = ["derive", "serde_derive"] }

crates/rust-mcp-sdk/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
[<img alt="build status" src="https://img.shields.io/github/actions/workflow/status/rust-mcp-stack/rust-mcp-sdk/ci.yml?style=for-the-badge" height="22">
1010
](https://github.com/rust-mcp-stack/rust-mcp-sdk/actions/workflows/ci.yml)
1111
[<img alt="Hello World MCP Server" src="https://img.shields.io/badge/Example-Hello%20World%20MCP-0286ba?style=for-the-badge&logo=rust" height="22">
12-
](examples/hello-world-mcp-server)
12+
](https://github.com/rust-mcp-stack/rust-mcp-sdk/tree/main/examples/hello-world-mcp-server#hello-world-mcp-server)
13+
1314

1415
A high-performance, asynchronous toolkit for building MCP servers and clients.
1516
Focus on your app's logic while **rust-mcp-sdk** takes care of the rest!

crates/rust-mcp-sdk/src/mcp_traits/mcp_client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::sync::Arc;
33
use async_trait::async_trait;
44
use rust_mcp_schema::{
55
schema_utils::{
6-
self, MCPMessage, MessageFromClient, NotificationFromClient, RequestFromClient,
6+
self, McpMessage, MessageFromClient, NotificationFromClient, RequestFromClient,
77
ResultFromServer, ServerMessage,
88
},
99
CallToolRequest, CallToolRequestParams, CallToolResult, CompleteRequest, CompleteRequestParams,

crates/rust-mcp-sdk/src/mcp_traits/mcp_server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use async_trait::async_trait;
22
use rust_mcp_schema::{
33
schema_utils::{
4-
ClientMessage, MCPMessage, MessageFromServer, NotificationFromServer, RequestFromServer,
4+
ClientMessage, McpMessage, MessageFromServer, NotificationFromServer, RequestFromServer,
55
ResultFromClient,
66
},
77
CallToolRequest, CreateMessageRequest, CreateMessageRequestParams, CreateMessageResult,

crates/rust-mcp-transport/src/mcp_stream.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{
44
IoStream,
55
};
66
use futures::Stream;
7-
use rust_mcp_schema::{schema_utils::RPCMessage, RequestId, RpcError};
7+
use rust_mcp_schema::{schema_utils::RpcMessage, RequestId, RpcError};
88
use std::{
99
collections::HashMap,
1010
pin::Pin,
@@ -42,7 +42,7 @@ impl MCPStream {
4242
IoStream,
4343
)
4444
where
45-
R: RPCMessage + Clone + Send + Sync + serde::de::DeserializeOwned + 'static,
45+
R: RpcMessage + Clone + Send + Sync + serde::de::DeserializeOwned + 'static,
4646
{
4747
let (tx, rx) = tokio::sync::broadcast::channel::<R>(CHANNEL_CAPACITY);
4848

@@ -79,7 +79,7 @@ impl MCPStream {
7979
mut shutdown_rx: Receiver<bool>,
8080
) -> JoinHandle<Result<(), TransportError>>
8181
where
82-
R: RPCMessage + Clone + Send + Sync + serde::de::DeserializeOwned + 'static,
82+
R: RpcMessage + Clone + Send + Sync + serde::de::DeserializeOwned + 'static,
8383
{
8484
tokio::spawn(async move {
8585
let mut lines_stream = BufReader::new(readable).lines();

crates/rust-mcp-transport/src/message_dispatcher.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use async_trait::async_trait;
22
use rust_mcp_schema::schema_utils::{
3-
self, ClientMessage, FromMessage, MCPMessage, MessageFromClient, MessageFromServer,
3+
self, ClientMessage, FromMessage, McpMessage, MessageFromClient, MessageFromServer,
44
ServerMessage,
55
};
66
use rust_mcp_schema::{RequestId, RpcError};
@@ -69,7 +69,7 @@ impl<R> MessageDispatcher<R> {
6969
/// An `Option<RequestId>`: `Some` for requests or responses/errors, `None` for notifications.
7070
fn request_id_for_message(
7171
&self,
72-
message: &impl MCPMessage,
72+
message: &impl McpMessage,
7373
request_id: Option<RequestId>,
7474
) -> Option<RequestId> {
7575
// we need to produce next request_id for requests

crates/rust-mcp-transport/src/stdio.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use async_trait::async_trait;
22
use futures::Stream;
3-
use rust_mcp_schema::schema_utils::{MCPMessage, RPCMessage};
3+
use rust_mcp_schema::schema_utils::{McpMessage, RpcMessage};
44
use rust_mcp_schema::RequestId;
55
use std::collections::HashMap;
66
use std::pin::Pin;
@@ -114,8 +114,8 @@ impl StdioTransport {
114114
#[async_trait]
115115
impl<R, S> Transport<R, S> for StdioTransport
116116
where
117-
R: RPCMessage + Clone + Send + Sync + serde::de::DeserializeOwned + 'static,
118-
S: MCPMessage + Clone + Send + Sync + serde::Serialize + 'static,
117+
R: RpcMessage + Clone + Send + Sync + serde::de::DeserializeOwned + 'static,
118+
S: McpMessage + Clone + Send + Sync + serde::Serialize + 'static,
119119
{
120120
/// Starts the transport, initializing streams and the message dispatcher.
121121
///

crates/rust-mcp-transport/src/transport.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::pin::Pin;
22

33
use async_trait::async_trait;
4-
use rust_mcp_schema::{schema_utils::MCPMessage, RequestId};
4+
use rust_mcp_schema::{schema_utils::McpMessage, RequestId};
55

66
use futures::Stream;
77

@@ -44,15 +44,15 @@ impl Default for TransportOptions {
4444
///It is intended to be implemented by types that send messages in the MCP protocol, such as servers or clients.
4545
///
4646
/// The `McpDispatch` trait requires two associated types:
47-
/// - `R`: The type of the response, which must implement the `MCPMessage` trait and be capable of deserialization.
47+
/// - `R`: The type of the response, which must implement the `McpMessage` trait and be capable of deserialization.
4848
/// - `S`: The type of the message to send, which must be serializable and cloneable.
4949
///
5050
/// Both associated types `R` and `S` must be `Send`, `Sync`, and `'static` to ensure they can be used
5151
/// safely in an asynchronous context and across threads.
5252
///
5353
/// # Associated Types
5454
///
55-
/// - `R`: The response type, which must implement the `MCPMessage` trait, be `Clone`, `Send`, `Sync`, and
55+
/// - `R`: The response type, which must implement the `McpMessage` trait, be `Clone`, `Send`, `Sync`, and
5656
/// be deserializable (`DeserializeOwned`).
5757
/// - `S`: The type of the message to send, which must be `Clone`, `Send`, `Sync`, and serializable (`Serialize`).
5858
///
@@ -78,7 +78,7 @@ impl Default for TransportOptions {
7878
#[async_trait]
7979
pub trait McpDispatch<R, S>: Send + Sync + 'static
8080
where
81-
R: MCPMessage + Clone + Send + Sync + serde::de::DeserializeOwned + 'static,
81+
R: McpMessage + Clone + Send + Sync + serde::de::DeserializeOwned + 'static,
8282
S: Clone + Send + Sync + serde::Serialize + 'static,
8383
{
8484
/// Sends a raw message represented by type `S` and optionally includes a `request_id`.
@@ -94,14 +94,14 @@ where
9494
/// and handling I/O operations.
9595
///
9696
/// The `Transport` trait requires three associated types:
97-
/// - `R`: The message type to send, which must implement the `MCPMessage` trait.
97+
/// - `R`: The message type to send, which must implement the `McpMessage` trait.
9898
/// - `S`: The message type to send.
9999
/// - `M`: The type of message that we expect to receive as a response to the sent message.
100100
///
101101
#[async_trait]
102102
pub trait Transport<R, S>: Send + Sync + 'static
103103
where
104-
R: MCPMessage + Clone + Send + Sync + serde::de::DeserializeOwned + 'static,
104+
R: McpMessage + Clone + Send + Sync + serde::de::DeserializeOwned + 'static,
105105
S: Clone + Send + Sync + serde::Serialize + 'static,
106106
{
107107
async fn start(

0 commit comments

Comments
 (0)