MCP Server

Model Context Protocol server for AI agent integration

@hareru/mcp is an MCP (Model Context Protocol) server that exposes Hareru UI's design tokens, schema, and component registry to AI agents via stdio transport.

Installation

npm install @hareru/mcp

Claude Desktop Configuration

Add to claude_desktop_config.json:

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

Or if installed locally:

{
  "mcpServers": {
    "hareru-ui": {
      "command": "node",
      "args": ["./node_modules/@hareru/mcp/bin/hareru-mcp.mjs"]
    }
  }
}

Resources

URIDescription
hareru-ui://tokensDTCG design tokens — CSS custom properties for light/dark themes
hareru-ui://tokens/schemaJSON Schema — CSS variable enums and type constraints
hareru-ui://componentsComponent registry with CVA variants and Props
hareru-ui://components/schemaJSON Schema for the component registry
hareru-ui://bundlesTask bundles — curated component sets for common UI patterns
hareru-ui://rules/consumerConsumer rules — import patterns, styling rules, and token reference

Tools

ToolInputOutput
get-component-usagecomponentName: stringMarkdown: import, variants table, props, JSX example, states, accessibility, and examples when available
get-bundle-usagebundleName: stringMarkdown: components, CSS imports, token categories
validate-token-valuetokenType: string, value: stringValid/Invalid with pattern description
recommend-css-modehasTailwind: boolean, componentCount: number, hasExistingReset?: booleanRecommended CSS import mode with reasoning
list-components-by-groupgroup: enum (core, form, layout, overlay, navigation, feedback, data-display, agent, di-domain)Filtered component list with variants and descriptions

Prompts

PromptParametersDescription
create-uidescription, framework?Generates a UI component using Hareru UI conventions
create-ui-tailwinddescriptionGenerates a component mixing Hareru UI and Tailwind CSS with Cascade Layer guidance
consumer-rulesImport/styling/theming/provider/CSS import rules and token quick reference

Programmatic Usage

import { createServer } from '@hareru/mcp';

const server = createServer();
await server.connect(transport);

MCP Apps Compatibility

Hareru UI works in iframe sandboxes because:

  1. CSS variables are scope-complete — All styling uses --hui-* custom properties. Injecting @hareru/tokens/css provides all design tokens.
  2. data-theme works on any root — Theme switching works on any element, not just document.documentElement.
  3. No CSS-in-JS runtime — Static CSS files with BEM classes.
  4. No framework runtime conflicts — Standard React with no required global providers.

On this page