Skip to content

Commit acb06ea

Browse files
authored
fix(build): fix build of the project when no features are selected (modelcontextprotocol#606)
1 parent 46e149e commit acb06ea

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

crates/rmcp/Cargo.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,25 @@ path = "tests/test_task.rs"
208208
name = "test_streamable_http_priming"
209209
required-features = ["server", "client", "transport-streamable-http-server", "reqwest"]
210210
path = "tests/test_streamable_http_priming.rs"
211+
212+
213+
[[test]]
214+
name = "test_custom_request"
215+
required-features = ["server", "client"]
216+
path = "tests/test_custom_request.rs"
217+
218+
[[test]]
219+
name = "test_prompt_macros"
220+
required-features = ["server", "client"]
221+
path = "tests/test_prompt_macros.rs"
222+
223+
[[test]]
224+
name = "test_sampling"
225+
required-features = ["server", "client"]
226+
path = "tests/test_sampling.rs"
227+
228+
229+
[[test]]
230+
name = "test_close_connection"
231+
required-features = ["server", "client"]
232+
path = "tests/test_close_connection.rs"

crates/rmcp/src/error.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ impl std::error::Error for ErrorData {}
2020

2121
/// This is an unified error type for the errors could be returned by the service.
2222
#[derive(Debug, thiserror::Error)]
23+
#[allow(clippy::large_enum_variant)]
2324
pub enum RmcpError {
2425
#[error("Service error: {0}")]
2526
Service(#[from] ServiceError),

crates/rmcp/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,14 @@
104104
//!
105105
//! ```rust
106106
//! use anyhow::Result;
107-
//! use rmcp::{model::CallToolRequestParam, service::ServiceExt, transport::{TokioChildProcess, ConfigureCommandExt}};
107+
//! use rmcp::{model::CallToolRequestParam, service::ServiceExt};
108+
//! #[cfg(feature = "transport-child-process")]
109+
//! #[cfg_attr(docsrs, doc(cfg(feature = "transport-child-process")))]
110+
//! use rmcp::transport::{TokioChildProcess, ConfigureCommandExt};
108111
//! use tokio::process::Command;
109112
//!
113+
//! #[cfg(feature = "transport-child-process")]
114+
//! #[cfg_attr(docsrs, doc(cfg(feature = "transport-child-process")))]
110115
//! async fn client() -> Result<()> {
111116
//! let service = ().serve(TokioChildProcess::new(Command::new("uvx").configure(|cmd| {
112117
//! cmd.arg("mcp-server-git");

crates/rmcp/src/transport.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,15 @@
4040
//!
4141
//! ```rust
4242
//! # use rmcp::{
43-
//! # ServiceExt, serve_client, serve_server,
43+
//! # ServiceExt, serve_server,
4444
//! # };
45+
//! #[cfg(feature = "client")]
46+
//! #[cfg_attr(docsrs, doc(cfg(feature = "client")))]
47+
//! # use rmcp::serve_client;
4548
//!
4649
//! // create transport from tcp stream
50+
//! #[cfg(feature = "client")]
51+
//! #[cfg_attr(docsrs, doc(cfg(feature = "client")))]
4752
//! async fn client() -> Result<(), Box<dyn std::error::Error>> {
4853
//! let stream = tokio::net::TcpSocket::new_v4()?
4954
//! .connect("127.0.0.1:8001".parse()?)
@@ -55,6 +60,8 @@
5560
//! }
5661
//!
5762
//! // create transport from std io
63+
//! #[cfg(feature = "client")]
64+
//! #[cfg_attr(docsrs, doc(cfg(feature = "client")))]
5865
//! async fn io() -> Result<(), Box<dyn std::error::Error>> {
5966
//! let client = ().serve((tokio::io::stdin(), tokio::io::stdout())).await?;
6067
//! let tools = client.peer().list_tools(Default::default()).await?;

0 commit comments

Comments
 (0)