change to class based

This commit is contained in:
Shahar Abramov
2025-04-08 18:13:39 +03:00
parent 222e104d13
commit 97ffd8e7c4
4 changed files with 139 additions and 163 deletions

View File

@@ -4,11 +4,11 @@ Simple example of using FastAPI-MCP to add an MCP server to a FastAPI app.
from examples.apps import items
from fastapi_mcp import add_mcp_server
from fastapi_mcp import FastApiMCP
# Add MCP server to the FastAPI app
mcp = add_mcp_server(
mcp = FastApiMCP(
items.app,
mount_path="/mcp",
name="Item API MCP",
@@ -18,6 +18,9 @@ mcp = add_mcp_server(
describe_all_responses=True,
)
mcp.mount()
if __name__ == "__main__":
import uvicorn