MCPcopy Create free account
hub / github.com/GCWing/BitFun / initialize_mcp_servers

Function initialize_mcp_servers

src/apps/desktop/src/api/mcp_api.rs:125–147  ·  view source on GitHub ↗
(
    state: State<'_, AppState>,
    startup_trace: State<'_, DesktopStartupTrace>,
)

Source from the content-addressed store, hash-verified

123
124#[tauri::command]
125pub async fn initialize_mcp_servers(
126 state: State<'_, AppState>,
127 startup_trace: State<'_, DesktopStartupTrace>,
128) -> Result<(), String> {
129 let trace_started = Instant::now();
130 let result = async {
131 let mcp_service = state
132 .mcp_service
133 .as_ref()
134 .ok_or_else(|| "MCP service not initialized".to_string())?;
135
136 mcp_service
137 .server_manager()
138 .initialize_all()
139 .await
140 .map_err(|e| e.to_string())?;
141
142 Ok(())
143 }
144 .await;
145 startup_trace.record_tauri_command_elapsed("initialize_mcp_servers", None, trace_started);
146 result
147}
148
149#[tauri::command]
150pub async fn initialize_mcp_servers_non_destructive(

Callers

nothing calls this directly

Calls 3

server_managerMethod · 0.80
initialize_allMethod · 0.45

Tested by

no test coverage detected