feat: add /health endpoint bypassing transport security
All checks were successful
Build and Push Proxmox MCP Docker Image / build (push) Successful in 32s

- Migrate from SSE to HTTP transport using fastmcp>=2.0
- Add /health endpoint for Docker health checks and load balancers
- Remove MCP_ALLOWED_HOSTS (no longer needed with http_app approach)
- Add lifespan handler for proper task group initialization
- Install curl in Docker image for health checks
- Update Makefile with test-health and test-mcp targets
- Update documentation to reflect new endpoint structure

Fixes: Health check fails with 421 Misdirected Request when
MCP_ALLOWED_HOSTS doesn't include localhost
This commit is contained in:
Ben
2025-12-20 23:17:55 +00:00
parent 4b576d40ad
commit 18a8c2e59f
6 changed files with 73 additions and 33 deletions

View File

@@ -1,4 +1,4 @@
.PHONY: build dev logs stop test-sse clean
.PHONY: build dev logs stop test-health clean
# Build the Docker image locally
build:
@@ -18,14 +18,15 @@ logs:
stop:
docker compose -f docker-compose.dev.yml down
# Test SSE endpoint (5 second timeout)
test-sse:
@echo "Testing SSE endpoint (5s timeout)..."
@curl -N --max-time 5 http://localhost:8001/sse 2>/dev/null || echo "\n[Timeout - this is expected for SSE]"
# Test health endpoint
test-health:
@echo "Testing health endpoint..."
@curl -s http://localhost:8001/health | jq .
# Test root endpoint
test-root:
@curl -s http://localhost:8001/ | head -20
# Test MCP endpoint (should return 406 for GET)
test-mcp:
@echo "Testing MCP endpoint..."
@curl -s -o /dev/null -w "%{http_code}" http://localhost:8001/mcp
# Full rebuild (no cache)
rebuild: