midea-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., "@midea-mcpset bedroom AC to 24°C cool mode"
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.
midea-mcp
面向美的空调的本地单用户 MCP Server。MVP 使用 Python 3.12、MCP Python
SDK >=1.27,<2 和 stdio,公开七个工具:
list_devicesget_deviceget_device_logrefresh_deviceset_device_statediscover_lan_devicesdiagnose_device
设备状态日志
所有 set_device_state 调用都会写入 data/device-log.jsonl,包括请求字段、
Provider、五种写入状态、核验结果和失败原因。每次真实设备状态读取都会与上一份
持久化快照比较,并分别记录:
state_change:开关、模式、设定温度;sensor_change:室内温度;availability_change:在线状态;state_snapshot:首次读取时建立的基线。
每条记录同时包含 UTC 和北京时间。通过 midea-mcp 写入后的读回带有同一个
request_id;其他入口造成的变化标记为 external_unknown。observed_via=cloud
只表示变化是通过云端读取发现的,不能证明操作来自美居 App。
读取最近日志:
get_device_log(limit=50)
get_device_log(limit=50, field="mode")
get_device_log(limit=50, event_type="state_change")可过滤字段为 power、mode、target_temperature、current_temperature 和
online,limit 范围为 1–500。日志只在真实状态读取发生时发现外部变化;
midea-mcp 本身不会后台轮询设备。
Related MCP server: xiaomi-device-control
安全与一致性保证
每台逻辑设备使用 midea-mcp 内部 UUID。
Cloud ID、LAN ID 和 keyed SN fingerprint 分别保存为 bindings,绝不假设 Cloud ID 与 LAN ID 相同。
写入只返回
rejected、not_delivered、delivery_unknown、accepted或verified。LAN 或 Cloud 写入投递结果不明时,只通过原 Provider 读取实际状态进行核验, 绝不切换 Provider 或重发。
Token/Key 使用 AES-256-GCM 加密落盘;日志和工具响应不返回明文凭证或原始 SN。
路由选择为“可用 LAN 优先;没有可用 LAN binding 时使用 Cloud”。一旦开始写入, 本次请求就锁定 Provider。
Cloud 支持空调状态读取及开关、模式、目标温度写入,并使用云端状态读回核验。
安装
py -3.12 -m venv .venv
.\.venv\Scripts\python.exe -m pip install -e ".[dev]"如果系统没有 py 命令,直接使用 Python 3.12 可执行文件创建虚拟环境。
默认数据目录是当前目录下的 data/,可通过 MIDEA_MCP_DATA_DIR 修改。
首次启动会生成 data/master.key。生产使用时应备份密钥并限制文件访问权限;也可以
使用 MIDEA_MCP_MASTER_KEY 注入一个 URL-safe base64 编码的 32 字节密钥。
Phase 0
1. 局域网扫描
.\.venv\Scripts\midea-mcp.exe phase0跨子网或广播受限时可指定设备 IP 或广播地址:
.\.venv\Scripts\midea-mcp.exe phase0 --target 192.168.1.2552. 导入旧 HA V3 凭证
midea_ac_lan 的单设备文件通常位于:
<HA config>/.storage/midea_ac_lan/<device_id>.json可导入单个文件、整个 midea_ac_lan 目录,也可导入 HA
.storage/core.config_entries:
.\.venv\Scripts\midea-mcp.exe import-ha C:\path\to\123456789.json导入器仅接受设备类型 0xAC、协议版本 V3,并将 Token/Key 立即加密后保存。
3. 可选的 Cloud 库存及 Token/Key 补取
不要把账号密码写入命令行历史:
$env:MIDEA_ACCOUNT = "your-account"
$env:MIDEA_PASSWORD = "your-password"
$env:MIDEA_CLOUD_NAME = "美的美居"
.\.venv\Scripts\midea-mcp.exe sync-cloud旧 Token API 正在被美的关闭,因此该步骤可能无法取得新凭证。已有 HA 凭证优先且 不会被云端候选覆盖。Cloud/LAN 只有在 SN fingerprint 唯一匹配时才合并为同一设备。
sync-cloud 同时会登记 Cloud binding。部署在无法访问家庭局域网的服务器时,应在
启动 MCP Server 前至少执行一次该命令;之后 refresh_device 和
set_device_state 会通过 Cloud 路由工作。
4. 加密备份
.\.venv\Scripts\midea-mcp.exe backup-credentials C:\safe\midea.backup.json
.\.venv\Scripts\midea-mcp.exe restore-credentials C:\safe\midea.backup.json备份使用独立口令通过 scrypt 派生密钥,再使用 AES-256-GCM 加密。
启动 MCP Server
.\.venv\Scripts\midea-mcp-server.exe客户端配置示例:
{
"mcpServers": {
"midea": {
"command": "C:\\path\\to\\midea-mcp\\.venv\\Scripts\\midea-mcp-server.exe",
"env": {
"MIDEA_MCP_DATA_DIR": "C:\\path\\to\\midea-mcp\\data"
}
}
}
}控制参数
set_device_state 只接受:
{
"device_id": "midea-mcp-internal-uuid",
"changes": {
"power": true,
"mode": "cool",
"target_temperature": 26
}
}模式为 off / auto / cool / dry / heat / fan_only,目标温度默认限制
为 17–30°C,步长 0.5°C。power=false 不能与模式或温度同时提交。
当前不做
热水器、烤箱及其他设备品类
场景和
execute_sceneHome Assistant Provider
多用户或公网认证
测试
.\.venv\Scripts\python.exe -m pytest
.\.venv\Scripts\python.exe -m ruff check .测试使用模拟 Provider,不会控制真实设备。实机写入只通过显式调用
set_device_state 发生。
本次 Phase 0 与实机验收结果见 PHASE0.md。项目已发现并登记 一台 V3 空调,通过云端 Token API 候选完成 LAN 认证,并实际验证开关、模式 和温度控制。验收结束后设备已恢复为关机、25°C。
Acknowledgments
wuwentao/midea_ac_lan — LAN 协议参考,MIT
sususweet/midea_auto_cloud — 云端 API 和设备映射,Apache-2.0
hasscc/meiju — 协议研究,Apache-2.0
Do1e/mijia-mcp — MCP 架构参考
Unofficial community project, not affiliated with Midea Group.
Available Tools
6 toolsdiagnose_deviceCRead-onlyIdempotent
Check bindings, encrypted credential presence, route policy, and LAN read.
| Name | Required | Description | Default |
|---|---|---|---|
| device_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true and idempotentHint=true, so the safety profile is clear. The description adds no additional behavioral context (e.g., permissions, response format, side effects) beyond what annotations convey.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence listing four items, which is concise but lacks structure (e.g., bullets or categorization). Every word serves a purpose, but the listing style could be clearer.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the output schema exists, the description omits what the tool returns or how diagnostics are presented. The tool's role relative to siblings is implied but not explained, leaving gaps for an agent to fully understand its usage.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% and the description does not clarify the device_id parameter—no format, constraints, or relationship to the listed checks is explained.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool checks bindings, encrypted credential presence, route policy, and LAN read. It uses a specific verb ('Check') and lists distinct diagnostic areas, distinguishing it from sibling tools like get_device or refresh_device, though not explicitly contrasting them.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use diagnose_device versus alternatives such as get_device or discover_lan_devices. No prerequisites, context, or exclusion criteria are provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
discover_lan_devicesBIdempotent
Scan LAN ACs and reconcile identities; target may be an IP/broadcast address.
| Name | Required | Description | Default |
|---|---|---|---|
| target | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations provide idempotentHint true and destructiveHint false. The description adds 'reconcile identities,' implying state changes, but lacks further context on side effects or prerequisites. Adequate given annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence, no fluff, front-loaded with action. Could be clearer but efficient for a single-parameter tool.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Output schema covers return values, annotations cover safety. Description omits usage scenarios and parameter constraints, but overall adequate for a simple discovery tool with a single optional parameter.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description compensates by noting target may be an IP/broadcast address. However, it omits format, required vs optional, and default behavior, leaving gaps.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states the tool scans LAN ACs and reconciles identities, providing a specific verb and resource. It distinguishes from siblings like list_devices (known devices) by focusing on discovery, though 'LAN ACs' is somewhat cryptic.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use this tool versus alternatives like list_devices or get_device. The context of target being an IP/broadcast address is implied but not elaborated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_deviceARead-onlyIdempotent
Get one AC by its midea-mcp internal UUID, including capabilities.
| Name | Required | Description | Default |
|---|---|---|---|
| device_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false. The description adds that it 'includes capabilities', which is a minor behavioral detail. No contradictions with annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single 10-word sentence that is front-loaded with the verb and resource. Every word is necessary and no fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple retrieval tool with one parameter and an output schema, the description conveys the core purpose and parameter meaning. It could optionally mention that the output is a device object, but the output schema covers that. Slightly more context about when to use this over siblings would improve completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 0% description coverage for device_id. The description explains that the parameter is a 'midea-mcp internal UUID', providing essential context that the schema lacks. This fully compensates for the missing schema descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb 'Get' and resource 'one AC', clearly distinguishing from sibling tools like list_devices (plural) and diagnose_device. It mentions the identifier type (midea-mcp internal UUID) and that capabilities are included.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool vs alternatives (e.g., list_devices for all devices, diagnose_device for diagnostics). The description only states what it does, not when to choose it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_devicesARead-onlyIdempotent
List registered logical air conditioners, bindings, routes, and cached state.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false. The description adds 'cached state,' implying the list may not be real-time, but lacks other behavioral details like pagination or response size.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence, front-loaded with verb and resources, no redundant words, perfectly concise for the tool's simplicity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the low complexity (no params, output schema exists, annotations cover safety), the description sufficiently explains the tool's purpose and output scope. It could mention that the list is complete or lacks filtering, but it's adequate.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With zero parameters, the description adds value by listing what is included (air conditioners, bindings, routes, cached state), which helps the agent understand the output. The baseline is 4 for 0 params.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses the verb 'list' with specific resources ('registered logical air conditioners, bindings, routes, and cached state'), clearly distinguishing it from sibling tools like get_device (single device) or discover_lan_devices (discovery).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus siblings (e.g., get_device for details, refresh_device for updates). The agent must infer from tool names alone without explicit context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
refresh_deviceARead-onlyIdempotent
Read the actual AC state through LAN and update the local cache.
| Name | Required | Description | Default |
|---|---|---|---|
| device_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description adds context beyond annotations: it discloses the side effect of updating local cache and the LAN mechanism, matching the readOnlyHint and idempotentHint.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single concise sentence with no wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given few parameters, presence of annotations and output schema, the description provides sufficient context for the tool's purpose and behavior.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, and the description does not explain the device_id parameter, though its purpose is implicitly clear from context.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool reads the actual AC state via LAN and updates the local cache, specifying verb and resource, and distinguishes from siblings like set_device_state.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies use when fresh data is needed (vs cached), but does not explicitly state when to use vs alternatives or provide exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
set_device_stateAIdempotent
Set AC desired state once; never retry an uncertain LAN write via Cloud.
| Name | Required | Description | Default |
|---|---|---|---|
| changes | Yes | ||
| device_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already indicate idempotentHint=true and destructiveHint=false. The description adds valuable context with 'never retry an uncertain LAN write via Cloud', clarifying the one-shot nature and retry policy beyond what annotations provide. No contradictions with annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, short sentence that conveys the core purpose and a critical behavioral note. No wasted words; front-loaded with the action.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool is simple (2 params, no enums) but has an output schema and nested objects. The description covers the main behavior and retry policy, but lacks details about the 'changes' parameter, prerequisites (e.g., device must exist), and expected outcomes. Basic but missing some context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so the description must explain parameters. It only mentions 'AC desired state' but does not define the 'changes' object or its allowed keys. The 'device_id' is also not explained. This leaves the agent with insufficient information for correct invocation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Set AC desired state') and the resource ('AC desired state'), using a specific verb. It distinguishes itself from sibling tools (all reads or diagnostics) by indicating a state-setting operation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The instruction 'never retry an uncertain LAN write via Cloud' provides a clear behavioral guideline for when to avoid retrying. It implies usage for setting state without retry, but does not explicitly state when to use this tool versus alternatives or when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
6 tool updates
v0.2.0- First observed
diagnose_device - First observed
discover_lan_devices - First observed
get_device - First observed
list_devices - First observed
refresh_device - First observed
set_device_state
TDQS
Each tool has a clearly distinct purpose: retrieving device info, refreshing state, listing devices, setting state, discovering LAN devices, and diagnosing. No overlap or ambiguity.
All tool names follow a consistent verb_noun pattern using lowercase snake_case (get_device, refresh_device, list_devices, set_device_state, discover_lan_devices, diagnose_device).
With 6 tools covering listing, retrieval, state refresh, state setting, discovery, and diagnostics, the set is well-scoped for managing Midea air conditioners without being excessive or insufficient.
The tool set covers core operations: listing, reading, refreshing, setting state, discovering, and diagnosing. Minor gaps like device deletion or cloud-only refresh are absent but not critical for the intended domain.
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 Connectors
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
MCP server wrapping the Tesla Fleet API and TeslaMate API
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.-
- 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-
- FlicenseNot gradedqualityDmaintenanceAn MCP server that enables LLMs to control Mitsubishi Electric AC units through MELCloud, supporting device listing, power on/off, temperature changes, and smart auto comfort mode.-
- FlicenseNot gradedqualityCmaintenanceLocal MCP server for reading temperature/humidity sensors from Tuya/SmartLife devices, exposing tools to list devices, get capabilities, and read sensor data.-
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/caroliny1031/midea-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server