Add pending request cleanup and config

This commit is contained in:
2025-05-29 14:53:48 +02:00
parent 493ba53c08
commit 89130c2067
15 changed files with 242 additions and 19 deletions

View File

@@ -18,17 +18,34 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
)
.init();
let transport1 = StdioTransport::new("uvx", vec!["mcp-server-git".to_string()], HashMap::new());
let transport1 = StdioTransport::new(
"uvx",
vec!["mcp-server-git".to_string()],
HashMap::new(),
None,
None,
);
let handle1 = transport1.start().await?;
let service1 = McpService::with_timeout(handle1, Duration::from_secs(30));
let client1 = McpClient::new(service1);
let transport2 = StdioTransport::new("uvx", vec!["mcp-server-git".to_string()], HashMap::new());
let transport2 = StdioTransport::new(
"uvx",
vec!["mcp-server-git".to_string()],
HashMap::new(),
None,
None,
);
let handle2 = transport2.start().await?;
let service2 = McpService::with_timeout(handle2, Duration::from_secs(30));
let client2 = McpClient::new(service2);
let transport3 = SseTransport::new("http://localhost:8000/sse", HashMap::new());
let transport3 = SseTransport::new(
"http://localhost:8000/sse",
HashMap::new(),
None,
None,
);
let handle3 = transport3.start().await?;
let service3 = McpService::with_timeout(handle3, Duration::from_secs(10));
let client3 = McpClient::new(service3);

View File

@@ -18,7 +18,12 @@ async fn main() -> Result<()> {
.init();
// Create the base transport
let transport = SseTransport::new("http://localhost:8000/sse", HashMap::new());
let transport = SseTransport::new(
"http://localhost:8000/sse",
HashMap::new(),
None,
None,
);
// Start transport
let handle = transport.start().await?;

View File

@@ -20,7 +20,13 @@ async fn main() -> Result<(), ClientError> {
.init();
// 1) Create the transport
let transport = StdioTransport::new("uvx", vec!["mcp-server-git".to_string()], HashMap::new());
let transport = StdioTransport::new(
"uvx",
vec!["mcp-server-git".to_string()],
HashMap::new(),
None,
None,
);
// 2) Start the transport to get a handle
let transport_handle = transport.start().await?;

View File

@@ -29,6 +29,8 @@ async fn main() -> Result<(), ClientError> {
.map(|s| s.to_string())
.collect(),
HashMap::new(),
None,
None,
);
// Start the transport to get a handle