The MCP OpenAPI Proxy enables you to expose any REST API with an OpenAPI specification as a set of tools through the Model Context Protocol. It dynamically creates tools from API endpoints, making external services accessible for AI systems and automation workflows.
Install the package directly from PyPI:
uvx mcp-openapi-proxy
MCP OpenAPI Proxy can be configured by environment variables. The minimal configuration requires only an OpenAPI specification URL:
OPENAPI_SPEC_URL="https://example.com/openapi.json" uvx mcp-openapi-proxy
To integrate with your MCP ecosystem, add the following to your configuration:
{
"mcpServers": {
"mcp-openapi-proxy": {
"command": "uvx",
"args": ["mcp-openapi-proxy"],
"env": {
"OPENAPI_SPEC_URL": "${OPENAPI_SPEC_URL}",
"API_KEY": "${API_OPENAPI_KEY}"
}
}
}
}
In this mode, the proxy automatically registers all valid API endpoints from the OpenAPI specification as individual tools. Tool names are derived from normalized paths and methods.
Enable this mode by setting OPENAPI_SIMPLE_MODE=true
. It exposes a fixed set of tools derived from specific OpenAPI endpoints rather than creating tools for every endpoint.
The proxy can be customized with several environment variables:
OPENAPI_SPEC_URL
: (Required) URL to the OpenAPI specification JSON fileAPI_KEY
: Authentication token for the APITOOL_WHITELIST
: Comma-separated list of endpoint paths to expose as toolsTOOL_NAME_PREFIX
: Prefix to prepend to all tool namesAPI_AUTH_TYPE
: Overrides the default Bearer
Authorization header typeEXTRA_HEADERS
: Additional HTTP headers to attach to outgoing API requestsSERVER_URL_OVERRIDE
: Overrides the base URL from the OpenAPI specificationDEBUG
: Enables verbose debug logging when set to "true"OPENAPI_SPEC_URL="https://glama.ai/api/mcp/openapi.json" uvx mcp-openapi-proxy
OPENAPI_SPEC_URL="https://raw.githubusercontent.com/abhiaagarwal/peristera/refs/heads/main/fly-machines-gen/fixed_spec.json" API_KEY="your_flyio_token_here" API_AUTH_TYPE="Api-Key" uvx mcp-openapi-proxy
OPENAPI_SPEC_URL="https://raw.githubusercontent.com/slackapi/slack-api-specs/master/web-api/slack_web_openapi_v2.json" TOOL_WHITELIST="/chat,/bots,/conversations,/reminders,/files,/users" API_KEY="your_slack_bot_token" STRIP_PARAM="token" TOOL_NAME_PREFIX="slack_" uvx mcp-openapi-proxy
OPENAPI_SPEC_URL="https://raw.githubusercontent.com/matthewhand/mcp-openapi-proxy/refs/heads/main/examples/virustotal.openapi.yml" EXTRA_HEADERS="x-apikey: your_virustotal_api_key" OPENAPI_SPEC_FORMAT="yaml" uvx mcp-openapi-proxy
After starting the proxy, you can test it by sending JSON-RPC messages:
{"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"claude-ai","version":"0.1.0"}},"jsonrpc":"2.0","id":0}
{"method":"notifications/initialized","jsonrpc":"2.0"}
{"method":"resources/list","params":{},"jsonrpc":"2.0","id":1}
{"method":"tools/list","params":{},"jsonrpc":"2.0","id":2}
OPENAPI_SPEC_URL
points to a valid OpenAPI specificationDEBUG=true
for detailed outputTOOL_WHITELIST
matches the desired endpointsThere are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.