mirror of
https://github.com/RunLit/Bambu-Run.git
synced 2026-10-21 07:27:38 +01:00
added mcp server setup guide
This commit is contained in:
10
README.md
10
README.md
@@ -304,7 +304,15 @@ Bambu-Run exposes printer status, print history, and filament inventory as
|
|||||||
read-only [MCP](https://modelcontextprotocol.io/) tools, so an AI agent (e.g.
|
read-only [MCP](https://modelcontextprotocol.io/) tools, so an AI agent (e.g.
|
||||||
Claude Desktop, Claude Code) can query your printer directly.
|
Claude Desktop, Claude Code) can query your printer directly.
|
||||||
|
|
||||||
Install the extra:
|
**Native install (`setup.sh`):** if you declined MCP during setup (or ran
|
||||||
|
`setup.sh` before MCP support existed), enable it any time with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./native/bambu-run.sh enable-mcp # install deps, create + start the systemd service
|
||||||
|
./native/bambu-run.sh disable-mcp # stop and remove it
|
||||||
|
```
|
||||||
|
|
||||||
|
**Manual / library install:** install the extra:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install 'bambu-run[mcp]'
|
pip install 'bambu-run[mcp]'
|
||||||
|
|||||||
@@ -37,6 +37,38 @@ case "${1:-help}" in
|
|||||||
fi
|
fi
|
||||||
journalctl --user $JOURNAL_UNITS -f --no-hostname
|
journalctl --user $JOURNAL_UNITS -f --no-hostname
|
||||||
;;
|
;;
|
||||||
|
enable-mcp)
|
||||||
|
if [ -f "$SERVICE_DIR/bambu-run-mcp.service" ]; then
|
||||||
|
echo "MCP server already enabled."
|
||||||
|
else
|
||||||
|
echo "Installing MCP dependencies..."
|
||||||
|
"$VENV_DIR/bin/pip" install --quiet ".[mcp]"
|
||||||
|
|
||||||
|
sed "s|{{REPO_DIR}}|$REPO_DIR|g; s|{{VENV_DIR}}|$VENV_DIR|g" \
|
||||||
|
"$REPO_DIR/native/bambu-run-mcp.service" > "$SERVICE_DIR/bambu-run-mcp.service"
|
||||||
|
|
||||||
|
systemctl --user daemon-reload
|
||||||
|
systemctl --user enable bambu-run-mcp.service
|
||||||
|
systemctl --user start bambu-run-mcp.service
|
||||||
|
|
||||||
|
PI_IP=$(hostname -I 2>/dev/null | awk '{print $1}')
|
||||||
|
echo "MCP server enabled on port 8808."
|
||||||
|
echo
|
||||||
|
echo " Claude Desktop config:"
|
||||||
|
echo " {\"mcpServers\":{\"bambu-run\":{\"url\":\"http://${PI_IP:-localhost}:8808/sse\"}}}"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
disable-mcp)
|
||||||
|
if [ ! -f "$SERVICE_DIR/bambu-run-mcp.service" ]; then
|
||||||
|
echo "MCP server is not enabled."
|
||||||
|
else
|
||||||
|
systemctl --user stop bambu-run-mcp.service 2>/dev/null || true
|
||||||
|
systemctl --user disable bambu-run-mcp.service 2>/dev/null || true
|
||||||
|
rm -f "$SERVICE_DIR/bambu-run-mcp.service"
|
||||||
|
systemctl --user daemon-reload
|
||||||
|
echo "MCP server disabled."
|
||||||
|
fi
|
||||||
|
;;
|
||||||
update)
|
update)
|
||||||
echo "Pulling latest code..."
|
echo "Pulling latest code..."
|
||||||
cd "$REPO_DIR" && git pull
|
cd "$REPO_DIR" && git pull
|
||||||
@@ -60,13 +92,15 @@ case "${1:-help}" in
|
|||||||
echo "Update complete."
|
echo "Update complete."
|
||||||
;;
|
;;
|
||||||
help|*)
|
help|*)
|
||||||
echo "Usage: $0 {start|stop|restart|status|logs|update}"
|
echo "Usage: $0 {start|stop|restart|status|logs|update|enable-mcp|disable-mcp}"
|
||||||
echo
|
echo
|
||||||
echo " start Start web + collector services"
|
echo " start Start web + collector services"
|
||||||
echo " stop Stop web + collector services"
|
echo " stop Stop web + collector services"
|
||||||
echo " restart Restart web + collector services"
|
echo " restart Restart web + collector services"
|
||||||
echo " status Show service status"
|
echo " status Show service status"
|
||||||
echo " logs Tail live logs (Ctrl+C to stop)"
|
echo " logs Tail live logs (Ctrl+C to stop)"
|
||||||
echo " update Pull latest code, install deps, migrate, restart"
|
echo " update Pull latest code, install deps, migrate, restart"
|
||||||
|
echo " enable-mcp Install and start the MCP server for AI agent access"
|
||||||
|
echo " disable-mcp Stop and remove the MCP server service"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user