mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-19 03:54:18 +02:00
Co-authored-by: marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>
94 lines
3.2 KiB
Text
94 lines
3.2 KiB
Text
---
|
|
title: provider
|
|
sidebarTitle: provider
|
|
---
|
|
|
|
# `fastmcp.server.providers.openapi.provider`
|
|
|
|
|
|
OpenAPIProvider for creating MCP components from OpenAPI specifications.
|
|
|
|
## Classes
|
|
|
|
### `OpenAPIProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/providers/openapi/provider.py#L47" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
|
|
Provider that creates MCP components from an OpenAPI specification.
|
|
|
|
Components are created eagerly during initialization by parsing the OpenAPI
|
|
spec. Each component makes HTTP calls to the described API endpoints.
|
|
|
|
|
|
**Methods:**
|
|
|
|
#### `list_tools` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/providers/openapi/provider.py#L351" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
list_tools(self) -> Sequence[Tool]
|
|
```
|
|
|
|
Return all tools created from the OpenAPI spec.
|
|
|
|
|
|
#### `get_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/providers/openapi/provider.py#L355" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
get_tool(self, name: str) -> Tool | None
|
|
```
|
|
|
|
Get a tool by name.
|
|
|
|
|
|
#### `list_resources` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/providers/openapi/provider.py#L359" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
list_resources(self) -> Sequence[Resource]
|
|
```
|
|
|
|
Return all resources created from the OpenAPI spec.
|
|
|
|
|
|
#### `get_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/providers/openapi/provider.py#L363" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
get_resource(self, uri: str) -> Resource | None
|
|
```
|
|
|
|
Get a resource by URI.
|
|
|
|
|
|
#### `list_resource_templates` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/providers/openapi/provider.py#L367" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
list_resource_templates(self) -> Sequence[ResourceTemplate]
|
|
```
|
|
|
|
Return all resource templates created from the OpenAPI spec.
|
|
|
|
|
|
#### `get_resource_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/providers/openapi/provider.py#L371" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
get_resource_template(self, uri: str) -> ResourceTemplate | None
|
|
```
|
|
|
|
Get a resource template that matches the given URI.
|
|
|
|
|
|
#### `list_prompts` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/providers/openapi/provider.py#L378" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
list_prompts(self) -> Sequence[Prompt]
|
|
```
|
|
|
|
Return empty list - OpenAPI doesn't create prompts.
|
|
|
|
|
|
#### `get_tasks` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/providers/openapi/provider.py#L382" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
get_tasks(self) -> Sequence[FastMCPComponent]
|
|
```
|
|
|
|
Return empty list - OpenAPI components don't support tasks.
|
|
|