MCP Streamable HTTP Proxy
MCP Streamable HTTP Proxy
Streamable HTTP proxy implementation for MCP using rmcp 0.12 with stateful session management.
Overview
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>)
Installation
Add to Cargo.toml:
[]
= { = "0.1.5", = "../mcp-streamable-proxy" }
Usage
Server
use ;
async
Client
use ;
// Connect to an MCP server
let config = new;
let conn = connect.await?;
// List available tools
let tools = conn.list_tools.await?;
Session Management
The ProxyAwareSessionManager provides:
- Backend version tracking using DashMap
- Automatic session invalidation on backend reconnect
- Concurrent-safe session operations
Development
# Build
# Test
License
MIT OR Apache-2.0