File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ def __init__(
46
46
47
47
self .operation_map : Dict [str , Dict [str , Any ]]
48
48
self .tools : List [types .Tool ]
49
+ self .server : Server
49
50
50
51
self .fastapi = fastapi
51
52
self .name = name or self .fastapi .title or "FastAPI MCP"
@@ -57,9 +58,9 @@ def __init__(
57
58
58
59
self ._http_client = http_client or httpx .AsyncClient ()
59
60
60
- self .server = self . create_server ()
61
+ self .setup_server ()
61
62
62
- def create_server (self ) -> Server :
63
+ def setup_server (self ) -> None :
63
64
# Get OpenAPI schema from FastAPI app
64
65
openapi_schema = get_openapi (
65
66
title = self .fastapi .title ,
@@ -115,7 +116,7 @@ async def handle_call_tool(
115
116
operation_map = self .operation_map ,
116
117
)
117
118
118
- return mcp_server
119
+ self . server = mcp_server
119
120
120
121
def mount (self , router : Optional [FastAPI | APIRouter ] = None , mount_path : str = "/mcp" ) -> None :
121
122
"""
You can’t perform that action at this time.
0 commit comments