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

This commit is contained in:
Riz Ashraf committed 2026-09-21 17:47:48 +01:00
1 parent d3fce30ca5
commit bf7bf48163
1 file changed
+10 -2
+10 -2
View File
@@ -179,11 +179,19 @@ impl MemoryHandler {
}
}
}
_ => Some(crate::mcp::error(
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),
)),
))
}
}
}
}
}