Expand description
Warp integration for the Rust MCP SDK.
This crate provides integration between the MCP SDK and the Warp web framework, making it easy to expose MCP servers over HTTP.
§Features
- HTTP POST endpoint for JSON-RPC messages
- Server-Sent Events (SSE) streaming for notifications
- Session management with automatic cleanup
- Protocol version validation
- CORS support via Warp filters
§Quick Start
ⓘ
use mcpkit::prelude::*;
use mcpkit_warp::McpRouter;
// Your MCP server handler (use #[mcp_server] macro)
#[mcp_server(name = "my-server", version = "1.0.0")]
impl MyServer {
#[tool(description = "Say hello")]
async fn hello(&self, name: String) -> ToolOutput {
ToolOutput::text(format!("Hello, {name}!"))
}
}
#[tokio::main]
async fn main() {
McpRouter::new(MyServer::new())
.serve(([0, 0, 0, 0], 3000))
.await;
}Re-exports§
pub use handler::handle_mcp_post;pub use handler::handle_sse;
Modules§
- handler
- Handler module for MCP request processing. HTTP handlers for MCP requests using Warp.
- prelude
- Prelude module for convenient imports.
Structs§
- McpRouter
- Builder for MCP Warp routers.
- McpState
- Shared state for MCP request handling.
- Session
Store - Session manager for tracking MCP client sessions.
Enums§
- Warp
Error - Errors that can occur during MCP request handling.
Constants§
- SUPPORTED_
VERSIONS - Protocol versions supported by this extension.
Traits§
- Session
Manager - Session manager trait for managing MCP sessions.
Functions§
- is_
supported_ version - Check if a protocol version is supported.