pub struct HttpMcpServerBuilder { /* private fields */ }Expand description
Builder for HttpMcpServer
Implementations§
Source§impl HttpMcpServerBuilder
impl HttpMcpServerBuilder
pub fn new() -> Self
Sourcepub fn tool<F, Fut>(
self,
name: impl Into<String>,
meta: ToolMeta,
handler: F,
) -> Self
pub fn tool<F, Fut>( self, name: impl Into<String>, meta: ToolMeta, handler: F, ) -> Self
Register a tool with handler
Sourcepub fn resource<FL, FR, FutL, FutR>(
self,
uri: impl Into<String>,
meta: ResourceMeta,
list_handler: FL,
read_handler: FR,
) -> Self
pub fn resource<FL, FR, FutL, FutR>( self, uri: impl Into<String>, meta: ResourceMeta, list_handler: FL, read_handler: FR, ) -> Self
Register a resource with list and read handlers
Sourcepub fn prompt<F, Fut>(
self,
name: impl Into<String>,
meta: PromptMeta,
handler: F,
) -> Self
pub fn prompt<F, Fut>( self, name: impl Into<String>, meta: PromptMeta, handler: F, ) -> Self
Register a prompt with handler
Sourcepub fn endpoint<F, Fut>(self, meta: EndpointMeta, handler: F) -> Selfwhere
F: Fn(RequestContext, Option<Value>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<HttpResponse>> + Send + 'static,
pub fn endpoint<F, Fut>(self, meta: EndpointMeta, handler: F) -> Selfwhere
F: Fn(RequestContext, Option<Value>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<HttpResponse>> + Send + 'static,
Register a custom HTTP endpoint
Sourcepub fn multipart_endpoint<F, Fut>(self, meta: EndpointMeta, handler: F) -> Selfwhere
F: Fn(RequestContext, Multipart) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<HttpResponse>> + 'static,
pub fn multipart_endpoint<F, Fut>(self, meta: EndpointMeta, handler: F) -> Selfwhere
F: Fn(RequestContext, Multipart) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<HttpResponse>> + 'static,
Register a custom multipart HTTP endpoint for file uploads
Sourcepub fn with_oauth(
self,
client_id: impl Into<String>,
client_secret: impl Into<String>,
_token_url: impl Into<String>,
_auth_url: impl Into<String>,
) -> Self
pub fn with_oauth( self, client_id: impl Into<String>, client_secret: impl Into<String>, _token_url: impl Into<String>, _auth_url: impl Into<String>, ) -> Self
Configure OAuth 2.0
Sourcepub fn enable_cors(self, enable: bool) -> Self
pub fn enable_cors(self, enable: bool) -> Self
Enable or disable CORS
Sourcepub fn build(self) -> Result<HttpMcpServer>
pub fn build(self) -> Result<HttpMcpServer>
Build the server
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HttpMcpServerBuilder
impl !RefUnwindSafe for HttpMcpServerBuilder
impl Send for HttpMcpServerBuilder
impl Sync for HttpMcpServerBuilder
impl Unpin for HttpMcpServerBuilder
impl !UnwindSafe for HttpMcpServerBuilder
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
Source§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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more