fix: improve MCP tool probing reliability

- Increase default probe timeout from 10s to 30s to handle slow
  package managers (uvx, npx) that install on first run
- Add console logging for probe success/failure to aid debugging
- Probe manually configured MCP servers (not just discovered ones)
  so all servers with wildcard tools get their tools discovered

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-03-28 19:30:42 +01:00
co-authored by Copilot
parent 8312a47bf1
commit b4b0bf54d2
2 changed files with 33 additions and 2 deletions
+28
View File
@@ -2130,10 +2130,14 @@ export class AryxAppService extends EventEmitter<AppServiceEvents> {
}
private async probeAllAcceptedMcpServers(workspace: WorkspaceState): Promise<void> {
// Probe discovered MCP servers (from config files)
await this.probeDiscoveredMcpServersFromState(workspace.settings.discoveredUserTooling);
for (const project of workspace.projects) {
await this.probeDiscoveredMcpServersFromState(project.discoveredTooling);
}
// Probe manually configured MCP servers that have empty tools arrays
await this.probeManualMcpServers(workspace);
}
private async probeDiscoveredMcpServersFromState(
@@ -2185,6 +2189,30 @@ export class AryxAppService extends EventEmitter<AppServiceEvents> {
}
}
private async probeManualMcpServers(workspace: WorkspaceState): Promise<void> {
const manualServers = workspace.settings.tooling.mcpServers.filter(
(server) => server.tools.length === 0 && (!server.probedTools || server.probedTools.length === 0),
);
if (manualServers.length === 0) return;
const tokenLookup = (url: string) => getStoredToken(url)?.accessToken;
const results = await probeServers(manualServers, tokenLookup);
let changed = false;
for (const result of results) {
if (result.status !== 'success' || result.tools.length === 0) continue;
const server = workspace.settings.tooling.mcpServers.find((s) => s.id === result.serverId);
if (server) {
server.probedTools = result.tools;
changed = true;
}
}
if (changed) {
await this.persistAndBroadcast(workspace);
}
}
private discoveredServerToDefinition(server: DiscoveredMcpServer): McpServerDefinition {
if (server.transport === 'local') {
return {