15What's the minimum for a basic version?
Say itHonestly? A folder of components, a JSON file that describes them, and about forty lines of code. No hosting, no accounts. Here it is.
The details
// server.mjs: npm i @modelcontextprotocol/sdk zod
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
import { z } from 'zod'
import { readFileSync } from 'node:fs'
// [{ name, description, tags, file }]: one entry per component
const catalog = JSON.parse(readFileSync(new URL('./catalog.json', import.meta.url)))
const server = new McpServer({ name: 'my-library', version: '1.0.0' })
server.registerTool('search_components', {
description: 'Find components by what they do. Use it whenever the user asks for a UI piece.',
inputSchema: { query: z.string() },
}, async ({ query }) => {
const words = query.toLowerCase().split(/\s+/)
const hits = catalog.filter((c) => words.every((w) => `${c.name} ${c.description} ${c.tags}`.toLowerCase().includes(w)))
return { content: [{ type: 'text', text: hits.map((c) => `${c.name}: ${c.description}`).join('\n') || 'Nothing found.' }] }
})
server.registerTool('get_component_code', {
description: 'The source of one component, to put into the user\'s project.',
inputSchema: { name: z.string() },
}, async ({ name }) => {
const c = catalog.find((x) => x.name === name)
return { content: [{ type: 'text', text: c ? readFileSync(new URL(c.file, import.meta.url), 'utf8') : 'No such component.' }] }
})
await server.connect(new StdioServerTransport())
# connect it
claude mcp add my-library -- node /full/path/to/server.mjs
Then grow it in this order: an install tool that writes files and reports packages; settings as props in your catalog; a rehearsal that installs everything into an empty project; and only then accounts and payment.