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 with Streamable HTTP transport
- Stateful Sessions: Custom SessionManager with backend version tracking
- Per-session URL backends: each upstream session connects its own backend on
initialize - Shared stdio backends: one child process shared across sessions
- Hot Swap: Supports backend connection replacement (shared isolation)
§Architecture
Client → Streamable HTTP → ProxyAwareSessionManager → ProxyHandler → Backend MCP Service
URL (per-session): each session opens its own backend (connect on initialize)
Stdio (shared): one backend, clones share Arcs + notification fan-out registry§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 backend_client::BackendNotificationBridge;pub use backend_client::NotifyTarget;pub use backend_client::ProgressRouteGuard;pub use backend_client::UpstreamPeerRegistry;pub use backend_client::UpstreamPeerSlot;pub use backend_connector::BackendConnector;pub use backend_connector::BackendIsolation;pub use backend_connector::StdioBackendConnector;pub use backend_connector::UrlBackendConnector;pub use proxy_handler::BackendRunningService;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 detector::is_streamable_http_with_headers;pub use server_builder::BackendConfig;pub use server_builder::StreamServerBuilder;pub use server_builder::StreamServerConfig;pub use client::StreamClientConnection;pub use client::ToolInfo;pub use fallback::DiscoverySnapshot;pub use fallback::FallbackMetadata;
Modules§
- backend_
client - Backend client handler that bridges server notifications to upstream peers.
- backend_
connector - Backend connection factories for shared (stdio) and per-session (URL) isolation.
- client
- Streamable HTTP Client Connection Module
- config
- Configuration types for Streamable HTTP proxy
- detector
- fallback
- 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
Config - A client’s own configuration: the protocol version, capabilities, and implementation identity it advertises to servers.
- Server
Config - A server’s own configuration: the protocol version, capabilities, implementation identity, and instructions it advertises to clients.
- Streamable
Http Client Transport - A client-agnostic HTTP transport for RMCP that supports streaming responses.