Dreame D20 Pro Plus MCP Server
Enables control and monitoring of a Dreame robot vacuum via MCP tools, including cleaning, status, and map viewing through the cloud API.
README
Dreame D20 Pro Plus MCP Server
<p align="center"> <a href="https://github.com/casey/just"><img src="https://img.shields.io/badge/just-ready_to_go-7c5cfc?style=flat-square&logo=just&logoColor=white" alt="Just"></a> <a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff"></a> <a href="https://python.org"><img src="https://img.shields.io/badge/Python-3.13+-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python"></a> <a href="https://biomejs.dev"><img src="https://img.shields.io/badge/Linted_with-Biome-60a5fa?style=flat-square&logo=biome&logoColor=white" alt="Biome"></a> <a href="https://github.com/PrefectHQ/fastmcp"><img src="https://img.shields.io/badge/FastMCP-3.2-7c5cfc?style=flat-square" alt="FastMCP"></a> </p>
📖 Installation Guide — quick start, manual setup, and troubleshooting
FastMCP 3.2.0 MCP server and webapp for the Dreame D20 Pro Plus robot vacuum. Uses the DreameHome cloud API; local miio is optional (hybrid mode: see below). Protocol layer extracted from Tasshack/dreame-vacuum.
Features
- MCP tools:
dreame(operation=...)status, map, start_clean, stop, pause, go_home, find_robot, battery - MCP tools:
dreame_help(category),dreame_agentic_workflow(goal)with SEP-1577 sampling - Prompts:
dreame_quick_start,dreame_diagnostics - Skills:
skills/dreame-operator.md - REST API: GET /api/v1/health, /api/v1/status, /api/v1/map; POST /api/v1/control/{cmd}
- Webapp: Dashboard, LIDAR Map, Status, Controls, Settings, Help, MCP Tools
Ports
- Backend: 10894 (REST + MCP SSE)
- Dashboard: 10895 (Vite dev server)
Prerequisites
-
Clone this repo and enter it:
git clone https://github.com/sandraschi/dreame-mcp.git Set-Location dreame-mcp -
Clone the Tasshack dreame-vacuum reference repo (protocol + map layer). Default ref path is
D:/Dev/repos/tasshack_dreame_vacuum_ref:Set-Location D:\Dev\repos git clone https://github.com/Tasshack/dreame-vacuum tasshack_dreame_vacuum_ref Set-Location dreame-mcp(Adjust paths if your dev folder is not
D:\Dev\repos; setDREAME_REF_PATHaccordingly.) -
Install Python deps from the dreame-mcp repository root:
uv sync
Environment variables
| Variable | Required | Description |
|---|---|---|
DREAME_USER |
DreameHome email or phone | |
DREAME_PASSWORD |
DreameHome password | |
DREAME_COUNTRY |
Cloud region, default eu |
|
DREAME_DID |
Device ID, auto-discovered if single device | |
DREAME_AUTH_KEY |
Refresh token from previous login (speeds up startup) | |
DREAME_REF_PATH |
Path to tasshack ref clone (default: D:/Dev/repos/tasshack_dreame_vacuum_ref) |
|
DREAME_MCP_PORT |
Backend port (default: 10894) |
|
DREAME_IP / DREAME_TOKEN |
Local miio (null token if token empty); hybrid with cloud for maps |
Development and tests
- Python (repo root):
uv run ruff check src tests,uv run pytest(CI setsPYTHONPATH=src; on Windows:$env:PYTHONPATH = 'src'; uv run pytest tests). - MCP tool
dreame(operation=...)returns Markdown for LLM context. For structured dicts (same shapes as the REST handlers), importfetch_status_data,fetch_map_data, andexecute_control_datafromdreame_mcp.portmanteau(seetests/test_map.py). - Live tests (real robot + cloud):
DREAME_LIVE=1 uv run pytest tests --liveor--liveflag. - Webapp (
webapp/):npm cithennpm run biome:ciandnpm run build.
Connection Modes
This server supports three operational modes depending on your .env configuration:
| Mode | Credentials | Commands | Lidar Map | Notes |
|---|---|---|---|---|
| Local | DREAME_IP |
⚡ Local | ❌ No | Uses the Null Token trick (000...000) |
| Cloud | USER + PWD |
☁️ Cloud | ✅ Yes | Subject to cloud latency and API rate limits |
| Hybrid | Both | ⚡ Local | ✅ Yes | Recommended: Fast control + Full visual map |
The "Null Token" Trick (Bypass)
For users avoiding the DreameHome cloud for controls, you do not need to extract a secret 32-character token. By providing only the DREAME_IP, the backend automatically uses a Null Token (32 zeros). This works on many bridged or circumvention-ready firmwares (like those used with the Tasshack protocol).
Quick Start
git clone https://github.com/sandraschi/dreame-mcp
cd dreame-mcp
just
This opens an interactive dashboard showing all available commands. Run just bootstrap to install dependencies, then just serve or just dev to start.
Manual Setup
If you don't have just installed:
Setup
-
Configure credentials: Copy
.env.exampleto.envand fill in your details.# Typical Hybrid Setup (.env) DREAME_IP=192.168.0.178 DREAME_USER=your@email.com DREAME_PASSWORD=yourpassword -
Start the system:
# Start backend + webapp together .\webapp\start.ps1
MCP client config
{
"mcpServers": {
"dreame": {
"url": "http://localhost:10894/sse",
"transport": "sse"
}
}
}
Map (LIDAR / floor plan)
Map data does not require miIO on this server: it uses DreameHome cloud + the Tasshack ref at DREAME_REF_PATH. Local miIO is optional and often unavailable on DreameHome-only firmware.
- REST:
GET http://localhost:10894/api/v1/map(same JSON as MCPdreame(operation='map')). - Fields:
image(base64-encoded image when decode/render works),raw_b64(always on successful cloud fetch; use for custom decoders or robotics-mcp / yahboom-mcp), optionalmap_data, optionalrender_errorif the PNG path failed. - Dashboard: Map page at
http://localhost:10895shows the image whenimageis present.
Download path (cloud): matches Home Assistant’s Tasshack integration — resolve OBJECT_NAME (property 6.3) when available, then get_interim_file_url / get_file (signed object storage). get_device_file is only a fallback; it often returns 80001 if the cloud cannot reach the device at that moment.
Render path: raw bytes are decoded with DreameVacuumMapDecoder.decode_map and drawn with DreameVacuumMapRenderer.render_map (not DreameMapVacuumMapManager methods, which only orchestrate HA state). The ref clone’s custom_components.… packages are given proper __path__ at load time so map.py imports cleanly.
See docs/MAP_AND_ROBOTICS.md for fleet integration, the JSON contract, and operations.
Map rendering (dependencies)
The rendered image requires the Tasshack stack: py-mini-racer, numpy, Pillow, cryptography, and related pins from uv.lock. If dreame(operation='map') has render_error but raw_b64 is set, the fetch worked and only decode/render failed; check logs and dependencies.
Troubleshooting: Unable to discover the device / status 502
GET /api/v1/health includes local_miot: true only after a successful UDP miio handshake to DREAME_IP (port 54321). If you see Unable to discover the device 192.168.x.x in logs or local_miot: false, the robot did not answer the standard miio discovery on the LAN. Typical causes: DreameHome-only firmware (no or limited LAN miio), wrong IP, null token not accepted (add a real DREAME_TOKEN), or cloud login failed (fix DREAME_USER / DREAME_PASSWORD / DREAME_COUNTRY, captcha, 2FA) so you get DREAME_DID and maps. Set DREAME_DID manually in .env when you know it from the app or cloud.
Docs
- Map and fleet robotics HTTP/MCP consumption, miIO vs cloud, yahboom / robotics integration
- PRD product context, ports, 5 Map API contract
- Token and Home Assistant historical miIO reference (v0.2+ uses cloud)
🛡️ Industrial Quality Stack
This project adheres to SOTA 14.1 industrial standards for high-fidelity agentic orchestration:
- Python (Core): Ruff for linting and formatting. Zero-tolerance for
printstatements in core handlers (T201). - Webapp (UI): Biome for sub-millisecond linting. Strict
noConsoleLogenforcement. - Protocol Compliance: Hardened
stdout/stderrisolation to ensure crash-resistant JSON-RPC communication. - Automation: Justfile recipes for all fleet operations (
just lint,just fix,just dev). - Security: Automated audits via
banditandsafety.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。