Fix route count logging in OpenAPI server (#1928)

This commit is contained in:
nate nowack 2025-09-26 10:54:57 -05:00 committed by GitHub
commit df9e5ac2dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -785,6 +785,7 @@ class FastMCPOpenAPI(FastMCP):
http_routes = openapi.parse_openapi_to_http_routes(openapi_spec)
# Process routes
num_excluded = 0
route_maps = (route_maps or []) + DEFAULT_ROUTE_MAPPINGS
for route in http_routes:
# Determine route type based on mappings or default rules
@ -823,8 +824,11 @@ class FastMCPOpenAPI(FastMCP):
self._create_openapi_template(route, component_name, tags=route_tags)
elif route_type == MCPType.EXCLUDE:
logger.info(f"Excluding route: {route.method} {route.path}")
num_excluded += 1
logger.info(f"Created FastMCP OpenAPI server with {len(http_routes)} routes")
logger.info(
f"Created FastMCP OpenAPI server with {len(http_routes) - num_excluded} routes"
)
def _generate_default_name(
self, route: openapi.HTTPRoute, mcp_names_map: dict[str, str] | None = None