┌─────────────────────────────────────────────────────────────────────┐
│ Claude / MCP Client │
│ (Natural Language Interface) │
└────────────────────────────┬────────────────────────────────────────┘
│ MCP Protocol (stdio)
▼
┌─────────────────────────────────────────────────────────────────────┐
│ MCP Server (index.ts) │
│ • Protocol handling │
│ • Tool routing │
└────────────────────────────┬────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ Tools Layer (tools.ts) │
│ 40+ MCP Tools │
│ ┌──────────────┬──────────────┬──────────────┬──────────────┐ │
│ │ Virtuals │ Effects │ Scenes │ Palettes │ │
│ │ Presets │ Playlists │ Colors │ AI Help │ │
│ └──────────────┴──────────────┴──────────────┴──────────────┘ │
└────────┬────────────┬────────────┬────────────┬────────────────────┘
│ │ │ │
▼ ▼ ▼ ▼
┌────────────┐ ┌────────────┐
│ LedFX │ │ AI Helper │
│ Client │ │ (NLP) │
│ │ │ │
│ • Virtuals │ │ • Scene │
│ • Effects │ │ Parsing │
│ • Scenes │ │ • Effect │
│ • Presets │ │ Recs │
│ • Audio │ │ • Explains │
│ • Colors │ └────────────┘
└──────┬─────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ LedFX HTTP API │
│ (localhost:8888/api) │
│ │
│ /virtuals/ /effects/ /scenes/ │
│ /devices/ /presets/ /audio/ │
│ /colors/ │
└────────────────────────────┬────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ Physical LED Devices │
│ │
│ WLED Controllers ESP32 Boards OpenRGB Nanoleaf │
└─────────────────────────────────────────────────────────────────────┘
User: "Create a calm ocean scene with slow blue waves"
↓
Claude (MCP Client)
↓
MCP Server (stdio)
↓
Tools Layer → ledfx_create_scene_from_description
↓
AI Helper → parseSceneDescription()
• Extracts: gradient effect, ocean gradient, speed=20, tags=chill
↓
LedFX /api/colors → get colors and gradients
• Provides: builtin + user gradients (CSS strings)
↓
LedFX Client → setVirtualEffect(virtualId, "gradient", config)
↓
LedFX HTTP API → POST /virtuals/{id}/effects
↓
Physical LEDs → Display ocean gradient
User: "Create palette 'Sunset Vibes' with #FFA500, #FF69B4, #800080"
↓
Claude (MCP Client)
↓
MCP Server
↓
Tools Layer → ledfx_create_palette
↓
Build gradient string
• linear-gradient(90deg, #FFA500, #FF69B4, #800080)
↓
LedFX /api/colors → POST {"palette:Sunset Vibes": "linear-gradient(...)"}
↓
Returns: { id: "palette:Sunset Vibes", gradient: "linear-gradient(...)" }
User: "Recommend effects for a party"
↓
Claude (MCP Client)
↓
MCP Server
↓
Tools Layer → ledfx_recommend_effects
↓
AI Helper → recommendEffects("party")
• Analyzes keywords: "party" → energetic, music
• Checks effect types for audio-reactive
• Scores by confidence
↓
Returns:
[
{ effect: "pulse", reason: "music beats", confidence: 0.9 },
{ effect: "rainbow", reason: "energetic", confidence: 0.8 }
]
- Initialize MCP server
- Set up stdio transport
- Create LedFX client instance
- Register tool handlers
- Define 35 MCP tools
- Route tool calls to appropriate modules
- Format responses for MCP protocol
- Error handling
- CORRECTED endpoints (virtuals not devices)
- HTTP request abstraction
- Response parsing
- Error handling
- Type safety
- LedFX
/api/colorssupport
- Natural language parsing
- Scene description analysis
- Effect recommendations
- Feature explanations
- Keyword extraction
- Single source of truth in LedFX
- Builtin + user-defined colors and gradients
- No local persistence layer required
- Consistent with LedFX UI and API
- Natural language is complex
- Centralized NLP logic
- Reusable parsing functions
- Easy to improve/extend
- Clean separation of concerns
- Backwards compatibility
- Clear migration path
- Warning messages educate users
- Gradual transition
- Color lookup: 10-100ms (LedFX /api/colors)
- API calls: 10-100ms (network)
- NLP parsing: 1-5ms (simple regex)
- No local color library or database
- Total footprint: <10MB
- Handles 1000s of palette entries
- Efficient indexed queries
- Connection pooling
- No memory leaks
try {
await client.setVirtualEffect(...)
} catch (error) {
return formatResponse({
error: true,
message: error.message
})
}try {
db.createPalette(...)
} catch (error) {
// Unique constraint violation, etc.
return formatResponse({ error: error.message })
}if (!virtualId) {
return formatResponse({
error: "virtual_id is required"
})
}1. Caching Layer
Tools → Cache → LedFX Client
↓
(In-memory)
2. WebSocket Support
MCP Server → WebSocket → LedFX
(Real-time updates)
3. Plugin System
Tools → Plugin Manager → Custom Plugins
(User extensions)
4. Cloud Sync
Database → Sync Service → Cloud Storage
(Backup/share palettes)
- Local network assumed (localhost)
- HTTP only (no auth needed)
- Error messages sanitized
- No credential storage
- Stdio communication
- No network exposure
- Sandboxed execution
- Input validation
npm install
npm run build
# Configure Claude Desktop with path to dist/index.js{
"LEDFX_HOST": "localhost",
"LEDFX_PORT": "8888"
}- stderr for debug messages
- stdout for MCP protocol
- Error context included
curl http://localhost:8888/api/info
curl http://localhost:8888/api/virtualsArchitecture Status: ✅ Production Ready
Last Updated: 2026-02-01
Version: 0.2.0