Overview
What is Openapi To Mcp?
Openapi To Mcp is a .NET tool that reads an OpenAPI specification and exposes each API endpoint as a strongly typed MCP tool, enabling AI assistants to interact with any REST API via the Model Context Protocol.
How to use Openapi To Mcp?
Install the .NET global tool via dotnet tool install --global openapi-to-mcp or download the pre-built executable from releases. Then configure your MCP client (e.g., Claude Desktop) with the command openapi-to-mcp <open-api> where <open-api> is a URL or file path to the OpenAPI specification. Additional options include authentication (bearer token, OAuth2), tool naming strategy, and host override.
Key features of Openapi To Mcp
- Converts OpenAPI 2.0 and 3.0 specs (JSON/YAML) into MCP tools
- Supports bearer token and OAuth2 (client_credentials, password, refresh_token)
- Configurable tool naming strategy: operationId, verb+path, or extension
- Custom OpenAPI extensions for instructions, tool name, description, and enable/disable
- Only STDIO transport; local file or remote URL specs supported
- Tools are discarded if name does not match
^[a-zA-Z0-9_-]{1,64}$
Use cases of Openapi To Mcp
- Expose a private API to an MCP-compatible AI assistant without writing custom adapters
- Quickly turn any public API with an OpenAPI spec into consumable tools for agents
- Integrate GitHub API (or similar) with authentication into a Claude Desktop session
- Enable AI to call your REST endpoints using strongly typed parameters from the spec
FAQ from Openapi To Mcp
Does Openapi To Mcp support OpenAPI 3.1?
No, currently only OpenAPI 2.0 and 3.0 are supported. 3.1 will be supported once the underlying OpenAPI.NET library adds support.
What runtime or dependencies are required?
The tool runs on .NET and is installed as a .NET global tool. Pre-built executables are also available for systems without .NET.
Which MCP transport is used?
Only STDIO transport is currently supported – no SSE or other transports.
How does authentication work?
You can provide a bearer token via --bearer-token (added as Authorization: Bearer header) or use OAuth2 with the appropriate options (client credentials, password, or refresh token). The tool can read token URLs from the OpenAPI specification.
Can I override the host that the tool calls?
Yes, use the --host-override option. If not provided, the host is determined from the spec’s server URL (first absolute URL) or the remote spec’s own host.