feat: add /health endpoint and switch to fastmcp 2.0
All checks were successful
Build and Push Komodo MCP Docker Image / build (push) Successful in 18s

- Switch from mcp package to fastmcp>=2.0 for Streamable HTTP support
  - Fixes 405 Method Not Allowed for MCP clients like Gemini CLI
  - MCP endpoint now at /mcp (POST) instead of /sse (GET)
  - Removes MCP_ALLOWED_HOSTS (handled at reverse proxy level)

- Add /health endpoint for Docker health checks
  - Returns {"status": "ok"} (200) or {"status": "degraded"} (503)
  - Enables health checks without transport security issues

- Add curl to Docker image for health checks
- Add healthcheck config to docker-compose files
- Add test-health and test-mcp Makefile targets
- Update documentation
This commit is contained in:
Ben
2025-12-20 22:30:56 +00:00
parent 0ecf6880a1
commit 98dc6b7f50
9 changed files with 80 additions and 28 deletions

View File

@@ -1,4 +1,4 @@
.PHONY: build dev logs stop test-sse clean rebuild
.PHONY: build dev logs stop test-mcp test-health clean rebuild
# Build the Docker image locally
build:
@@ -18,15 +18,22 @@ 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 MCP endpoint (POST to /mcp)
test-mcp:
@echo "Testing MCP endpoint..."
@curl -s -X POST http://localhost:8001/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "initialize", "params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0"}}, "id": 1}' | head -200
# Test root endpoint
test-root:
@curl -s http://localhost:8001/ | head -20
# Test health endpoint (bypasses MCP_ALLOWED_HOSTS)
test-health:
@echo "Testing health endpoint..."
@curl -s http://localhost:8001/health
# Full rebuild (no cache)
rebuild:
docker compose -f docker-compose.dev.yml build --no-cache