| Crates.io | mcpkit-actix |
| lib.rs | mcpkit-actix |
| version | 0.5.0 |
| created_at | 2025-12-11 17:52:18.755402+00 |
| updated_at | 2025-12-26 00:57:33.495625+00 |
| description | Actix-web integration for mcpkit |
| homepage | |
| repository | https://github.com/praxiomlabs/mcpkit |
| max_upload_size | |
| id | 1980185 |
| size | 131,223 |
Actix-web integration for the Model Context Protocol (MCP).
This crate provides integration between the MCP SDK and the Actix-web framework, making it easy to expose MCP servers over HTTP.
use mcpkit_actix::McpRouter;
use mcpkit_server::ServerHandler;
// Your MCP server handler (must implement ServerHandler, ToolHandler, etc.)
// Note: Clone is NOT required - the handler is wrapped in Arc internally.
struct MyServer;
#[actix_web::main]
async fn main() -> std::io::Result<()> {
// Simplest approach: use McpRouter for stdio-like ergonomics
McpRouter::new(MyServer)
.with_cors()
.with_logging()
.serve("0.0.0.0:3000")
.await
}
| Endpoint | Method | Purpose |
|---|---|---|
/mcp |
POST | JSON-RPC messages |
/mcp/sse |
GET | Server-Sent Events stream |
McpRouter::new(MyServer)
.post_path("/api/mcp")
.sse_path("/api/mcp/sse")
.serve("0.0.0.0:3000")
.await
For more control, integrate MCP routes into an existing Actix-web application:
use mcpkit_actix::McpRouter;
use mcpkit_server::ServerHandler;
use actix_web::{App, HttpServer};
struct MyServer;
#[actix_web::main]
async fn main() -> std::io::Result<()> {
let router = McpRouter::new(MyServer);
HttpServer::new(move || {
App::new()
.configure(router.configure_app())
// Add your other routes here
})
.bind("0.0.0.0:3000")?
.run()
.await
}
| Export | Purpose |
|---|---|
McpRouter |
Router builder for MCP endpoints |
McpState |
Shared state for MCP handlers |
handle_mcp_post |
Handler for POST requests |
handle_sse |
Handler for SSE streaming |
Session |
Individual client session |
SessionManager |
Manages SSE broadcast channels |
SessionStore |
Storage for HTTP session data |
This crate is part of the mcpkit SDK. For most use cases, depend on mcpkit directly rather than this crate.
Licensed under either of Apache License, Version 2.0 or MIT license at your option.