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:
1 parent
d3fce30ca5
commit
bf7bf48163
1 file changed
+10
-2
+10
-2
@@ -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,
|
id,
|
||||||
-32601,
|
-32601,
|
||||||
&format!("Method {} not found", method),
|
&format!("Method {} not found", method),
|
||||||
)),
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user