A modern Model Context Protocol (MCP) server that provides comprehensive access to the CheerLights API. CheerLights is a global IoT project that synchronizes colors across thousands of connected lights worldwide, creating a real-time shared experience.
- Current Color: Get the most recent CheerLights color from the global network
- Color History: Retrieve recent color changes with configurable count (1-100)
- Color Statistics: Analyze color usage patterns and popularity over time
- Color Search: Find specific colors in the historical data
- Hex Color Codes: Get hex codes and RGB values for CheerLights colors
- Current Color Resource: Real-time current color as a readable resource
- History Resource: Formatted color history for context injection
- Supported Colors: Complete list of valid CheerLights colors with hex codes
- Trend Analysis: Generate prompts for analyzing CheerLights color trends
- Color Reports: Create detailed reports about specific colors
# Clone the repository
git clone https://github.com/cheerlights/cheerlights-mcp.git
cd cheerlights-mcp
# Install with uv
uv sync
# Run the server
uv run cheerlights-mcp# Clone and install
git clone https://github.com/cheerlights/cheerlights-mcp.git
cd cheerlights-mcp
pip install -e .
# Run the server
python -m cheerlights_mcp.server# Install with development dependencies
uv sync --dev
# Install pre-commit hooks
uv run pre-commit installpip install cheerlights-mcpAdd to your Claude Desktop configuration:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"cheerlights": {
"command": "uv",
"args": ["run", "cheerlights-mcp"],
"cwd": "/path/to/cheerlights-mcp"
}
}
}# Standard I/O (default)
python -m cheerlights_mcp.server
# With specific transport
python -m cheerlights_mcp.server stdio
python -m cheerlights_mcp.server sse
python -m cheerlights_mcp.server streamable-httpfrom cheerlights_mcp import create_server
# Create and run server
server = create_server("My CheerLights Server")
server.run()Returns structured ColorData with:
color: Current color nametimestamp: When it was setentry_id: Unique identifiercreated_at: Parsed datetime (optional)
Returns ColorHistory with recent changes (1-100 entries).
Returns ColorStatistics with:
- Color frequency counts
- Most/least popular colors
- Analysis period information
- Unique color count
Returns ColorSearchResult with matching entries.
Returns HexColor with hex code and RGB values.
cheerlights://current- Current color statuscheerlights://history/{count}- Recent color historycheerlights://colors/supported- All supported colors
- "What's the current CheerLights color and when was it last changed?"
- "Show me the last 20 CheerLights color changes"
- "Analyze the color usage statistics for the last 100 changes"
- "Search for all recent times the color was 'blue'"
- "What's the hex code for the CheerLights 'warmwhite' color?"
- "Create a report on CheerLights color trends"
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=cheerlights_mcp
# Run specific test files
uv run pytest tests/test_tools.py -vcheerlights-mcp/
βββ src/cheerlights_mcp/
β βββ api/ # ThingSpeak API client
β βββ models/ # Pydantic data models
β βββ tools/ # MCP tool implementations
β βββ utils/ # Utilities (color mapping, statistics)
β βββ server.py # Main FastMCP server
βββ tests/ # Comprehensive test suite
βββ examples/ # Usage examples
- ThingSpeakClient: Async HTTP client for CheerLights API
- Pydantic Models: Type-safe data validation and serialization
- Structured Output: Full support for MCP structured responses
- Comprehensive Error Handling: Graceful degradation and logging
- Statistics Engine: Color usage analysis and trend calculation
CheerLights supports these standard colors:
- Primary: red, green, blue
- Secondary: cyan, magenta, yellow
- Extended: orange, pink, purple, white, warmwhite, oldlace
- Utility: black
Each color includes hex codes and RGB values for precise representation.
{
"color": "red",
"timestamp": "2024-01-15 14:30:22 UTC",
"entry_id": "12345",
"created_at": "2024-01-15T14:30:22Z"
}{
"color_counts": {"red": 15, "blue": 12, "green": 8},
"most_popular": "red",
"least_popular": "green",
"total_changes": 35,
"unique_colors": 3,
"analysis_period": "2 hours"
}# Clone and setup
git clone https://github.com/cheerlights/cheerlights-mcp.git
cd cheerlights-mcp
uv sync --dev
# Install pre-commit hooks
uv run pre-commit install
# Run tests
uv run pytest -v- Complete rewrite using modern MCP Python SDK
- Structured Output support for all tools
- Enhanced API client with proper error handling
- Comprehensive test suite with >90% coverage
- Type safety with Pydantic models throughout
- New tools: statistics, search, hex color codes
- Resources and prompts for richer integration
- Modern packaging with uv and pyproject.toml
- Initial FastMCP implementation
- Basic current color and history tools
- Simple ThingSpeak integration
This project is licensed under the MIT License - see the LICENSE file for details.
- CheerLights Project: cheerlights.com
- MCP Documentation: modelcontextprotocol.io
- ThingSpeak API: thingspeak.com
- Original Tutorial: Creating MCP Servers
CheerLights is a global Internet of Things project that synchronizes colored lights all around the world to create a synchronized light display. The project was created by Hans Scharler and has connected thousands of lights across the globe since 2011. When someone changes the color on the CheerLights Discord Server, all participating lights change to that color in near real-time.
This MCP server provides AI assistants with rich access to CheerLights data, enabling analysis of global lighting trends, color popularity, and temporal patterns in this unique IoT dataset.