Control Aqara smart home devices, query status, execute scenes, and much more using natural language.
Aqara MCP Server is an intelligent home automation control service built on the MCP (Model Context Protocol). It enables any MCP-compatible AI assistant or API (such as Claude, Cursor, etc.) to interact with your Aqara smart home devices, providing natural language device control, status queries, and scene execution capabilities.
Aqara MCP Server serves as a bridge between AI assistants and the Aqara smart home platform:
graph LR
A[AI Assistant] --> B[MCP Client]
B --> C[Aqara MCP Server]
C --> D[Aqara Cloud API]
D --> E[Smart Devices]
device_control
) per MCP protocolYou can either download pre-built executables or build from source.
Visit the GitHub Releases page to download the latest executable for your operating system:
π₯ Go to Releases Page
Simply download and extract the appropriate package for your platform.
# Clone the repository
git clone https://github.com/aqara/aqara-mcp-server.git
cd aqara-mcp-server
# Download dependencies
go mod tidy
# Build executable
go build -o aqara-mcp-server
After building, you'll have an aqara-mcp-server
executable in the current directory.
To enable MCP Server access to your Aqara account and device control, you must first complete login authorization.
Please visit the following URL to complete login authorization: π https://cdn.aqara.com/app/mcpserver/login.html
After successful login, you'll receive necessary authentication information (such as token
, region
) for use in subsequent configuration steps.
β οΈ Security Notice: Please keep your
token
information secure and do not share with others.
Configuration methods vary slightly between different MCP clients. Here's an example of how to configure Claude for Desktop to use this MCP Server:
Open Claude for Desktop Settings
Switch to the Developer tab, then click Edit Config to open the configuration file in a text editor
Add the configuration information from the "Login Success Page" to your client's configuration file claude_desktop_config.json
{
"mcpServers": {
"aqara": {
"command": "/path/to/aqara-mcp-server",
"args": ["run", "stdio"],
"env": {
"token": "your_token_here",
"region": "your_region_here"
}
}
}
}
command
: Full path to your downloaded or built aqara-mcp-server
executableargs
: Use ["run", "stdio"]
to start stdio transport modeenv
: Environment variable configuration
token
: Access token obtained from Aqara login pageregion
: Your Aqara account region (supported regions: CN, US, EU, KR, SG, RU)For other MCP protocol-compatible clients (such as ChatGPT, Cursor, etc.), configuration is similar:
token
and region
stdio
)Restart Claude for Desktop. You can then perform device control, device queries, scene execution, and other operations through natural language.
Example conversations:
MCP clients can interact with Aqara smart home devices by calling these tools.
Control smart home device states or attributes (such as power, temperature, brightness, color, color temperature, etc.).
Parameters:
endpoint_ids
(Array<Integer>, Required): List of device IDs to controlcontrol_params
(Object, Required): Control parameter object containing specific operations:
action
(String, Required): Operation to execute (e.g., "on"
, "off"
, "set"
, "up"
, "down"
, "cooler"
, "warmer"
)attribute
(String, Required): Device attribute to control (e.g., "on_off"
, "brightness"
, "color_temperature"
, "ac_mode"
)value
(String | Number, Optional): Target value (required when action is "set")unit
(String, Optional): Unit of the value (e.g., "%"
, "K"
, "β"
)Returns: Device control operation result message
Get device list based on specified location (room) and device type (excludes real-time status information).
Parameters:
positions
(Array<String>, Optional): List of room names. Empty array queries all roomsdevice_types
(Array<String>, Optional): List of device types (e.g., "Light"
, "WindowCovering"
, "AirConditioner"
, "Button"
). Empty array queries all typesReturns: Markdown formatted device list including device names and IDs
Get current device status information (for querying real-time status like color, brightness, power state, etc.).
Parameters:
positions
(Array<String>, Optional): List of room names. Empty array queries all roomsdevice_types
(Array<String>, Optional): List of device types. Same options as device_query
. Empty array queries all typesReturns: Markdown formatted device status information
Query device historical log information.
Parameters:
endpoint_ids
(Array<Integer>, Required): List of device IDs to query history forstart_datetime
(String, Optional): Query start time in format YYYY-MM-DD HH:MM:SS
(e.g., "2023-05-16 12:00:00"
)end_datetime
(String, Optional): Query end time in format YYYY-MM-DD HH:MM:SS
attributes
(Array<String>, Optional): List of device attribute names to query (e.g., ["on_off", "brightness"]
). Queries all recorded attributes if not providedReturns: Markdown formatted device historical status information
Query all scenes under user's home, or scenes within specified rooms.
Parameters:
positions
(Array<String>, Optional): List of room names. Empty array queries entire home's scenesReturns: Markdown formatted scene information
Execute specified scenes by scene ID.
Parameters:
scenes
(Array<Integer>, Required): List of scene IDs to executeReturns: Scene execution result message
Get list of all homes under user account.
Parameters: None
Returns: Comma-separated list of home names. Returns empty string or appropriate message if no data
Switch user's current operating home. After switching, subsequent device queries, controls, and other operations will target the newly switched home.
Parameters:
home_name
(String, Required): Name of target homeReturns: Switch operation result message
Automation configuration (currently supports only scheduled or delayed device control tasks).
Parameters:
scheduled_time
(String, Required): Scheduled execution time using standard Crontab format "minute hour day month weekday"
. Examples: "30 14 * * *"
(daily at 14:30), "0 9 * * 1"
(Mondays at 9:00)endpoint_ids
(Array<Integer>, Required): List of device IDs for scheduled controlcontrol_params
(Object, Required): Device control parameters using same format as device_control
tool (including action, attribute, value, etc.)task_name
(String, Required): Name or description of this automation task (for identification and management)execution_once
(Boolean, Optional): Whether to execute only once
true
: Execute task only once at specified time (default)false
: Execute task periodically (daily, weekly, etc.)Returns: Automation configuration result message
.
βββ cmd.go # Cobra CLI command definitions and program entry point (contains main function)
βββ server.go # MCP server core logic, tool definitions, and request handling
βββ smh.go # Aqara smart home platform API interface wrapper
βββ middleware.go # Middleware: user authentication, timeout control, exception recovery
βββ config.go # Global configuration management and environment variable handling
βββ go.mod # Go module dependency management file
βββ go.sum # Go module dependency checksum file
βββ readme/ # README documentation and image resources
β βββ img/ # Image resources directory
β βββ *.md # Multi-language README files
βββ LICENSE # MIT open source license
βββ README.md # Main project documentation
cmd.go
: Cobra framework-based CLI implementation defining run stdio
and run http
startup modes and main entry functionserver.go
: MCP server core implementation responsible for tool registration, request handling, and protocol supportsmh.go
: Aqara smart home platform API wrapper layer providing device control, authentication, and multi-home supportmiddleware.go
: Request processing middleware providing authentication verification, timeout control, and exception handlingconfig.go
: Global configuration management responsible for environment variable processing and API configurationWe welcome contributions through Issues and Pull Requests!
Before submitting code, please ensure:
π If this project helps you, please give us a Star!
π€ Welcome to join our community and make smart homes smarter together!
This project is licensed under the MIT License.
Copyright (c) 2025 Aqara-Copilot