From 17a99c1fc6db6dcd5f59fadb12c584cac3c2a2fc Mon Sep 17 00:00:00 2001 From: Gorka Eguileor Date: Fri, 24 Jul 2026 14:57:52 +0200 Subject: [PATCH] Add /health endpoint This patch adds a trivial `/health` endpoint so OpenShift/k8s deployments can add a probe. --- src/rhos_ls_mcps/extra_endpoints.py | 13 +++++++++++++ src/rhos_ls_mcps/main.py | 3 +++ 2 files changed, 16 insertions(+) create mode 100644 src/rhos_ls_mcps/extra_endpoints.py diff --git a/src/rhos_ls_mcps/extra_endpoints.py b/src/rhos_ls_mcps/extra_endpoints.py new file mode 100644 index 0000000..5c6dea0 --- /dev/null +++ b/src/rhos_ls_mcps/extra_endpoints.py @@ -0,0 +1,13 @@ +from starlette.requests import Request +from starlette.responses import JSONResponse, Response +from starlette.routing import Route + + +async def health(request: Request) -> Response: + return JSONResponse({"status": "ok"}) + + +def get_routes() -> [Route]: + return [ + Route("/health", endpoint=health, methods=["GET"]), + ] diff --git a/src/rhos_ls_mcps/main.py b/src/rhos_ls_mcps/main.py index 602658a..e5fdcc4 100644 --- a/src/rhos_ls_mcps/main.py +++ b/src/rhos_ls_mcps/main.py @@ -15,6 +15,7 @@ import uvicorn from rhos_ls_mcps import auth as auth_module +from rhos_ls_mcps import extra_endpoints from rhos_ls_mcps import oc from rhos_ls_mcps import osc from rhos_ls_mcps import settings @@ -84,6 +85,8 @@ async def lifespan(app: Starlette): if mcp_ocp: routes.append(Mount("/openshift", app=mcp_ocp.streamable_http_app())) + routes.extend(extra_endpoints.get_routes()) + starlette_app = Starlette(routes=routes, lifespan=lifespan) # Wrap ASGI application with CORS middleware to allow browser-based clients to work