mcp-hue-server

yveskaufmann/mcp-hue-server

3.1

If you are the rightful owner of mcp-hue-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A Model Context Protocol (MCP) server for controlling Phillips Hue lights via natural language.

Tools
7
Resources
0
Prompts
0

Phillips Hue MCP Server

A Model Context Protocol (MCP) server for controlling Phillips Hue lights via natural language.

Disclaimer: This is a small hobby project and not an official Phillips Hue product. It is provided as-is without any guarantees.

Features

This server provides an interface to control your Phillips Hue lights using natural language processing through the Model Context Protocol. It connects to your Hue Bridge and allows you to:

  • Turn individual lights on and off
  • Control all lights in a room at once
  • List all available lights and rooms

Installation

Prerequisites

  • Node.js (v18+)
  • A Phillips Hue Bridge on your local network
  • Phillips Hue lights set up with your bridge

Setup

  1. Clone the repository
  2. Install dependencies
npm install

Environment Variables

The server uses the following environment variables:

VariableDescriptionRequiredDefault
HUE_BRIDGE_IPIP address of your Hue BridgeNoAuto-discovered via DNS-SD
HUE_USERNAMEUsername (API key) for your Hue Bridge. During initial setup, if not provided, the server will automatically register a new user on the bridge (requires pressing the physical link button on the bridge).NoStored in ~/.hue-credentials.json
HUE_CREDENTIALS_PATHCustom path to store credentialsNo~/.hue-credentials.json

Creating Initial Hue User

Before using the server, you need to create a user on your Hue Bridge. The server will attempt to do this automatically on first run:

  1. If you don't provide the HUE_USERNAME environment variable, the server will automatically try to register a new user on the bridge
  2. Find your Hue Bridge IP (or let the server auto-discover it via DNS-SD)
  3. Press the link button on your Hue Bridge (the physical button on the device)
  4. Start the server within 30 seconds of pressing the button
  5. The server will automatically create and store credentials in ~/.hue-credentials.json (or the path specified in HUE_CREDENTIALS_PATH)

The registered username will then be used for all subsequent API calls to control your lights and rooms.

If you have issues with automatic setup, you can manually create a user by following the Hue API Getting Started guide.

Available Tools

The server exposes the following MCP tools:

Tool NameDescriptionParameters
turnLightOnTurn on a specific lightname (string)
turnLightOffTurn off a specific lightname (string)
listAllLightsList all available lightsNone
listAllRoomsList all available roomsNone
turnRoomLightsOnTurn on all lights in a roomname (string), brightness (number, optional)
turnRoomLightsOffTurn off all lights in a roomname (string)

Running the Server

You can start the server using:

npm start

Or with the provided Makefile:

make start

Using with VS Code

To use this server with VS Code, add it to your .vscode/mcp.json file:

{
  "servers": {
    "hue-mcp-server": {
      "type": "stdio",
      "command": "npm",
      "args": ["start"],
      "cwd": "/path/to/mcp-hue-server"
    }
  },
  "inputs": []
}

Alternatively, if you're using the Makefile:

{
  "servers": {
    "hue-mcp-server": {
      "type": "stdio",
      "command": "make",
      "args": ["start"]
    }
  },
  "inputs": []
}

Example Usage

Once the server is running, you can use natural language commands with any MCP-compatible client:

  • "Turn on the living room lights"
  • "Turn off the kitchen light"
  • "List all available lights"
  • "What rooms do I have?"
  • "Schalte alle Lichter im Arbeitszimmer an" (German: Turn on all lights in the work room)

Development

To build the project:

npm run build

To run tests:

npm test

License

MIT