docs: Update CLAUDE.md with new features and improvements

- Update tool count: 19 → 20
- Add HAPROXY_CONTAINER environment variable
- Add haproxy_add_servers (bulk operations) to tool list
- Document IPv6 support in haproxy_add_domain
- Add include_wildcards parameter note for haproxy_list_domains
- Update haproxy_reload: now auto-restores servers
- Add Bulk Server Operations section with example
- Update server.py description (~1500 lines, 20 tools)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
kaffa
2026-02-01 13:45:02 +00:00
parent eebb1ca8df
commit 7985501d48

View File

@@ -72,6 +72,7 @@ journalctl -u haproxy-mcp -f # Logs
| `HAPROXY_SERVERS_FILE` | `/opt/haproxy/conf/servers.json` | Servers config path | | `HAPROXY_SERVERS_FILE` | `/opt/haproxy/conf/servers.json` | Servers config path |
| `HAPROXY_POOL_COUNT` | `100` | Number of pool backends | | `HAPROXY_POOL_COUNT` | `100` | Number of pool backends |
| `HAPROXY_MAX_SLOTS` | `10` | Max servers per pool | | `HAPROXY_MAX_SLOTS` | `10` | Max servers per pool |
| `HAPROXY_CONTAINER` | `haproxy` | Podman container name |
| `LOG_LEVEL` | `INFO` | Logging level (DEBUG/INFO/WARNING/ERROR) | | `LOG_LEVEL` | `INFO` | Logging level (DEBUG/INFO/WARNING/ERROR) |
## Zero-Reload Domain Management ## Zero-Reload Domain Management
@@ -105,6 +106,17 @@ This will:
- Backends always use HTTP (port 80 or custom) - Backends always use HTTP (port 80 or custom)
- SSL/TLS termination happens at HAProxy frontend - SSL/TLS termination happens at HAProxy frontend
- Each pool has 10 server slots (pool_N_1 to pool_N_10) - Each pool has 10 server slots (pool_N_1 to pool_N_10)
- **IPv6 supported**: Both IPv4 and IPv6 addresses accepted
### Bulk Server Operations
```bash
# Add multiple servers at once
haproxy_add_servers("api.example.com", '[
{"slot": 1, "ip": "10.0.0.1", "http_port": 80},
{"slot": 2, "ip": "10.0.0.2", "http_port": 80},
{"slot": 3, "ip": "2001:db8::1", "http_port": 80}
]')
```
### Files ### Files
| File | Purpose | | File | Purpose |
@@ -228,13 +240,13 @@ Returns backend server status for a specific domain:
**Status values:** `healthy` (all UP), `degraded` (partial UP), `down` (all DOWN), `no_servers` **Status values:** `healthy` (all UP), `degraded` (partial UP), `down` (all DOWN), `no_servers`
## MCP Tools (19 total) ## MCP Tools (20 total)
### Domain Management ### Domain Management
| Tool | Description | | Tool | Description |
|------|-------------| |------|-------------|
| `haproxy_list_domains` | List all domains with pool mappings and servers | | `haproxy_list_domains` | List domains (use `include_wildcards=true` for wildcards) |
| `haproxy_add_domain` | Add domain to available pool (no reload) | | `haproxy_add_domain` | Add domain to available pool (no reload), supports IPv6 |
| `haproxy_remove_domain` | Remove domain from pool (no reload) | | `haproxy_remove_domain` | Remove domain from pool (no reload) |
### Server Management ### Server Management
@@ -242,6 +254,7 @@ Returns backend server status for a specific domain:
|------|-------------| |------|-------------|
| `haproxy_list_servers` | List servers for a domain | | `haproxy_list_servers` | List servers for a domain |
| `haproxy_add_server` | Add server to slot (1-10), auto-saved | | `haproxy_add_server` | Add server to slot (1-10), auto-saved |
| `haproxy_add_servers` | Bulk add servers (JSON array), auto-saved |
| `haproxy_remove_server` | Remove server from slot, auto-saved | | `haproxy_remove_server` | Remove server from slot, auto-saved |
| `haproxy_set_server_state` | Set state: ready/drain/maint | | `haproxy_set_server_state` | Set state: ready/drain/maint |
| `haproxy_set_server_weight` | Set weight (0-256) | | `haproxy_set_server_weight` | Set weight (0-256) |
@@ -264,7 +277,7 @@ Returns backend server status for a specific domain:
### Configuration ### Configuration
| Tool | Description | | Tool | Description |
|------|-------------| |------|-------------|
| `haproxy_reload` | Validate and reload config | | `haproxy_reload` | Validate, reload config, auto-restore servers |
| `haproxy_check_config` | Validate config syntax | | `haproxy_check_config` | Validate config syntax |
| `haproxy_save_state` | Save server state to disk (legacy) | | `haproxy_save_state` | Save server state to disk (legacy) |
| `haproxy_restore_state` | Restore state from disk (legacy) | | `haproxy_restore_state` | Restore state from disk (legacy) |
@@ -322,7 +335,7 @@ echo "set server pool_1/pool_1_1 state ready" | nc localhost 9999
``` ```
/opt/haproxy/ /opt/haproxy/
├── mcp/ # MCP server (streamable-http) ├── mcp/ # MCP server (streamable-http)
│ └── server.py # Main MCP server (~1300 lines, 19 tools) │ └── server.py # Main MCP server (~1500 lines, 20 tools)
├── conf/ ├── conf/
│ ├── haproxy.cfg # Main HAProxy config (100 pool backends) │ ├── haproxy.cfg # Main HAProxy config (100 pool backends)
│ ├── domains.map # Domain → Pool mapping │ ├── domains.map # Domain → Pool mapping