improvement(extesnsions): handle legacy multimodel MCP diagnostics Merge pull request #67 from artemrootman/fix/mcp-diagnostics-runtime-fallback
Merge pull request #67 from artemrootman/fix/mcp-diagnostics-runtime-fallback
This commit is contained in:
commit
2552e87a39
2 changed files with 51 additions and 14 deletions
|
|
@ -26,8 +26,7 @@
|
|||
<sub>Free desktop app for AI agent teams. Auto-detects Claude/Codex. Use the provider access you already have - subscriptions or API keys. Not just coding agents.</sub>
|
||||
</p>
|
||||
|
||||
<img width="1500" height="1065" alt="demo" src="https://github.com/user-attachments/assets/9d502887-7e28-4a11-aedd-3bd45fdfb0d2" />
|
||||
|
||||
<img width="1304" height="820" alt="image" src="https://github.com/user-attachments/assets/dea53a01-68b3-4c36-bcf6-e4d1ad4cdb31" />
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ export class ClaudeExtensionsAdapter implements ExtensionsRuntimeAdapter {
|
|||
export class MultimodelExtensionsAdapter implements ExtensionsRuntimeAdapter {
|
||||
readonly flavor = 'agent_teams_orchestrator' as const;
|
||||
|
||||
constructor(private readonly stateReader = new McpConfigStateReader()) {}
|
||||
|
||||
async buildManagementCliEnv(binaryPath: string): Promise<NodeJS.ProcessEnv> {
|
||||
return buildManagementCliEnvForBinary(binaryPath);
|
||||
}
|
||||
|
|
@ -72,13 +74,21 @@ export class MultimodelExtensionsAdapter implements ExtensionsRuntimeAdapter {
|
|||
}
|
||||
|
||||
const env = await this.buildManagementCliEnv(binaryPath);
|
||||
const { stdout } = await execCli(binaryPath, ['mcp', 'list', '--json'], {
|
||||
timeout: MCP_LIST_TIMEOUT_MS,
|
||||
cwd: projectPath,
|
||||
env,
|
||||
});
|
||||
try {
|
||||
const { stdout } = await execCli(binaryPath, ['mcp', 'list', '--json'], {
|
||||
timeout: MCP_LIST_TIMEOUT_MS,
|
||||
cwd: projectPath,
|
||||
env,
|
||||
});
|
||||
|
||||
return parseInstalledMcpJsonOutput(stdout);
|
||||
return parseInstalledMcpJsonOutput(stdout);
|
||||
} catch (error) {
|
||||
if (!isUnsupportedMcpJsonContractError(error)) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
return this.stateReader.readInstalled(projectPath);
|
||||
}
|
||||
}
|
||||
|
||||
async diagnoseMcp(projectPath?: string): Promise<McpServerDiagnostic[]> {
|
||||
|
|
@ -88,16 +98,44 @@ export class MultimodelExtensionsAdapter implements ExtensionsRuntimeAdapter {
|
|||
}
|
||||
|
||||
const env = await this.buildManagementCliEnv(binaryPath);
|
||||
const { stdout } = await execCli(binaryPath, ['mcp', 'diagnose', '--json'], {
|
||||
timeout: MCP_DIAGNOSE_TIMEOUT_MS,
|
||||
cwd: projectPath,
|
||||
env,
|
||||
});
|
||||
try {
|
||||
const { stdout } = await execCli(binaryPath, ['mcp', 'diagnose', '--json'], {
|
||||
timeout: MCP_DIAGNOSE_TIMEOUT_MS,
|
||||
cwd: projectPath,
|
||||
env,
|
||||
});
|
||||
|
||||
return parseMcpDiagnosticsJsonOutput(stdout);
|
||||
return parseMcpDiagnosticsJsonOutput(stdout);
|
||||
} catch (error) {
|
||||
if (!isUnsupportedMcpJsonContractError(error)) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
const { stdout, stderr } = await execCli(binaryPath, ['mcp', 'list'], {
|
||||
timeout: MCP_DIAGNOSE_TIMEOUT_MS,
|
||||
cwd: projectPath,
|
||||
env,
|
||||
});
|
||||
|
||||
return parseMcpDiagnosticsOutput([stdout, stderr].filter(Boolean).join('\n'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isUnsupportedMcpJsonContractError(error: unknown): boolean {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
const normalized = message.toLowerCase();
|
||||
|
||||
return (
|
||||
normalized.includes("unknown command 'diagnose'") ||
|
||||
normalized.includes('unknown command "diagnose"') ||
|
||||
normalized.includes('unknown option') ||
|
||||
normalized.includes('unknown argument') ||
|
||||
normalized.includes('unexpected argument') ||
|
||||
normalized.includes('unrecognized option')
|
||||
);
|
||||
}
|
||||
|
||||
class RuntimeSwitchingExtensionsAdapter implements ExtensionsRuntimeAdapter {
|
||||
constructor(
|
||||
private readonly claudeAdapter: ClaudeExtensionsAdapter,
|
||||
|
|
|
|||
Loading…
Reference in a new issue