from fastapi import FastAPI, UploadFile, File, Form from fastapi_mcp import FastApiMCP app = FastAPI(title="test fastapi mcp") @app.get("/") async def root(): """Root endpoint to confirm the API is running.""" return {"message": "Welcome to the FAST API MCP integration!"} @app.get("/greet") async def root(): """Root endpoint to confirm the API is running.""" return {"message": "Good day ! this greet endpoint with mcp server feel free to add more api endpoints and usecases"} # Initialize MCP server mcp = FastApiMCP( app, name="FAST API MCP ", description="FAST API MCP Intergration test in hf", ) mcp.mount() if __name__ == "__main__": import uvicorn uvicorn.run(app, host="0.0.0.0", port=8000) # working below code # from fastapi import FastAPI # app = FastAPI() # @app.get("/") # def read_root(): # return {"Hello": "World"} # @app.get("/greet") # def read_root(): # return {"Hello User! ": "Welcome to new application"}