from_mcp_config
Generate VS Code installation buttons and markdown badges by processing a raw MCP config object and server name, enabling quick setup and configuration for MCP servers.
Instructions
Generate install buttons from a raw MCP JSON-like config object and a server name.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mcp | No | ||
| name | Yes | Server display name. |
Implementation Reference
- src/index.ts:142-146 (handler)The handler function for the 'from_mcp_config' tool. It uses fromMcpConfigObject to parse the MCP config into inputs and config, then generates markdown buttons.async ({ name, mcp }) => { const { inputs, config } = fromMcpConfigObject(name, mcp ?? {}); const markdown = generateButtonsMarkdown(name, inputs, config); return { content: [{ type: "text", text: markdown }] }; }
- src/index.ts:137-141 (schema)Input schema for the 'from_mcp_config' tool: requires 'name' string and 'mcp' any object.inputSchema: { name: z.string().describe("Server display name."), mcp: z.any(), } },
- src/index.ts:132-147 (registration)Registration of the 'from_mcp_config' tool using server.registerTool, including schema and handler.server.registerTool( "from_mcp_config", { title: "Buttons from MCP config", description: "Generate install buttons from a raw MCP JSON-like config object and a server name.", inputSchema: { name: z.string().describe("Server display name."), mcp: z.any(), } }, async ({ name, mcp }) => { const { inputs, config } = fromMcpConfigObject(name, mcp ?? {}); const markdown = generateButtonsMarkdown(name, inputs, config); return { content: [{ type: "text", text: markdown }] }; } );
- src/lib/buttons.ts:47-56 (helper)Helper function fromMcpConfigObject that extracts inputs and config from the MCP config object provided to the tool.export function fromMcpConfigObject(name: string, configObj: any): { inputs: MCPInput[]; config: CommandConfig } { // Accepts a JSON like the example and converts env placeholders ${input:...} to VS Code expected rendering untouched. const inputs = Array.isArray(configObj.inputs) ? (configObj.inputs as MCPInput[]) : []; // For NPX-based servers, we expect the consumer to specify the npx invocation // Example: { command: 'npx', args: ['-y', '@scope/server@latest', '--flag'], env: { KEY: '${input:id}' } } // If not given, default to npx with no args const config: CommandConfig = configObj.config ?? { command: 'npx', args: [] }; return { inputs, config }; }