From 30c74d5cce57d145d21e6845a8f64e23ee4f3cf7 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Wed, 4 Feb 2026 20:46:55 +0800 Subject: [PATCH] fixed mcp bug --- koboldcpp.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/koboldcpp.py b/koboldcpp.py index a96b5affb..c19c1dd1c 100755 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -560,7 +560,7 @@ class MCPHTTPClient: return json_events[-1].encode("utf-8") - def send(self, message: dict) -> dict: # Send JSON-RPC request and return response. + def send(self, message: dict, await_response=True) -> dict: # Send JSON-RPC request and return response. data = json.dumps(message).encode("utf-8") req = urllib.request.Request(self.url, data=data, headers=self.headers, method="POST") try: @@ -575,6 +575,8 @@ class MCPHTTPClient: raise RuntimeError(f"MCP HTTP error {e.code}: {error_body}") from e except urllib.error.URLError as e: raise RuntimeError(f"MCP HTTP connection failed: {e.reason}") from e + if not await_response: + return None if not body: raise RuntimeError("MCP HTTP server returned empty response") try: