You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FastAPI supports Sub-Applications / Mounts, see here.
In this case, you have separate SwaggerUIs. For instance:
importloggingimportuvicornfromfastapiimportFastAPIlogging.basicConfig(format="%(asctime)s %(message)s")
logging.getLogger().setLevel(logging.INFO)
logger=logging.getLogger(__name__)
app=FastAPI()
@app.get("/app")defread_main():
return {"message": "Hello World from main app"}
subapi=FastAPI()
@subapi.get("/sub")defread_sub():
return {"message": "Hello World from sub API"}
app.mount("/subapi", subapi)
if__name__=="__main__":
logger.info("Starting HTTP server ...")
uvicorn.run(app, reload=False, log_config=None)
In this case, you can reach the SwaggerUIs under the following URLs:
Is it possible to use FastAPI-MCP, and expose all endpoints (including those from the sub-apps)? Alternatively, is it possible to just expose the endpoints from any of the sub-apps?