Smart Bulb MCP Server
Provides tools for controlling Xiaomi-compatible smart bulbs (including Yeelight) over IP, with capabilities for turning power on/off, adjusting brightness, setting RGB or hex colors, and querying the current bulb state.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Smart Bulb MCP Serverconnect to the mock bulb, turn it on, and set the color to blue"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Smart Bulb MCP Server
A Model Context Protocol (MCP) server built with Node.js and TypeScript to control smart bulbs over IP. It supports:
Mock/Simulated Bulb: For local testing and development without physical hardware.
Yeelight/Xiaomi Bulb: Uses standard TCP port
55443(local control JSON-RPC protocol) to control real physical smart bulbs.
Features
Connect using IP: Dynamically connect to different bulbs on your local network.
Power Control: Turn the bulb on or off.
Brightness & Opacity: Adjust bulb brightness / intensity from 1% to 100%.
Color Control: Set colors using RGB coordinates or hexadecimal color codes.
State Queries: Fetch the current state of the bulb in real-time.
Related MCP server: Philips Hue MCP Service
Getting Started
1. Build the Server
First, install the dependencies and compile the TypeScript files:
# Install dependencies
npm install
# Compile the TypeScript files
npm run buildThe compiled files will be output to the dist/ directory.
2. Run / Development
You can run the server directly via standard I/O (Stdio):
# Run the built JS
npm start
# Compile and run in development mode
npm run devConfiguring with MCP Clients
To use this server with an MCP client (such as Claude Desktop or Cursor), add the server configuration to your configuration file.
For Claude Desktop
Edit your claude_desktop_config.json (typically located in %APPDATA%\Claude on Windows or ~/Library/Application Support/Claude on macOS):
{
"mcpServers": {
"smart-bulb": {
"command": "node",
"args": ["D:/Palwinder/mcp-server-bulb/dist/index.js"]
}
}
}Note: Replace D:/Palwinder/mcp-server-bulb/dist/index.js with the absolute path to dist/index.js on your machine.
Exposed MCP Tools
Once the server is connected, the host LLM will have access to the following tools:
1. connect_bulb
Connects to a bulb at a specified IP.
Arguments:
ip(string, required): IP address (e.g."192.168.1.15"or"127.0.0.1").type(enum["mock", "yeelight"], default:"mock"): Driver type. Use"mock"to test the server features without physical hardware, or"yeelight"for real Yeelight bulbs.port(number, optional): Port to use. Defaults to55443for Yeelight, and9999for Mock.
2. disconnect_bulb
Disconnects from the currently connected bulb.
Arguments: None.
3. get_bulb_state
Retrieves the connection status, power state, brightness/opacity percentage, and RGB color.
Arguments: None.
4. set_bulb_power
Turns the light bulb ON or OFF.
Arguments:
power(boolean, required):trueto turn ON,falseto turn OFF.
5. set_bulb_brightness
Sets the bulb's brightness / opacity.
Arguments:
brightness(number, required): Values from1to100.
6. set_bulb_color_rgb
Sets the color of the bulb using RGB values.
Arguments:
r(number, required): Red component0-255.g(number, required): Green component0-255.b(number, required): Blue component0-255.
7. set_bulb_color_hex
Sets the color of the bulb using a hex color code.
Arguments:
hex(string, required): Hex code (e.g.,"#FF0000"or"00FF00").
OpenAI Connection Client
We have built a client wrapper in src/openai-client.ts that allows you to feed prompts directly to OpenAI. OpenAI will then autonomously invoke the MCP tools to perform the actions on your smart bulb.
Setup and Running the Client
Set your OpenAI API Key: On Windows (PowerShell):
$env:OPENAI_API_KEY="your-actual-api-key"On macOS/Linux (Bash):
export OPENAI_API_KEY="your-actual-api-key"Run the Client:
Interactive CLI mode:
npm run clientThis opens a shell prompt. Try typing:
Connect to the mock bulb, turn it on, set its brightness to 80% and color to yellow.
One-off command mode: Pass your prompt directly as arguments:
npm run client -- "connect to the mock bulb, turn it on, and set color to blue"
Customizing the Model (Optional): By default, it uses
gpt-4o-mini. You can change it by setting theOPENAI_MODELenvironment variable:$env:OPENAI_MODEL="gpt-4o"
Developer Details & Architecture
The project has a modular architecture:
src/bulb/interface.ts: Defines the common contract (ISmartBulb) and state shape (BulbState).src/bulb/mock.ts: Simulated bulb instance that mimics network latency and state changes in memory.src/bulb/yeelight.ts: Implements a raw TCP line-based buffer parser to send and receive JSON-RPC packets directly from physical Yeelight WiFi bulbs without any third-party SDK dependencies.src/index.ts: Configures and mounts the@modelcontextprotocol/servertools, handling connection states and validation schemas.src/openai-client.ts: Launches the MCP server as a subprocess, loads all its tools dynamically, exposes them as OpenAI Functions, and handles the multi-turn conversational tool execution loop.
Built by Palwinder Singh
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables control of smart lights through MQTT messaging protocol, supporting operations like turning lights on/off and adjusting brightness levels from 0-100.
- AlicenseNot gradedqualityDmaintenanceEnables control of Philips Hue lights through the Model Context Protocol, providing tools for turning lights on/off, setting brightness and color, and retrieving light status.1Apache 2.0
- AlicenseNot gradedqualityCmaintenanceControls TAPO L530E smart light bulbs via MCP, supporting on/off, brightness, and color temperature, with local and remote AWS deployment.MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server for controlling LIFX smart lights, enabling AI assistants to manage power, color, brightness, effects, and scenes.MIT
Related MCP Connectors
A TypeScript MCP server for Home Assistant, enabling programmatic management of entities, automati…
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to control Unreal E…
A webhook inbox for agents: one call returns a live URL. Mock, verify, inspect and replay.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/PalwinderSinghPaali/smart-bulb-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server