mcp_sse_proxy/
lib.rs

1//! MCP SSE Proxy Module
2//!
3//! This module provides a proxy implementation for MCP (Model Context Protocol)
4//! using SSE (Server-Sent Events) transport.
5//!
6//! # Features
7//!
8//! - **SSE Support**: Uses rmcp 0.10 with SSE transport (removed in 0.12+)
9//! - **Stable Protocol**: Production-ready SSE implementation
10//! - **Hot Swap**: Supports backend connection replacement
11//! - **Fallback Option**: Used when Streamable HTTP is not supported
12//! - **High-level Client API**: Simple connection interface hiding transport details
13//!
14//! # Architecture
15//!
16//! ```text
17//! Client → SSE → SseHandler → Backend MCP Service
18//! ```
19//!
20//! # Example
21//!
22//! ```rust,ignore
23//! use mcp_sse_proxy::{SseClientConnection, McpClientConfig};
24//!
25//! // Connect to an MCP server
26//! let config = McpClientConfig::new("http://localhost:8080/sse");
27//! let conn = SseClientConnection::connect(config).await?;
28//!
29//! // List available tools
30//! let tools = conn.list_tools().await?;
31//! ```
32
33pub mod sse_handler;
34pub mod server;
35pub mod config;
36pub mod client;
37
38// Re-export main types
39pub use sse_handler::{SseHandler, ToolFilter};
40pub use server::{run_sse_server, run_sse_server_from_config, McpServiceConfig};
41
42// Re-export client connection types
43pub use client::{SseClientConnection, ToolInfo};
44pub use mcp_common::McpClientConfig;
45
46// Re-export commonly used rmcp types
47pub use rmcp::{
48    RoleClient, RoleServer, ServerHandler,
49    model::{ServerInfo, ClientInfo, ClientCapabilities, CallToolRequestParam, Implementation},
50    service::{RunningService, Peer},
51    ServiceExt,
52};
53
54// Re-export transport types for SSE protocol (rmcp 0.10)
55pub use rmcp::transport::{
56    SseClientTransport,
57    sse_client::SseClientConfig,
58    child_process::TokioChildProcess,
59    stdio,
60    SseServer,
61    sse_server::SseServerConfig,
62};