feat: add healthcheck
perso/mcp-maildir/pipeline/head This commit looks good

This commit is contained in:
Julien Cabillot
2026-02-27 13:31:48 -05:00
parent 4e45f3e8d9
commit 25c2f7aea0
+7
View File
@@ -10,6 +10,8 @@ import qdrant_client as qdrant_pkg
from dateutil import parser as date_parser
from email.utils import parseaddr
from dotenv import load_dotenv
from starlette.requests import Request
from starlette.responses import JSONResponse
from fastmcp import FastMCP
from qdrant_client import QdrantClient
from qdrant_client.http import models
@@ -44,6 +46,11 @@ logger.info(f"Starting MCP server with collection: {COLLECTION_NAME}")
# Initialize FastMCP server
mcp = FastMCP("mcp-maildir")
@mcp.custom_route("/health", methods=["GET"])
async def health_check(request: Request):
"""Simple health check endpoint for Kubernetes liveness/readiness probes."""
return JSONResponse({"status": "ok"})
# Lazy singletons
_qdrant_client: Optional[QdrantClient] = None
_embedding_model: Optional[TextEmbedding] = None