Skip to main content
Glama
burkeholland

VS Code MCP Button Generator

by burkeholland

Buttons from MCP config

from_mcp_config

Generate VS Code installation buttons and badges from MCP configuration objects to simplify server setup.

Instructions

Generate install buttons from a raw MCP JSON-like config object and a server name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesServer display name.
mcpNo

Implementation Reference

  • The handler function for the 'from_mcp_config' tool. It extracts inputs and config from the provided MCP object using the helper function, generates the install buttons markdown, and returns it as structured content.
    async ({ name, mcp }) => {
      const { inputs, config } = fromMcpConfigObject(name, mcp ?? {});
      const markdown = generateButtonsMarkdown(name, inputs, config);
      return { content: [{ type: "text", text: markdown }] };
    }
  • src/index.ts:132-147 (registration)
    Registration of the 'from_mcp_config' tool on the MCP server using server.registerTool.
    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 }] };
      }
    );
  • Input schema definition for the 'from_mcp_config' tool using Zod, specifying 'name' as string and 'mcp' as any.
    inputSchema: {
      name: z.string().describe("Server display name."),
      mcp: z.any(),
    }
  • Helper function used by the handler to parse the MCP config object into inputs (MCPInput[]) and config (CommandConfig).
    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 };
    }
  • Type definitions for MCPInput and CommandConfig used in the tool's inputs and config parsing.
    export type MCPInput = {
      type: string;
      id: string;
      description?: string;
      password?: boolean;
    };
    
    export type CommandConfig = {
      command: string; // e.g., "npx"
      args?: string[];
      env?: Record<string, string>;
    };

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/burkeholland/mcp-vsc-button-gen'

If you have feedback or need assistance with the MCP directory API, please join our Discord server