cheerlights/cheerlights-mcp
If you are the rightful owner of cheerlights-mcp 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 that allows Claude or other AI tools to interact with the CheerLights API. CheerLights is a global IoT project that synchronizes colors across connected lights worldwide.
CheerLights MCP Server
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.
๐ Features
Tools (Actions)
- 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
Resources (Context)
- 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
Prompts (Templates)
- Trend Analysis: Generate prompts for analyzing CheerLights color trends
- Color Reports: Create detailed reports about specific colors
๐ Quick Start
Using uv (Recommended)
# 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
Using pip
# 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
๐ฆ Installation
For Development
# Install with development dependencies
uv sync --dev
# Install pre-commit hooks
uv run pre-commit install
From PyPI (when published)
pip install cheerlights-mcp
๐ง Usage
With Claude Desktop
Add 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"
}
}
}
Direct Execution
# 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-http
Programmatic Usage
from cheerlights_mcp import create_server
# Create and run server
server = create_server("My CheerLights Server")
server.run()
๐ ๏ธ API Reference
Tools
get_current_cheerlights_color()
Returns structured ColorData
with:
color
: Current color nametimestamp
: When it was setentry_id
: Unique identifiercreated_at
: Parsed datetime (optional)
get_cheerlights_history(count: int = 5)
Returns ColorHistory
with recent changes (1-100 entries).
analyze_color_statistics(sample_size: int = 50)
Returns ColorStatistics
with:
- Color frequency counts
- Most/least popular colors
- Analysis period information
- Unique color count
search_colors(color: str, limit: int = 20)
Returns ColorSearchResult
with matching entries.
get_hex_color_code(color_name: str)
Returns HexColor
with hex code and RGB values.
Resources
cheerlights://current
- Current color statuscheerlights://history/{count}
- Recent color historycheerlights://colors/supported
- All supported colors
Example Queries for Claude
- "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"
๐งช Testing
# 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 -v
๐๏ธ Architecture
cheerlights-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
Key Components
- 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
๐จ Supported Colors
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.
๐ Example Data
Current Color Response
{
"color": "red",
"timestamp": "2024-01-15 14:30:22 UTC",
"entry_id": "12345",
"created_at": "2024-01-15T14:30:22Z"
}
Statistics Response
{
"color_counts": {"red": 15, "blue": 12, "green": 8},
"most_popular": "red",
"least_popular": "green",
"total_changes": 35,
"unique_colors": 3,
"analysis_period": "2 hours"
}
Development Setup
# 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
๐ Changelog
Version 2.0.0
- 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
Version 1.0.0
- Initial FastMCP implementation
- Basic current color and history tools
- Simple ThingSpeak integration
๐ License
This project is licensed under the MIT License - see the file for details.
๐ Links
- CheerLights Project: cheerlights.com
- MCP Documentation: modelcontextprotocol.io
- ThingSpeak API: thingspeak.com
- Original Tutorial: Creating MCP Servers
๐ About CheerLights
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.