Releases: StanleyChanH/MCP2Xiaozhi
Release list
v0.2.1 — stdio environment inheritance fix
Patch release — fixes a stdio environment-inheritance bug that silently dropped app-specific variables from spawned MCP servers.
Fixed
-
stdio transport now always inherits the full parent environment (
os.environ) for spawned MCP servers.Previously, when a server had no
envblock,env=Nonewas passed to the SDK'sStdioServerParameters. The SDK does not inheritos.environin that case — it substitutes a small whitelist default (DEFAULT_INHERITED_ENV_VARS:PATH,HOME, …), silently dropping every other variable the parent process had set. App-specific vars likeBABY_*, API keys, config paths, etc. never reached the child MCP server.The
if server.envguard is removed;os.environis now always passed, with any server-specificenvoverrides layered on top. If you worked around this with a_INHERIT_PARENT_ENV-style marker in your own project, you can drop it after upgrading.
Upgrade
uv add "mcp2xiaozhi>=0.2.1"
# or
pip install -U mcp2xiaozhiFull Changelog: v0.2.0...v0.2.1
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
v0.1.0 — Initial release
🎉 Initial release of mcp2xiaozhi — a general-purpose bridge connecting any MCP server (stdio / SSE / StreamableHTTP) to a Xiaozhi server over WebSocket.
The Xiaozhi server acts as an MCP client over a WebSocket: it sends JSON-RPC tool calls as text frames and expects JSON-RPC replies. mcp2xiaozhi receives those frames and relays them — at the protocol level — to your MCP server, wherever it runs and whatever transport it speaks.
Highlights
- Three native transports —
stdio,sse,streamablehttp(http), all via the official mcp Python SDK. Nomcp-proxysubprocess. - Protocol-level relay — frames parsed as
JSONRPCMessage, wrapped/unwrapped through the SDK'sSessionMessage. Malformed frames are logged and dropped instead of crashing the bridge. - Resilient reconnection — exponential backoff with jitter; clean closes (
ConnectionClosedOK) distinguished from abnormal ones. - Multi-server — run one bridge or every server in your config; each server gets its own Xiaozhi endpoint with conflict warnings.
- Cross-platform — UTF-8 console handling on Windows, graceful
SIGINT/SIGTERMshutdown. - Developer-friendly —
pyproject.toml, src layout, type hints, CLI, 42 tests (incl. a real fastmcp integration test), ruff/mypy clean, uv-managed.
Install
pip install mcp2xiaozhi
# or
uv add mcp2xiaozhiQuick start
export MCP_ENDPOINT="wss://api.your-xiaozhi-server.example/mcp/<token>"
mcp2xiaozhi run calculatorDocumentation
- 📖 README (English)
- 📖 中文说明
- 🔧 Configuration
- 📋 CHANGELOG
- 🐍 PyPI
Full Changelog: https://github.com/StanleyChanH/MCP2Xiaozhi/commits/v0.1.0