Skip to content

armgit / LEANN

Public Imported from GitHub
0

[MLsys2026 Best Paper]: https://arxiv.org/abs/2506.08276. RAG on Everything with LEANN. Enjoy 97% storage savings while running a fast, accurate, and 100% private RAG application on your personal device.

fix(mcp): respond -32601 to unknown request methods instead of silence (#384)

John A. Kassebaum7a34d8856b7a
diff --git a/packages/leann-core/src/leann/mcp.py b/packages/leann-core/src/leann/mcp.py
index f0b6017..458cf71 100755
--- a/packages/leann-core/src/leann/mcp.py
+++ b/packages/leann-core/src/leann/mcp.py
@@ -362,6 +362,17 @@ def handle_request(request):
except Exception as e:
return _make_error(request_id, str(e))
+ # Unknown method: a request (with an id) must get a -32601 error response
+ # so strict clients can fall back — e.g. Google Antigravity CLI probes
+ # with a server/discover request before initialize and hangs forever
+ # ("initializing...") if the server stays silent. Notifications (no id)
+ # must get no reply at all (JSON-RPC 2.0).
+ if request_id is not None:
+ return {
+ "jsonrpc": "2.0",
+ "id": request_id,
+ "error": {"code": -32601, "message": "Method not found"},
+ }
return None