from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import StreamingResponse from fastapi.encoders import jsonable_encoder import uvicorn from . import tools app = FastAPI( title='Clients', summary='Provides various clients.' ) origins = [ "http://localhost.tiangolo.com", "https://localhost.tiangolo.com", "http://localhost", "http://localhost:8080", ] app.add_middleware( CORSMiddleware, allow_origins=origins, allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) def setup_mcp(): try: from fastapi_mcp import FastApiMCP mcp = FastApiMCP(app) mcp.mount() print('MCP mounted') except ImportError: print('MCP could not be mounted') def setup_tools(): for tool in tools.get_tools(): component, method = tool.__name__.split('.') path = f'/{component}/{method}' app.get(path, response_model=None,tags=[component])(tool) if __name__ == "__main__": setup_tools() setup_mcp() uvicorn.run(app, host="0.0.0.0", port=8000)