Spaces:
Running
Running
Merge pull request #583 from jlowin/docs
Browse files- docs/servers/openapi.mdx +2 -8
docs/servers/openapi.mdx
CHANGED
|
@@ -51,13 +51,7 @@ FastMCP analyzes your API specification and automatically creates MCP components
|
|
| 51 |
| `GET` without path params | `GET /stats` | **Resource** |
|
| 52 |
| `POST`, `PUT`, `PATCH`, `DELETE`, etc. | `POST /users` | **Tool** |
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
### Custom Route Maps
|
| 57 |
-
|
| 58 |
-
<VersionBadge version="2.5.0" />
|
| 59 |
-
|
| 60 |
-
FastMCP uses an ordered list of `RouteMap` objects to determine how to map OpenAPI routes to various MCP component types.
|
| 61 |
|
| 62 |
Each `RouteMap` specifies a combination of methods, patterns, and tags, as well as a corresponding MCP component type. Each OpenAPI route is checked against each `RouteMap` in order, and the first one that matches every criteria is used to determine its converted MCP type. A special type, `EXCLUDE`, can be used to exclude routes from the MCP server entirely.
|
| 63 |
|
|
@@ -66,7 +60,7 @@ Each `RouteMap` specifies a combination of methods, patterns, and tags, as well
|
|
| 66 |
- **Tags**: A set of OpenAPI tags that must all be present. An empty set (`{}`) means no tag filtering, so the route matches regardless of its tags.
|
| 67 |
- **MCP type**: What MCP component type to create (`TOOL`, `RESOURCE`, `RESOURCE_TEMPLATE`, or `EXCLUDE`)
|
| 68 |
|
| 69 |
-
To illustrate this in practice, here are FastMCP's default
|
| 70 |
|
| 71 |
```python
|
| 72 |
from fastmcp.server.openapi import RouteMap, MCPType
|
|
|
|
| 51 |
| `GET` without path params | `GET /stats` | **Resource** |
|
| 52 |
| `POST`, `PUT`, `PATCH`, `DELETE`, etc. | `POST /users` | **Tool** |
|
| 53 |
|
| 54 |
+
Interally, FastMCP uses an ordered list of `RouteMap` objects to determine how to map OpenAPI routes to various MCP component types.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
Each `RouteMap` specifies a combination of methods, patterns, and tags, as well as a corresponding MCP component type. Each OpenAPI route is checked against each `RouteMap` in order, and the first one that matches every criteria is used to determine its converted MCP type. A special type, `EXCLUDE`, can be used to exclude routes from the MCP server entirely.
|
| 57 |
|
|
|
|
| 60 |
- **Tags**: A set of OpenAPI tags that must all be present. An empty set (`{}`) means no tag filtering, so the route matches regardless of its tags.
|
| 61 |
- **MCP type**: What MCP component type to create (`TOOL`, `RESOURCE`, `RESOURCE_TEMPLATE`, or `EXCLUDE`)
|
| 62 |
|
| 63 |
+
To illustrate this in practice, here are FastMCP's default rules as a list of `RouteMap` objects:
|
| 64 |
|
| 65 |
```python
|
| 66 |
from fastmcp.server.openapi import RouteMap, MCPType
|