rust-mcp-axum 2.0.0

Axum HTTP server integration for rust-mcp-sdk
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use axum::{
    http::{StatusCode, Uri},
    response::IntoResponse,
    Router,
};
use rust_mcp_sdk::mcp_http::McpAppState;
use std::sync::Arc;

pub fn routes() -> Router<Arc<McpAppState>> {
    Router::new().fallback(not_found)
}

pub async fn not_found(uri: Uri) -> impl IntoResponse {
    (
        StatusCode::NOT_FOUND,
        format!("The requested uri does not exist:\r\nuri: {uri}"),
    )
}