Initial commit: HAProxy MCP Server
- Zero-reload domain management with map-based routing - 100 pool backends with 10 server slots each - Runtime API integration for dynamic configuration - Auto-restore servers from persistent config on startup - 17 MCP tools for domain/server management Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
26
scripts/restore-state.sh
Executable file
26
scripts/restore-state.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
# Wait for HAProxy and MCP to be ready
|
||||
sleep 5
|
||||
|
||||
# Initialize MCP session
|
||||
INIT_RESPONSE=$(curl -s -i -X POST "http://localhost:8000/mcp" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Accept: application/json, text/event-stream" \
|
||||
-d '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"cli","version":"1.0"}},"id":0}' 2>/dev/null)
|
||||
|
||||
SESSION_ID=$(echo "$INIT_RESPONSE" | grep -i "mcp-session-id" | cut -d' ' -f2 | tr -d '\r')
|
||||
|
||||
if [ -z "$SESSION_ID" ]; then
|
||||
echo "Failed to get MCP session"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Restore state
|
||||
curl -s -X POST "http://localhost:8000/mcp" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Accept: application/json, text/event-stream" \
|
||||
-H "Mcp-Session-Id: $SESSION_ID" \
|
||||
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"haproxy_restore_state","arguments":{}},"id":1}'
|
||||
|
||||
echo ""
|
||||
echo "State restored at $(date)"
|
||||
Reference in New Issue
Block a user