
openapi-to-mcp
Turn any OpenAPI spec into an MCP server, exposing your API endpoints as strongly typed tools.
Add to your client
Copy the config for your MCP client and paste it into its config file.
dotnet tool install --global openapi-to-mcpPaste into ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"openapi-to-mcp": {
"command": "openapi-to-mcp",
"args": [
"https://petstore3.swagger.io/api/v3/openapi.json"
]
}
}
}Step-by-step guides: Add to Claude Desktop · Add to Cursor · Add to Windsurf
Before you start
- .NET SDK (to install via `dotnet tool install`), or download a prebuilt executable from the releases page
- An OpenAPI 2.0 or 3.0 specification (JSON or YAML; OpenAPI 3.1 is not yet supported)
- Credentials (bearer token or OAuth2 client/refresh credentials) if the target API requires authentication
About openapi-to-mcp
A .NET tool (distributed via NuGet or as standalone release executables) that generates an MCP server from any OpenAPI 2.0/3.0 specification. Each API operation is translated into an MCP tool, with parameters taken from the operation's JSON schema and responses returned as-is. Supports JSON/YAML specs, local files or URLs, configurable tool-naming strategies, host overrides, and bearer-token or OAuth2 authorization. STDIO transport only.
Tools & capabilities (1)
Dynamically generated per OpenAPI operationThere are no fixed tools. Each operation (endpoint) in the supplied OpenAPI spec is exposed as one MCP tool. Path/query/JSON-body parameters are derived from the operation's JSON schema, and the raw API response is returned. The tool name comes from the `x-mcp-tool-name` extension, the `operationId`, or `{httpMethod}_{escaped_path}`, per the chosen `--tool-naming-strategy`; the description comes from `x-mcp-tool-description`, `operation.description`, or `path.description`.
When to use it
- Expose an internal or third-party REST API to an LLM agent without hand-writing an MCP server
- Quickly try out a public API (e.g. the Swagger Petstore) as MCP tools in Claude Desktop, Cursor, or Windsurf
- Wrap GitHub's REST API as MCP tools using a Personal Access Token and the verb-and-path naming strategy
- Selectively expose subsets of an API by toggling operations with the `x-mcp-tool-enabled` extension
Security notes
Bearer tokens and OAuth2 client secrets/passwords are passed as command-line args in the MCP config and forwarded as the Authorization header on every call (including when fetching a remote spec). Avoid committing config files containing these credentials. The server forwards API responses as-is, so be mindful of which spec/host you point it at.
openapi-to-mcp FAQ
Which OpenAPI versions are supported?
OpenAPI 2.0 and 3.0 are supported. 3.1 is not (pending OpenAPI 3.1 support in microsoft/OpenAPI.NET). Specs may be JSON or YAML, local or remote, but only local $refs are supported.
What transports are supported?
Only STDIO transport is currently supported.
How does the server know which host to call?
It uses, in order: the `--host-override` option, the spec's first server URL if absolute, then the host of the remote OpenAPI URL provided. If none resolve to an absolute host, an error is thrown.
How do I authenticate to the underlying API?
Pass a static token via `--bearer-token` (sent as `Authorization: Bearer {token}`), or use OAuth2 with the `--oauth-2-*` options for the client_credentials, password, or refresh_token grant types. If the spec declares matching OAuth2 securitySchemes, their tokenUrl is used unless overridden.
Why are some endpoints missing as tools?
Tools are discarded if their computed name does not match `^[a-zA-Z0-9_-]{1,64}$`. Adjust the `--tool-naming-strategy` (e.g. to `verbandpath`) or set explicit names via the `x-mcp-tool-name` extension.
Alternatives to openapi-to-mcp
Compare all alternatives →Microsoft's official browser-automation MCP using Playwright's accessibility tree (no vision model).
Up-to-date, version-specific library documentation injected into your coding agent.
Code intelligence engine that indexes repos into a persistent knowledge graph for AI coding agents.
Compare openapi-to-mcp with: