mirror of
https://github.com/tadata-org/fastapi_mcp.git
synced 2025-04-13 23:32:11 +03:00
change to class based
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user