Merge pull request #7826 from uinstinct/install-guide-mcp
feat: add installation guides for mcp commands
This commit is contained in:
commit
47b0cd632e
5 changed files with 37 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ describe("MCPConnection", () => {
|
|||
expect(status).toEqual({
|
||||
...options,
|
||||
errors: [],
|
||||
infos: [],
|
||||
isProtectedResource: false,
|
||||
prompts: [],
|
||||
resources: [],
|
||||
|
|
|
|||
1
core/index.d.ts
vendored
1
core/index.d.ts
vendored
|
|
@ -1335,6 +1335,7 @@ export interface MCPTool {
|
|||
export interface MCPServerStatus extends MCPOptions {
|
||||
status: MCPConnectionStatus;
|
||||
errors: string[];
|
||||
infos: string[];
|
||||
isProtectedResource: boolean;
|
||||
|
||||
prompts: MCPPrompt[];
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { getMCPToolName } from "./mcpToolName";
|
|||
const createMcpServer = (name: string): MCPServerStatus => ({
|
||||
name,
|
||||
errors: [],
|
||||
infos: [],
|
||||
prompts: [],
|
||||
tools: [],
|
||||
resources: [],
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue