MCP Support
Connect the Vayu UI MCP server to your AI coding tools for intelligent component discovery, props lookup, scaffolding, and design token access.
The Vayu UI MCP server exposes 17 tools that let AI assistants understand your component library — search components, get props and variants, scaffold code, access design tokens, and more. It runs via stdio, so it works with any MCP-compatible tool.
Quick Setup
The fastest way is using the CLI. All configurations are written at the project level (workspace root):
# Interactive — prompts which tools to configure
npx vayu-ui-cli@latest install-mcp
# Configure specific tools
npx vayu-ui-cli@latest install-mcp --tool claude
npx vayu-ui-cli@latest install-mcp --tool claude,cursor,opencodeThis writes the correct config to each tool's settings file in your project root. Restart your AI tool after running it.
| Flag | Description |
|---|---|
--tool | Comma-separated: claude, cursor, opencode |
--dry-run | Preview changes without writing |
--force | Overwrite existing entries |
Note: The CLI auto-configures Claude Code, Cursor, and OpenCode. For Codex, Antigravity, and Windsurf, use the manual setup below.
Manual Setup
If you prefer to add the config manually, add the JSON (or TOML) below to the correct file for your tool.
File: .mcp.json (project root)
{
"mcpServers": {
"vayu-ui": {
"command": "npx",
"args": ["-y", "vayu-ui-mcp"]
}
}
}If the file already exists, merge the vayu-ui entry into the existing mcpServers, mcp, or mcp_servers object — don't overwrite other entries.
Project-Level Setup
All MCP configurations managed by this CLI are project-scoped. This means:
- Config files are created in your project root, not your home directory.
- The MCP server is only active when the AI tool is working inside this project.
- Other projects are unaffected.
If you need the same MCP server in multiple projects, run install-mcp in each project directory.
Available Tools
Once connected, the following 17 tools are available to your AI assistant:
| Tool | Description |
|---|---|
list_components | List all components and hooks with optional filters |
find_component | Fuzzy search by natural language query |
get_component_summary | Lightweight identity card (name, category, tags) |
get_component_props | All props with types, defaults, and descriptions |
get_component_variants | Available visual variants and sizes |
get_component_states | Interactive states (loading, disabled, hover, etc.) |
get_component_events | Event handlers with TypeScript signatures |
get_component_a11y | ARIA roles, keyboard navigation, focus management |
get_component_dependencies | NPM deps, registry deps, install command |
get_component_peer_components | Frequently co-used components |
get_component_composition | Compound component structure and sub-components |
get_component_example | Ready-to-paste TSX code examples |
get_component_do_not | Anti-patterns and common mistakes |
get_hook_details | Full hook API (signature, params, return values) |
scaffold_component_usage | Generate working code with imports and state |
get_install_guide | CLI commands and import paths for installation |
get_design_tokens | CSS design tokens with Tailwind classes |
Usage Guide
Recommended Workflow
- Discover —
find_component(orlist_componentsfor broad browsing), thenget_component_summary - Inspect —
get_component_props,get_component_variants,get_component_states, andget_component_events - A11y + composition —
get_component_compositionandget_component_a11yfor overlays/forms/keyboard paths - Scaffold + validate —
scaffold_component_usage, thenget_component_do_not - Install/import verification —
get_install_guidebefore sharing commands/import paths
Example: Finding and Using a Component
{
"name": "find_component",
"arguments": { "query": "modal dialog with overlay" }
}Common Tool Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Component/hook name (case-insensitive) |
slug | string | No | CLI slug identifier |
variant | string | No | Example variant key |
category | enum | No | Filter: inputs, overlay, state, etc. |
type | enum | No | Filter: component or hook |
withState | boolean | No | Wrap scaffold in useState |
Design Tokens via MCP
Use get_design_tokens to access the full design system:
{
"name": "get_design_tokens",
"arguments": { "name": "Button" }
}Token Categories
| Category | What's Included |
|---|---|
| Colors | Semantic tokens: brand, surface, elevated, success, warning, destructive, info, muted (each with content variant) |
| Radius | rounded-control, rounded-surface, rounded-overlay |
| Shadows | shadow-control, shadow-surface, shadow-elevated |
| Structural | border, field, focus tokens |
Pass overridableOnly: true to get only tokens that are safe to override without breaking component behavior.
Component Categories
| Category | Description | Examples |
|---|---|---|
inputs | Form controls and data entry | Button, TextInput, Checkbox, Select |
feedback | Status and feedback | Alert, Spinner, Toast |
overlay | Modal and overlay UI | Modal, Tooltip, Popover |
layout | Structural components | Card, Container, Grid |
data-display | Content presentation | Avatar, Badge, Separator |
navigation | Navigation components | Navbar, Sidebar, Tabs |
animation | Animated components | AnimatedContainer, FadeIn |
state | State management hooks | useLocalStorage, useDebounce |
sensor | Browser sensor hooks | useMediaQuery, useResizeObserver |
dom | DOM interaction hooks | useClickOutside, useFocusTrap |
Best Practices
- Use
find_componentbefore assuming — the AI should search for the right component rather than guessing - Check anti-patterns — always run
get_component_do_notbefore generating code - Include accessibility — reference
get_component_a11yfor ARIA and keyboard requirements - Use the scaffold tool —
scaffold_component_usagegenerates complete code with imports and state - Cache component lists — call
list_componentsonce per session, not per request
Project setup and import accuracy
npx vayu-ui-cli@latest install-mcp --tool claude,cursor,opencode,vscode,codex --forceSetup merges the Vayu entry with existing server settings. It supports JSON comments for VS Code and TOML for Codex. --dry-run previews changes; malformed configuration stops setup before any selected file is modified.
| Client | Project configuration |
|---|---|
| Claude Code | .mcp.json |
| Cursor | .cursor/mcp.json |
| OpenCode | opencode.json |
| VS Code | .vscode/mcp.json |
| Codex | .codex/config.toml |
Restart or reload your client after setup. Codex loads project MCP configuration in trusted projects; see the official Codex MCP documentation. VS Code uses a servers object with type: "stdio", as described in its MCP documentation.
Before requesting generated usage, read vayu-ui.config.json. Pass its uiPath, paths, and aliases as config, and pass the target source filename as fromFile, to get_install_guide or scaffold_component_usage. Their default is CLI-copied sources. Use mode: "package" only when the application installs the vayu-ui npm package.
Scaffolding uses registry examples with valid compound nesting and returns the slugs used by the snippet. Application headings and paragraphs use Typography. Overlay titles retain Modal.Title / Drawer.Title so their accessible IDs stay connected.