oas2mcp.generate.fastmcp_app ============================ .. py:module:: oas2mcp.generate.fastmcp_app .. autoapi-nested-parse:: FastMCP bootstrap helpers from exported ``oas2mcp`` artifacts. Functions --------- .. autoapisummary:: oas2mcp.generate.fastmcp_app.build_default_headers_from_env oas2mcp.generate.fastmcp_app.build_export_aware_component_fn oas2mcp.generate.fastmcp_app.build_export_aware_route_map_fn oas2mcp.generate.fastmcp_app.build_fastmcp_from_exported_artifacts oas2mcp.generate.fastmcp_app.build_fastmcp_from_loaded_artifacts oas2mcp.generate.fastmcp_app.build_fastmcp_name_overrides oas2mcp.generate.fastmcp_app.build_semantic_route_maps oas2mcp.generate.fastmcp_app.fetch_openapi_spec oas2mcp.generate.fastmcp_app.infer_base_url_from_spec oas2mcp.generate.fastmcp_app.load_json_file oas2mcp.generate.fastmcp_app.register_exported_prompts oas2mcp.generate.fastmcp_app.register_exported_resources Module Contents --------------- .. py:function:: build_default_headers_from_env() -> dict[str, str] Build optional upstream headers from environment variables. .. py:function:: build_export_aware_component_fn(fastmcp_config: Mapping[str, Any]) -> Callable[[Any, Any], Any] Build a component mutator that applies exported metadata to FastMCP. .. py:function:: build_export_aware_route_map_fn(fastmcp_config: Mapping[str, Any]) -> Callable[[Any, fastmcp.server.providers.openapi.MCPType], fastmcp.server.providers.openapi.MCPType | None] Build a route-mapping override that respects exported operation kinds. .. py:function:: build_fastmcp_from_exported_artifacts(*, source: str | pathlib.Path | None = None, source_url: str | pathlib.Path | None = None, fastmcp_config_path: str | pathlib.Path, server_name: str | None = None, headers: dict[str, str] | None = None, timeout: float = 30.0, client: httpx.AsyncClient | None = None) -> fastmcp.FastMCP Build a FastMCP server from exported oas2mcp artifacts. .. py:function:: build_fastmcp_from_loaded_artifacts(*, openapi_spec: Mapping[str, Any], fastmcp_config: Mapping[str, Any], server_name: str | None = None, headers: dict[str, str] | None = None, timeout: float = 30.0, client: httpx.AsyncClient | None = None) -> fastmcp.FastMCP Build a FastMCP server from already loaded OpenAPI and config data. .. py:function:: build_fastmcp_name_overrides(fastmcp_config: Mapping[str, Any]) -> dict[str, str] Return operationId -> FastMCP component name overrides. .. py:function:: build_semantic_route_maps() -> list[fastmcp.server.providers.openapi.RouteMap] Restore semantic OpenAPI mapping for FastMCP. GET with path params -> RESOURCE_TEMPLATE other GET -> RESOURCE everything else falls through to default TOOL mapping. .. py:function:: fetch_openapi_spec(source: str | pathlib.Path, *, timeout: float = 30.0) -> dict[str, Any] Load an OpenAPI specification from any supported source. .. py:function:: infer_base_url_from_spec(openapi_spec: dict[str, Any]) -> str Infer the base URL from the first OpenAPI server entry. .. py:function:: load_json_file(path: str | pathlib.Path) -> dict[str, Any] Load a JSON file from disk. .. py:function:: register_exported_prompts(mcp: fastmcp.FastMCP, fastmcp_config_path: str | pathlib.Path | Mapping[str, Any]) -> None Register exported prompt templates on a FastMCP server. .. py:function:: register_exported_resources(mcp: fastmcp.FastMCP, fastmcp_config_path: str | pathlib.Path | Mapping[str, Any]) -> None Register exported catalog resources on a FastMCP server.