You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An official rust Model Context Protocol SDK implementation with tokio async runtime.
13
13
14
+
15
+
This repository contains the following crates:
16
+
17
+
-[rmcp](crates/rmcp): The core crate providing the RMCP protocol implementation( If you want to get more information, please visit [rmcp](crates/rmcp/README.md))
18
+
-[rmcp-macros](crates/rmcp-macros): A procedural macro crate for generating RMCP tool implementations(If you want to get more information, please visit [rmcp-macros](crates/rmcp-macros/README.md))
[`IntoTransport`] is a helper trait that implicitly convert a type into a transport type.
61
-
62
-
These types is automatically implemented [`IntoTransport`] trait
63
-
1. A type that already implement both [`futures::Sink`] and [`futures::Stream`] trait, or a tuple `(Tx, Rx)` where `Tx` is [`futures::Sink`] and `Rx` is [`futures::Stream`].
64
-
2. A type that implement both [`tokio::io::AsyncRead`] and [`tokio::io::AsyncWrite`] trait. or a tuple `(R, W)` where `R` is [`tokio::io::AsyncRead`] and `W` is [`tokio::io::AsyncWrite`].
65
-
3. A type that implement [Worker](`worker::Worker`) trait.
66
-
4. A type that implement [`Transport`] trait.
67
-
68
-
For example, you can see how we build a transport through TCP stream or http upgrade so easily. [examples](examples/README.md)
69
64
</details>
70
65
71
66
<details>
72
-
<summary>2. Build a service</summary>
67
+
<summary>Build a service</summary>
73
68
74
69
You can easily build a service by using [`ServerHandler`](crates/rmcp/src/handler/server.rs) or [`ClientHandler`](crates/rmcp/src/handler/client.rs).
75
70
@@ -79,7 +74,7 @@ let service = common::counter::Counter::new();
79
74
</details>
80
75
81
76
<details>
82
-
<summary>3. Serve them together</summary>
77
+
<summary>Start the server</summary>
83
78
84
79
```rust, ignore
85
80
// this call will finish the initialization process
@@ -88,7 +83,7 @@ let server = service.serve(transport).await?;
88
83
</details>
89
84
90
85
<details>
91
-
<summary>4. Interact with the server</summary>
86
+
<summary>Interact with the server</summary>
92
87
93
88
Once the server is initialized, you can send requests or notifications:
`rmcp-macros` is a procedural macro library for the Rust Model Context Protocol (RMCP) SDK, providing macros that facilitate the development of RMCP applications.
4
+
5
+
## Features
6
+
7
+
This library primarily provides the following macros:
8
+
9
+
-`#[tool]`: Used to mark functions as RMCP tools, automatically generating necessary metadata and invocation mechanisms
0 commit comments