Crate mcpkit_warp

Crate mcpkit_warp 

Source
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.
SessionStore
Session manager for tracking MCP client sessions.

Enums§

WarpError
Errors that can occur during MCP request handling.

Constants§

SUPPORTED_VERSIONS
Protocol versions supported by this extension.

Traits§

SessionManager
Session manager trait for managing MCP sessions.

Functions§

is_supported_version
Check if a protocol version is supported.