INNER CODE UNIT · Python
_get_mcp_http_app
CronusL-1141/AI-company · src/aiteam/api/app.py:75
def _get_mcp_http_app():
"""Get or create the FastMCP ASGI app (lazy, module-level cached).
path='/' is required: FastAPI mount('/mcp') strips the '/mcp' prefix before
forwarding to the sub-app, so the sub-app route must be at '/' to match.
Using the default path='/mcp' would require CC to call /mcp/mcp instead.
"""
global _mcp_http_app
if _mcp_http_app is None:
try:
from aiteam.mcp.server import mcp
_mcp_http_app = mcp.http_app(transport="streamable-http", path="/")
except Exception:
pass
return _mcp_http_app
@asynccontextmanager