Skip to content

feat!: extract Axum to standalone rust-mcp-axum crate#146

Open
hashemix wants to merge 5 commits into
mainfrom
refactor/extract-axum-crate
Open

feat!: extract Axum to standalone rust-mcp-axum crate#146
hashemix wants to merge 5 commits into
mainfrom
refactor/extract-axum-crate

Conversation

@hashemix
Copy link
Copy Markdown
Member

📌 Summary

Extracts the Axum HTTP server integration from rust-mcp-sdk into a standalone
rust-mcp-axum crate. This makes rust-mcp-sdk framework-agnostic (zero HTTP
framework dependencies) while providing a dedicated first-class Axum crate.

👥 Support for both scenarios:

  • Turnkeycreate_axum_server().start().await
  • Bring Your Servermcp_routes(state, handler, &mount_opts) to mount on existing Axum apps

✨ Changes Made

  • New crate: crates/rust-mcp-axum/ - standalone Axum integration with
    AxumServer, AxumServerOptions, AxumRuntime, mcp_routes() mount function,
    AxumMountOptions for BYO-server pattern, and create_axum_server() factory

  • Renamed types:

    • HyperServerAxumServer
    • HyperServerOptionsAxumServerOptions
    • HyperRuntimeAxumRuntime
    • create_server()create_axum_server()
  • Deleted crates/rust-mcp-sdk/src/hyper_servers/ , SDK is now framework-agnostic ⭐

  • SDK cleanup: removed axum, axum-server dependencies; removed hyper-server,
    ssl, tls-no-provider features;

  • removed #[cfg(feature = "hyper-server")] gates

  • Added new tests in covering health check, streamable HTTP, SSE, messages, fallback routes, error bridge, and options

  • Updated SDK examples and related SDK integration tests as well as rust-mcp-extra examples

🛠️ Testing Steps

# Full CI pipeline
cargo make check

💡 Additional Notes

Breaking changes :

# Cargo.toml
- rust-mcp-sdk = { features = ["hyper-server"] }
+ rust-mcp-sdk = "0.10"
+ rust-mcp-axum = "0.1"
# source code
- use rust_mcp_sdk::mcp_server::{hyper_server, HyperServerOptions};
- let server = hyper_server::create_server(details, handler, options);
+ use rust_mcp_axum::{create_axum_server, AxumServerOptions};
+ let server = create_axum_server(details, handler, options);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant