feat: Adding streamable-http transport support for backend, desktop and cli (#2942)

This commit is contained in:
btdeviant
2025-07-01 16:35:11 -07:00
committed by GitHub
parent 2cadc1db7e
commit 2948d4a375
21 changed files with 1085 additions and 21 deletions
+18 -1
View File
@@ -1,7 +1,7 @@
use anyhow::Result;
use futures::lock::Mutex;
use mcp_client::client::{ClientCapabilities, ClientInfo, McpClient, McpClientTrait};
use mcp_client::transport::{SseTransport, Transport};
use mcp_client::transport::{SseTransport, StreamableHttpTransport, Transport};
use mcp_client::StdioTransport;
use std::collections::HashMap;
use std::sync::Arc;
@@ -20,6 +20,7 @@ async fn main() -> Result<()> {
.init();
test_transport(sse_transport().await?).await?;
test_transport(streamable_http_transport().await?).await?;
test_transport(stdio_transport().await?).await?;
// Test broken transport
@@ -52,6 +53,22 @@ async fn sse_transport() -> Result<SseTransport> {
))
}
async fn streamable_http_transport() -> Result<StreamableHttpTransport> {
let port = "60054";
tokio::process::Command::new("npx")
.env("PORT", port)
.arg("@modelcontextprotocol/server-everything")
.arg("streamable-http")
.spawn()?;
tokio::time::sleep(Duration::from_secs(1)).await;
Ok(StreamableHttpTransport::new(
format!("http://localhost:{}/mcp", port),
HashMap::new(),
))
}
async fn stdio_transport() -> Result<StdioTransport> {
Ok(StdioTransport::new(
"npx",