Skip to content

Commit d46e0c8

Browse files
feat:add simple health endpoint (#42)
Signed-off-by: Akihiko Kuroda <[email protected]>
1 parent 16efb94 commit d46e0c8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/maestro_mcp/server.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
from fastmcp import FastMCP
1212
from fastmcp.tools.tool import ToolResult
13+
from starlette.requests import Request
14+
from starlette.responses import PlainTextResponse
1315
from pydantic import BaseModel, Field
1416

1517
from ..chunking import ChunkingConfig
@@ -390,6 +392,25 @@ def create_mcp_server() -> FastMCP:
390392
# Create FastMCP server directly
391393
app = FastMCP("maestro-vector-db")
392394

395+
@app.custom_route("/health", methods=["GET"])
396+
async def health_check(request: Request) -> PlainTextResponse:
397+
if not vector_databases:
398+
PlainTextResponse("No vector databases are currently active")
399+
400+
db_list = []
401+
for db_name, db in vector_databases.items():
402+
db_list.append(
403+
{
404+
"name": db_name,
405+
"type": db.db_type,
406+
"collection": db.collection_name,
407+
"document_count": db.count_documents(),
408+
}
409+
)
410+
return PlainTextResponse(
411+
f"Available vector databases:\n{json.dumps(db_list, indent=2)}"
412+
)
413+
393414
@app.tool()
394415
async def create_vector_database_tool(input: CreateVectorDatabaseInput) -> str:
395416
"""Create a new vector database instance."""

0 commit comments

Comments
 (0)