# Midea Mcp

> A safety-first MCP server for Midea air conditioners. LAN-preferred, cloud fallback.

- **Type:** MCP server
- **Install:** `agentstack add mcp-caroliny1031-midea-mcp`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [caroliny1031](https://agentstack.voostack.com/s/caroliny1031)
- **Installs:** 0
- **Category:** [Integrations](https://agentstack.voostack.com/c/integrations)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [caroliny1031](https://github.com/caroliny1031)
- **Source:** https://github.com/caroliny1031/midea-mcp

## Install

```sh
agentstack add mcp-caroliny1031-midea-mcp
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# midea-mcp

面向美的空调的本地单用户 MCP Server。MVP 使用 Python 3.12、MCP Python
SDK `>=1.27,/.storage/midea_ac_lan/.json
```

可导入单个文件、整个 `midea_ac_lan` 目录，也可导入 HA
`.storage/core.config_entries`：

```powershell
.\.venv\Scripts\midea-mcp.exe import-ha C:\path\to\123456789.json
```

导入器仅接受设备类型 `0xAC`、协议版本 V3，并将 Token/Key 立即加密后保存。

### 3. 可选的 Cloud 库存及 Token/Key 补取

不要把账号密码写入命令行历史：

```powershell
$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. 加密备份

```powershell
.\.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

```powershell
.\.venv\Scripts\midea-mcp-server.exe
```

客户端配置示例：

```json
{
  "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` 只接受：

```json
{
  "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_scene`
- Home Assistant Provider
- 多用户或公网认证

## 测试

```powershell
.\.venv\Scripts\python.exe -m pytest
.\.venv\Scripts\python.exe -m ruff check .
```

测试使用模拟 Provider，不会控制真实设备。实机写入只通过显式调用
`set_device_state` 发生。

本次 Phase 0 与实机验收结果见 [PHASE0.md](PHASE0.md)。项目已发现并登记
一台 V3 空调，通过云端 Token API 候选完成 LAN 认证，并实际验证开关、模式
和温度控制。验收结束后设备已恢复为关机、25°C。

## Acknowledgments

- [wuwentao/midea_ac_lan](https://github.com/wuwentao/midea_ac_lan) — LAN 协议参考，MIT
- [sususweet/midea_auto_cloud](https://github.com/sususweet/midea_auto_cloud) — 云端 API 和设备映射，Apache-2.0
- [hasscc/meiju](https://github.com/hasscc/meiju) — 协议研究，Apache-2.0
- [Do1e/mijia-mcp](https://github.com/Do1e/mijia-mcp) — MCP 架构参考

Unofficial community project, not affiliated with Midea Group.

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [caroliny1031](https://github.com/caroliny1031)
- **Source:** [caroliny1031/midea-mcp](https://github.com/caroliny1031/midea-mcp)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-caroliny1031-midea-mcp
- Seller: https://agentstack.voostack.com/s/caroliny1031
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
