feat(#2038): surface degraded mcp servers at turn start (observability)
This commit is contained in:
parent
2a5c4d441f
commit
d7d46d347c
3 changed files with 116 additions and 2 deletions
|
|
@ -290,6 +290,26 @@ fn load_extra_mcp() -> std::collections::BTreeMap<String, ExtraMcpServer> {
|
|||
/// declared via `hyperhive.extraMcpServers` (those stay stdio bridges).
|
||||
#[must_use]
|
||||
pub fn render_claude_config() -> String {
|
||||
let config = serde_json::json!({ "mcpServers": build_mcp_servers() });
|
||||
serde_json::to_string_pretty(&config).unwrap_or_else(|_| "{}".into())
|
||||
}
|
||||
|
||||
/// The set of MCP server names claude is configured with this turn — the
|
||||
/// keys of the rendered `--mcp-config` (built-in hyperhive HTTP surface +
|
||||
/// any tool-group-permitted extra stdio servers). The harness compares
|
||||
/// this against the per-turn `system`/`init` event's `mcp_servers` to
|
||||
/// detect a configured server that failed to connect or was dropped
|
||||
/// (the MCP-health instrumentation).
|
||||
#[must_use]
|
||||
pub fn configured_server_names() -> Vec<String> {
|
||||
build_mcp_servers().into_iter().map(|(k, _)| k).collect()
|
||||
}
|
||||
|
||||
/// Build the `mcpServers` map claude gets in its `--mcp-config`: the
|
||||
/// built-in hyperhive HTTP surface plus any tool-group-permitted extra
|
||||
/// stdio servers. Shared by [`render_claude_config`] (serialises it) and
|
||||
/// [`configured_server_names`] (lists its keys) so the two never drift.
|
||||
fn build_mcp_servers() -> serde_json::Map<String, serde_json::Value> {
|
||||
let mut servers = serde_json::Map::new();
|
||||
// The built-in hyperhive surface is served exclusively over streamable
|
||||
// HTTP by the persistent `hive-mcp-http` daemon (loopback, inside the
|
||||
|
|
@ -344,8 +364,7 @@ pub fn render_claude_config() -> String {
|
|||
}),
|
||||
);
|
||||
}
|
||||
let config = serde_json::json!({ "mcpServers": servers });
|
||||
serde_json::to_string_pretty(&config).unwrap_or_else(|_| "{}".into())
|
||||
servers
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue