π The fast, Pythonic way to build MCP servers and clients.
Fix route count logging in OpenAPI server (#1928)
nate nowackdf9e5ac2dd77
diff --git a/src/fastmcp/server/openapi.py b/src/fastmcp/server/openapi.pyindex e090957fd..3aa752abc 100644--- a/src/fastmcp/server/openapi.py+++ b/src/fastmcp/server/openapi.py@@ -785,6 +785,7 @@ class FastMCPOpenAPI(FastMCP):http_routes = openapi.parse_openapi_to_http_routes(openapi_spec)# Process routes+ num_excluded = 0route_maps = (route_maps or []) + DEFAULT_ROUTE_MAPPINGSfor 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