pub struct McpServerHttpService<H> { /* private fields */ }Expand description
Cloneable production HTTP service for one MCP handler.
The service implements Tower’s Service and can be mounted directly by
Axum, Hyper, or another compatible server. Its transport is always
stateless: legacy sessions and initialize are disabled.
Implementations§
Source§impl<H> McpServerHttpService<H>
impl<H> McpServerHttpService<H>
Sourcepub fn new(
handler: H,
options: McpServerHttpOptions,
authentication: McpServerAuthentication,
) -> Result<Self, McpServerHttpServiceBuildError>
pub fn new( handler: H, options: McpServerHttpOptions, authentication: McpServerAuthentication, ) -> Result<Self, McpServerHttpServiceBuildError>
Builds a strict service with permissive authenticated admission.
Sourcepub fn with_admission_control(
handler: H,
options: McpServerHttpOptions,
authentication: McpServerAuthentication,
admission: Arc<dyn McpServerAdmissionControl>,
) -> Result<Self, McpServerHttpServiceBuildError>
pub fn with_admission_control( handler: H, options: McpServerHttpOptions, authentication: McpServerAuthentication, admission: Arc<dyn McpServerAdmissionControl>, ) -> Result<Self, McpServerHttpServiceBuildError>
Builds a strict service with caller-owned shared admission control.
Sourcepub fn is_shutting_down(&self) -> bool
pub fn is_shutting_down(&self) -> bool
Returns whether shutdown has begun.
Trait Implementations§
Source§impl<H> Clone for McpServerHttpService<H>
impl<H> Clone for McpServerHttpService<H>
Source§impl<H> Debug for McpServerHttpService<H>
impl<H> Debug for McpServerHttpService<H>
Source§impl<B, H> Service<Request<B>> for McpServerHttpService<H>
impl<B, H> Service<Request<B>> for McpServerHttpService<H>
Source§type Future = Pin<Box<dyn Future<Output = Result<<McpServerHttpService<H> as Service<Request<B>>>::Response, <McpServerHttpService<H> as Service<Request<B>>>::Error>> + Send>>
type Future = Pin<Box<dyn Future<Output = Result<<McpServerHttpService<H> as Service<Request<B>>>::Response, <McpServerHttpService<H> as Service<Request<B>>>::Error>> + Send>>
The future response value.
Auto Trait Implementations§
impl<H> !Freeze for McpServerHttpService<H>
impl<H> !RefUnwindSafe for McpServerHttpService<H>
impl<H> !UnwindSafe for McpServerHttpService<H>
impl<H> Forget for McpServerHttpService<H>
impl<H> Move for McpServerHttpService<H>
impl<H> Send for McpServerHttpService<H>
impl<H> Sync for McpServerHttpService<H>
impl<H> Unpin for McpServerHttpService<H>
impl<H> UnsafeUnpin for McpServerHttpService<H>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, ReqBody, ResBody> GrpcService<ReqBody> for T
impl<T, ReqBody, ResBody> GrpcService<ReqBody> for T
Source§type ResponseBody = ResBody
type ResponseBody = ResBody
Responses body given by the service.
Source§fn poll_ready(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), <T as GrpcService<ReqBody>>::Error>>
fn poll_ready( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), <T as GrpcService<ReqBody>>::Error>>
Returns
Ready when the service is able to process requests. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<S, R> ServiceExt<R> for Swhere
S: Service<R>,
impl<S, R> ServiceExt<R> for Swhere
S: Service<R>,
Source§fn into_make_service(self) -> IntoMakeService<S>
fn into_make_service(self) -> IntoMakeService<S>
Convert this service into a
MakeService, that is a Service whose
response is another service. Read moreSource§fn into_make_service_with_connect_info<C>(
self,
) -> IntoMakeServiceWithConnectInfo<S, C>
fn into_make_service_with_connect_info<C>( self, ) -> IntoMakeServiceWithConnectInfo<S, C>
Convert this service into a
MakeService, that will store C’s
associated ConnectInfo in a request extension such that ConnectInfo
can extract it. Read moreSource§fn handle_error<F, T>(self, f: F) -> HandleError<Self, F, T>
fn handle_error<F, T>(self, f: F) -> HandleError<Self, F, T>
Convert this service into a
HandleError, that will handle errors
by converting them into responses. Read moreSource§impl<T, Request> ServiceExt<Request> for T
impl<T, Request> ServiceExt<Request> for T
Source§fn ready(&mut self) -> Ready<'_, Self, Request> ⓘwhere
Self: Sized,
fn ready(&mut self) -> Ready<'_, Self, Request> ⓘwhere
Self: Sized,
Yields a mutable reference to the service when it is ready to accept a request.
Source§fn ready_oneshot(self) -> ReadyOneshot<Self, Request> ⓘwhere
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request> ⓘwhere
Self: Sized,
Yields the service when it is ready to accept a request.
Source§fn oneshot(self, req: Request) -> Oneshot<Self, Request> ⓘwhere
Self: Sized,
fn oneshot(self, req: Request) -> Oneshot<Self, Request> ⓘwhere
Self: Sized,
Consume this
Service, calling it with the provided request once it is ready.Source§fn and_then<F>(self, f: F) -> AndThen<Self, F>
fn and_then<F>(self, f: F) -> AndThen<Self, F>
Executes a new future after this service’s future resolves. This does
not alter the behaviour of the
poll_ready method. Read moreSource§fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
Maps this service’s response value to a different value. This does not
alter the behaviour of the
poll_ready method. Read moreSource§fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
Maps this service’s error value to a different value. This does not
alter the behaviour of the
poll_ready method. Read moreSource§fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
Maps this service’s result type (
Result<Self::Response, Self::Error>)
to a different value, regardless of whether the future succeeds or
fails. Read moreSource§fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
Composes a function in front of the service. Read more
Source§fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
Composes an asynchronous function after this service. Read more
Source§fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>
fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>
Composes a function that transforms futures produced by the service. Read more