pub struct HttpServerTransport { /* private fields */ }Expand description
HTTP transport for MCP servers
This transport serves MCP requests over HTTP and provides Server-Sent Events for real-time notifications to clients.
Implementations§
Source§impl HttpServerTransport
impl HttpServerTransport
Sourcepub fn with_config<S: Into<String>>(
bind_addr: S,
config: TransportConfig,
) -> Self
pub fn with_config<S: Into<String>>( bind_addr: S, config: TransportConfig, ) -> Self
Sourcepub async fn set_request_handler<F>(&mut self, handler: F)
pub async fn set_request_handler<F>(&mut self, handler: F)
Sourcepub fn with_mtls(self, config: MtlsServerConfig) -> Self
pub fn with_mtls(self, config: MtlsServerConfig) -> Self
Require TLS 1.3 client certificates signed by the configured client CA.
Trait Implementations§
Source§impl ServerTransport for HttpServerTransport
impl ServerTransport for HttpServerTransport
Source§fn set_tool_schemas(&mut self, schemas: HashMap<String, Value>) -> McpResult<()>
fn set_tool_schemas(&mut self, schemas: HashMap<String, Value>) -> McpResult<()>
Provide registered tool input schemas to transports that mirror and
validate MCP routing headers. Other transports may ignore them.
Source§fn set_server_capabilities(
&mut self,
capabilities: ServerCapabilities,
) -> McpResult<()>
fn set_server_capabilities( &mut self, capabilities: ServerCapabilities, ) -> McpResult<()>
Provide the capabilities used to acknowledge subscription filters.
Source§fn set_task_notifications(
&mut self,
receiver: Receiver<JsonRpcNotification>,
) -> McpResult<()>
fn set_task_notifications( &mut self, receiver: Receiver<JsonRpcNotification>, ) -> McpResult<()>
Attach task-status notifications to the transport’s subscription hub.
Source§fn start<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start the server transport and begin listening for connections Read more
Source§fn set_request_handler(&mut self, handler: ServerRequestHandler)
fn set_request_handler(&mut self, handler: ServerRequestHandler)
Set the request handler that will process incoming requests Read more
Source§fn send_notification<'life0, 'async_trait>(
&'life0 mut self,
notification: JsonRpcNotification,
) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_notification<'life0, 'async_trait>(
&'life0 mut self,
notification: JsonRpcNotification,
) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a JSON-RPC notification to the client Read more
Source§fn stop<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stop the server transport Read more
Source§fn is_running(&self) -> bool
fn is_running(&self) -> bool
Check if the server is running Read more
Source§fn server_info(&self) -> String
fn server_info(&self) -> String
Get server information for debugging Read more
Auto Trait Implementations§
impl !RefUnwindSafe for HttpServerTransport
impl !UnwindSafe for HttpServerTransport
impl Freeze for HttpServerTransport
impl Send for HttpServerTransport
impl Sync for HttpServerTransport
impl Unpin for HttpServerTransport
impl UnsafeUnpin for HttpServerTransport
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].