v0.2.0 โ Tool filtering, observability, security hardening
๐ v0.2.0 โ tool filtering, observability, and security hardening.
Highlights
- ๐ง Tool filtering โ optional per-server
toolsallow/deny lists. Disallowed tools are stripped from outboundtools/listresponses, and inboundtools/callrequests for them are answered with a JSON-RPC error (-32000) and never reach the MCP server. - ๐ Observability โ optional
/healthand/metrics(Prometheus-format) HTTP server via--metrics-port. Counters for messages, reconnects, malformed frames, blocked tool calls, plus aconnectedgauge. Binds to loopback (127.0.0.1) by default. - ๐ Token redaction โ the Xiaozhi JWT in the WebSocket endpoint is scrubbed from logs at every level, including third-party (e.g.
websockets) DEBUG output. - ๐ก๏ธ Hardened โ 11 issues found by an adversarial multi-dimension review were fixed: secure-by-default metrics bind, graceful metrics-port failures, correct non-zero exit on startup failure, HTTP method/reason-phrase compliance, accurate metrics semantics, clean teardown.
Install
pip install -U mcp2xiaozhi
# or
uv tool upgrade mcp2xiaozhiQuick example: expose only some tools + monitor
# mcp_config.json: { "mcpServers": { "calc": { "type": "stdio", "command": "python", "args": ["calc.py"], "tools": {"allow": ["add","sqrt"]} } } }
export MCP_ENDPOINT='wss://api.xiaozhi.me/mcp/?token=...'
mcp2xiaozhi run calc --metrics-port 9100
curl localhost:9100/health # {"status":"ok","servers":[...]}
curl localhost:9100/metrics # Prometheus formatLinks
- ๐ Changelog
- ๐ง Tool filtering
- ๐ CLI metrics flags
- ๐ PyPI
Full Changelog: v0.1.0...v0.2.0