fix(mcp): treat missing resources/list as non-fatal for servers that don't implement it

This commit is contained in:
Shaun Arman 2026-06-01 13:19:34 -05:00
parent 7c2452e3f7
commit 7cc4f0f689

View File

@ -103,9 +103,16 @@ async fn discover_server_inner(
other => return Err(format!("Unknown transport type: {other}")), other => return Err(format!("Unknown transport type: {other}")),
}; };
// List tools and resources // List tools and resources (resources are optional — not all servers implement them)
let tools = list_tools(&conn, &server.id, &server.name).await?; let tools = list_tools(&conn, &server.id, &server.name).await?;
let resources = list_resources(&conn, &server.id).await?; let resources = match list_resources(&conn, &server.id).await {
Ok(r) => r,
Err(e) if e.contains("-32601") || e.contains("Method not found") => {
info!(server_id = %server.id, "Server does not support resources/list (optional)");
vec![]
}
Err(e) => return Err(e),
};
// Persist to DB // Persist to DB
{ {