File size: 1,343 Bytes
a0477b5 7917211 a0477b5 7917211 a0477b5 7917211 a0477b5 7917211 a0477b5 7917211 a0477b5 7917211 a0477b5 7917211 a0477b5 7917211 a0477b5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 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)
|