from __future__ import annotations import os import sys from pathlib import Path from typing import Any from fastapi import FastAPI CURRENT_DIR = Path(__file__).resolve().parent PLUGIN_DIR = CURRENT_DIR / "deepTools" / "mcp_output" / "mcp_plugin" if str(PLUGIN_DIR) not in sys.path: sys.path.insert(0, str(PLUGIN_DIR)) app = FastAPI(title="deepTools MCP Info App", version="1.0.0") @app.get("/") def root() -> dict[str, Any]: return { "service": "deepTools MCP Deployment", "mcp_transport_default": "stdio", "mcp_http_path": "/mcp", "note": "This FastAPI app is supplementary and not the MCP runtime entry point.", } @app.get("/health") def health() -> dict[str, str]: return {"status": "healthy"} @app.get("/tools") def tools() -> dict[str, Any]: from mcp_service import create_app mcp = create_app() tool_items = [] for tool in getattr(mcp, "tools", []): tool_items.append( { "name": getattr(tool, "name", getattr(tool, "__name__", "unknown")), "description": getattr(tool, "description", ""), } ) return {"count": len(tool_items), "tools": tool_items} PORT = int(os.getenv("PORT", "7860")) if __name__ == "__main__": import uvicorn uvicorn.run(app, host="0.0.0.0", port=PORT)