Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/rust-mcp-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ tracing.workspace = true
base64.workspace = true
bytes.workspace = true

# rustls = { workspace = true, optional = true }
rustls = { workspace = true, optional = true }
hyper = { version = "1.6.0", optional = true }
http = { workspace = true, optional = true }
http-body-util = { workspace = true, optional = true }
Expand Down Expand Up @@ -82,7 +82,7 @@ auth=["url","jsonwebtoken/aws_lc_rs","reqwest"]
server = [] # Server feature
client = [] # Client feature
hyper-server = ["axum", "axum-server", "hyper", "server", "streamable-http", "tokio-stream","http","http-body","http-body-util"]
ssl = ["axum-server/tls-rustls"]
ssl = ["axum-server/tls-rustls", "dep:rustls"]
tls-no-provider = ["axum-server/tls-rustls-no-provider"]
macros = ["rust-mcp-macros/sdk"]

Expand Down
8 changes: 8 additions & 0 deletions crates/rust-mcp-sdk/src/hyper_servers/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,14 @@ impl HyperServer {
/// * `TransportServerResult<()>` - Ok if the server starts successfully, Err otherwise
#[cfg(feature = "ssl")]
pub(crate) async fn start_ssl(self, addr: SocketAddr) -> TransportServerResult<()> {
// Install a process-wide rustls crypto provider before the first TLS
// handshake. With both `aws-lc-rs` (via jsonwebtoken) and `ring`
// potentially in the dependency graph, rustls otherwise has no
// unambiguous default and the first handshake panics. `install_default`
// returns an error if a provider is already installed, which we
// intentionally ignore so embedders may install their own first.
let _ = rustls::crypto::aws_lc_rs::default_provider().install_default();

let config = RustlsConfig::from_pem_file(
self.options.ssl_cert_path.as_deref().unwrap_or_default(),
self.options.ssl_key_path.as_deref().unwrap_or_default(),
Expand Down