AI Integration

How AI agents consume Hareru UI via MCP, CLI, and machine-readable contracts

Hareru UI provides multiple integration paths for AI agents, from full MCP server access to static guidance files.

Integration Paths

PathBest forSetup
MCP ServerClaude Desktop, Cursor, MCP-compatible clientsnpx @hareru/mcp
CLICode generation agents, CI pipelinesnpx @hareru/cli add Button --write
.cursorrulesCursor editorIncluded in repository root
llms.txtAny AI agent without MCPui.hareru.ai/llms.txt
consumer-rules.jsonCustom agent integrations@hareru/ui/consumer-rules.json

MCP Server

The @hareru/mcp server exposes the full design system contract:

  • 6 resources — Tokens, token schema, component registry, component schema, task bundles, consumer rules
  • 5 toolsget-component-usage, get-bundle-usage, validate-token-value, recommend-css-mode, list-components-by-group
  • 3 promptscreate-ui, create-ui-tailwind, consumer-rules
{
  "mcpServers": {
    "hareru-ui": {
      "command": "npx",
      "args": ["-y", "@hareru/mcp"]
    }
  }
}

See the MCP Server page for full documentation.

CLI for Code Generation

AI agents can use the CLI to generate correct CSS imports:

# Generate per-component CSS imports
npx @hareru/cli add Button

# Generate Tailwind coexistence imports
npx @hareru/cli add Dialog --mode tailwind

# Auto-append to CSS entry file
npx @hareru/cli add agent-chat-shell --write

AG-UI Event Mapping

AG-UI EventHareru ComponentProps Mapping
TEXT_MESSAGE_CONTENTChatMessage + StreamingTextAppend text to children
TOOL_CALL_STARTToolCallCardtoolName, status="running"
TOOL_CALL_ENDToolCallCardstatus="complete", result
STATE_DELTAuseAGUIState()Apply JSON Patch to state
RUN_STARTEDReasoningPanelstatus="thinking"
RUN_FINISHEDReasoningPanelstatus="complete"

Responsibility Boundary

Hareru UI provides display components only: ChatContainer, ChatMessage, ChatComposer, ToolCallCard, ApprovalCard, StreamingText, ReasoningPanel.

Application-side responsibilities (not provided by Hareru UI): AG-UI transport, event stream parsing, authentication, message persistence.

Rules for AI Agents

These rules are available programmatically via the MCP consumer-rules prompt or hareru-ui://rules/consumer resource.

  1. Import all components flat from @hareru/ui
  2. Use var(--hui-*) tokens for all CSS values — never hardcode
  3. Use useTheme() hook for theme switching — never manipulate data-theme directly
  4. Place ThemeProvider and Toaster at the application root
  5. Use BEM class naming (hui-*) if adding custom component styles
  6. Colors are OKLCH format

On this page