mcp
v3.16.0MCP server for Baseline UI design system documentation
Internal documentation for developing and maintaining the MCP server. This package provides a Model Context Protocol (MCP) server that exposes Baseline UI's component documentation, icons, and design tokens to AI assistants like Claude and Cursor. The server uses a build-time process to extract metadata from components, icons, and design tokens; all of it is inlined into the bundle at build, so nothing is read from disk at runtime. The server implementation (src/server.ts) is transport-agnostic; the published bin (src/index.ts) wires it to stdio.
Summary extracted from the README.
Baseline UI MCP Server
Internal documentation for developing and maintaining the MCP server.
For public API documentation, see MCP.mdx (used in Storybook)
Overview
This package provides a Model Context Protocol (MCP) server that exposes Baseline UI's component documentation, icons, and design tokens to AI assistants like Claude and Cursor.
Architecture
The server uses a build-time process to extract metadata from components, icons, and design tokens; all of it is inlined into the bundle at build, so nothing is read from disk at runtime. The server implementation (src/server.ts) is transport-agnostic; the published bin (src/index.ts) wires it to stdio.
Running In-Process
Hosts can run the server inside their own Node process instead of spawning the stdio bin, via the ./server export:
import { createServer } from "@baseline-ui/mcp/server";
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
const server = createServer();
const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
await server.connect(serverTransport);
const client = new Client({ name: "my-host", version: "1.0.0" });
await client.connect(clientTransport);
All documentation data is inlined into the bundle at build time — the package reads no files at runtime, so it is safe to bundle or trace in any deployment (unlike MCP packages that resolve data from their package directory).
Development
Setup
pnpm install
pnpm build
Running Locally
# Run the server
pnpm start
# Development with source maps
pnpm dev
# Run tests
pnpm test:unit --run packages/mcp
# Type checking
pnpm test:static
Testing
- Unit Tests - Data file structure validation
- Integration Tests - Tool invocation and end-to-end MCP protocol testing
Publishing
The package is published to npm as @baseline-ui/mcp. See package.json for published files and scripts.
Performance Considerations
- Pre-built Data - All metadata generated at build time and inlined into the bundle
- Efficient Search - Simple string matching for icons
Troubleshooting
Build Failures
Check that:
packages/coreis builtpackages/tokensis built- TypeDoc has generated
docs/index.json
Test Failures
Rebuild before testing: pnpm build