pub struct StreamableHttpServer { /* private fields */ }Available on crate feature
streamable-http and non-WebAssembly only.Expand description
A streamable HTTP server for MCP.
Implementations§
Source§impl StreamableHttpServer
impl StreamableHttpServer
Sourcepub fn new(addr: SocketAddr, server: Arc<Mutex<Server>>) -> Self
pub fn new(addr: SocketAddr, server: Arc<Mutex<Server>>) -> Self
Creates a new StreamableHttpServer with default config
Sourcepub fn with_config(
addr: SocketAddr,
server: Arc<Mutex<Server>>,
config: StreamableHttpServerConfig,
) -> Self
pub fn with_config( addr: SocketAddr, server: Arc<Mutex<Server>>, config: StreamableHttpServerConfig, ) -> Self
Creates a new StreamableHttpServer with custom config
Sourcepub async fn start(self) -> Result<(SocketAddr, JoinHandle<()>)>
pub async fn start(self) -> Result<(SocketAddr, JoinHandle<()>)>
Starts the server and returns the bound address and a task handle.
Applies the same Tower layer security stack as
pmcp::axum::router():
CorsLayer– origin-locked CORS (no wildcard*)DnsRebindingLayer– Host/Origin header validationSecurityHeadersLayer– nosniff, DENY, no-store
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for StreamableHttpServer
impl !UnwindSafe for StreamableHttpServer
impl Freeze for StreamableHttpServer
impl Send for StreamableHttpServer
impl Sync for StreamableHttpServer
impl Unpin for StreamableHttpServer
impl UnsafeUnpin for StreamableHttpServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more