Hue MCP Server

Hue MCP Server

A Model Context Protocol server that enables AI assistants to control Philips Hue smart lighting systems through natural language commands.

Category
访问服务器

README

🌈 Hue MCP Server

A modern Model Context Protocol (MCP) server that enables AI assistants to control Philips Hue smart lighting systems with natural language.

TypeScript Node.js License: MIT

✨ Features

  • 🎨 Natural Language Control - "Turn the living room lights to stormy dusk"
  • 🔍 Smart Light Search - "Find all color bulbs in the bedroom"
  • 🏠 Smart Room & Zone Management - Control entire rooms and zones with single commands
  • 🌟 Atmospheric Variation - Individual light variations for realistic scenes
  • 🎭 Scene Activation - Browse and activate predefined lighting scenes
  • 🧠 AI-Optimized Tools - Enhanced responses with quick actions and suggestions
  • 💬 Chatbot UX Optimized - Smart response sizing and context management
  • Intelligent Caching - 95% reduction in API calls with graceful fallbacks
  • 🔧 Modern Setup Wizard - Beautiful React-based configuration experience
  • 🔒 Secure & Local - All communication stays on your local network
  • 🛠️ Developer Friendly - TypeScript-first with comprehensive testing

🚀 Quick Start

Prerequisites

  • Node.js 18+
  • Philips Hue Bridge (v2) on your local network
  • Claude Desktop or compatible MCP client

1. Installation

git clone https://github.com/your-username/hue-mcp.git
cd hue-mcp
npm install

2. Setup Your Hue Bridge

Option A: Web Setup (Recommended)

npm run setup:web

This launches a beautiful setup wizard at http://localhost:3000 that will:

  • Auto-discover your Hue bridge
  • Guide you through authentication
  • Test your connection
  • Generate Claude Desktop configuration

Option B: CLI Setup

npm run setup

3. Add to Claude Desktop

Copy the generated configuration to your Claude Desktop config file:

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

{
  "mcpServers": {
    "hue-lights": {
      "command": "node",
      "args": ["/path/to/hue-mcp/dist/index.js"],
      "env": {
        "HUE_BRIDGE_IP": "192.168.1.100",
        "HUE_API_KEY": "your-api-key-here"
      }
    }
  }
}

4. Start Using

Restart Claude Desktop and try these commands:

  • "Turn on the living room lights"
  • "Set bedroom to warm white at 30%"
  • "Activate the energize scene"
  • "Show me all available lights"
  • "Turn everything off"

📚 Documentation

💡 Optimal Usage Patterns

For Chatbot Efficiency

🔍 Discovery Queries

❌ Avoid: "List all lights" (potentially large response)
✅ Better: "Find lights that are on" (filtered, relevant)
✅ Best: "Quick status" (minimal context summary)

🏠 Room Controls

❌ Avoid: Multiple individual light commands
✅ Better: "Turn off all bedroom lights" (single room command)
✅ Best: "Set bedroom to relaxing mood" (scene activation)

📊 Status Checking

❌ Avoid: Detailed system overview every time
✅ Better: "Minimal status" (compact summary)
✅ Best: Context-aware - detailed first time, minimal after

Response Size Guidelines

  • First interaction: Use standard detail level for orientation
  • Ongoing conversation: Use compact to preserve context window
  • Troubleshooting: Use verbose for comprehensive information
  • Quick checks: Use minimal for status updates

🛠️ Available Commands

Command Description
npm run setup:web Launch interactive web setup wizard
npm run setup CLI setup tool
npm run dev Run in development mode with hot reload
npm run build Build for production
npm run start Run production build
npm run test Run unit tests
npm run test:connection Test connection to your Hue bridge
npm run typecheck Check TypeScript types
npm run lint Lint code
npm run format Format code with Prettier

🔧 MCP Tools

The server provides these AI-optimized tools:

🔍 Discovery & Search Tools

Tool Description Example
find_lights Smart search with filters "Find all off lights", "Color bulbs in bedroom"
list_lights Enhanced listing with room context "What lights do I have?"
get_light Detailed info with quick actions "Show me the kitchen light status"

🏠 Room & Zone Management

Tool Description Example
list_rooms List all rooms with states "What rooms are available?"
control_room_lights Control entire rooms "Turn off the bedroom"
list_zones List all zones with states "What zones do I have?"
control_zone_lights Control entire zones "Set Main Area to relaxing"

🎭 Scene Management

Tool Description Example
list_scenes Browse scenes with categories "What scenes can I activate?"
activate_scene Activate predefined scenes "Activate the relax scene"

🎛️ Individual Control & Overview

Tool Description Example
set_light_state Control with natural language "Turn on the desk lamp to warm white"
get_summary System overview with insights "Give me a lighting summary"

✨ Enhanced Features

All tools now include:

  • 🎯 Quick Actions - Pre-built suggestions for common tasks
  • 💡 Smart Recommendations - Energy tips and troubleshooting
  • 📊 Rich Context - Room relationships and capability info
  • 🔍 Filtering & Search - Find exactly what you need
  • 📈 Summary Statistics - Overview data for better decisions

💬 Chatbot UX Optimizations

For sustained conversation efficiency:

  • 📏 Smart Response Sizing - compact, standard, verbose modes
  • 🧠 Context Management - Learns preferences, adapts over time
  • 📊 Intelligent Pagination - Never overwhelms with too much data
  • 🎛️ Progressive Disclosure - Start minimal, expand on request
  • ⚡ Conversation State - Tracks usage for optimal tool selection

🎨 Natural Language Examples

🔍 Smart Search Queries

  • "Find all kitchen lights" → Searches by room name
  • "Show me lights that are on" → Filters by current state
  • "Color bulbs in the bedroom" → Searches by capability and room
  • "All unreachable lights" → Finds connectivity issues

💬 Conversation Efficiency Examples

  • "Quick status" → Uses minimal context for fast response
  • "What lights do I have?" (first time) → Standard detail level
  • "What lights do I have?" (repeated) → Compact response
  • "Turn on bedroom lights" → Suggests room control over individual lights

🎨 Colors & Moods

  • "stormy dusk" → Deep blue-purple with low brightness
  • "warm white" → Comfortable warm temperature
  • "sunrise" → Orange-yellow with medium brightness
  • "ocean" → Blue-cyan colors
  • "fire" → Red-orange with high saturation

🌟 Atmospheric Scenes (Auto-Variation)

These keywords trigger realistic individual light variations:

  • "thunderstorm", "stormy" → Varied blues with different intensities
  • "sunset", "sunrise" → Gradient of warm colors across lights
  • "fireplace", "candlelight" → Flickering warm variations
  • "forest", "ocean" → Natural color variations
  • "cozy", "romantic" → Subtle warm variations

Brightness & Settings

  • "dim blue slowly" → Blue color with slow transition
  • "bright red" → Red at full brightness
  • "50% warm white" → Warm temperature at half brightness

Room & Zone Control

  • "Turn the living room to energizing mode"
  • "Set bedroom lights to candlelight"
  • "Make the office bright and cool"
  • "Set the Main Area zone to something relaxing for a sunday evening"
  • "Turn off all lights in the downstairs zone"

🏗️ Architecture

Built with modern technologies:

  • TypeScript - Type-safe development
  • node-hue-api v5 - Official Hue SDK integration
  • React + Vite - Modern setup wizard
  • Express - Setup server backend
  • Vitest - Fast unit testing
  • ESLint + Prettier - Code quality

Key Design Principles

  • Dual-mode operation - Cached responses with direct API fallback
  • Graceful degradation - Always attempts to fulfill requests
  • Rate limiting protection - Prevents API abuse
  • Comprehensive error handling - Clear, actionable error messages

🚀 Performance Optimizations

API Efficiency

  • 60-70% fewer API calls through optimistic caching
  • 5x longer cache lifetime (1min → 5min) with smart invalidation
  • Bulk operations preferred over individual light controls
  • Rate limiting protection with 2-minute discovery caching
  • Parallel execution for atmospheric variations (all lights updated simultaneously)

Chatbot Context Management

  • 75% smaller responses in compact mode
  • Smart pagination - max 5-20 results based on detail level
  • Progressive disclosure - minimal → standard → verbose
  • Conversation state tracking - learns and adapts over time
  • Query optimization - suggests more efficient alternatives

Memory & Context Window

  • Adaptive response sizing based on conversation stage
  • Context-aware parameters automatically optimized
  • Intelligent truncation with clear continuation hints
  • Tool selection guidance for optimal efficiency

🔍 Troubleshooting

Common Issues

"No bridges found"

  • Ensure your Hue bridge is powered on and connected to the same network
  • Try manual IP entry in the setup wizard

"Authentication failed"

  • Make sure to press the physical button on your Hue bridge
  • The button must be pressed within 30 seconds of starting authentication

"Connection test failed"

  • Verify your bridge IP address is correct
  • Check that your API key is valid
  • Ensure your firewall allows connections to the bridge

For more help, see our Troubleshooting Guide.

🧪 Testing Your Setup

Test your configuration:

# Test connection to your bridge
npm run test:connection

# Run unit tests  
npm test

# Check TypeScript types
npm run typecheck

📄 Configuration

The server supports multiple configuration methods:

  1. Environment variables (highest priority)
  2. hue-config.json file
  3. .env file (lowest priority)

Configuration Options

Variable Description Default
HUE_BRIDGE_IP Bridge IP address Required
HUE_API_KEY API authentication key Required
HUE_SYNC_INTERVAL_MS Cache refresh interval 300000 (5 min)
HUE_ENABLE_EVENTS Real-time event updates false
LOG_LEVEL Logging verbosity info

🤝 Contributing

We welcome contributions! Please see our Development Guide for details.

Development Setup

# Clone and install
git clone https://github.com/your-username/hue-mcp.git
cd hue-mcp
npm install

# Run tests
npm test

# Start development server
npm run dev

📈 Performance

  • 95% API call reduction through intelligent caching
  • Sub-second response times for cached data
  • Graceful fallbacks when cache is unavailable
  • Rate limiting protection prevents bridge overload

🔒 Security

  • Local network only - No external API calls except bridge discovery
  • No data collection - All lighting data stays local
  • Secure authentication - API keys stored locally
  • HTTPS communication with Hue bridge

📝 License

MIT License - see LICENSE file for details.

🙏 Acknowledgments


Made with ❤️ for the smart home community

Need help? Check our documentation or open an issue!

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选