mcp-light-control
If you are the rightful owner of mcp-light-control 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.
The Morse Code Light MCP Server enables the control of Philips Hue lights to send messages using Morse code, integrating with platforms like Cursor and Claude Desktop.
Morse Code Light MCP Server (Philips Hue) 💡
This MCP server allows Cursor or Claude Desktop to control Philips Hue lights and send messages through them using Morse code.
💡Example use case💡: tell Cursor agent to send a Morse code message to you when it's done with a task.
Demo
https://www.youtube.com/watch?v=GM1l98TtZmk
Built with:
Setup
Prerequisites
- Philips Hue bridge and lights
- Hue bridge username (API key)
- Node.js (v14 or higher)
- Cursor or Claude Desktop
Local API Setup
-
Clone this repository locally.
-
Obtain your Philips Hue bridge IP address and username. If you don't have one, run the discovery script:
node build/discover-bridge.js
Follow the prompts to press the link button on your Hue bridge and receive your API key.
-
Run
npm install
followed bynpm run build
in the project directory. This will generate the MCP server script in the/build
directory. -
Add the following MCP configuration. In Cursor it's under Settings -> MCP -> Add new MCP server. In Claude Desktop it's under Settings -> MCP -> Add new MCP server.
{
"mcpServers": {
"control_lights": {
"command": "node",
"args": ["ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js"],
"env": {
"HUE_USERNAME": "YOUR_HUE_USERNAME",
"BRIDGE_IP": "YOUR_BRIDGE_IP"
}
}
}
}
Remote API Setup
This project supports controlling your Philips Hue lights remotely (from outside your local network) using the Hue Remote API. This enables you to control your lights from anywhere with an internet connection.
Getting Remote API Credentials
-
Create a Hue Developer Account:
- Register at https://developers.meethue.com/
-
Create a Remote Hue API App:
- Go to https://developers.meethue.com/my-apps/
- Create a new app with these details:
- App name: Choose a name for your app
- Callback URL: Use
http://localhost/
for simple testing - Application description: Brief description of your app
- After creating the app, you'll receive:
- Client ID
- Client Secret
-
Get Access and Refresh Tokens:
a. Construct an authorization URL and open it in your browser:
https://api.meethue.com/oauth2/auth?clientid=YOUR_CLIENT_ID&response_type=code&state=anystring&appid=YOUR_APP_NAME&deviceid=test-device&devicename=TestDevice
Replace
YOUR_CLIENT_ID
andYOUR_APP_NAME
with your values.b. Log in with your Hue developer account and authorize the app.
c. You'll be redirected to your callback URL with a code parameter.
d. Extract the code from the URL (e.g.,
?code=abcd1234&state=anystring
).e. Exchange the code for tokens using cURL or Postman:
curl -X POST https://api.meethue.com/oauth2/token \ -d "code=YOUR_AUTHORIZATION_CODE&grant_type=authorization_code" \ -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET"
f. The response will contain:
{ "access_token": "YOUR_ACCESS_TOKEN", "refresh_token": "YOUR_REFRESH_TOKEN", "token_type": "bearer", "expires_in": 604800 }
Store these tokens securely. The access token is valid for approximately 7 days, and the refresh token for approximately 100 days.
Add this to your MCP configuration:
{
"mcpServers": {
"control_lights": {
"command": "node",
"args": ["ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js"],
"env": {
"USE_REMOTE": "true",
"REMOTE_CLIENT_ID": "YOUR_CLIENT_ID",
"REMOTE_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
"REMOTE_ACCESS_TOKEN": "YOUR_ACCESS_TOKEN",
"REMOTE_REFRESH_TOKEN": "YOUR_REFRESH_TOKEN"
}
}
}
}
Available Tools
control_lights
Turn specific or all Philips Hue lights on or off.
Parameters:
state
(boolean): True to turn lights on, false to turn them offspecific_lights
(array of strings, optional): List of specific light IDs to control
get_lights_info
Retrieve information about all available Philips Hue lights.
Parameters: None
send_morse_code_through_light
Send a message through Philips Hue lights using Morse code.
Parameters:
message
(string): The message to send through the lightsspeed_multiplier
(number, optional): Speed multiplier for the Morse code (0.1 to 5, default 1)restore_state
(boolean, optional): Whether to restore lights to their original state after sending
Development
npm install
npm run build