Skip to content

Question: Is it possible to use this package together with Sub-Applications/Mounts #172

@ChrisEthon

Description

@ChrisEthon

First: Thanks for this amazing package!

FastAPI supports Sub-Applications / Mounts, see here.

In this case, you have separate SwaggerUIs. For instance:

import logging

import uvicorn
from fastapi import FastAPI

logging.basicConfig(format="%(asctime)s %(message)s")
logging.getLogger().setLevel(logging.INFO)
logger = logging.getLogger(__name__)

app = FastAPI()


@app.get("/app")
def read_main():
    return {"message": "Hello World from main app"}


subapi = FastAPI()


@subapi.get("/sub")
def read_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?

Thank you :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions