huskies: merge 905

This commit is contained in:
dave
2026-05-12 14:57:53 +00:00
parent 2c5326f339
commit 379ff16d3e
3 changed files with 290 additions and 1 deletions
+22
View File
@@ -108,6 +108,28 @@ pub async fn proxy_mcp_call(
.map_err(|e| format!("failed to read response from {mcp_url}: {e}"))
}
/// Proxy an MCP `tools/call` request to the sled with `Accept: text/event-stream`
/// and return the raw response for streaming. No per-request timeout is applied
/// so long-running tool calls (e.g. `run_tests`, up to 1200 s) are not cut short.
///
/// The caller reads `.bytes_stream()` from the returned response and re-emits
/// each SSE `data:` line as a new event to the originating client.
pub async fn proxy_mcp_call_sse(
client: &Client,
base_url: &str,
request_bytes: &[u8],
) -> Result<reqwest::Response, String> {
let mcp_url = format!("{}/mcp", base_url.trim_end_matches('/'));
client
.post(&mcp_url)
.header("Content-Type", "application/json")
.header("Accept", "text/event-stream")
.body(request_bytes.to_vec())
.send()
.await
.map_err(|e| format!("failed to reach {mcp_url}: {e}"))
}
/// Fetch tools/list from a project's MCP endpoint.
pub async fn fetch_tools_list(client: &Client, base_url: &str) -> Result<Value, String> {
let mcp_url = format!("{}/mcp", base_url.trim_end_matches('/'));