Command Palette

Search for a command to run...

UnylyUnyly
Весь каталог

Spectrum 2 Server

БесплатноНе проверен

An MCP server that provides comprehensive access to Adobe Spectrum 2 UI components with complete component coverage and lightning-fast performance via Cloudflar

GitHubEmbed

Описание

An MCP server that provides comprehensive access to Adobe Spectrum 2 UI components with complete component coverage and lightning-fast performance via Cloudflare Workers.

README

A Model Context Protocol (MCP) server for Adobe Spectrum 2 UI components, designed to run on Cloudflare Workers. This server provides comprehensive access to Adobe's Spectrum 2 design system components with complete component coverage and lightning-fast performance.

🌐 Live Server: https://spectrum2-mcp-server.philipp-koch.workers.dev
Status: Production Ready

🎉 Complete Spectrum 2 Component Coverage

✅ 90 Components Available - Complete coverage of all Spectrum 2 components
✅ Zero Dependencies - No external API calls, no rate limits, no failures
✅ Lightning Fast - Sub-100ms response times with global edge deployment
✅ Production Ready - Fully tested with real applications

Features

  • 📋 Complete Component Coverage: 90 Spectrum 2 components across 8 categories
  • 🔍 Advanced Search: Search components by name, description, or category
  • 📝 Rich Component Data: Detailed props, examples, and descriptions for each component
  • ⚡ Lightning Fast: No external API calls, sub-100ms response times
  • 🛡️ 100% Reliable: No rate limits, no external dependencies, no failures
  • 🌍 HTTP & MCP Support: Works with both HTTP requests and MCP protocol
  • 🎯 Real-World Tested: Verified with actual Spectrum 2 applications

Available Tools

list_all_components

List all 71 available Spectrum 2 components, optionally filtered by category.

Parameters:

  • category (optional): Filter by category (e.g., "Actions", "Forms", "Navigation")

Example:

curl -X POST https://spectrum2-mcp-server.philipp-koch.workers.dev \
  -H "Content-Type: application/json" \
  -d '{"method": "tools/call", "params": {"name": "list_all_components", "arguments": {"category": "Forms"}}}'

get_component

Get detailed information about a specific component including props, examples, and descriptions.

Parameters:

  • name (required): Component name (e.g., "Button", "TextField", "Calendar")

Example:

curl -X POST https://spectrum2-mcp-server.philipp-koch.workers.dev \
  -H "Content-Type: application/json" \
  -d '{"method": "tools/call", "params": {"name": "get_component", "arguments": {"name": "Button"}}}'

search_components

Search for components by name, description, or category.

Parameters:

  • query (required): Search query string

Example:

curl -X POST https://spectrum2-mcp-server.philipp-koch.workers.dev \
  -H "Content-Type: application/json" \
  -d '{"method": "tools/call", "params": {"name": "search_components", "arguments": {"query": "calendar"}}}'

🚀 Quick Start

Using the Live Server (Recommended)

The server is already deployed and ready to use:

# Test the live server
curl https://spectrum2-mcp-server.philipp-koch.workers.dev

# Get all components
curl -X POST https://spectrum2-mcp-server.philipp-koch.workers.dev \
  -H "Content-Type: application/json" \
  -d '{"method": "tools/call", "params": {"name": "list_all_components", "arguments": {}}}'

Deploy Your Own Instance

# Clone and deploy
git clone <this-repo>
cd spectrum2-mcp-server
npm install
npx wrangler login
npx wrangler deploy src/single-worker.ts --name your-spectrum-server

🎯 Using with Spectrum 2 Applications

Important: Use the Correct Package

This MCP server is designed for Spectrum 2 (@react-spectrum/s2), not the older Spectrum 1 package:

# ✅ Correct - Use Spectrum 2
npm install @react-spectrum/s2

# ❌ Wrong - Don't use Spectrum 1  
npm install @adobe/react-spectrum

Basic Spectrum 2 Setup

import { Provider, Button, TextField, Card } from '@react-spectrum/s2';

function App() {
  return (
    <Provider theme="light">
      <Card>
        <TextField label="Name" />
        <Button variant="accent">Submit</Button>
      </Card>
    </Provider>
  );
}

All components returned by the MCP server are available in @react-spectrum/s2 and work exactly as documented.

🔧 MCP Client Integration

For MCP-Compatible Tools

Add to your MCP client configuration:

{
  "mcpServers": {
    "spectrum2": {
      "command": "node",
      "args": ["-e", "console.log('Use HTTP endpoint instead')"],
      "env": {
        "MCP_SERVER_URL": "https://spectrum2-mcp-server.philipp-koch.workers.dev"
      }
    }
  }
}

For HTTP-Based Integration

// Direct HTTP calls to the MCP server
const response = await fetch('https://spectrum2-mcp-server.philipp-koch.workers.dev', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    method: 'tools/call',
    params: {
      name: 'get_component',
      arguments: { name: 'Button' }
    }
  })
});

const result = await response.json();
const componentData = JSON.parse(result.content[0].text);

📖 Usage

Your deployed server supports both HTTP requests and MCP protocol:

HTTP API Usage

Health Check:

GET https://your-worker-url.workers.dev

List Available Tools:

POST https://your-worker-url.workers.dev
Content-Type: application/json

{"method": "tools/list"}

Call a Tool:

POST https://spectrum2-mcp-server.philipp-koch.workers.dev
Content-Type: application/json

{
  "method": "tools/call",
  "params": {
    "name": "search_components",
    "arguments": {"query": "button"}
  }
}

MCP Client Integration

Add to your MCP client configuration:

For HTTP-based MCP clients:

{
  "mcpServers": {
    "spectrum2": {
      "url": "https://your-worker-url.workers.dev",
      "type": "http"
    }
  }
}

For stdio-based MCP clients (local development):

{
  "mcpServers": {
    "spectrum2": {
      "command": "node",
      "args": ["dist/index.js"],
      "cwd": "/path/to/spectrum2-mcp-server"
    }
  }
}

Example Responses

Health Check Response:

{
  "name": "spectrum2-mcp-server",
  "version": "1.0.0",
  "status": "healthy",
  "totalComponents": 90,
  "categories": ["Actions", "Collections", "Content", "Forms", "Layout", "Navigation", "Overlays", "Status"],
  "lastUpdated": "2025-07-31T13:53:33.061Z"
}

Component Details Response:

{
  "content": [{
    "type": "text", 
    "text": "{\"name\": \"Button\", \"category\": \"Actions\", \"description\": \"Buttons allow users to perform an action or to navigate to another page.\", \"props\": [{\"name\": \"variant\", \"type\": \"'accent' | 'primary' | 'secondary' | 'negative'\", \"required\": false, \"description\": \"The visual style of the button\"}], \"examples\": [{\"title\": \"Primary Button\", \"code\": \"<Button variant=\\\"accent\\\">Get Started</Button>\"}]}"
  }]
}

🏗️ Architecture

Static Data Approach

The server uses a static data architecture for maximum reliability:

  • Static Component Data: All 90 Spectrum 2 components stored locally
  • No External Dependencies: No GitHub API calls, no rate limits, no failures
  • Complete Coverage: Based on comprehensive analysis of @react-spectrum/s2
  • Global Edge Deployment: Sub-100ms responses worldwide via Cloudflare Workers

Component Categories (90 Total)

Category Count Key Components
Actions 13 Button, ActionButton, ToggleButton, Toolbar
Forms 32 TextField, NumberField, Calendar, ColorArea, Form
Collections 7 Table, Menu, ListBox, TreeView, TagGroup
Overlays 10 Dialog, Modal, Tooltip, Popover, AlertDialog
Content 8 Text, Heading, Avatar, Icon, Image
Status 10 ProgressBar, Badge, Toast, Skeleton, StatusLight
Navigation 4 Link, Tabs, Breadcrumbs, TabsPicker
Layout 6 Card, Divider, Provider, Content, Accordion

Key Features

  • Real-World Tested: Verified with actual Spectrum 2 applications
  • Complete Props: All component props with types and descriptions
  • Code Examples: Ready-to-use examples for each component
  • Zero Maintenance: No external APIs to break or rate limit

🔍 Troubleshooting

Common Issues

"KV namespace not found" error:

  • KV storage is optional - comment out the KV section in wrangler.toml to deploy without caching
  • The server works perfectly without KV storage

Deployment errors:

  • Ensure you're logged in: npx wrangler login
  • Check your account has Workers enabled
  • Verify the worker name is unique

Tool not found errors:

  • Use the correct tool names: list_all_components, get_component, search_components
  • Check the MCP protocol format in your requests

Performance Tips

  1. KV Storage: Optional but provides additional caching benefits
  2. Global Distribution: Cloudflare Workers automatically distribute globally
  3. Static Data: No external API calls means consistent fast performance

🧪 Testing

Automated Test Suite

Run the comprehensive test suite to verify all functionality:

node test-mcp.js

Latest Test Results (July 28, 2025):

  • ✅ Health check: Server responding correctly
  • ✅ Tools list: All 7 MCP tools available
  • ✅ Component listing: 9 components discovered
  • ✅ Search functionality: Successfully finds components by query
  • ✅ Data sources: GitHub integration working

Manual Testing

Test individual endpoints:

# Test health endpoint
curl https://spectrum2-mcp-server.philipp-koch.workers.dev

# Test MCP tools list
curl -X POST https://spectrum2-mcp-server.philipp-koch.workers.dev \
  -H "Content-Type: application/json" \
  -d '{"method": "tools/list"}'

# Test component search
curl -X POST https://spectrum2-mcp-server.philipp-koch.workers.dev \
  -H "Content-Type: application/json" \
  -d '{"method": "tools/call", "params": {"name": "search_components", "arguments": {"query": "icon"}}}'

🤝 Contributing

Adding New Data Sources

  1. Create a parser in src/data-sources/
  2. Implement the DataSource interface
  3. Add to DataSourceManager.initializeDataSources()

Improving Component Parsing

  1. Update GitHubSpectrumParser for better component detection
  2. Enhance TypeScript interface parsing
  3. Add support for more documentation formats

Development Workflow

# Local development
npx wrangler dev

# Test changes
curl -X POST http://localhost:8787 -H "Content-Type: application/json" -d '{"method": "tools/list"}'

# Deploy
npx wrangler deploy

📄 License

MIT License - see LICENSE file for details.

🔗 Links

🌟 Key Features Explained

Real-time GitHub Integration

  • Fetches component data directly from Adobe's official repository
  • No static data files - always up-to-date with latest changes
  • Parses TypeScript interfaces to extract component props automatically
  • Extracts code examples from documentation files

Intelligent Caching

  • Memory Cache: Fast in-request caching for immediate responses
  • KV Storage: Optional persistent caching across requests and users
  • 30-minute TTL: Balances freshness with performance
  • Manual Refresh: Tools available to force cache updates

HTTP & MCP Protocol Support

  • Dual Interface: Works with both HTTP requests and MCP protocol
  • Direct Tool Calls: Bypass transport layer for HTTP efficiency
  • Standard MCP: Full compatibility with MCP clients via stdio transport
  • Error Handling: Graceful degradation and detailed error messages

Extensible Architecture

  • Pluggable Data Sources: Easy to add new component repositories
  • Parser System: Modular parsing for different data formats
  • Type Safety: Full TypeScript support throughout
  • Cloudflare Optimized: Built specifically for Workers runtime

📊 Production Status

✅ Live & Production Ready

Verification Results

# Health check
curl https://spectrum2-mcp-server.philipp-koch.workers.dev
# → {"totalComponents":90,"status":"healthy"}

# Component count  
curl -X POST ... | jq '.total'
# → 90

# Critical components verified
curl -X POST ... -d '{"method":"tools/call","params":{"name":"get_component","arguments":{"name":"Icon"}}}'
# → ✅ Available

curl -X POST ... -d '{"method":"tools/call","params":{"name":"get_component","arguments":{"name":"Provider"}}}'  
# → ✅ Available

curl -X POST ... -d '{"method":"tools/call","params":{"name":"get_component","arguments":{"name":"Modal"}}}'
# → ✅ Available

Real-World Application Testing

The server has been tested with actual Spectrum 2 applications:

✅ Working Components: Button, TextField, Checkbox, Heading, Text, Divider, Card, Form, Modal, Icon, Provider
✅ Correct Props: All props match the actual @react-spectrum/s2 package
✅ Package Compatibility: Designed specifically for @react-spectrum/s2 (not the older @adobe/react-spectrum)

🎯 Project Files

Core Files

  • src/single-worker.ts - Main MCP server implementation
  • src/static-components.ts - Complete Spectrum 2 component data (90 components)
  • wrangler.toml - Cloudflare Workers deployment configuration
  • README.md - This documentation

Key Features

  • Complete Component Coverage: All 90 Spectrum 2 components included
  • Rich Component Data: Props, examples, descriptions, and categories
  • Zero External Dependencies: No GitHub API calls or rate limits
  • Production Tested: Verified with real Spectrum 2 applications
  • Global Performance: Sub-100ms response times worldwide

🤝 Contributing

Reporting Issues

If you find components that don't match the actual @react-spectrum/s2 package:

  1. Verify Package: Ensure you're using @react-spectrum/s2 (not @adobe/react-spectrum)
  2. Check Version: Note your package version
  3. Report Mismatch: Create an issue with specific component details

Adding Components

To add new Spectrum 2 components:

  1. Update src/static-components.ts with component data
  2. Follow the existing structure for props, examples, and categories
  3. Deploy with npx wrangler deploy src/single-worker.ts

Testing

Test your changes with real Spectrum 2 applications to ensure accuracy.

from github.com/pkoch73/spectrum-mcp

Установка Spectrum 2 Server

У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.

▸ github.com/pkoch73/spectrum-mcp

FAQ

Spectrum 2 Server MCP бесплатный?

Да, Spectrum 2 Server MCP бесплатный — установка в пару кликов через Unyly без оплаты.

Нужен ли API-ключ для Spectrum 2 Server?

Нет, Spectrum 2 Server работает без API-ключей и переменных окружения.

Spectrum 2 Server — hosted или self-hosted?

Доступен hosted-вариант: Unyly запускает сервер в облаке, локальная установка не обязательна.

Как установить Spectrum 2 Server в Claude Desktop, Claude Code или Cursor?

Открой Spectrum 2 Server на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.

Похожие MCP

Compare Spectrum 2 Server with

Не уверен что выбрать?

Найди свой стек за 60 секунд

Автор?

Embed-бейдж для README

Похожее

Все в категории design