Skip to main content

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"]
}

网关连接

以下方式任选其一:

  1. MCP 配置中的 GATEWAY_IP / GATEWAY_PASSWORD 环境变量
  2. 用户配置目录下的 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
  3. 对话中调用 add_gateway 工具

可参考 gateways.json.example。

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

Metadata

Release files for mxchip-gateway-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mxchip-gateway-mcp 0.1.0
File Size Uploaded Provenance Actions
mxchip_gateway_mcp-0.1.0.tar.gz 9.3 kB Without provenance Details for mxchip_gateway_mcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mxchip-gateway-mcp 0.1.0
File Interpreter ABI Platform Actions
mxchip_gateway_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for mxchip_gateway_mcp-0.1.0-py3-none-any.whl

Total release size: 21.1 kB

Release files / mxchip_gateway_mcp-0.1.0.tar.gz

Download URL mxchip_gateway_mcp-0.1.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f660d4903223756afa5d2863ece774f1f1bb7994ff4a14a08a4ad5447edf1200
BLAKE2b-256 checksum
How to use checksums
2eb6b1e4a8b2a3c2dd14733bb78ebfb86b7c462d877fac03bc521d810aeb0c56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.18

Release files / mxchip_gateway_mcp-0.1.0-py3-none-any.whl

Download URL mxchip_gateway_mcp-0.1.0-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c804c99f4860a260f125b657902fa23bb361dc1c1e59759a51590e68eee3a54
BLAKE2b-256 checksum
How to use checksums
a15846a7e70347ea7c2b5219dd853e83260bdece7d4b22669767d7903ae6a042
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.18

Security for mxchip-gateway-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page