
gehaiyi/xiaomi-home-mcp
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
Control Xiaomi smart home devices through AI assistants via MCP (Model Context Protocol). QR code login, zero config.
概要
Control your Xiaomi smart home devices through AI assistants via the Model Context Protocol (MCP). Works with Claude Code, Claude Desktop, Cursor, and any MCP-compatible client. - — Automatically find all devices in your Xiaomi account - — Read power state, brightness, temperature, humidity, battery, lock status - — Turn on/off, adjust brightness, color temperature, target temperature - — Play/pause music, TTS, volume control, voice commands - — Scan with Mi Home app, no password needed - — Just two Python files, no pip install required - Python 3.10+ - uv (recommended) or pip - Mi Home app on your phone (for QR code login) A QR code will open in your browser. Scan it with the Mi Home app (Profile → Scan icon in top-right corner). Tokens are saved to ~/.xiaomi-mcp/tokens.json with 600 permissions. That's it! Now you can talk to your devices: "Turn on the lamp" "What's the room temperature?" "Is the door locked?" "Set brightness to 50%" "Play some music"
README
以下は原文 README の抜粋です。原文を見る。
Xiaomi Home MCP Server
Control your Xiaomi smart home devices through AI assistants via the Model Context Protocol (MCP).
Works with Claude Code, Claude Desktop, Cursor, and any MCP-compatible client.
Features
- Device Discovery — Automatically find all devices in your Xiaomi account
- Status Monitoring — Read power state, brightness, temperature, humidity, battery, lock status
- Device Control — Turn on/off, adjust brightness, color temperature, target temperature
- XiaoAi Speaker — Play/pause music, TTS, volume control, voice commands
- QR Code Login — Scan with Mi Home app, no password needed
- Zero Dependencies Setup — Just two Python files, no pip install required
Quick Start
Prerequisites
- Python 3.10+
- uv (recommended) or pip
- Mi Home app on your phone (for QR code login)
1. Login
uv run --script login.py
A QR code will open in your browser. Scan it with the Mi Home app (Profile → Scan icon in top-right corner).
Tokens are saved to ~/.xiaomi-mcp/tokens.json with 600 permissions.
2. Connect to Claude Code
claude mcp add xiaomi-home -- uv run --script /path/to/mcp_server.py
That’s it! Now you can talk to your devices:
“Turn on the lamp” “What’s the room temperature?” “Is the door locked?” “Set brightness to 50%” “Play some music”
2a. Connect to Claude Desktop
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"xiaomi-home": {
"command": "uv",
"args": ["run", "--script", "/path/to/mcp_server.py"]
}
}
}
Available Tools
| Tool | Description |
|---|---|
get_devices() |
List all devices and online status |
get_device_status(name?) |
Query detailed status (power, brightness, temperature, battery, etc.) |
control_device(name, action) |
Control device: on/off, brightness, color_temp, target_temp |
play_music(keyword?) |
Play music on XiaoAi speaker |
pause_music() |
Pause playback |
resume_music() |
Resume playback |
set_volume(volume) |
Set speaker volume (0-100) |
tts(text) |
Text-to-speech on speaker |
xiaoai_command(command) |
Send voice command to XiaoAi |
get_speaker_status() |
Get playback status |
Supported Devices
The server auto-detects device types by model prefix:
| Type | Models | Status Query | Control |
|---|---|---|---|
| Light | philips.light.*, yeelink.light.* |
Power, Brightness | On/Off, Brightness, Color Temp |
| AC Partner | lumi.acpartner.* |
Power | On/Off |
| Heater | xiaomi.heater.* |
Power, Target Temp | On/Off, Target Temp |
| Fan | xiaomi.fan.* |
Power, Speed, Oscillate | On/Off |
| Lock | loock.lock.* |
Lock State, Battery | — |
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →設定
{
"mcpServers": {
"xiaomi-home": {
"command": "uv",
"args": ["run", "--script", "/path/to/mcp_server.py"]
}
}
}