From bb534a7a68933b587b03167431fa7dc0fcd6d40e Mon Sep 17 00:00:00 2001 From: Andrew Gazelka Date: Thu, 12 Feb 2026 09:00:47 -0800 Subject: [PATCH] refactor: remove unused axum dependency from server-side-http feature (#642) * refactor: remove unused axum dependency from server-side-http feature The `server-side-http` feature included `dep:axum` but axum was never actually used in the rmcp library source code (0 references found). The `StreamableHttpService` is a tower service that works with any HTTP server framework. Users can choose to use: - axum (via `Router::nest_service()` or `fallback_service()`) - hyper directly (via `hyper_util::service::TowerToHyperService`) - any other tower-compatible HTTP server This change removes the unnecessary transitive dependency, giving users more flexibility in their choice of HTTP server framework. Examples that use axum already have their own explicit axum dependency in their Cargo.toml, so they continue to work unchanged. * refactor: move axum to dev-dependencies with minimal features - Remove axum from library dependencies (not used in library source) - Add axum to dev-dependencies for tests with minimal features: default-features = false, features = ["http1", "tokio"] - Examples have their own axum dependency and are unaffected This addresses review feedback from @ofek to use minimal features, while ensuring axum is only bundled for running rmcp's own tests, not for downstream users. --- crates/rmcp/Cargo.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/rmcp/Cargo.toml b/crates/rmcp/Cargo.toml index cdcdddb..2b08f29 100644 --- a/crates/rmcp/Cargo.toml +++ b/crates/rmcp/Cargo.toml @@ -54,7 +54,6 @@ process-wrap = { version = "9.0", features = ["tokio1"], optional = true } # tokio-tungstenite ={ version = "0.26", optional = true } # for http-server transport -axum = { version = "0.8", features = [], optional = true } rand = { version = "0.9", optional = true } tokio-stream = { version = "0.1", optional = true } uuid = { version = "1", features = ["v4"], optional = true } @@ -99,7 +98,6 @@ server-side-http = [ "dep:http-body-util", "dep:bytes", "dep:sse-stream", - "dep:axum", "tower", ] @@ -136,7 +134,7 @@ schemars = ["dep:schemars"] [dev-dependencies] tokio = { version = "1", features = ["full"] } schemars = { version = "1.1.0", features = ["chrono04"] } - +axum = { version = "0.8", default-features = false, features = ["http1", "tokio"] } anyhow = "1.0" tracing-subscriber = { version = "0.3", features = [ "env-filter",