|
| 1 | +# MCP Server |
| 2 | + |
| 3 | +`@tiny-design/mcp` is a [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) server that gives AI assistants structured access to the Tiny Design component library, design tokens, and icon catalog. |
| 4 | + |
| 5 | +With MCP, AI coding assistants like Claude Code, GitHub Copilot, and Cursor can look up component props, browse usage examples, query design tokens, and search icons — all without leaving your editor. |
| 6 | + |
| 7 | +## What is MCP? |
| 8 | + |
| 9 | +The Model Context Protocol (MCP) is an open standard that lets AI assistants connect to external data sources and tools. Instead of relying solely on training data, the AI can query live, accurate information about your design system on demand. |
| 10 | + |
| 11 | +## Available Tools |
| 12 | + |
| 13 | +| Tool | Description | |
| 14 | +|------|-------------| |
| 15 | +| `list_components` | List all 80+ components. Filter by category: Foundation, Layout, Navigation, Data Display, Form, Feedback, Miscellany. | |
| 16 | +| `get_component_props` | Get the full props interface for a component — types, required flags, descriptions. | |
| 17 | +| `get_component_example` | Get usage examples (demo code) for a component. | |
| 18 | +| `get_design_tokens` | Get design tokens (SCSS variables) — colors, typography, spacing, breakpoints, shadows. | |
| 19 | +| `list_icons` | List all 240+ icon names. Filter by search term. | |
| 20 | +| `get_icon` | Get details and usage example for a specific icon. | |
| 21 | + |
| 22 | +## Setup |
| 23 | + |
| 24 | +Install the MCP server by adding it to your AI assistant's configuration: |
| 25 | + |
| 26 | +### Claude Code |
| 27 | + |
| 28 | +```json |
| 29 | +// .claude/settings.json |
| 30 | +{ |
| 31 | + "mcpServers": { |
| 32 | + "tiny-design": { |
| 33 | + "command": "npx", |
| 34 | + "args": ["@tiny-design/mcp"] |
| 35 | + } |
| 36 | + } |
| 37 | +} |
| 38 | +``` |
| 39 | + |
| 40 | +### VS Code (GitHub Copilot) |
| 41 | + |
| 42 | +```json |
| 43 | +// .vscode/mcp.json |
| 44 | +{ |
| 45 | + "mcpServers": { |
| 46 | + "tiny-design": { |
| 47 | + "command": "npx", |
| 48 | + "args": ["@tiny-design/mcp"] |
| 49 | + } |
| 50 | + } |
| 51 | +} |
| 52 | +``` |
| 53 | + |
| 54 | +### Cursor |
| 55 | + |
| 56 | +```json |
| 57 | +// .cursor/mcp.json |
| 58 | +{ |
| 59 | + "mcpServers": { |
| 60 | + "tiny-design": { |
| 61 | + "command": "npx", |
| 62 | + "args": ["@tiny-design/mcp"] |
| 63 | + } |
| 64 | + } |
| 65 | +} |
| 66 | +``` |
| 67 | + |
| 68 | +## Example Prompts |
| 69 | + |
| 70 | +Once configured, try asking your AI assistant: |
| 71 | + |
| 72 | +- "List all form components in Tiny Design" |
| 73 | +- "What props does the Modal component accept?" |
| 74 | +- "Show me an example of using the Select component" |
| 75 | +- "What colors are available in Tiny Design's design tokens?" |
| 76 | +- "Find icons related to arrows" |
| 77 | + |
| 78 | +## How It Works |
| 79 | + |
| 80 | +1. **Build time:** Extraction scripts parse component `types.ts` files (via `ts-morph`), SCSS token variables, and icon barrel exports to produce static JSON data. |
| 81 | +2. **Bundle time:** `tsup` bundles the server code with inlined JSON data into a single self-contained executable. |
| 82 | +3. **Runtime:** The MCP server loads the inlined data and serves it via 6 tools over stdio transport using `@modelcontextprotocol/sdk`. |
0 commit comments