Skip to content

Commit 4d8ac55

Browse files
committed
remove redundant base-url logic
1 parent dacee48 commit 4d8ac55

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

fastapi_mcp/server.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,20 +118,6 @@ def setup_server(self) -> None:
118118
# Filter tools based on operation IDs and tags
119119
self.tools = self._filter_tools(all_tools, openapi_schema)
120120

121-
# Determine base URL if not provided
122-
if not self._base_url:
123-
# Try to determine the base URL from FastAPI config
124-
if hasattr(self.fastapi, "root_path") and self.fastapi.root_path:
125-
self._base_url = self.fastapi.root_path
126-
else:
127-
# Default to localhost with FastAPI default port
128-
port = 8000
129-
for route in self.fastapi.routes:
130-
if hasattr(route, "app") and hasattr(route.app, "port"):
131-
port = route.app.port
132-
break
133-
self._base_url = f"http://localhost:{port}"
134-
135121
# Normalize base URL
136122
if self._base_url.endswith("/"):
137123
self._base_url = self._base_url[:-1]

0 commit comments

Comments
 (0)