From 1b7b01942264cde116beca7ba2380327f0034cf9 Mon Sep 17 00:00:00 2001 From: Evian-Zhang Date: Sat, 14 Feb 2026 09:56:09 +0800 Subject: [PATCH 1/3] fix: Remove unnecessary doc-cfg --- crates/rmcp/src/handler.rs | 2 -- crates/rmcp/src/lib.rs | 12 ----------- crates/rmcp/src/model.rs | 1 - crates/rmcp/src/service.rs | 6 ------ crates/rmcp/src/transport.rs | 21 ++++--------------- crates/rmcp/src/transport/async_rw.rs | 4 ++-- crates/rmcp/src/transport/common.rs | 3 --- crates/rmcp/src/transport/common/auth.rs | 1 - crates/rmcp/src/transport/common/reqwest.rs | 1 - .../src/transport/streamable_http_client.rs | 1 - .../src/transport/streamable_http_server.rs | 2 -- 11 files changed, 6 insertions(+), 48 deletions(-) diff --git a/crates/rmcp/src/handler.rs b/crates/rmcp/src/handler.rs index c2b9737b..6b848cd2 100644 --- a/crates/rmcp/src/handler.rs +++ b/crates/rmcp/src/handler.rs @@ -1,6 +1,4 @@ #[cfg(feature = "client")] -#[cfg_attr(docsrs, doc(cfg(feature = "client")))] pub mod client; #[cfg(feature = "server")] -#[cfg_attr(docsrs, doc(cfg(feature = "server")))] pub mod server; diff --git a/crates/rmcp/src/lib.rs b/crates/rmcp/src/lib.rs index 7a2ea49f..1050e6aa 100644 --- a/crates/rmcp/src/lib.rs +++ b/crates/rmcp/src/lib.rs @@ -9,25 +9,18 @@ pub use error::{Error, ErrorData, RmcpError}; /// 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(feature = "server")] -#[cfg_attr(docsrs, doc(cfg(feature = "server")))] pub use handler::server::wrapper::Json; #[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; @@ -36,17 +29,12 @@ pub mod transport; // re-export #[cfg(all(feature = "macros", feature = "server"))] -#[cfg_attr(docsrs, doc(cfg(all(feature = "macros", feature = "server"))))] pub use pastey::paste; #[cfg(all(feature = "macros", feature = "server"))] -#[cfg_attr(docsrs, doc(cfg(all(feature = "macros", feature = "server"))))] pub use rmcp_macros::*; #[cfg(any(feature = "macros", feature = "server"))] -#[cfg_attr(docsrs, doc(cfg(any(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; diff --git a/crates/rmcp/src/model.rs b/crates/rmcp/src/model.rs index 3832271a..a93f98d1 100644 --- a/crates/rmcp/src/model.rs +++ b/crates/rmcp/src/model.rs @@ -43,7 +43,6 @@ pub fn object(value: serde_json::Value) -> JsonObject { /// Use this macro just like [`serde_json::json!`] #[cfg(feature = "macros")] -#[cfg_attr(docsrs, doc(cfg(feature = "macros")))] #[macro_export] macro_rules! object { ({$($tt:tt)*}) => { diff --git a/crates/rmcp/src/service.rs b/crates/rmcp/src/service.rs index e0fd7642..3ad28b78 100644 --- a/crates/rmcp/src/service.rs +++ b/crates/rmcp/src/service.rs @@ -11,23 +11,17 @@ use crate::{ transport::{DynamicTransportError, IntoTransport, Transport}, }; #[cfg(feature = "client")] -#[cfg_attr(docsrs, doc(cfg(feature = "client")))] mod client; #[cfg(feature = "client")] -#[cfg_attr(docsrs, doc(cfg(feature = "client")))] pub use client::*; #[cfg(feature = "server")] -#[cfg_attr(docsrs, doc(cfg(feature = "server")))] mod server; #[cfg(feature = "server")] -#[cfg_attr(docsrs, doc(cfg(feature = "server")))] pub use server::*; #[cfg(feature = "tower")] -#[cfg_attr(docsrs, doc(cfg(feature = "tower")))] mod tower; use tokio_util::sync::{CancellationToken, DropGuard}; #[cfg(feature = "tower")] -#[cfg_attr(docsrs, doc(cfg(feature = "tower")))] pub use tower::*; use tracing::{Instrument as _, instrument}; #[derive(Error, Debug)] diff --git a/crates/rmcp/src/transport.rs b/crates/rmcp/src/transport.rs index 8228ce7c..891b68c1 100644 --- a/crates/rmcp/src/transport.rs +++ b/crates/rmcp/src/transport.rs @@ -43,12 +43,12 @@ //! # ServiceExt, serve_server, //! # }; //! #[cfg(feature = "client")] -//! #[cfg_attr(docsrs, doc(cfg(feature = "client")))] +//! //! # use rmcp::serve_client; //! //! // create transport from tcp stream //! #[cfg(feature = "client")] -//! #[cfg_attr(docsrs, doc(cfg(feature = "client")))] +//! //! async fn client() -> Result<(), Box> { //! let stream = tokio::net::TcpSocket::new_v4()? //! .connect("127.0.0.1:8001".parse()?) @@ -61,7 +61,7 @@ //! //! // create transport from std io //! #[cfg(feature = "client")] -//! #[cfg_attr(docsrs, doc(cfg(feature = "client")))] +//! //! async fn io() -> Result<(), Box> { //! let client = ().serve((tokio::io::stdin(), tokio::io::stdout())).await?; //! let tools = client.peer().list_tools(Default::default()).await?; @@ -77,35 +77,26 @@ use crate::service::{RxJsonRpcMessage, ServiceRole, TxJsonRpcMessage}; pub mod sink_stream; #[cfg(feature = "transport-async-rw")] -#[cfg_attr(docsrs, doc(cfg(feature = "transport-async-rw")))] pub mod async_rw; #[cfg(feature = "transport-worker")] -#[cfg_attr(docsrs, doc(cfg(feature = "transport-worker")))] pub mod worker; #[cfg(feature = "transport-worker")] -#[cfg_attr(docsrs, doc(cfg(feature = "transport-worker")))] pub use worker::WorkerTransport; #[cfg(feature = "transport-child-process")] -#[cfg_attr(docsrs, doc(cfg(feature = "transport-child-process")))] pub mod child_process; #[cfg(feature = "transport-child-process")] -#[cfg_attr(docsrs, doc(cfg(feature = "transport-child-process")))] pub use child_process::{ConfigureCommandExt, TokioChildProcess}; #[cfg(feature = "transport-io")] -#[cfg_attr(docsrs, doc(cfg(feature = "transport-io")))] pub mod io; #[cfg(feature = "transport-io")] -#[cfg_attr(docsrs, doc(cfg(feature = "transport-io")))] pub use io::stdio; #[cfg(feature = "auth")] -#[cfg_attr(docsrs, doc(cfg(feature = "auth")))] pub mod auth; #[cfg(feature = "auth")] -#[cfg_attr(docsrs, doc(cfg(feature = "auth")))] pub use auth::{ AuthClient, AuthError, AuthorizationManager, AuthorizationSession, AuthorizedHttpClient, CredentialStore, InMemoryCredentialStore, InMemoryStateStore, ScopeUpgradeConfig, StateStore, @@ -113,20 +104,16 @@ pub use auth::{ }; // #[cfg(feature = "transport-ws")] -// #[cfg_attr(docsrs, doc(cfg(feature = "transport-ws")))] +// // pub mod ws; #[cfg(feature = "transport-streamable-http-server-session")] -#[cfg_attr(docsrs, doc(cfg(feature = "transport-streamable-http-server-session")))] pub mod streamable_http_server; #[cfg(feature = "transport-streamable-http-server")] -#[cfg_attr(docsrs, doc(cfg(feature = "transport-streamable-http-server")))] pub use streamable_http_server::tower::{StreamableHttpServerConfig, StreamableHttpService}; #[cfg(feature = "transport-streamable-http-client")] -#[cfg_attr(docsrs, doc(cfg(feature = "transport-streamable-http-client")))] pub mod streamable_http_client; #[cfg(feature = "transport-streamable-http-client")] -#[cfg_attr(docsrs, doc(cfg(feature = "transport-streamable-http-client")))] pub use streamable_http_client::StreamableHttpClientTransport; /// Common use codes diff --git a/crates/rmcp/src/transport/async_rw.rs b/crates/rmcp/src/transport/async_rw.rs index acd1b4f6..3da4cd75 100644 --- a/crates/rmcp/src/transport/async_rw.rs +++ b/crates/rmcp/src/transport/async_rw.rs @@ -68,7 +68,7 @@ where } #[cfg(feature = "client")] -#[cfg_attr(docsrs, doc(cfg(feature = "client")))] + impl AsyncRwTransport where R: Send + AsyncRead + Unpin, @@ -80,7 +80,7 @@ where } #[cfg(feature = "server")] -#[cfg_attr(docsrs, doc(cfg(feature = "server")))] + impl AsyncRwTransport where R: Send + AsyncRead + Unpin, diff --git a/crates/rmcp/src/transport/common.rs b/crates/rmcp/src/transport/common.rs index e78d4a6e..615b0e27 100644 --- a/crates/rmcp/src/transport/common.rs +++ b/crates/rmcp/src/transport/common.rs @@ -4,16 +4,13 @@ pub mod server_side_http; pub mod http_header; #[cfg(feature = "__reqwest")] -#[cfg_attr(docsrs, doc(cfg(feature = "reqwest")))] mod reqwest; // Note: This module provides SSE stream parsing and auto-reconnect utilities. // It's used by the streamable HTTP client (which receives SSE-formatted responses), // not the removed SSE transport. The name is historical. #[cfg(feature = "client-side-sse")] -#[cfg_attr(docsrs, doc(cfg(feature = "client-side-sse")))] pub mod client_side_sse; #[cfg(feature = "auth")] -#[cfg_attr(docsrs, doc(cfg(feature = "auth")))] pub mod auth; diff --git a/crates/rmcp/src/transport/common/auth.rs b/crates/rmcp/src/transport/common/auth.rs index f9e3a071..6068f4e9 100644 --- a/crates/rmcp/src/transport/common/auth.rs +++ b/crates/rmcp/src/transport/common/auth.rs @@ -1,3 +1,2 @@ #[cfg(feature = "transport-streamable-http-client")] -#[cfg_attr(docsrs, doc(cfg(feature = "transport-streamable-http-client")))] mod streamable_http_client; diff --git a/crates/rmcp/src/transport/common/reqwest.rs b/crates/rmcp/src/transport/common/reqwest.rs index a51fa955..42075921 100644 --- a/crates/rmcp/src/transport/common/reqwest.rs +++ b/crates/rmcp/src/transport/common/reqwest.rs @@ -1,3 +1,2 @@ #[cfg(feature = "transport-streamable-http-client-reqwest")] -#[cfg_attr(docsrs, doc(cfg(feature = "transport-streamable-http-client-reqwest")))] mod streamable_http_client; diff --git a/crates/rmcp/src/transport/streamable_http_client.rs b/crates/rmcp/src/transport/streamable_http_client.rs index 37653c42..d45613bb 100644 --- a/crates/rmcp/src/transport/streamable_http_client.rs +++ b/crates/rmcp/src/transport/streamable_http_client.rs @@ -70,7 +70,6 @@ pub enum StreamableHttpError { #[error("Missing session id in HTTP response")] MissingSessionIdInResponse, #[cfg(feature = "auth")] - #[cfg_attr(docsrs, doc(cfg(feature = "auth")))] #[error("Auth error: {0}")] Auth(#[from] crate::transport::auth::AuthError), #[error("Auth required")] diff --git a/crates/rmcp/src/transport/streamable_http_server.rs b/crates/rmcp/src/transport/streamable_http_server.rs index 733fc5e5..b991ff2e 100644 --- a/crates/rmcp/src/transport/streamable_http_server.rs +++ b/crates/rmcp/src/transport/streamable_http_server.rs @@ -1,8 +1,6 @@ pub mod session; #[cfg(feature = "transport-streamable-http-server")] -#[cfg_attr(docsrs, doc(cfg(feature = "transport-streamable-http-server")))] pub mod tower; pub use session::{SessionId, SessionManager}; #[cfg(feature = "transport-streamable-http-server")] -#[cfg_attr(docsrs, doc(cfg(feature = "transport-streamable-http-server")))] pub use tower::{StreamableHttpServerConfig, StreamableHttpService}; From 394c3145a8bad1bc62401dbe632e8737f1251ec9 Mon Sep 17 00:00:00 2001 From: Evian-Zhang Date: Sat, 14 Feb 2026 10:09:04 +0800 Subject: [PATCH 2/3] fix: Remove unnecessary doc-cfg --- crates/rmcp/src/transport.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/crates/rmcp/src/transport.rs b/crates/rmcp/src/transport.rs index 891b68c1..d7dfa979 100644 --- a/crates/rmcp/src/transport.rs +++ b/crates/rmcp/src/transport.rs @@ -43,12 +43,10 @@ //! # ServiceExt, serve_server, //! # }; //! #[cfg(feature = "client")] -//! //! # use rmcp::serve_client; //! //! // create transport from tcp stream //! #[cfg(feature = "client")] -//! //! async fn client() -> Result<(), Box> { //! let stream = tokio::net::TcpSocket::new_v4()? //! .connect("127.0.0.1:8001".parse()?) @@ -61,7 +59,6 @@ //! //! // create transport from std io //! #[cfg(feature = "client")] -//! //! async fn io() -> Result<(), Box> { //! let client = ().serve((tokio::io::stdin(), tokio::io::stdout())).await?; //! let tools = client.peer().list_tools(Default::default()).await?; @@ -104,7 +101,6 @@ pub use auth::{ }; // #[cfg(feature = "transport-ws")] -// // pub mod ws; #[cfg(feature = "transport-streamable-http-server-session")] pub mod streamable_http_server; From f5796afa08e6cc88c97ca71c8f14533a8d624aed Mon Sep 17 00:00:00 2001 From: Evian-Zhang Date: Mon, 16 Feb 2026 22:23:22 +0800 Subject: [PATCH 3/3] fix: Remove empty lines --- crates/rmcp/src/transport/async_rw.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/crates/rmcp/src/transport/async_rw.rs b/crates/rmcp/src/transport/async_rw.rs index 3da4cd75..ff4ecc65 100644 --- a/crates/rmcp/src/transport/async_rw.rs +++ b/crates/rmcp/src/transport/async_rw.rs @@ -68,7 +68,6 @@ where } #[cfg(feature = "client")] - impl AsyncRwTransport where R: Send + AsyncRead + Unpin, @@ -80,7 +79,6 @@ where } #[cfg(feature = "server")] - impl AsyncRwTransport where R: Send + AsyncRead + Unpin,