MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / disconnect

Method disconnect

crates/opencode-server/src/mcp_oauth.rs:282–308  ·  view source on GitHub ↗
(&self, server_name: &str)

Source from the content-addressed store, hash-verified

280 }
281
282 pub async fn disconnect(&self, server_name: &str) -> Result<McpServerInfo, McpOAuthError> {
283 self.log_event(server_name, "info", "Disconnect requested")
284 .await;
285 let managed = self.managed_server(server_name).await?;
286 if let McpRuntimeConfig::Local(_) = managed.config {
287 self.clients
288 .remove(server_name)
289 .await
290 .map_err(|e| McpOAuthError::RuntimeError(e.to_string()))?;
291 }
292
293 let info = McpServerInfo {
294 name: server_name.to_string(),
295 status: "disabled".to_string(),
296 tools: 0,
297 resources: 0,
298 error: None,
299 oauth_required: managed.config.oauth_required(),
300 oauth_status: self.oauth_status_for(server_name).await,
301 };
302 self.statuses
303 .write()
304 .await
305 .insert(server_name.to_string(), info.clone());
306 self.log_event(server_name, "info", "Disconnected").await;
307 Ok(info)
308 }
309
310 pub async fn start_oauth(&self, server_name: &str) -> Result<McpOAuthState, McpOAuthError> {
311 let managed = self.managed_server(server_name).await?;

Callers 2

restartMethod · 0.80
disconnect_mcpFunction · 0.80

Calls 6

managed_serverMethod · 0.80
oauth_requiredMethod · 0.80
oauth_status_forMethod · 0.80
log_eventMethod · 0.45
removeMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected