huskies: merge 905
This commit is contained in:
@@ -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('/'));
|
||||
|
||||
Reference in New Issue
Block a user