hue-mcp

Hue MCP is a modern Model Context Protocol server that allows AI assistants to control Philips Hue smart lighting systems using natural language. Users can easily adjust room lighting or activate specific scenes. With an intuitive interface and AI-optimized tools, it enables efficient operation.

GitHub Stars

2

User Rating

Not Rated

Forks

0

Issues

3

Views

2

Favorites

0

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"
๐Ÿ”ง Bridge & System Management
Tool Description Example
get_bridge_config Bridge configuration and system info "Show me bridge settings"
get_info Server version and system information "What version am I running?"
๐Ÿ‘ฅ User Management
Tool Description Example
list_users List all whitelisted users "Who has access to the bridge?"
get_user Detailed user information "Show me details for user abc123"
โœจ 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
๐Ÿ›ก๏ธ User Management Security

The server includes user management tools with built-in safety protections:

  • ๐Ÿ‘€ Read-only access - User tools provide visibility into bridge access without modification
  • ๐Ÿ“ Audit trail - All user operations are logged with metadata
  • ๐Ÿ”’ Local network only - All user data stays on your local network

Note: User deletion is not supported as Philips Hue deprecated this feature in their local API. To remove users, use the official Philips Hue Account Management web interface.

๐Ÿ“ 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!

Author Information
Robert Sigler

I write code to make my life easier. Issues, pull requests, and constructive conversations are always welcome. My gists are my nerd notes.

Atlanta, Georgia, USA

9

Followers

38

Repositories

17

Gists

2

Total Contributions

Top Contributors

Threads