#!/usr/bin/env node import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { z } from "zod"; const server = new McpServer({ name: "UI Components Server", description: "Provide some UI components for the app. According to the additional information required, select the appropriate one or more UI components to return.", version: "1.0.0" }); server.tool( "TextInput", "Using for text input", { label: z.string(), required: z.boolean().default(true), }, async ({ label, required }) => { return { content: [{ type: "text", text: JSON.stringify({ component: "TextInput", label, required }) }] } } ); server.tool( "NumberInput", "Using for number input", { label: z.string(), required: z.boolean().default(true), }, async ({ label, required }) => { return { content: [{ type: "text", text: JSON.stringify({ component: "NumberInput", label, required }) }] } } ); server.tool( "Select", "Using for select value from a list of options", { label: z.string(), options: z.array(z.string()).describe("The options to choose from"), required: z.boolean().default(true), }, async ({ label, options, required }) => { return { content: [{ type: "text", text: JSON.stringify({ component: "Select", label, data: { options }, required }) }] } } ); const transport = new StdioServerTransport(); await server.connect(transport);