mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-09 15:19:10 +02:00
91 lines
3.1 KiB
Text
91 lines
3.1 KiB
Text
---
|
|
title: openapi
|
|
sidebarTitle: openapi
|
|
---
|
|
|
|
# `fastmcp.server.openapi`
|
|
|
|
|
|
FastMCP server implementation for OpenAPI integration.
|
|
|
|
## Classes
|
|
|
|
### `MCPType` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L78" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
|
|
Type of FastMCP component to create from a route.
|
|
|
|
|
|
### `RouteType` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L97" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
|
|
Deprecated: Use MCPType instead.
|
|
|
|
This enum is kept for backward compatibility and will be removed in a future version.
|
|
|
|
|
|
### `RouteMap` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L111" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
|
|
Mapping configuration for HTTP routes to FastMCP component types.
|
|
|
|
|
|
### `OpenAPITool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L229" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
|
|
Tool implementation for OpenAPI endpoints.
|
|
|
|
|
|
**Methods:**
|
|
|
|
#### `run` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L262" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
run(self, arguments: dict[str, Any]) -> ToolResult
|
|
```
|
|
|
|
Execute the HTTP request based on the route configuration.
|
|
|
|
|
|
### `OpenAPIResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L523" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
|
|
Resource implementation for OpenAPI endpoints.
|
|
|
|
|
|
**Methods:**
|
|
|
|
#### `read` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L552" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
read(self) -> str | bytes
|
|
```
|
|
|
|
Fetch the resource data by making an HTTP request.
|
|
|
|
|
|
### `OpenAPIResourceTemplate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L642" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
|
|
Resource template implementation for OpenAPI endpoints.
|
|
|
|
|
|
**Methods:**
|
|
|
|
#### `create_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L671" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
create_resource(self, uri: str, params: dict[str, Any], context: Context | None = None) -> Resource
|
|
```
|
|
|
|
Create a resource with the given parameters.
|
|
|
|
|
|
### `FastMCPOpenAPI` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L696" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
|
|
FastMCP server implementation that creates components from an OpenAPI schema.
|
|
|
|
This class parses an OpenAPI specification and creates appropriate FastMCP components
|
|
(Tools, Resources, ResourceTemplates) based on route mappings.
|
|
|