miot-mcp
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., "@miot-mcpturn on the living room TV and set bedroom lights to 30%"
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.
Mijia MCP Server
Chinese Docs | English
A productized Mijia MCP service based on mijiaAPI 3.x. It no longer requires clients to first understand protocol details such as did, siid/piid/aiid; instead, it prioritizes more natural query and control capabilities oriented around "home, room, device name, and scene name".
What This Version Solves
AI clients: exposes stable, clear product-level tools first, rather than low-level protocol fields
Real home scenarios: browse homes and rooms first, then locate devices, then execute controls
MCP standards: tools return structured results, and service status and login status can be consumed directly by clients
Extensibility: standard capability schemas, profile-driven control, and resource models can keep evolving
Related MCP server: Xiaomi smart home MCP server
Current Capabilities
Service & Login
get_service_statusprepare_loginreconnect_serviceclear_saved_loginrefresh_devicesget_tool_catalogping
Homes & Devices
get_home_overviewlist_homeslist_devicesget_deviceget_device_statusget_device_capabilities
Device Control
control_by_intentcontrol_deviceturn_on_deviceturn_off_deviceset_brightnessset_color_temperatureset_target_temperatureset_hvac_modeset_fan_speedset_cover_position
Scenes & Consumables
list_scenesexecute_sceneget_consumable_items
MCP Resources
mijia://servicemijia://homesmijia://devicesmijia://scenesmijia://capabilitiesmijia://tooling
Installation
Python 3.10+ is recommended.
poetry installIf you don't use Poetry:
pip install -r requirements.txtStartup
poetry run python mcp_server/mcp_server.pyTest the handshake:
poetry run python mcp_server/mcp_test.pyLogin Methods
mijiaAPI 3.x has removed username/password login and only supports QR code login.
When login is needed for the first time, the service will:
Generate a browser page:
~/.miot-mcp/qr.htmlAlso generate a QR code image:
~/.miot-mcp/qr.pngBy default, open
qr.htmlwith the system browser firstFall back to an image viewer or an in-terminal QR code only when the browser cannot open it
Authentication information will be saved to:
~/.miot-mcp/auth_data.jsonRecommended Primary Login Flow
Call
prepare_loginCall
get_service_statusRead
service.qr.page_pathorservice.qr.image_pathAfter the scan, call
reconnect_serviceor directlyrefresh_devices
Login-Related Status
Both get_service_status and mijia://service return structured login status. Key fields include:
service.connectedservice.has_saved_loginservice.qr.open_modeservice.qr.page_pathservice.qr.image_pathservice.qr.login_urlassistant_summarynext_steps.should_scan_qr
Environment Variables
export MIJIA_ENABLE_QR="true"
export MIJIA_QR_OPEN_MODE="browser"
export MIJIA_LOG_LEVEL="INFO"Notes:
MIJIA_ENABLE_QR: whether to enable QR code login; defaulttrueMIJIA_QR_OPEN_MODE: advanced setting; supportsbrowser/viewer/none; defaultbrowserMIJIA_LOG_LEVEL: log level; supportsDEBUG/INFO/WARNING/ERROR
MCP Client Configuration Example
It is recommended to use the Python in the virtual environment directly, rather than poetry run.
{
"mcpServers": {
"mijia": {
"command": "/path/to/venv/bin/python",
"args": [
"/path/to/miot-mcp/mcp_server/mcp_server.py"
],
"env": {
"MIJIA_ENABLE_QR": "true",
"MIJIA_QR_OPEN_MODE": "browser",
"MIJIA_LOG_LEVEL": "INFO"
}
}
}
}Recommended Call Flow
For most AI clients, the following order is recommended:
prepare_loginget_service_statusrefresh_devicesget_home_overviewget_device_statuscontrol_by_intentlist_scenesexecute_scene
If the client needs more stable and explicit routing, supplement with:
list_homeslist_devicesget_deviceget_device_capabilitiescontrol_device
Common Tools
prepare_login
Proactively prepares QR code login. By default, it prefers to reuse the existing QR page; if you need to go through a new scan round, pass force_reauth=true.
get_service_status
Returns service connection status, auth file path, log path, QR page path, and next-step suggestions.
get_home_overview
Outputs a device overview by home and room, suitable for clients to understand the home structure first.
get_device_status
Reads a single device's current status, available actions, and recommended next steps.
get_device_capabilities
Returns standard capability schemas and profile-driven control items, suitable for clients that need stable routing.
control_by_intent
Natural-language control entry point. Suitable for most everyday scenarios, e.g., "set the brightness of the bedroom desk lamp to 30%".
control_device
Unified structured control entry point. Suitable when the client already knows the target action and parameters.
speaker_say
Lets a Xiao Ai speaker voice-announce arbitrary text ("shout-out"). Suitable for long-task completion reminders, alarm-style announcements, and having a specific speaker read text.
{
"name": "speaker_say",
"arguments": {
"text": "任务完成啦,图片已生成",
"speaker_name": "城市之光音响"
}
}Why use play-text instead of execute-text-directive:
The Xiao Ai speaker has two related actions:
execute-text-directive— sends the text to Xiao Ai as a question/command to parse → triggers its AI response (e.g., "you've stumped me"), not a pure announcementplay-text— pure text playback, with the single parameter_in=[text], does not trigger an AI conversation ← this is whatspeaker_sayuses
Pitfall: the generic
run_actionpath stuffing parameters into thevaluefield causes the cloud API to report-704220025 Action参数个数不匹配; you must use the_inkwargs style (device.run_action('play-text', _in=[text])→method['in']=[text]).
Command-line mode (no MCP client needed; call directly via script):
python speaker_say.py "任务完成啦" --speaker "城市之光音响"
python speaker_say.py "任务完成啦" --speaker "客厅音箱" --quiet # 静默(只执行不播报)Parameters:
text: the text to read (natural language)--speaker: speaker name (fuzzy match; if not provided, the first online speaker is selected)--quiet: execute silently (no voice announcement)
Usage Examples
View Service Status
{
"name": "get_service_status",
"arguments": {}
}Proactively Prepare Login
{
"name": "prepare_login",
"arguments": {
"reopen_qr": true
}
}Refresh Device & Room Mapping
{
"name": "refresh_devices",
"arguments": {}
}View Home Overview
{
"name": "get_home_overview",
"arguments": {}
}View Single Device Status
{
"name": "get_device_status",
"arguments": {
"device_name": "吸顶灯",
"room": "客厅"
}
}View Capability Schema
{
"name": "get_device_capabilities",
"arguments": {
"device_name": "台灯",
"room": "卧室"
}
}Natural Language Control
{
"name": "control_by_intent",
"arguments": {
"query": "把卧室台灯亮度调到30%"
}
}Structured Control
{
"name": "control_device",
"arguments": {
"operation": "set_color_temperature",
"device_name": "台灯",
"room": "卧室",
"value": 4000
}
}Execute Scene
{
"name": "execute_scene",
"arguments": {
"scene_name": "回家模式"
}
}Current Boundaries
This version of the MCP focuses on the most common home control paths:
Home and room browsing
Device locating
Generic capability control
Standardized capability schema exposure
Scene execution
Consumable queries
Typical capabilities already covered include:
On/off
Brightness
Color temperature
Target temperature
Mode
Fan speed
Open/close position
Lower-level, more customizable capabilities can still be extended into control_device, but are no longer exposed externally as the default usage approach.
Code Structure
The service mainly has three layers internally:
adapter/Handles interaction withmijiaAPI, login, device discovery, and the QR login experiencemcp_server/core/Handles result wrapping, capability calculation, intent routing, and standardizationmcp_server/device_definitions/andmcp_server/device_resources/Handle standard capability definitions, intent definitions, and the productized resource model
The current capabilities and routing do not rely on plugin auto-discovery; instead, definition tables are explicitly imported. This is clearer and more suitable for stable invocation by AI clients.
DSH (DeepSeek Harness) Integration Plugin
In addition to the MCP service, this repository also ships a Cordis plugin for DeepSeek Harness (dsh-plugin/dsh-task-notify), letting the DSH agent proactively announce via the Xiao Ai speaker + Feishu notification (long-task completion reminders):
Tool | Purpose |
| Long-task completion notification: always sends a Feishu DM + decides whether to announce via the Xiao Ai speaker based on the do-not-disturb state |
| Make the specified Xiao Ai speaker read any text (pure playback; does not trigger Xiao Ai's AI conversation) |
| Toggle do-not-disturb / switch the current speaker / change the Feishu target (persisted across sessions) |
| Check the current state |
Install DSH Plugin
# 1. 复制到 DSH profiles 的 node_modules
cp -r dsh-plugin/dsh-task-notify C:\Users\<you>\.dsh\profiles\node_modules\@oadank\dsh-task-notify
# 2. 注册到 ~/.dsh/profiles/web/cordis.patch.yml 的 insert 列表
- id: dsh-task-notify
name: '@oadank/dsh-task-notify'
# 3. 重启 dsh-web 生效The plugin calls speaker_say.py (in this repository) to perform the Xiao Ai announcement. The default speaker can be switched with set_notify_state(currentSpeaker, "音箱名"), and the state is persisted across sessions in ~/.dsh/profiles/notify-state.json.
For details, see dsh-plugin/README.md.
This server cannot be installed
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 gradedqualityDmaintenanceAn MCP server based on the Mastra framework for controlling Xiaomi Mi Home smart devices. It enables device discovery, property management, action execution, and scene control through the Mi Home cloud service.
- AlicenseAqualityCmaintenancemijia-control A production-ready MCP server that enables AI agents (Claude Code, Claude Desktop, Cursor, Hermes, etc.) to directly control Xiaomi/Mijia smart home devices through natural language. What it does Turns conversations into physical actions — "turn on the desk lamp to 50%" becomes actual device control in real-time.1260MIT
- FlicenseNot gradedqualityCmaintenanceMCP server for controlling Xiaomi/Mi Home smart devices via natural language, supporting device listing, property read/write, action calls, and camera snapshots.11
- AlicenseNot gradedqualityCmaintenanceMCP server that enables AI agents to control Xiaomi Mi Home smart devices through natural language, with support for listing devices, controlling properties, and running scenes.MIT
Related MCP Connectors
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
Self-hosted MCP gateway: turn any API, database or MCP server into AI connectors — no code.
Markdown-first MCP server for Notion API with 8 composite tools and 39 actions.
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/oadank/miot-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server