rahgadda_openapi_mcp_server

rahgadda_openapi_mcp_server

by rahgadda
A server that provides configured REST APIs as context for LLMs, enabling them to interact with REST APIs using prompts.

OpenAPI Model Context Protocol Server

smithery badge

Overview

This project installs the Model Context Protocol Server (MCP), which provides configured REST APIs as context for Large Language Models (LLMs). It enables LLMs to interact with REST APIs and perform API calls using prompts. Currently, it supports HTTP API calls (GET, PUT, POST, PATCH).

Installation

  1. Install the package:
    shell pip install openapi_mcp_server

  2. Create a .env file in the project folder with the minimum required values for OPENAPI_SPEC_PATH and API_BASE_URL. A sample .env file is available here.

  3. Test the server:
    shell uv run openapi_mcp_server

Claud Desktop Integration

Configuration

To configure the MCP server for Claud Desktop, use the following JSON structure:

{
  "mcpServers": {
    "openapi_mcp_server": {
      "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"
      }
    }
  }
}

Pet Store Demo

Environment Variables

  • DEBUG: Enable debug logging (optional, default is False).
  • OPENAPI_SPEC_PATH: Path to the OpenAPI document (required).
  • API_BASE_URL: Base URL for API requests (required).
  • API_HEADERS: Headers to include in API requests (optional).
  • API_WHITE_LIST: Whitelisted operation IDs in list format (optional).
  • API_BLACK_LIST: Blacklisted operation IDs in list format (optional).
  • HTTP_PROXY: HTTP proxy details (optional).
  • HTTPS_PROXY: HTTPS proxy details (optional).
  • NO_PROXY: No proxy details (optional).

Contributing

Contributions are welcome! Feel free to submit a Pull Request.

License

This project is licensed under the MIT License.

GitHub Stars

Star History Chart

Appendix

UV Commands

mkdir -m777 openapi_mcp_server
cd openapi_mcp_server
uv init
uv add mcp[cli] pydantic python-dotenv requests
uv add --dev twine setuptools
uv sync
uv run openapi_mcp_server
uv build
pip install --force-reinstall --no-deps .\dist\openapi_mcp_server-*fileversion*.whl
export TWINE_USERNAME="rahgadda"
export TWINE_USERNAME="<<API Key>>"
uv run twine upload --verbose dist/*

Reference

About

Resources

License

Activity

Stars

Watchers

Forks

Languages

  • Python: 97.1%
  • Dockerfile: 1.2%
  • Other: 1.7%

Features & Capabilities

Categories
mcp_server model_context_protocol python docker api_integration rest_api llm openapi

Implementation Details

Stats

0 Views
4 GitHub Stars

Repository Info

rahgadda Organization

Similar MCP Servers

continuedev_continue by continuedev
25049
21423
9300