refactor: Transport trait and worker transport, and streamable http client with those new features. (#167)
* refactor: a transport trait and streamable http client * test: test with js streamable http server * refactor: separate sse stream connection * fix(test): streamable http client test with js * fix(test): wait longer time for js server startup
This commit is contained in:
parent
01eedb7770
commit
9a771fb157
1 changed files with 2761 additions and 1315 deletions
|
|
@ -1,3 +1,5 @@
|
|||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
#![cfg_attr(docsrs, allow(unused_attributes))]
|
||||
//! The official Rust SDK for the Model Context Protocol (MCP).
|
||||
//!
|
||||
//! The MCP is a protocol that allows AI assistants to communicate with other
|
||||
|
|
@ -93,16 +95,22 @@ pub use error::Error;
|
|||
/// Basic data types in MCP specification
|
||||
pub mod model;
|
||||
#[cfg(any(feature = "client", feature = "server"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "client", feature = "server"))))]
|
||||
pub mod service;
|
||||
#[cfg(feature = "client")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "client")))]
|
||||
pub use handler::client::ClientHandler;
|
||||
#[cfg(feature = "server")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "server")))]
|
||||
pub use handler::server::ServerHandler;
|
||||
#[cfg(any(feature = "client", feature = "server"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(any(feature = "client", feature = "server"))))]
|
||||
pub use service::{Peer, Service, ServiceError, ServiceExt};
|
||||
#[cfg(feature = "client")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "client")))]
|
||||
pub use service::{RoleClient, serve_client};
|
||||
#[cfg(feature = "server")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "server")))]
|
||||
pub use service::{RoleServer, serve_server};
|
||||
|
||||
pub mod handler;
|
||||
|
|
@ -110,12 +118,17 @@ pub mod transport;
|
|||
|
||||
// re-export
|
||||
#[cfg(all(feature = "macros", feature = "server"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(all(feature = "macros", feature = "server"))))]
|
||||
pub use paste::paste;
|
||||
#[cfg(all(feature = "macros", feature = "server"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(all(feature = "macros", feature = "server"))))]
|
||||
pub use rmcp_macros::tool;
|
||||
#[cfg(all(feature = "macros", feature = "server"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(all(feature = "macros", feature = "server"))))]
|
||||
pub use schemars;
|
||||
#[cfg(feature = "macros")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
|
||||
pub use serde;
|
||||
#[cfg(feature = "macros")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
|
||||
pub use serde_json;
|
||||
|
|
|
|||
Loading…
Reference in a new issue