pub struct McpHttpServer;Available on crate feature
http-server only.Expand description
MCP Server with HTTP transport.
This server exposes HTTP endpoints for JSON-RPC communication and
optionally SSE for server-to-client streaming. It wraps the core
McpServer and bridges HTTP I/O to the internal channel-based
communication.
Implementations§
Source§impl McpHttpServer
impl McpHttpServer
Sourcepub async fn run(
config: McpServerConfig,
host: &str,
port: u16,
) -> Result<(), ServerError>
pub async fn run( config: McpServerConfig, host: &str, port: u16, ) -> Result<(), ServerError>
Runs an MCP server with HTTP transport.
This starts an HTTP server on the specified host and port. The function blocks until the server stops.
§Endpoints
POST /rpc- JSON-RPC endpoint for all MCP methodsGET /tools- List available toolsPOST /call- Direct tool call endpointGET /sse- Server-Sent Events for server-to-client notifications
§Example
ⓘ
let config = McpServerConfig::builder()
.name("my-server")
.version("1.0.0")
.with_tool(MyTool)
.build();
McpHttpServer::run(config, "127.0.0.1", 8080).await?;Auto Trait Implementations§
impl Freeze for McpHttpServer
impl RefUnwindSafe for McpHttpServer
impl Send for McpHttpServer
impl Sync for McpHttpServer
impl Unpin for McpHttpServer
impl UnwindSafe for McpHttpServer
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