MCPcopy Create free account
hub / github.com/AI45Lab/Code / connect

Method connect

core/src/mcp/manager.rs:68–82  ·  view source on GitHub ↗

Connect to a registered server, recording success or failure internally. On success the stored error (if any) is cleared; on failure the error message is stored and visible via [`McpManager::get_status`].

(&self, name: &str)

Source from the content-addressed store, hash-verified

66 /// On success the stored error (if any) is cleared; on failure the error
67 /// message is stored and visible via [`McpManager::get_status`].
68 pub async fn connect(&self, name: &str) -> Result<()> {
69 let result = self.do_connect(name).await;
70 match &result {
71 Ok(_) => {
72 self.connect_errors.write().await.remove(name);
73 }
74 Err(e) => {
75 self.connect_errors
76 .write()
77 .await
78 .insert(name.to_string(), e.to_string());
79 }
80 }
81 result
82 }
83
84 async fn do_connect(&self, name: &str) -> Result<()> {
85 // Get config

Callers 4

add_mcp_serverMethod · 0.45
connect_global_mcpFunction · 0.45

Calls 4

do_connectMethod · 0.80
removeMethod · 0.80
writeMethod · 0.80
insertMethod · 0.45

Tested by 1