src/web/mcp/bridges/stdio-python/README.md
This Python bridge converts MCP stdio communication to Netdata's MCP over WebSocket.
The easiest way to set up the Python bridge is to use the included build script, which creates a virtual environment (recommended for most Linux distributions where pip is restricted to virtual environments):
# Make the build script executable (if needed)
chmod +x build.sh
# Run the build script
./build.sh
The script will:
venv directory if it doesn't existAfter running the build script:
# Activate the virtual environment
source venv/bin/activate
# Run the bridge
python nd-mcp.py ws://localhost:19999/mcp
# When finished, deactivate the virtual environment
deactivate
Or run it directly with the virtual environment's Python:
./venv/bin/python nd-mcp.py ws://localhost:19999/mcp
If your system allows global pip installations:
pip install websockets
The script can be run directly as an executable (the shebang line will use the system's Python):
./nd-mcp.py ws://<ip>:19999/mcp
Or explicitly with Python:
python nd-mcp.py ws://<ip>:19999/mcp
When using a virtual environment, run it with the environment's Python:
./venv/bin/python nd-mcp.py ws://<ip>:19999/mcp
Where <ip> is either localhost or the IP address where a Netdata instance is listening.
To use this bridge with Claude Desktop:
python /path/to/stdio-python/nd-mcp.py ws://localhost:19999/mcp
localhost with the appropriate IP address.The bridge:
This bridge implements robust connection handling:
The reconnection algorithm starts with a 1-second delay and doubles the wait time with each attempt, up to a maximum of 60 seconds. Random jitter is added to prevent connection storms.