From bf7bf4816395736fe8c8d48048cda03b5de804aa Mon Sep 17 00:00:00 2001 From: Riz Ashraf Date: Mon, 21 Sep 2026 17:47:48 +0100 Subject: [PATCH] fix(server): gracefully ignore MCP notifications (e.g. notifications/roots/list_changed) instead of returning a Method Not Found error that causes JSON-RPC clients to drop connections --- server/src/handlers.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/server/src/handlers.rs b/server/src/handlers.rs index 2818833..58b49e6 100644 --- a/server/src/handlers.rs +++ b/server/src/handlers.rs @@ -179,11 +179,19 @@ impl MemoryHandler { } } } - _ => Some(crate::mcp::error( - id, - -32601, - &format!("Method {} not found", method), - )), + m if m.starts_with("notifications/") => None, + "ping" => Some(crate::mcp::success(id, serde_json::json!({}))), + _ => { + if id.is_null() { + None + } else { + Some(crate::mcp::error( + id, + -32601, + &format!("Method {} not found", method), + )) + } + } } } }