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.
This commit is contained in:
Andrew Gazelka 2026-02-12 09:00:47 -08:00 committed by GitHub
parent 61845d61c4
commit bb534a7a68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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",