feat: add installation guides for mcp commands

This commit is contained in:
uinstinct 2025-09-18 11:38:17 +05:30
parent f8ea904f3d
commit 34f7492516
3 changed files with 35 additions and 1 deletions

View file

@ -52,6 +52,7 @@ class MCPConnection {
public status: MCPConnectionStatus = "not-connected";
public isProtectedResource = false;
public errors: string[] = [];
public infos: string[] = [];
public prompts: MCPPrompt[] = [];
public tools: MCPTool[] = [];
public resources: MCPResource[] = [];
@ -93,6 +94,7 @@ class MCPConnection {
return {
...this.options,
errors: this.errors,
infos: this.infos,
prompts: this.prompts,
resources: this.resources,
resourceTemplates: this.resourceTemplates,
@ -122,6 +124,7 @@ class MCPConnection {
this.resources = [];
this.resourceTemplates = [];
this.errors = [];
this.infos = [];
this.stdioOutput = { stdout: "", stderr: "" };
this.abortController.abort();
@ -280,6 +283,16 @@ class MCPConnection {
if (msg.includes("spawn") && msg.includes("enoent")) {
const command = msg.split(" ")[1];
errorMessage += `Error: command "${command}" not found. To use this MCP server, install the ${command} CLI.`;
if (["uv", "uvx"].includes(command)) {
this.infos.push(
'Please install uv by following the installation guide: <a href="https://docs.astral.sh/uv/getting-started/installation/">https://docs.astral.sh/uv/getting-started/installation/</a>',
);
}
if (["node", "npx"].includes(command)) {
this.infos.push(
'Please install npx by following the installation guide: <a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm">https://docs.npmjs.com/downloading-and-installing-node-js-and-npm</a>',
);
}
} else {
errorMessage += "Error: " + error.message;
}

1
core/index.d.ts vendored
View file

@ -1333,6 +1333,7 @@ export interface MCPTool {
export interface MCPServerStatus extends MCPOptions {
status: MCPConnectionStatus;
errors: string[];
infos: string[];
isProtectedResource: boolean;
prompts: MCPPrompt[];

View file

@ -5,7 +5,6 @@ import {
CircleStackIcon,
CommandLineIcon,
GlobeAltIcon,
PlusIcon,
UserCircleIcon,
WrenchScrewdriverIcon,
} from "@heroicons/react/24/outline";
@ -268,6 +267,27 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) {
))}
</div>
)}
{server.infos && server.infos.length > 0 && (
<div className="mt-3 space-y-2">
{server.infos.map((info, infoIndex) => (
<Alert
key={infoIndex}
type="info"
size="sm"
className="transition-all"
onClick={() =>
void ideMessenger.ide.showVirtualFile(server.name, info)
}
>
<span
className="text-xs"
dangerouslySetInnerHTML={{ __html: info }}
/>
</Alert>
))}
</div>
)}
</div>
);
}