feat: serveur MCP Forgejo (4 tools lecture) + demarrage auto

This commit is contained in:
Bastien Gourdon
2026-07-20 17:27:02 +02:00
commit f18e9ad96f
4 changed files with 599 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
#!/bin/sh
# Watchdog Code Versioning — verifie le MCP Forgejo (8770),
# relance via start_mcp_forgejo.sh s'il ne repond pas sur /health.
# Idempotent : couvre le boot (rien ne tourne) ET le crash.
# Lance par tache planifiee DSM toutes les 5 min.
BASE=/volume1/homes/Master/App/Code_versioning
LOG="$BASE/watchdog.log"
TS=$(date '+%Y-%m-%d %H:%M:%S')
wait_health() {
URL="$1"
TRIES="$2"
i=0
while [ "$i" -lt "$TRIES" ]; do
if curl -s -f -m 5 "$URL" > /dev/null 2>&1; then
return 0
fi
i=$((i + 1))
sleep 3
done
return 1
}
check_and_restart() {
NAME="$1"
URL="$2"
STARTER="$3"
if curl -s -f -m 5 "$URL" > /dev/null 2>&1; then
return 0
fi
echo "$TS [$NAME] KO sur $URL — relance via $STARTER" >> "$LOG"
sh "$BASE/$STARTER"
if wait_health "$URL" 5; then
echo "$TS [$NAME] relance OK" >> "$LOG"
else
echo "$TS [$NAME] ECHEC relance — toujours muet apres ~15s" >> "$LOG"
fi
}
check_and_restart "mcp-forgejo" "http://127.0.0.1:8770/health" "start_mcp_forgejo.sh"