Expand description
MCP Streamable HTTP Proxy Module
This module provides a proxy implementation for MCP (Model Context Protocol) using Streamable HTTP transport with stateful session management.
§Features
- Streamable HTTP Support: Uses rmcp 0.12 with enhanced Streamable HTTP transport
- Stateful Sessions: Custom SessionManager with backend version tracking
- Hot Swap: Supports backend connection replacement without downtime
- Version Control: Automatically invalidates sessions when backend reconnects
- High-level Client API: Simple connection interface hiding transport details
§Architecture
Client → Streamable HTTP → ProxyAwareSessionManager → ProxyHandler → Backend MCP Service
↓
Version Tracking
(DashMap<SessionId, BackendVersion>)§Example
ⓘ
use mcp_streamable_proxy::{StreamClientConnection, McpClientConfig};
// Connect to an MCP server
let config = McpClientConfig::new("http://localhost:8080/mcp");
let conn = StreamClientConnection::connect(config).await?;
// List available tools
let tools = conn.list_tools().await?;Re-exports§
pub use proxy_handler::ProxyHandler;pub use server::run_stream_server;pub use server::run_stream_server_from_config;pub use session_manager::ProxyAwareSessionManager;pub use detector::is_streamable_http;pub use server_builder::BackendConfig;pub use server_builder::StreamServerBuilder;pub use server_builder::StreamServerConfig;pub use client::StreamClientConnection;pub use client::ToolInfo;
Modules§
- client
- Streamable HTTP Client Connection Module
- config
- Configuration types for Streamable HTTP proxy
- detector
- proxy_
handler - server
- Streamable HTTP server implementation
- server_
builder - Streamable HTTP Server Builder
- session_
manager - Session Manager with backend version tracking
Structs§
- Client
Capabilities - Builder
- Implementation
- Local
Session Manager - McpClient
Config - Configuration for MCP client connections
- McpService
Config - MCP 服务配置
- Peer
- An interface to fetch the remote client or server
- Role
Client - Role
Server - Running
Service - Streamable
Http Client Transport Config - Streamable
Http Server Config - Streamable
Http Service - Streamable HTTP server
- Tokio
Child Process - Tool
Filter - 工具过滤配置
Traits§
Functions§
- stdio
- StdIO Transport
Type Aliases§
- Client
Info - Server
Info - Streamable
Http Client Transport - A client-agnostic HTTP transport for RMCP that supports streaming responses.