MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / get_mcp_status

Method get_mcp_status

crates/opencode-tui/src/api.rs:490–507  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

488 }
489
490 pub fn get_mcp_status(&self) -> anyhow::Result<Vec<McpStatusInfo>> {
491 let url = format!("{}/mcp", self.base_url);
492
493 let response = self.client.get(&url).send()?;
494
495 if !response.status().is_success() {
496 let status = response.status();
497 let text = response.text().unwrap_or_default();
498 anyhow::bail!("Failed to fetch MCP status: {} - {}", status, text);
499 }
500
501 let mut servers: Vec<McpStatusInfo> = response
502 .json::<HashMap<String, McpStatusInfo>>()?
503 .into_values()
504 .collect();
505 servers.sort_by(|a, b| a.name.cmp(&b.name));
506 Ok(servers)
507 }
508
509 pub fn start_mcp_auth(&self, name: &str) -> anyhow::Result<McpAuthStartInfo> {
510 let url = format!("{}/mcp/{}/auth", self.base_url, name);

Callers 1

refresh_mcp_dialogMethod · 0.80

Calls 4

sendMethod · 0.45
getMethod · 0.45
statusMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected