Exposes an OpenAPI spec as MCP tools to invoke API operations from an OpenAPI document.
Configuration
View docs{
"mcpServers": {
"rmasters-mcp-openapi": {
"command": "uvx",
"args": [
"mcp-openapi",
"--openapi-url=http://localhost:8000/openapi.json",
"stdio"
],
"env": {
"MCP_OPENAPI_URL": "https://api.example.com/openapi.json"
}
}
}
}You can expose an OpenAPI specification as a set of MCP tools using MCP-OpenAPI. It fetches the spec, turns each path-operation into a tool, and lets you invoke those tools through an MCP client. This makes API endpoints available in a consistent, tool-like interface for your applications and assistants.
Start a local MCP-OpenAPI server that serves tools derived from a chosen OpenAPI spec. You can run multiple instances to expose different specs. Each instance becomes a FastMCP server that offers the API’s endpoints as individual tools.
Run the server using the runtime and command shown below, specifying the OpenAPI URL of your target spec. You can also pass the URL via an environment variable for convenience. When the server starts, connect to it with your MCP client and begin invoking the exposed tools.
Prerequisites: install Python and the runtime you use to run MCP servers. You also need a tool to install Python packages from PyPI.
Install the MCP-OpenAPI package from PyPI, then run a server by using the MCP runtime to execute it. The following steps illustrate a practical flow.
Install the MCP-OpenAPI package from PyPI and ensure the MCP runtime is available on your system.
Start a server with a specified OpenAPI URL. You can pass it directly on the command line or set it via an environment variable.
This MCP-OpenAPI server exposes operations from a single OpenAPI spec. You can start multiple instances to expose multiple specs.
The server fetches and parses the OpenAPI spec, registers each path-operation as a tool, and starts a FastMCP server with the registered tools.
OpenAPI versions supported: 3.0 and 3.1. The server works with JSON and YAML formats. You can restrict exposed endpoints in the future, but by default every endpoint is exposed as a tool.
Authentication can be configured with a global auth token if your API requires it. You can pass a bearer token or basic credentials through the appropriate option.
{
"mcpServers": {
"todos": {
"command": "uvx",
"args": [
"mcp-openapi",
"--openapi-url=http://localhost:8000/openapi.json",
"stdio"
]
}
}
}