fix: MCP connection - Added explicit connectAll() method with timeout - Updated mcp-connect endpoint to use connectAll - Enhanced UI feedback for connection errors
This commit is contained in:
@@ -163,12 +163,24 @@ const McpManager: Component<McpManagerProps> = (props) => {
|
||||
setConnecting(true)
|
||||
setError(null)
|
||||
try {
|
||||
log.info("Connecting to all MCP servers...")
|
||||
const result = await serverApi.connectWorkspaceMcps(props.instanceId)
|
||||
log.info("MCP connection result:", result)
|
||||
setConnectionStatus(result.servers ?? {})
|
||||
setToolCount(result.toolCount ?? 0)
|
||||
|
||||
// Check for any connection errors
|
||||
const connectionDetails = (result as any).connectionDetails ?? {}
|
||||
const failedServers = Object.entries(connectionDetails)
|
||||
.filter(([_, details]: [string, any]) => !details.connected)
|
||||
.map(([name, details]: [string, any]) => `${name}: ${details.error || 'Unknown error'}`)
|
||||
|
||||
if (failedServers.length > 0) {
|
||||
setError(`Some servers failed to connect: ${failedServers.join(', ')}`)
|
||||
}
|
||||
} catch (err) {
|
||||
log.error("Failed to connect MCPs", err)
|
||||
setError("Failed to connect MCP servers.")
|
||||
setError("Failed to connect MCP servers. Check console for details.")
|
||||
} finally {
|
||||
setConnecting(false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user