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