JSPM

  • Created
  • Published
  • Downloads 134
  • Score
    100M100P100Q94095F
  • License MIT

Model Context Protocol server for MoonUI component library - AI-native component access

Package Exports

  • @moontra/moonui-mcp-server
  • @moontra/moonui-mcp-server/docs-reader

Readme

MoonUI Dynamic MCP Server ๐Ÿš€

Next-generation Model Context Protocol server for MoonUI. Uses dynamic code analysis instead of static registries to provide 100% accurate component information to AI assistants.

npm version License: MIT TypeScript

๐ŸŽฏ Why Dynamic MCP Server?

Previous Issues (Static Registry)

  • โŒ Manual export lists prone to errors
  • โŒ AI suggesting non-existent components (DashboardGrid, MetricCard)
  • โŒ Constant maintenance required
  • โŒ Out-of-sync with actual package exports

New Solution (Dynamic Analysis)

  • โœ… Real-time Export Analysis - TypeScript Compiler API reads actual exports
  • โœ… 100% Accuracy - Directly from .d.ts files
  • โœ… Zero Maintenance - Automatically stays in sync
  • โœ… Rich Documentation - Markdown docs, JSDoc, and type info
  • โœ… Smart Suggestions - Finds similar components when typos occur

๐Ÿš€ What's New in v2.0.0

Complete Architecture Redesign

  • Dynamic Export Analyzer using TypeScript AST parsing
  • Intelligent Component Organizer groups related components
  • Rich Documentation Generator with real examples
  • JSDoc Standards & Applicator for IDE support
  • Smart Cache System for performance

Key Features

  • Analyzes 900+ exports accurately (393 from moonui, 501+ from moonui-pro)
  • Distinguishes between components, hooks, types, and utilities
  • Groups sub-components under main components (Tooltip includes TooltipTrigger, TooltipContent, etc.)
  • Provides detailed documentation with real usage examples

๐Ÿ“ฆ Installation

For Claude Desktop

  1. Install the MCP server:
npm install -g @moontra/moonui-mcp-server
  1. Configure Claude Desktop:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "moonui": {
      "command": "moonui-mcp"
    }
  }
}
  1. Restart Claude Desktop

๐Ÿ”ง MCP Tools

get_exports

Get all exports from a MoonUI package with accurate categorization.

{
  "package": "@moontra/moonui",
  "category": "components", // optional: components, hooks, types, utilities
  "refresh": false // optional: force cache refresh
}

get_component_info

Get detailed information about a specific component including documentation and examples.

{
  "package": "@moontra/moonui",
  "componentName": "Button"
}

search_exports

Search for exports by name pattern across packages.

{
  "query": "button",
  "package": "@moontra/moonui" // optional
}

validate_import

Check if imports are valid and get suggestions for incorrect ones.

{
  "package": "@moontra/moonui",
  "imports": ["Button", "Card", "NonExistent"]
}

generate_import_statement

Generate correct import statements for components.

{
  "components": ["Button", "Card", "Dialog"]
}

๐Ÿ“Š Export Analysis

The dynamic analyzer provides real-time information:

  • @moontra/moonui: 393 exports (280 components, 1 hook, various utilities)
  • @moontra/moonui-pro: 501+ exports (300+ components, 6 hooks, advanced features)

Component Organization

Components are intelligently grouped:

Button
โ”œโ”€โ”€ Button (main component)
โ”œโ”€โ”€ ButtonProps (type)
โ”œโ”€โ”€ ButtonVariant (type)
โ””โ”€โ”€ buttonVariants (utility)

Card
โ”œโ”€โ”€ Card
โ”œโ”€โ”€ CardHeader
โ”œโ”€โ”€ CardTitle
โ”œโ”€โ”€ CardDescription
โ”œโ”€โ”€ CardContent
โ””โ”€โ”€ CardFooter

Tooltip
โ”œโ”€โ”€ Tooltip
โ”œโ”€โ”€ TooltipProvider
โ”œโ”€โ”€ TooltipTrigger
โ”œโ”€โ”€ TooltipContent
โ””โ”€โ”€ TooltipArrow

๐Ÿงช Testing

Run the test suite:

npm test

Analyze exports:

npm run analyze:exports

๐Ÿ“š Documentation

Detailed component documentation is generated dynamically and includes:

  • Overview - What the component does
  • Installation - How to add it
  • Basic Usage - Simple examples
  • Advanced Examples - Complex patterns
  • API Reference - Props and types
  • Accessibility - Keyboard and ARIA support
  • Best Practices - Do's and don'ts

๐Ÿ”„ Migration from v1.x

If upgrading from the static registry version:

  1. Update the package:
npm update -g @moontra/moonui-mcp-server
  1. No configuration changes needed - it's backward compatible!

  2. Enjoy accurate component suggestions ๐ŸŽ‰

๐Ÿ› ๏ธ Development

Setup

git clone https://github.com/moonui/mcp-server
cd mcp-server
npm install

Commands

npm run dev           # Development mode
npm run build         # Build for production
npm run test          # Run tests
npm run analyze:exports # Analyze package exports

Architecture

mcp-server/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ analyzer/          # Export analysis engine
โ”‚   โ”œโ”€โ”€ organizer/         # Component organization
โ”‚   โ”œโ”€โ”€ generator/         # Documentation generation
โ”‚   โ”œโ”€โ”€ standards/         # JSDoc standards
โ”‚   โ”œโ”€โ”€ server/           # MCP server implementation
โ”‚   โ””โ”€โ”€ __tests__/        # Test suite
โ”œโ”€โ”€ docs/
โ”‚   โ””โ”€โ”€ components/       # Generated documentation
โ””โ”€โ”€ scripts/              # Utility scripts

๐Ÿค Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.

๐Ÿ“„ License

MIT License - see LICENSE file for details.


Maintained by the MoonUI Team
Version: 2.0.0
Last Updated: 2024-01-15