OpenAPI

OpenAPI MCP Server
  • python

6

GitHub Stars

python

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "rahgadda-openapi_mcp_server": {
      "command": "uv",
      "args": [
        "run",
        "openapi_mcp_server"
      ],
      "env": {
        "DEBUG": "1",
        "API_HEADERS": "Accept:application/json",
        "API_BASE_URL": "https://petstore.swagger.io/v2",
        "API_WHITE_LIST": "addPet,updatePet,findPetsByStatus",
        "OPENAPI_SPEC_PATH": "https://petstore.swagger.io/v2/swagger.json"
      }
    }
  }
}

You can run an OpenAPI-driven MCP Server that exposes REST APIs as a contextual resource for language models. It enables LLM prompts to interact with REST endpoints using standard HTTP methods (GET, PUT, POST, PATCH) by serving OpenAPI-defined endpoints in a configurable, programmatic way.

How to use

Start the local MCP server using the runtime tool and then connect your MCP client to it. You can perform REST API calls through the LLM prompts by leveraging the OpenAPI spec as the source of truth for endpoints, methods, and parameters. Use the configured base URL and OpenAPI document to route requests, and apply optional headers or whitelists to constrain available operations.

How to install

Prerequisites: you need Python and a runtime tool for managing MCP servers. You will install the MCP server package with Python’s package manager and then run the server using the designated runtime command.

pip install openapi_mcp_server

Create a working folder and place a minimal environment configuration that points to the OpenAPI document and the API base URL. You’ll supply these values to run the server.

# Example .env in the working folder
OPENAPI_SPEC_PATH=https://petstore.swagger.io/v2/swagger.json
API_BASE_URL=https://petstore.swagger.io/v2

Test and run the server using the runtime command shown in the configuration example. This starts the OpenAPI MCP Server in your local environment.

uv run openapi_mcp_server

Optional: if you’re using Claud Desktop, you can configure the MCP server as shown below to manage the process and environment variables centrally.

{
  "mcpServers": {
    "openapi_mcp":{
      "command": "uv",
      "args": ["run","openapi_mcp_server"],
      "env": {
        "DEBUG":"1",
        "API_BASE_URL":"https://petstore.swagger.io/v2",
        "OPENAPI_SPEC_PATH":"https://petstore.swagger.io/v2/swagger.json",
        "API_HEADERS":"Accept:application/json",
        "API_WHITE_LIST":"addPet,updatePet,findPetsByStatus"
      }
    }
  }
}

Additional sections

Configuration details for the OpenAPI MCP Server are driven by environment variables. The following variables are supported, with their purposes and typical usage:

  • DEBUG: Enable verbose debugging output. Optional. Default is off.

  • OPENAPI_SPEC_PATH: Path or URL to the OpenAPI document. Required.

  • API_BASE_URL: Base URL for API requests. Required.

  • API_HEADERS: Headers to include in API requests (format is a header string). Optional.

  • API_WHITE_LIST: Whitelisted operationIds in a list format, e.g. ["getPet","findPetsByStatus"]. Optional.

  • API_BLACK_LIST: Blacklisted operationIds in a list format. Optional.

  • HTTP_PROXY, HTTPS_PROXY, NO_PROXY: Proxy-related settings. Optional.

Security and access: Limit which operations the LLM can call by using the white/black lists, and protect endpoints with standard API-style security practices in your environment.

Notes and troubleshooting

  • When starting the server, ensure the environment variables are accessible to the runtime process. If the server fails to read the OpenAPI specification, verify the OPENAPI_SPEC_PATH URL or file path is reachable and correctly formatted.

  • If you need to test API calls locally, confirm that the API_BASE_URL is reachable from the host running the MCP server and that any required headers or authentication are provided via API_HEADERS or other config.

Available tools

REST API calls

LLMs can perform HTTP GET/PUT/POST/PATCH calls against configured API endpoints using the OpenAPI-driven context.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
OpenAPI MCP Server - rahgadda/openapi_mcp_server | VeilStrat