MCP Server

The @spectre-ui/mcp package is a Model Context Protocol (MCP) server that gives AI coding assistants full access to the spectre-ui documentation. It exposes 59 resources (component docs, hook docs, guides, and design system data) along with 7 prompt templates for common UI building tasks.

Once configured, your AI assistant can read any spectre-ui documentation on demand, use the correct component APIs, and follow the project's design conventions without you needing to paste docs into the chat.

Configuration

All supported clients use the same server definition. Add the configuration below to the appropriate file for your tool.

Claude Code

Create or edit .mcp.json in your project root:

{
  "mcpServers": {
    "spectre-ui": {
      "command": "npx",
      "args": ["-y", "@spectre-ui/mcp"]
    }
  }
}

Cursor

Create or edit .cursor/mcp.json in your project root:

{
  "mcpServers": {
    "spectre-ui": {
      "command": "npx",
      "args": ["-y", "@spectre-ui/mcp"]
    }
  }
}

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "spectre-ui": {
      "command": "npx",
      "args": ["-y", "@spectre-ui/mcp"]
    }
  }
}

Available Resources

The MCP server exposes 59 resources via spectre:// URIs. Your AI assistant can read any of these to get up-to-date documentation.

URI PatternDescription
spectre://overviewProject overview, philosophy, and feature summary
spectre://componentsFull list of all available components
spectre://component/{name}Detailed docs for a specific component (props, variants, examples)
spectre://hooksFull list of all available hooks
spectre://hook/{name}Detailed docs for a specific hook (parameters, return value, examples)
spectre://guides/{slug}Guide content by slug (e.g. getting-started, theming, installation)
spectre://design-system/tokensDesign tokens including colors, spacing, typography, and border radius values
spectre://design-system/colorsFull color palette with CSS variable mappings
spectre://design-system/typographyFont families, sizes, weights, and line heights

Available Prompts

The server includes 7 prompt templates that give your AI assistant a head start on common tasks. These prompts automatically pull in relevant component and design system documentation.

PromptDescription
build-dashboardScaffold a full dashboard layout using Card, Stat, DataTable, Grid, and Sidebar
build-landing-pageCreate a landing page with Navbar, Container, GridBackground, and TerminalText
build-formBuild an accessible form with Input, Select, Checkbox, Switch, and Toast feedback
build-data-viewSet up a data display view with DataTable, Badge, Avatar, and Skeleton loaders
setup-projectInitialize a new project with SpectreThemeProvider, styles import, and Tailwind config
build-navigationBuild a navigation system with Navbar, Sidebar, Breadcrumb, and CommandPalette
add-theme-switchingAdd dark/light theme switching using useSpectreTheme and Switch

Usage Example

After configuration, your AI assistant automatically has access to all spectre-ui documentation. You can ask it things like:

  • “Build me a dashboard page using spectre-ui components”
  • “Create a form with validation using spectre-ui Input and Select”
  • “What props does the Card component accept?”
  • “Set up theming with dark/light mode toggle”

The assistant will read the relevant resources from the MCP server to produce accurate, up-to-date code that follows spectre-ui conventions.