You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/my-website/docs/mcp.md
+195Lines changed: 195 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -246,6 +246,201 @@ litellm_settings:
246
246
</TabItem>
247
247
</Tabs>
248
248
249
+
## Converting OpenAPI Specs to MCP Servers
250
+
251
+
LiteLLM can automatically convert OpenAPI specifications into MCP servers, allowing you to expose any REST API as MCP tools. This is useful when you have existing APIs with OpenAPI/Swagger documentation and want to make them available as MCP tools.
252
+
253
+
### Benefits
254
+
255
+
- **Rapid Integration**: Convert existing APIs to MCP tools without writing custom MCP server code
256
+
- **Automatic Tool Generation**: LiteLLM automatically generates MCP tools from your OpenAPI spec
257
+
- **Unified Interface**: Use the same MCP interface for both native MCP servers and OpenAPI-based APIs
258
+
- **Easy Testing**: Test and iterate on API integrations quickly
259
+
260
+
### Configuration
261
+
262
+
Add your OpenAPI-based MCP server to your `config.yaml`:
263
+
264
+
```yaml title="config.yaml - OpenAPI to MCP" showLineNumbers
265
+
model_list:
266
+
- model_name: gpt-4o
267
+
litellm_params:
268
+
model: openai/gpt-4o
269
+
api_key: sk-xxxxxxx
270
+
271
+
mcp_servers:
272
+
# OpenAPI Spec Example - Petstore API
273
+
petstore_mcp:
274
+
url: "https://petstore.swagger.io/v2"
275
+
spec_path: "/path/to/openapi.json"
276
+
auth_type: "none"
277
+
278
+
# OpenAPI Spec with API Key Authentication
279
+
my_api_mcp:
280
+
url: "http://0.0.0.0:8090"
281
+
spec_path: "/path/to/openapi.json"
282
+
auth_type: "api_key"
283
+
auth_value: "your-api-key-here"
284
+
285
+
# OpenAPI Spec with Bearer Token
286
+
secured_api_mcp:
287
+
url: "https://api.example.com"
288
+
spec_path: "/path/to/openapi.json"
289
+
auth_type: "bearer_token"
290
+
auth_value: "your-bearer-token"
291
+
```
292
+
293
+
### Configuration Parameters
294
+
295
+
| Parameter | Required | Description |
296
+
|-----------|----------|-------------|
297
+
| `url` | Yes | The base URL of your API endpoint |
298
+
| `spec_path` | Yes | Path or URL to your OpenAPI specification file (JSON or YAML) |
0 commit comments