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

Method authenticate_mcp

crates/opencode-tui/src/api.rs:520–534  ·  view source on GitHub ↗
(&self, name: &str)

Source from the content-addressed store, hash-verified

518 }
519
520 pub fn authenticate_mcp(&self, name: &str) -> anyhow::Result<McpStatusInfo> {
521 let url = format!("{}/mcp/{}/auth/authenticate", self.base_url, name);
522 let response = self.client.post(&url).send()?;
523 if !response.status().is_success() {
524 let status = response.status();
525 let text = response.text().unwrap_or_default();
526 anyhow::bail!(
527 "Failed to authenticate MCP `{}`: {} - {}",
528 name,
529 status,
530 text
531 );
532 }
533 Ok(response.json::<McpStatusInfo>()?)
534 }
535
536 pub fn remove_mcp_auth(&self, name: &str) -> anyhow::Result<bool> {
537 let url = format!("{}/mcp/{}/auth", self.base_url, name);

Callers 1

handle_dialog_keyMethod · 0.80

Calls 3

sendMethod · 0.45
statusMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected