MCP server for MXCHIP local gateway (WebSocket)
Project description
mxchip-gateway-mcp
庆科本地网关 MCP Server。通过局域网 WebSocket(ws://{ip}:53248/ws)连接网关,提供 MCP Tool 查询与控制子设备、场景。
安装
需要 Python 3.10+ 与 uv(推荐)或 pip。
pip install mxchip-gateway-mcp
# 或
uvx mxchip-gateway-mcp
MCP 配置
在 Cursor(.cursor/mcp.json)或 Claude Code(.mcp.json)中添加:
{
"mcpServers": {
"mxchip-gateway-mcp": {
"command": "uvx",
"args": ["mxchip-gateway-mcp"]
}
}
}
可选通过 env 预置网关连接:
{
"mcpServers": {
"mxchip-gateway-mcp": {
"command": "uvx",
"args": ["mxchip-gateway-mcp"],
"env": {
"GATEWAY_IP": "192.168.1.100",
"GATEWAY_PASSWORD": "mxchip-gateway-admin"
}
}
}
}
锁定版本:
{
"args": ["--from", "mxchip-gateway-mcp==0.1.0", "mxchip-gateway-mcp"]
}
网关连接
以下方式任选其一:
- MCP 配置中的
GATEWAY_IP/GATEWAY_PASSWORD环境变量 - 用户配置目录下的
gateways.json(add_gateway工具会自动写入)- macOS:
~/Library/Application Support/mxchip-gateway-mcp/gateways.json - Linux:
~/.config/mxchip-gateway-mcp/gateways.json - Windows:
%APPDATA%/mxchip-gateway-mcp/gateways.json
- macOS:
- 对话中调用
add_gateway工具
MCP Tools
| Tool | 说明 |
|---|---|
add_gateway |
手动配置网关 IP 并建立连接 |
get_gateway_status |
查看连接状态与重连信息 |
get_home |
获取设备、场景、区域、群组等家庭模型 |
get_attributes |
读取设备属性 |
set_attributes |
设置设备属性(下行控制) |
set_scenes |
触发场景(下行控制) |
Resource gateway://home 提供当前家庭状态快照(含上行 event 更新)。网关断线后后台自动重连。
开发
python3.10 -m venv .venv
.venv/bin/pip install -e ".[dev]"
mxchip-gateway-mcp
# 或
uvx --from . mxchip-gateway-mcp
构建与发布:
pip install build twine
python -m build
twine upload dist/*
调试
npx @modelcontextprotocol/inspector mxchip-gateway-mcp
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mxchip_gateway_mcp-0.1.0.tar.gz.
File metadata
- Download URL: mxchip_gateway_mcp-0.1.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f660d4903223756afa5d2863ece774f1f1bb7994ff4a14a08a4ad5447edf1200
|
|
| MD5 |
0854bbf62f7afe25ee13d8a95545494a
|
|
| BLAKE2b-256 |
2eb6b1e4a8b2a3c2dd14733bb78ebfb86b7c462d877fac03bc521d810aeb0c56
|
File details
Details for the file mxchip_gateway_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mxchip_gateway_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c804c99f4860a260f125b657902fa23bb361dc1c1e59759a51590e68eee3a54
|
|
| MD5 |
8fa524165bb56a90dddb8ba1f1411786
|
|
| BLAKE2b-256 |
a15846a7e70347ea7c2b5219dd853e83260bdece7d4b22669767d7903ae6a042
|