fix(build): fix build of the project when no features are selected (#606)

This commit is contained in:
Pavel Bezglasny 2026-01-14 16:47:50 +01:00 committed by GitHub
parent 46e149ee8b
commit acb06ea819
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 37 additions and 2 deletions

View file

@ -208,3 +208,25 @@ path = "tests/test_task.rs"
name = "test_streamable_http_priming"
required-features = ["server", "client", "transport-streamable-http-server", "reqwest"]
path = "tests/test_streamable_http_priming.rs"
[[test]]
name = "test_custom_request"
required-features = ["server", "client"]
path = "tests/test_custom_request.rs"
[[test]]
name = "test_prompt_macros"
required-features = ["server", "client"]
path = "tests/test_prompt_macros.rs"
[[test]]
name = "test_sampling"
required-features = ["server", "client"]
path = "tests/test_sampling.rs"
[[test]]
name = "test_close_connection"
required-features = ["server", "client"]
path = "tests/test_close_connection.rs"

View file

@ -20,6 +20,7 @@ impl std::error::Error for ErrorData {}
/// This is an unified error type for the errors could be returned by the service.
#[derive(Debug, thiserror::Error)]
#[allow(clippy::large_enum_variant)]
pub enum RmcpError {
#[error("Service error: {0}")]
Service(#[from] ServiceError),

View file

@ -104,9 +104,14 @@
//!
//! ```rust
//! use anyhow::Result;
//! use rmcp::{model::CallToolRequestParam, service::ServiceExt, transport::{TokioChildProcess, ConfigureCommandExt}};
//! use rmcp::{model::CallToolRequestParam, service::ServiceExt};
//! #[cfg(feature = "transport-child-process")]
//! #[cfg_attr(docsrs, doc(cfg(feature = "transport-child-process")))]
//! use rmcp::transport::{TokioChildProcess, ConfigureCommandExt};
//! use tokio::process::Command;
//!
//! #[cfg(feature = "transport-child-process")]
//! #[cfg_attr(docsrs, doc(cfg(feature = "transport-child-process")))]
//! async fn client() -> Result<()> {
//! let service = ().serve(TokioChildProcess::new(Command::new("uvx").configure(|cmd| {
//! cmd.arg("mcp-server-git");

View file

@ -40,10 +40,15 @@
//!
//! ```rust
//! # use rmcp::{
//! # ServiceExt, serve_client, serve_server,
//! # 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<dyn std::error::Error>> {
//! let stream = tokio::net::TcpSocket::new_v4()?
//! .connect("127.0.0.1:8001".parse()?)
@ -55,6 +60,8 @@
//! }
//!
//! // create transport from std io
//! #[cfg(feature = "client")]
//! #[cfg_attr(docsrs, doc(cfg(feature = "client")))]
//! async fn io() -> Result<(), Box<dyn std::error::Error>> {
//! let client = ().serve((tokio::io::stdin(), tokio::io::stdout())).await?;
//! let tools = client.peer().list_tools(Default::default()).await?;