|
| 1 | +# @tiny-design/mcp |
| 2 | + |
| 3 | +MCP (Model Context Protocol) server that gives AI assistants structured access to the [Tiny Design](https://wangdicoder.github.io/tiny-design/) component library, design tokens, and icon catalog. |
| 4 | + |
| 5 | +## Setup |
| 6 | + |
| 7 | +Add to your MCP client config: |
| 8 | + |
| 9 | +### Claude Code |
| 10 | + |
| 11 | +```json |
| 12 | +// .claude/settings.json |
| 13 | +{ |
| 14 | + "mcpServers": { |
| 15 | + "tiny-design": { |
| 16 | + "command": "npx", |
| 17 | + "args": ["@tiny-design/mcp"] |
| 18 | + } |
| 19 | + } |
| 20 | +} |
| 21 | +``` |
| 22 | + |
| 23 | +### VS Code (GitHub Copilot) |
| 24 | + |
| 25 | +```json |
| 26 | +// .vscode/mcp.json |
| 27 | +{ |
| 28 | + "mcpServers": { |
| 29 | + "tiny-design": { |
| 30 | + "command": "npx", |
| 31 | + "args": ["@tiny-design/mcp"] |
| 32 | + } |
| 33 | + } |
| 34 | +} |
| 35 | +``` |
| 36 | + |
| 37 | +### Cursor |
| 38 | + |
| 39 | +```json |
| 40 | +// .cursor/mcp.json |
| 41 | +{ |
| 42 | + "mcpServers": { |
| 43 | + "tiny-design": { |
| 44 | + "command": "npx", |
| 45 | + "args": ["@tiny-design/mcp"] |
| 46 | + } |
| 47 | + } |
| 48 | +} |
| 49 | +``` |
| 50 | + |
| 51 | +## Available Tools |
| 52 | + |
| 53 | +| Tool | Description | |
| 54 | +|------|-------------| |
| 55 | +| `list_components` | List all 80+ components. Filter by category: Foundation, Layout, Navigation, Data Display, Form, Feedback, Miscellany. | |
| 56 | +| `get_component_props` | Get the full props interface for a component — types, required flags, descriptions. | |
| 57 | +| `get_component_example` | Get usage examples (demo code) for a component. | |
| 58 | +| `get_design_tokens` | Get design tokens (SCSS variables) — colors, typography, spacing, breakpoints, shadows. | |
| 59 | +| `list_icons` | List all 240+ icon names. Filter by search term. | |
| 60 | +| `get_icon` | Get details and usage example for a specific icon. | |
| 61 | + |
| 62 | +## Examples |
| 63 | + |
| 64 | +Ask your AI assistant: |
| 65 | + |
| 66 | +- "List all form components in Tiny Design" |
| 67 | +- "What props does the Modal component accept?" |
| 68 | +- "Show me an example of using the Select component" |
| 69 | +- "What colors are available in Tiny Design's design tokens?" |
| 70 | +- "Find icons related to arrows" |
| 71 | + |
| 72 | +## Development |
| 73 | + |
| 74 | +```bash |
| 75 | +# Install dependencies (from monorepo root) |
| 76 | +pnpm install |
| 77 | + |
| 78 | +# Run extraction + build |
| 79 | +pnpm --filter @tiny-design/mcp build |
| 80 | + |
| 81 | +# Run tests |
| 82 | +pnpm --filter @tiny-design/mcp test |
| 83 | +``` |
| 84 | + |
| 85 | +### How It Works |
| 86 | + |
| 87 | +1. **Build time:** Extraction scripts parse component `types.ts` files (via `ts-morph`), SCSS token variables (via regex), and icon barrel exports to produce static JSON. |
| 88 | +2. **Bundle time:** `tsup` bundles the server code with inlined JSON data into a single self-contained `dist/index.js`. |
| 89 | +3. **Runtime:** The MCP server loads the inlined data and serves it via 6 tools over stdio transport using `@modelcontextprotocol/sdk`. |
| 90 | + |
| 91 | +## License |
| 92 | + |
| 93 | +MIT |
0 commit comments