loading…
Search for a command to run...
loading…
An MCP server based on the Mastra framework for controlling Xiaomi Mi Home smart devices. It enables device discovery, property management, action execution, an
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.
Welcome to your new Mastra project! We're excited to see what you'll build.
本项目在 Mastra Studio(默认端口 4111)之外,额外启动了一个 miloco_server 风格的兼容 HTTP/WS 服务(默认端口 8787),用于对齐 xiaomi-miloco/miloco_server 的接口形态(/api/* + NormalResponse{code,message,data})并复用本仓库的 src/miot_kit。
pnpm run dev
Mastra Studio:
http://localhost:4111
Miloco 兼容 API:
http://localhost:8787/api
MILOCO_HTTP_ENABLEDtruefalse 则不启动兼容服务MILOCO_HTTP_PORT8787MILOCO_DATA_PATH./.miloco-dataJWT_EXPIRES_MINUTES1440POST /auth/registerGET /auth/register-statusPOST /auth/loginGET /auth/logoutGET /auth/languagePOST /auth/language说明:
access_token(JWT)。logout 会更新全局 invalidation 时间戳,使所有旧 token 失效(对齐 miloco_server 行为)。GET /miot/xiaomi_home_callback?code&state(HTML)GET /miot/login_statusGET /miot/user_infoGET /miot/device_listGET /miot/camera_listGET /miot/refresh_miot_all_infoGET /miot/refresh_miot_camerasGET /miot/refresh_miot_scenesGET /miot/refresh_miot_user_infoGET /miot/refresh_miot_devicesGET /miot/miot_scene_actionsGET /miot/send_notify?notify=...WS /miot/ws/video_stream?camera_id=...&channel=...说明:
/device_list、/camera_list 已对接 MIoTClient.getDevices() 并做了字段适配。/refresh_* 会将数据缓存到 MILOCO_DATA_PATH 下的 json 文件。video_stream WS 已接入 miot_kit/camera.ts 的帧回调,当前直接推送二进制帧数据。POST /mcpGET /mcpPUT /mcp/:config_idDELETE /mcp/:config_idPOST /mcp/reconnect/:config_idGET /mcp/clients/statusPOST /ha/set_configGET /ha/get_configGET /ha/automationsGET /ha/automation_actionsGET /ha/refresh_ha_automationsPOST /trigger/ruleGET /trigger/rules?enabled_only=PUT /trigger/rule/:rule_idDELETE /trigger/rule/:rule_idGET /trigger/logs?limit=POST /trigger/execute_actionsWS /trigger/ws/dynamic_execute_log?log_id=...POST /modelGET /modelPUT /model/:model_idDELETE /model/:model_idPOST /model/get_vendor_modelsGET /model/model_purposesGET /model/set_current_model?purpose=...&model_id=...POST /model/loadGET /model/get_cuda_infoWS /chat/ws/query?request_id=...&session_id=...GET /chat/history/:session_idGET /chat/historysDELETE /chat/history/:session_idGET /chat/history/search?keyword=...NormalResponse 返回结构MIoTCameraManager 推送帧数据以下内容当前为“接口存在但内部尚未完全对齐 miloco_server 的真实业务逻辑/数据来源”,后续会逐步补齐:
video_stream 需要 ip/token/key 等信息。mcp_client_manager/tool_executor)。Start the development server:
pnpm run dev
Open http://localhost:4111 in your browser to access Mastra Studio. It provides an interactive UI for building and testing your agents, along with a REST API that exposes your Mastra application as a local service. This lets you start building without worrying about integration right away.
You can start editing files inside the src/mastra directory. The development server will automatically reload whenever you make changes.
To learn more about Mastra, visit our documentation. Your bootstrapped project includes example code for agents, tools, workflows, scorers, and observability.
If you're new to AI agents, check out our course and YouTube videos. You can also join our Discord community to get help and share your projects.
Mastra Cloud gives you a serverless agent environment with atomic deployments. Access your agents from anywhere and monitor performance. Make sure they don't go off the rails with evals and tracing.
Check out the deployment guide for more details.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"mihome-mcp": {
"command": "npx",
"args": []
}
}
}