Skip to content
ui-layoutsPublic

About

MCP server for AI-powered UI component discovery on ui-layouts.com — search, docs, metadata, and TSX source in one pipeline.

Topics

Resources

Stars

34 stars

Watchers

1 watching

Forks

Repository files navigation

@ui-layouts/mcp

npm version node version

MCP Badge

@ui-layouts/mcp provides AI assistants with several valuable tools to help them search, understand, and retrieve UI components from ui-layouts.com.

Each tool can be used independently, but they are designed to work together as a complete "component exploration pipeline."

📦 Installation & MCP Setup

Requirements

  • Node.js: >=20.10.0
  • MCP Client: Claude Desktop, Cursor, or compatible MCP client

Quick Start

Run @ui-layouts/mcp without installing it globally using npx. This is the recommended way to get started:

{
  "mcpServers": {
    "ui-layouts-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["@ui-layouts/mcp"]
    }
  }
}

💡 Note: npx will automatically download and run the latest version of @ui-layouts/mcp when needed. No global installation required!

Using with Claude Code (CLI)

claude mcp add ui-layouts-mcp --scope user -- npx -y @ui-layouts/mcp

This registers the MCP server under the CLI-safe name ui-layouts-mcp while still using the @ui-layouts/mcp npm package.


🛠️ Tools

🔍 search_components

Search the ui-layouts.com docs pages, blocks sections, and registry item names. Results are ranked, best match first. A query can have several words (e.g. drag and drop), and an entry that matches more of them ranks higher. Separators do not matter, so datepicker finds date picker. A query word matches a whole word or the start of one (3 letters or more). There is no fuzzy or plural matching.

Each result lists the registry items that matched the query. Registry items that belong to no docs page are listed separately. Pass any of these names to get_source_code.

Parameters

  • q — one or more words, matched against name, key, group, tags, and registry item names
  • limit — max results to return (default 20, max 100). The header shows how many matched in total (e.g. 20 of 31), plus the count of matching items without a docs page

When it's useful

  • To find a specific UI component or block by name or tag
  • To find which entry a registry item (e.g. btn-bg-shine) belongs to
  • To explore available components by category

📘 get_docs

Fetch the complete documentation for a component as raw MDX markdown, read from the ui-layouts source repo on GitHub. Installation commands, props tables, and structure snippets come through as-is. The response header lists the entry's registry items. Pass one of those names to get_source_code to get the example code. A blocks entry (e.g. hero-section) has no docs page, so it returns only its items.

Parameters

  • key — entry key (e.g. accordion, hero-section)
  • href — entry href (e.g. /components/accordion, /blocks/hero-section), used when key is omitted
  • maxChars — max characters of markdown to return (default 20000)
  • timeoutMs — fetch timeout in milliseconds (default 7000)

When it's useful

  • To read implementation guides and examples
  • To view a component’s structure, props, or variants
  • To extract technical explanations for AI-assisted reasoning or integration

🧩 get_component_meta

Fetch structured HTML metadata for a specific component from ui-layouts.com. It includes fields such as title, description, keywords, Open Graph, and Twitter card. Registry item names for get_source_code come from get_docs, not from this tool.

When it's useful

  • To understand a component’s intent or SEO context
  • To generate previews or summaries automatically

💾 get_source_code

Fetch the actual TypeScript/React source code of a registry item directly from https://www.ui-layouts.com/r/{componentName}.json. The tool returns every file of the item, each under its path, so the files an example imports come with it. The header lists the npm dependencies to install.

maxChars is one budget across all files, spent in file order. When it runs out, the response ends with a notice that names the files that were cut short or left out and the maxChars that returns the rest.

Parameters

  • componentName — registry item name from the items of get_docs (e.g. liquid-glass-weather)
  • maxChars — max characters of file content to return, across all files (default 20000, max 200000)
  • timeoutMs — fetch timeout in milliseconds (default 7000)

When it's useful

  • To review or analyze the source code of a component
  • To use the component implementation as a code example
  • To verify that a component matches your design or API expectations

💬 Prompts

The MCP server also provides reusable prompt templates that guide AI assistants to perform complex tasks using the available tools.

🎯 find_component

Help find the best ui-layouts component(s) for specific requirements, use cases, or design needs.

Parameters:

  • requirements: What you need (e.g. 'collapsible content sections with smooth animation')
  • tags (optional): Comma-separated tags to filter by (e.g. 'interactive,layout')
  • maxCandidates (optional): Max candidates to fetch docs for (default: '3', range: 1-10)

What it does:

  • Generates multiple search queries with synonyms
  • Calls search_components multiple times and merges results
  • Fetches documentation for top candidates using get_docs
  • Provides structured recommendations with:
    • Recommended: name/key/href/tags, why, trade-offs
    • Alternatives: 1-3 alternative options
    • Next steps: Exact tool calls to continue

Strategy:

  • Uses intelligent search with synonyms (e.g. accordion/collapse/disclosure)
  • Prioritizes components matching provided tags
  • Ranks by relevance and compares multiple candidates

🛠️ implement_component

Get a step-by-step implementation guide for a ui-layouts component, including code examples, integration steps, and best practices.

Parameters:

  • componentKey (optional): Component key (e.g. 'accordion', 'sparkles-title')
  • componentHref (optional): Component href (e.g. '/components/accordion')
  • One of componentKey or componentHref is required.
  • framework (optional): Target framework (e.g. 'react', 'next', 'vite', 'general', default: 'react')
  • includeSourceCode (optional): Whether to include source code ('true' or 'false', default: 'true')

What it does:

  • Fetches component documentation and optionally source code
  • Generates a comprehensive implementation guide with:
    • Overview: Component purpose, features, and when to use
    • Installation: Dependencies and setup for the target framework
    • Basic Usage: Minimal working example with explanations
    • Configuration: Available props and customization options
    • Advanced Examples: Real-world use cases with code
    • Integration: Framework-specific setup and patterns
    • Styling & Customization: Theming and appearance customization
    • Best Practices: Performance tips, accessibility, common pitfalls
    • Troubleshooting: Common issues and solutions

Output:

  • Practical, copy-paste ready code examples
  • Framework-specific integration guidance
  • Real code from source when available

🔗 Recommended Workflow

💡 Tip: The path from a keyword to source code is: search_components → get_docs → get_source_code

Step Description Example
① Find components matching a keyword or tag search_components { "q": "accordion" }
② Fetch the documentation (MDX) and item names get_docs { "key": "accordion" }
③ Get the source files of an item get_source_code { "componentName": "single-layout-accordion" }
— Optional: page metadata (title, Open Graph) get_component_meta { "key": "accordion" }

⚙️ Server Info


🔄 Updating the registry

The server discovers component docs and registry items from the website repository’s main branch. Searches and lookups refresh the catalog on demand every five minutes. A failed refresh uses the last successful catalog (or the bundled index on first launch) and retries on a request after 30 seconds. New components do not require another MCP release.


🧠 Example Usage in Cursor / Claude

> call tool search_components { "q": "slider" }
> call tool get_docs { "key": "range-slider" }
> call tool get_source_code { "componentName": "dual-range-slider" }

👤 Author (Naymur & Jinho)

Be A Sponsor

naymur-uilayout

About

MCP server for AI-powered UI component discovery on ui-layouts.com — search, docs, metadata, and TSX source in one pipeline.

Topics

Resources

Stars

34 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages