Skip to main content
Glama
handsomejustin

Xiaomi smart home MCP server

MijiaPilot

中文 | English | 日本語 | 한국어 | Español

MCP Server GitHub license Python Version Flask GitHub stars GitHub issues GitHub last commit

米家 小米生态 × MCP x CLI × AI Agent × HomeKit 全桥接智能家居平台。

Changelog

v1.0.3 (2026-05-14)

  • fix: SQLALCHEMY_DATABASE_URI 增加 SQLite 默认值(sqlite:///mijia.db),未设置 DATABASE_URL 时不再崩溃

  • fix: Werkzeug 3.1+ 安全限制,run.py 添加 allow_unsafe_werkzeug=True 保障开发环境启动

升级注意:如果你之前使用 MySQL,不受影响。SQLite 仅在未配置 DATABASE_URL 时作为 fallback。 若从 MySQL 首次切换到 SQLite(或新建 SQLite 数据库),需要执行 flask db upgrade 创建表, 并通过 Web 界面或 /api/auth/register 注册用户,再绑定小米账号后方可使用设备控制功能。

v1.0.2 (2026-05-13)

  • fix: 修复 Jinja2 search 测试不存在导致的 500 错误

v1.0.1

  • feat: 专属设备控制页模板(灯光、取暖器、空调伴侣、传感器、开关、摄像头)

  • feat: 通用设备控制页使用共享组件和更好的 UI

v1.0.0

  • 初始发布

致谢:本项目底层使用了 Do1e/mijia-api(mijiaAPI v3.0+)提供的 Python SDK, 用于与小米云端进行设备通信、属性读写和场景执行。感谢原作者的开源贡献。

Related MCP server: Home Controller

演示

Agent 演示界面

Agent 演示视频

功能特性

  • Web 管理界面 — 设备控制、家庭/场景管理、能耗统计、自动化规则、深色模式、移动端适配

  • RESTful API — JWT 认证,完整的 Swagger 文档(/api/docs/),支持第三方集成

  • CLI 工具mijia-control 命令行,支持登录、设备列表、属性读写、场景执行

  • 实时通信 — SocketIO 推送设备状态变更

  • 设备分组/收藏 — 自定义分组管理设备,快速收藏常用设备

  • 定时自动化规则 — 支持 cron、interval、日出/日落等触发方式

  • 能耗统计仪表板 — 按设备记录和展示能耗数据(日/小时粒度)

  • API Token 管理 — 为第三方应用创建和管理访问令牌

  • MCP Server — 内置 MCP 协议支持,Claude Code / Hermes Agent 等 AI Agent 可直接调用

  • HomeKit 桥接 — 通过 Apple 家庭 App 和 Siri 控制米家设备,支持灯光、插座、传感器、温控器等

  • BLE 蓝牙传感器 — PC 蓝牙直连小米 BLE 温湿度计,本地实时数据采集,支持自动化联动

  • 多用户 & 权限 — 用户注册登录、管理员后台、限流保护

技术栈

层级

技术

Web 框架

Flask 3.0+

ORM & 迁移

SQLAlchemy + Flask-Migrate (Alembic)

数据库

MySQL (pymysql)

认证

Flask-Login (Session) + Flask-JWT-Extended (API)

CSRF 保护

Flask-WTF

限流

Flask-Limiter

实时通信

Flask-SocketIO

API 文档

Flasgger (Swagger UI)

序列化/校验

Marshmallow

米家 SDK

mijiaAPI >= 3.0

MCP 协议

MCP Python SDK >= 1.6

HomeKit

HAP-Python >= 5.0

BLE 扫描

bleak >= 0.22

代码质量

Ruff (lint + format)

测试

pytest

项目结构

├── app/
│   ├── __init__.py          # Flask 应用工厂
│   ├── extensions.py        # 扩展实例(db, jwt, csrf, socketio...)
│   ├── api/                 # REST API 蓝图 (JWT 认证)
│   ├── web/                 # Web UI 蓝图 (Session + CSRF 认证)
│   ├── services/            # 业务逻辑层
│   ├── models/              # SQLAlchemy 数据模型
│   ├── schemas/             # Marshmallow 序列化/校验
│   ├── utils/               # MijiaAPI 适配器、统一响应、装饰器
│   ├── cli/                 # Click CLI 命令
│   ├── homekit/             # HomeKit Bridge(Apple 家庭桥接)
│   └── ble/                 # BLE 蓝牙传感器守护进程(独立进程)
├── mcp_server/              # MCP Server(AI Agent 工具)
├── config/                  # Flask 配置(development/testing/production)
├── migrations/              # Alembic 数据库迁移脚本
├── tests/                   # pytest 测试
├── run.py                   # 开发服务器入口
├── docs/                    # 详细文档(HomeKit、API 等)
└── pyproject.toml           # 项目配置 & 依赖

快速开始

1. 环境准备

  • Python 3.10+

  • MySQL 5.7+

2. 安装

# 克隆本项目
git clone https://github.com/handsomejustin/mijia-control.git
cd mijia-control

# 创建虚拟环境
python -m venv venv
source venv/bin/activate  # Linux/Mac
# venv\Scripts\activate   # Windows

# 安装依赖(mijiaAPI 会作为依赖自动安装)
pip install -e ".[dev]"

3. 配置

复制 .env.example.env 并填写实际配置:

cp .env.example .env
FLASK_APP=app:create_app
FLASK_ENV=development
SECRET_KEY=your-secret-key-here
DATABASE_URL=mysql+pymysql://user:password@127.0.0.1:3306/mijia
JWT_SECRET_KEY=your-jwt-secret-key-here
GO2RTC_URL=http://127.0.0.1:1984

4. 初始化数据库

# 创建 MySQL 数据库
mysql -u root -p -e "CREATE DATABASE mijia CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"

# 执行迁移
flask db upgrade

5. 启动

python run.py

访问 http://127.0.0.1:5000 ,注册账号后即可使用。

API 概览

模块

路径前缀

说明

认证 (Session)

/api/auth/

注册、登录、登出、修改密码

认证 (JWT)

/api/auth-jwt/

JWT 登录、刷新令牌

小米账号绑定

/api/xiaomi/

二维码绑定、状态查询、解绑

设备管理

/api/devices/

设备列表、属性读写、动作执行、摄像头流

家庭管理

/api/homes/

家庭列表、详情

场景执行

/api/scenes/

场景列表、执行

设备分组

/api/groups/

分组 CRUD、收藏管理

自动化规则

/api/automations/

定时规则 CRUD、启用/禁用

能耗统计

/api/energy/

能耗记录、日/小时/最新查询

BLE 传感器

/api/ble/

BLE 设备注册、数据上报、历史查询

API Token

/api/tokens/

令牌管理(第三方集成)

完整 API 文档:启动后访问 /api/docs/

MCP Server(AI Agent 集成)

内置 MCP Server,支持 Claude Code、Hermes Agent、OpenClaw 等任何兼容 MCP 协议的 AI Agent 直接控制米家设备。

安装

pip install -e ".[mcp]"

配置

首先确保 Web 服务已启动(python run.py),然后获取 Token:

# 方式一:CLI 登录(推荐,自动保存 Token)
mijia-control login

# 方式二:API 登录获取
curl -X POST http://127.0.0.1:5000/api/auth/jwt/login \
  -H "Content-Type: application/json" \
  -d '{"username": "你的用户名", "password": "你的密码"}'
# 返回的 access_token 即为 MIJIA_TOKEN

设置环境变量:

# Linux / macOS
export MIJIA_API_URL=http://127.0.0.1:5000/api
export MIJIA_TOKEN=eyJhbGci...   # 上一步获取的 access_token

# Windows (PowerShell)
$env:MIJIA_API_URL = "http://127.0.0.1:5000/api"
$env:MIJIA_TOKEN = "eyJhbGci..."

# Windows (CMD)
set MIJIA_API_URL=http://127.0.0.1:5000/api
set MIJIA_TOKEN=eyJhbGci...

Claude Code 中使用

# 注册 MCP 服务器
claude mcp add mijia -- python -m mcp_server

# 之后在对话中直接使用
# "帮我把客厅的灯关掉"
# "查看所有设备的在线状态"
# "执行回家场景"

可用工具

工具

功能

list_devices

列出所有设备

get_device

查看设备详情与规格

get_property

读取设备属性

set_property

设置设备属性(控制设备)

run_action

执行设备动作

list_scenes

列出场景

run_scene

执行场景

list_homes

列出家庭

get_home

查看家庭详情

list_ble_devices

列出 BLE 传感器设备

get_ble_sensor

获取 BLE 传感器最新数据

get_ble_readings

查询 BLE 传感器历史读数

HomeKit Bridge(Apple 家庭 & Siri 控制)

通过 HAP-Python 实现 HomeKit 桥接,让 iPhone、Mac 用户在 Apple 家庭 App 和 Siri 中直接控制米家设备。

架构

Apple 家庭 / Siri  →  HomeKit Bridge (HAP-Python)  →  Flask REST API  →  米家设备
                    独立进程,端口 51826                  python run.py

安装

pip install -e ".[homekit]"

Windows 用户:需要安装 Bonjour Print Services 或使用 Docker 运行 Bridge。

配置

.env 中添加(或直接设置环境变量):

HOMEKIT_ENABLED=true
HOMEKIT_PORT=51826
HOMEKIT_PIN=123-45-678

确保 Web 服务已启动并获取 JWT Token(与 MCP Server 相同的 MIJIA_TOKEN)。

启动

# 先启动 Web 服务
python run.py

# 再启动 HomeKit Bridge(另一个终端)
python -m app.homekit

配对

  1. 确保手机和电脑在同一局域网

  2. iPhone → 家庭 App → 添加设备 → 扫描终端显示的 QR 码,或手动输入 PIN

  3. 配对成功后,设备会以「米家智能家居」桥接器的形式出现

iPhone 家庭 App 效果

支持的设备类型

HomeKit 类型

米家设备

控制能力

Lightbulb

灯泡、灯带

开关、亮度、色温

Outlet

插座、智能开关

开关

Switch

扫地机、净化器等

开关

TemperatureSensor

温湿度传感器

温度、湿度读取

Thermostat

空调伴侣、除湿机

开关、目标温度

HeaterCooler

取暖器

开关、目标温度

设备映射自定义

当你的设备型号不在内置规则中时,Bridge 会自动从设备的 spec_data 推断类型。如果推断不准确,可以创建 homekit_mapping.yaml 自定义映射:

cp homekit_mapping.yaml.example homekit_mapping.yaml
# homekit_mapping.yaml
devices:
  zhimi.airp.mb4a: switch           # 精确 model 匹配
  lumi.sensor_magnet.aq2: ignored   # 忽略不需要的设备

fallback: auto    # auto=智能推断 | switch=全部当开关 | ignore=忽略未知

可用类别:lightoutletswitchtemperature_sensorthermostatheatercameraignored

BLE 蓝牙传感器(本地蓝牙数据采集)

通过 PC 蓝牙直连小米 BLE 温湿度计等传感器,无需额外蓝牙网关硬件。支持数据展示、历史查询和自动化联动。

架构

BLE 温度计  ─BLE 广播→  BLE Scanner (独立进程)  ─HTTP POST→  Flask API  →  DB
                         python -m app.ble                        python run.py

安装

pip install -e ".[ble]"

需要 PC 具备蓝牙功能(Windows 10/11 内置支持,无需额外驱动)。

配置

.env 中添加:

BLE_ENABLED=true

确保已设置 MIJIA_TOKEN(与 MCP Server / HomeKit Bridge 相同)。

使用步骤

# 1. 扫描附近 BLE 设备,发现 MAC 地址
mijia-control ble scan

# 2. 注册 BLE 设备(自动从云端获取解密密钥)
mijia-control ble register --did "blt.3.xxxxx" --mac "A4:C1:38:XX:XX:XX"

# 3. 启动 BLE 守护进程(需要先启动 Web 服务)
python run.py           # 终端 1
python -m app.ble       # 终端 2

# 4. 查看数据
mijia-control ble list
mijia-control ble readings "blt.3.xxxxx" --hours 24

支持的设备

设备

型号

数据

米家温湿度传感器迷你

LYWSD03MMC

温度、湿度、电量

米家温湿度传感器(圆形)

LYWSDCGQ

温度、湿度、电量

米家温湿度传感器(新品)

MJWSD05MMC

温度、湿度、电量

自动化联动

BLE 传感器数据可触发自动化规则,例如温度 > 30°C 自动开空调:

curl -X POST http://127.0.0.1:5000/api/automations \
  -H "Authorization: Bearer $MIJIA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "温度过高开空调",
    "trigger_type": "ble_sensor",
    "trigger_config": {
      "did": "blt.3.xxxxx",
      "metric": "temperature",
      "operator": ">",
      "threshold": 30.0,
      "cooldown_seconds": 300
    },
    "action_type": "set_property",
    "action_config": {"did": "空调did", "prop_name": "power", "value": "on"}
  }'

📖 详细文档docs/ble.md — 包含架构说明、安装配置、调试指南、故障排除、扩展新设备等完整内容。

CLI 使用

安装并激活虚拟环境后,可直接使用 mijia-control 命令(无需 Flask 上下文):

mijia-control --help                           # 查看帮助

也可通过 Flask CLI 调用:flask mijia <command>

跨平台说明: pip install -e ".[dev]" 会自动创建平台对应的可执行入口:

平台

入口路径

说明

Windows

venv\Scripts\mijia-control.exe

激活 venv 后直接可用

Linux / macOS

venv/bin/mijia-control

激活 venv 后直接可用

可选:全局使用(不激活 venv)

# Linux / macOS — 创建软链接
sudo ln -s /path/to/mijia-control/venv/bin/mijia-control /usr/local/bin/mijia-control

# Windows — 将以下路径添加到系统 PATH 环境变量
# D:\path\to\mijia-control\venv\Scripts

用户管理

mijia-control login                            # 登录(交互式输入用户名密码)
mijia-control logout                           # 退出登录
mijia-control whoami                           # 查看当前用户
mijia-control xiaomi status                    # 查看小米账号绑定状态
mijia-control xiaomi unlink                    # 解绑小米账号

设备控制

mijia-control device list                      # 列出设备
mijia-control device list --home-id <id>       # 按家庭筛选
mijia-control device list --refresh            # 强制刷新设备列表
mijia-control device show <did>                # 查看设备详情
mijia-control device get <did> <prop_name>     # 读取设备属性
mijia-control device set <did> <prop_name> <value>  # 设置设备属性
mijia-control device action <did> <action_name>     # 执行设备动作

场景 & 家庭

mijia-control scene list                       # 列出场景
mijia-control scene list --refresh             # 强制刷新
mijia-control scene run <scene_id>             # 执行场景
mijia-control home list                        # 列出家庭
mijia-control home show <home_id>              # 查看家庭详情

BLE 蓝牙传感器

mijia-control ble scan                          # 扫描附近 BLE 设备
mijia-control ble register --did <did> --mac <mac>  # 注册 BLE 设备
mijia-control ble list                          # 列出 BLE 设备及最新读数
mijia-control ble readings <did> --hours 24     # 查询历史读数

开发

# Lint
ruff check .

# 自动修复
ruff check --fix .

# 格式化
ruff format .

# 运行测试
pytest -v

许可证

本项目基于 GPL-3.0 许可证开源,继承自上游 mijiaAPI 的许可协议。

Available Tools

12 tools
get_ble_readingsA

查询蓝牙传感器的历史温湿度读数,用于趋势分析。

Args:
    did: BLE 设备ID
    hours: 查询最近多少小时的数据,默认 24
    limit: 最大返回条数,默认 100
ParametersJSON Schema
NameRequiredDescriptionDefault
didYes
hoursNo
limitNo

TDQS

A3.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. It states the query is for historical readings (implying read-only) but does not disclose pagination behavior, data retention limits, permission requirements, or error scenarios. More transparency is needed for a query tool with no annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise: one sentence for purpose followed by a succinct parameter list. No unnecessary words. Front-loads the core function, making it easy to scan.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and no annotations, the description explains purpose and parameters adequately but lacks details on return format (e.g., timestamp format, measurement units), rate limits, or error handling. It is functional but not fully complete for an agent to use without assumptions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, but the description compensates by explaining each parameter: 'did' as BLE device ID, 'hours' as query recency (default 24), 'limit' as max results (default 100). This adds meaning beyond the schema's titles and types, though further details like units could improve clarity.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool queries historical temperature and humidity readings from a Bluetooth sensor for trend analysis. It specifies the resource (BLE sensor readings) and action (query history), distinguishing it from siblings like get_ble_sensor (likely current data) and list_ble_devices (listing devices).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for trend analysis but does not explicitly state when to use or alternatives. It lacks guidance on when not to use or comparisons to sibling tools like get_ble_sensor. The purpose is clear, but usage context is only implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_ble_sensorB

获取蓝牙传感器的最新温湿度数据和设备详情。

Args:
    did: BLE 设备ID,如 blt.3.xxxxx
ParametersJSON Schema
NameRequiredDescriptionDefault
didYes

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, and the description does not disclose behavior beyond being a read operation. It does not mention side effects, authorization needs, or limitations, relying solely on the minimal 'get the latest data' phrasing.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is short and includes an Args section, making it structured and easy to parse. It is concise with no redundant information, though it could benefit from a bit more detail without losing brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simple nature of the tool (1 required parameter, no output schema), the description covers the basics. However, it lacks details on return format, error conditions, or what '设备详情' includes, leaving some ambiguity for the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has one required parameter with 0% schema description coverage. The description adds an example format ('blt.3.xxxxx') for the 'did' parameter, which adds meaning beyond the schema. However, no further details like validation rules or acceptable values are given.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves the latest temperature, humidity, and device details for a BLE sensor. This distinguishes it from siblings like get_ble_readings (likely more general) and get_device (general device).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

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 alternatives is provided. The description only states what it does without mentioning exclusions or alternative tools, leaving the agent without context for selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_deviceA

获取设备详情,包含设备规格、可用属性列表和动作列表。

Args:
    did: 设备ID
ParametersJSON Schema
NameRequiredDescriptionDefault
didYes

TDQS

A3.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. Description implies read-only ('获取详情') but does not explicitly state safety, permissions, or side effects. Lacks disclosure of behavioral traits beyond the action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise lines plus an Args section. Every sentence is meaningful with no redundancy. Front-loaded with purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given single parameter, no output schema, and no annotations, the description adequately covers what the tool does and what it returns. It is complete for a simple getter tool, though could mention if it requires authentication.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has one parameter 'did' with 0% description coverage. Description adds 'Args: did: 设备ID', clarifying that 'did' is the device ID, which adds meaning beyond the schema's type requirement.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states '获取设备详情,包含设备规格、可用属性列表和动作列表' (Get device details, including specifications, available property list, and action list). This uses a specific verb and resource, distinguishing it from siblings like 'list_devices' which lists all devices.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

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 vs alternatives. However, the purpose is straightforward, and the context of siblings makes it implied that this is for a specific device's details. Missing when-not or exclusion conditions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_homeB

获取家庭详情,包含该家庭下的所有设备列表。

Args:
    home_id: 家庭ID
ParametersJSON Schema
NameRequiredDescriptionDefault
home_idYes

TDQS

B3.1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, and the description does not disclose behavioral aspects such as read-only nature, authentication requirements, or whether the operation is destructive. The description carries the full burden but only states functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise: a single sentence with a clear 'Args' section. No wasted words or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has only one parameter and no output schema, the description covers the basic purpose but lacks details on return structure, error cases, or usage context relative to siblings. Minimally complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description adds minimal value by labeling 'home_id' as '家庭ID' (home ID), but this is nearly redundant with the parameter name and does not specify format, constraints, or source of the ID.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it retrieves home details including the list of devices, effectively distinguishing it from siblings like 'list_homes' and 'get_device'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

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 alternatives (e.g., 'list_homes' for all homes, 'get_device' for a specific device). No exclusions or context provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_propertyB

读取设备属性值,例如灯光亮度、空调温度、开关状态等。

Args:
    did: 设备ID
    prop_name: 属性名称,如 power、brightness、temperature
ParametersJSON Schema
NameRequiredDescriptionDefault
didYes
prop_nameYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden to disclose behavioral traits. It only describes the basic read operation and does not mention any side effects, authentication needs, rate limits, or potential errors. This is insufficient for a tool with zero annotation support.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with a single sentence followed by an Args list. It is front-loaded with the purpose. However, it is written only in Chinese, which may limit accessibility for non-Chinese-speaking agents, but within its context it is efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of output schema and annotations, the description covers the basic operation but omits details on return format, error handling, or any special behaviors. For a simple read tool, it is partially complete but could be more informative.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, and the description adds meaningful context for both parameters: 'did' is identified as device ID, and 'prop_name' is given with examples (power, brightness, temperature). This provides essential meaning beyond the schema's basic type definitions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool reads device property values, with concrete examples like light brightness, air conditioner temperature, and switch status. It effectively identifies the verb and resource, though it does not explicitly differentiate from sibling tools like 'get_device'. However, the sibling 'set_property' provides contrast.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives, nor any exclusions or prerequisites. The description simply states what it does, leaving the agent to infer usage context from the sibling list.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_ble_devicesA

列出所有已注册的蓝牙传感器设备,返回设备信息和最新温湿度读数。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states it lists devices and returns readings, which implies a read operation, but it does not explicitly disclose whether it is safe, requires authentication, or has rate limits. The description lacks behavioral context beyond the obvious.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single efficient sentence that is front-loaded and to the point. Every word is necessary, no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no parameters and no output schema, the description is fairly complete for a list tool. It mentions the type of returned data. However, it could be improved by noting whether the list is paginated or if there are any filtering capabilities.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are zero parameters, so baseline is 4 per instructions. The description adds value by explaining the return content (device info and latest temperature/humidity readings), which goes beyond the empty schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it lists all registered BLE sensor devices and returns device info with latest temp/humidity readings. It distinguishes from siblings like list_devices which likely lists all device types, and get_ble_readings which may return historical readings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies this tool is for getting an overview of BLE sensors, but no explicit when-to-use or when-not-to-use guidance is given. Siblings include get_ble_readings and get_ble_sensor, but the description does not differentiate use cases or provide exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_devicesA

列出所有米家智能设备。返回设备ID、名称、型号、在线状态等信息。

Args:
    home_id: 按家庭ID过滤,不传则返回全部设备
    refresh: 是否强制刷新设备列表缓存
ParametersJSON Schema
NameRequiredDescriptionDefault
home_idNo
refreshNo

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description discloses caching behavior (refresh parameter) and that it returns read-only device information. It is adequate for a list operation, though no explicit read-only declaration.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise: one sentence for purpose, then parameter details. Front-loaded and efficient, no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and lack of annotations, the description covers purpose, parameters, and return values sufficiently. Could mention potential limitations (e.g., pagination, rate limits) but not required for a simple list tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, but the description fully explains both parameters: home_id filters by home, refresh forces cache refresh. This adds significant meaning beyond the bare schema, compensating for the lack of schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states it lists all Xiaomi smart devices and returns key attributes (ID, name, model, online status). It clearly distinguishes from siblings like get_device (single device) and list_ble_devices (BLE-specific devices).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for listing all devices with optional filtering, but does not explicitly state when to use this over alternatives or provide exclusions. Context from sibling tools suggests differentiation, but not stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_homesB

列出所有家庭及其设备概览。

Args:
    refresh: 是否强制刷新缓存
ParametersJSON Schema
NameRequiredDescriptionDefault
refreshNo

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds some transparency about the refresh parameter controlling cache forcing, but no annotations exist. It does not mention read-only nature or any other behavioral traits beyond caching.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise: a single purpose sentence and an Args line. No unnecessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

While it covers the tool's purpose and the single parameter, it lacks details about the return format or any prerequisites. With no output schema, some description of the output would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description compensates by explaining the refresh parameter's meaning ('whether to force refresh cache'), adding value beyond the schema's title alone.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it lists all homes and their device overview (specific verb+resource). However, it does not explicitly differentiate from sibling tools like get_home, though the name implies it.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives (e.g., get_home for a single home, or list_devices for devices). The description only states what it does.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_scenesA

列出所有米家场景。

Args:
    home_id: 按家庭ID过滤
    refresh: 是否强制刷新缓存
ParametersJSON Schema
NameRequiredDescriptionDefault
home_idNo
refreshNo

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses caching behavior via the 'refresh' parameter, but does not state if the operation is read-only, requires authentication, or has rate limits. The read-only nature is implied by 'list', but not explicit.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very concise: one line for purpose and bullet points for arguments. No unnecessary information, each sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description lacks details about the return format. With no output schema, the agent does not know what fields are returned (e.g., scene ID, name, state). This is a gap given the context of sibling tools like run_scene that likely need scene IDs.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must add meaning. It provides Chinese explanations for both parameters: '按家庭ID过滤' (filter by home ID) and '是否强制刷新缓存' (whether to force refresh cache), which adds value beyond the schema's type and default.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states '列出所有米家场景' (List all Mi Home scenes), which is a specific verb and resource. It distinguishes from sibling tools like run_scene, which executes a scene.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention prerequisites, typical workflows, or conditions that would favor this tool over others like list_devices or get_device.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

run_actionC

执行设备动作,例如扫地机开始清扫、播放音乐等。

Args:
    did: 设备ID
    action_name: 动作名称,如 start-sweep、stop-sweeping
    value: 动作参数,可选
ParametersJSON Schema
NameRequiredDescriptionDefault
didYes
action_nameYes
valueNo

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided. Description only implies mutation (execute actions) but does not disclose side effects, permissions needed, error handling, or return behavior. For a mutation tool, more behavioral context is necessary.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise and well-structured: one-line purpose followed by parameter list. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists. Description lacks information about return values, success/failure indications, or idempotency. Incomplete for a command execution tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description compensates partially. did and action_name are well-described with examples. value is only described as 'optional parameters' with no structure, leaving ambiguity.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states verb 'execute' and resource 'device actions', with examples like start-sweep and playing music. Differentiates from read-oriented siblings like get_property. However, could be more specific about the exact scope of actions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

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 run_scene. No mention of prerequisites 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.

run_sceneC

执行一个米家场景,触发该场景中预设的所有设备操作。

Args:
    scene_id: 场景ID
ParametersJSON Schema
NameRequiredDescriptionDefault
scene_idYes

TDQS

C2.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry the full burden. It only mentions that the scene triggers 'all device operations preset' but does not disclose side effects, destructive potential, or failure behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very short and to the point, but lacks structure or additional information that would improve usability. It is concise but under-specified.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the low complexity (single parameter, no output schema), the description could be considered minimally adequate, but it omits important details such as return values, error handling, or effects on the system.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description adds minimal extra meaning ('场景ID' for scene_id) beyond the schema's type definition. It does not explain how to obtain the scene ID or any constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('execute a Mijia scene') and identifies the resource ('scene'), distinguishing it from sibling tools like 'list_scenes' and 'run_action'. However, it is only in Chinese and lacks additional context for non-Chinese users.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

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, no prerequisites or conditions provided. The description only specifies the parameter without usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

set_propertyA

设置设备属性值,用于控制设备。例如开灯、调亮度、设温度等。

Args:
    did: 设备ID
    prop_name: 属性名称,如 power、brightness、temperature
    value: 属性值,类型取决于属性定义。常见值:power 为 "on"/"off",brightness 为 0-100,temperature 为数字
ParametersJSON Schema
NameRequiredDescriptionDefault
didYes
prop_nameYes
valueYes

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, and the description does not disclose important behavioral traits such as side effects, authentication requirements, rate limits, or error handling for invalid property names or values. As a mutation tool, critical behaviors are omitted.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise, with a clear purpose statement followed by a structured Args section. Every sentence adds value, though the Args format could be slightly more compact. Overall, it is efficient and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of output schema and annotations, the description does not explain return values (e.g., success/failure) or prerequisites (e.g., device online, auth). For a mutation tool with three parameters and no structured guidance, the description is insufficiently complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema provides only types (string) with no descriptions (0% coverage). The description compensates effectively by explaining each parameter: did as device ID, prop_name with examples like 'power', 'brightness', 'temperature', and value with common types and example values ('on'/'off', 0-100).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it sets device property values to control devices, with concrete examples like '开灯、调亮度、设温度' (turn on light, adjust brightness, set temperature). It distinguishes from sibling tools such as get_property (read) and list_devices (list).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides examples of when to use the tool (controlling devices by setting properties) but does not explicitly state when not to use it or mention alternatives for similar tasks like run_action or run_scene. The usage context is implied but not clearly delineated.

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.

  1. 3 tool updatesv1.2.0
    • Addedget_ble_readings
    • Addedget_ble_sensor
    • Addedlist_ble_devices
  2. 9 tool updatesv0.1.0
    • First observedget_device
    • First observedget_home
    • First observedget_property
    • First observedlist_devices
    • First observedlist_homes
    • First observedlist_scenes
    • First observedrun_action
    • First observedrun_scene
    • First observedset_property

TDQS

A3.7/5.0
Disambiguation5/5

Each tool targets a distinct operation: getting device/home details, reading properties, listing devices/homes/scenes, running actions/scenes, and setting properties. No overlap in functionality.

Naming Consistency5/5

All tools follow a consistent verb_noun pattern (e.g., get_device, list_devices, set_property) in English, making the naming predictable and clear.

Tool Count5/5

With 9 tools, the server covers essential smart home control operations without being overwhelming. Each tool serves a clear purpose, and the count is well-scoped for the domain.

Completeness5/5

The tool set provides complete coverage for controlling Xiaomi smart home devices: reading state, setting properties, running actions and scenes. No obvious gaps for typical home automation tasks.

Maintenance

ActivityInactive
ResponsivenessUnresponsive

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

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    A Model Context Protocol (MCP) integration that allows AI assistants to control Home Assistant devices by searching for entities and controlling devices through natural language commands.
    3
    24
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A unified smart home automation system that enables control and monitoring of Miele appliances, LG ThinQ devices, HUUM saunas, and Phyn water monitors through Claude using the Model Context Protocol.
    88
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    An 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.
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    MCP server for controlling Xiaomi/Mi Home smart devices via natural language, supporting device listing, property read/write, action calls, and camera snapshots.
    11
    -

Latest Blog Posts

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/handsomejustin/mijia-control'

If you have feedback or need assistance with the MCP directory API, please join our Discord server