OpenAPI MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add -e "API_BASE_URL=${API_BASE_URL}" -e "OPENAPI_SPEC_PATH=${OPENAPI_SPEC_PATH}" openapi-mcp-server -- docker run --rm -i -e API_BASE_URL=https://api.example.com -e OPENAPI_SPEC_PATH=https://api.example.com/openapi.json reallv/openapi-mcp-server:latest
Required:API_BASE_URLOPENAPI_SPEC_PATH+ 1 optional
README.md

Dynamically exposes OpenAPI-defined REST APIs as MCP tools

OpenAPI MCP Server

A generic Model Context Protocol (MCP) server that dynamically exposes OpenAPI-defined REST APIs as MCP tools. This enables Large Language Models like Claude to discover and interact with any OpenAPI-compliant API through the standardized MCP protocol.

✨ Key Features

  • šŸ”„ Dynamic Tool Generation: Automatically converts OpenAPI operations to MCP tools
  • šŸ” Flexible Authentication: Static headers, dynamic providers, token refresh
  • šŸ“Š Advanced Filtering: Filter tools by tags, resources, operations, or explicit lists
  • 🌐 Multiple Transports: Stdio for Claude Desktop, HTTP for web applications
  • šŸ“ Smart Tool Naming: Intelligent abbreviation with ≤64 character limit
  • ļæ½ Meta-Tools: Built-in API exploration and dynamic endpoint invocation
  • šŸ— Interface-Based Architecture: Type-safe, modular design with comprehensive interfaces
  • šŸ“„ Multiple Input Methods: URL, file, stdin, or inline OpenAPI specifications

šŸš€ Quick Start

CLI Usage (Recommended)

# Install globally
npm install -g @lucid-spark/openapi-mcp-server

# Use with any OpenAPI-compliant API
openapi-mcp-server \
  --api-base-url https://api.example.com \
  --openapi-spec https://api.example.com/openapi.json \
  --transport stdio

Docker Usage (Production Ready)

# Run with HTTP transport
docker run --rm -p 3000:3000 \
  -e API_BASE_URL=https://petstore.swagger.io/v2 \
  -e OPENAPI_SPEC_PATH=https://raw.githubusercontent.com/readmeio/oas-examples/main/3.0/json/petstore.json \
  -e TRANSPORT_TYPE=http \
  reallv/openapi-mcp-server:latest

# Run with stdio transport (for Claude Desktop)
docker run --rm -i \
  -e API_BASE_URL=https://api.example.com \
  -e OPENAPI_SPEC_PATH=https://api.example.com/openapi.json \
  reallv/openapi-mcp-server:latest

# Use docker-compose for multiple APIs
docker-compose up -d

Library Usage

npm install @lucid-spark/openapi-mcp-server
import { OpenAPIServer } from "@lucid-spark/openapi-mcp-server";

const server = new OpenAPIServer({
  apiBaseUrl: "https://api.example.com",
  openApiSpec: "https://api.example.com/openapi.json",
  transportType: "stdio",
});

await server.start();

šŸ“– Documentation

For MCP protocol details, see modelcontextprotocol.io.

šŸ“‹ Table of Contents

šŸ— Architecture

The OpenAPI MCP Server uses a modular, interface-based architecture for maximum flexibility and type safety:

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”    ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”    ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│   OpenAPI Server    │    │    Configuration    │    │    Type System      │
│                     │    │                     │    │                     │
│ • Orchestration     │◄──►│ • Validation        │◄──►│ • Interface-based   │
│ • MCP Protocol      │    │ • Defaults          │    │ • Type Safety       │
│ • Lifecycle Mgmt    │    │ • Environment Vars  │    │ • Extensibility     │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜    ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜    ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
          │                          │                          │
          ā–¼                          ā–¼                          ā–¼
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”    ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”    ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│  OpenAPI Spec       │    │   Tools Manager     │    │   Authentication    │
│  Loader             │    │                     │    │   System            │
│                     │    │ • Tool Creation     │    │                     │
│ • Multiple Inputs   │    │ • Filtering         │    │ • Static Headers    │
│ • $ref Resolution   │    │ • Lookup & Cache    │    │ • Dynamic Providers │
│ • Schema Processing │    │ • Meta-tool

Tools (1)

dynamic-api-toolsAutomatically generated tools based on the provided OpenAPI specification operations.

Environment Variables

API_BASE_URLrequiredThe base URL of the target REST API
OPENAPI_SPEC_PATHrequiredURL or local path to the OpenAPI JSON specification
TRANSPORT_TYPECommunication protocol (stdio or http)

Configuration

claude_desktop_config.json
{"mcpServers": {"openapi": {"command": "npx", "args": ["-y", "@lucid-spark/openapi-mcp-server"], "env": {"API_BASE_URL": "https://api.example.com", "OPENAPI_SPEC_PATH": "https://api.example.com/openapi.json"}}}}

Try it

→List all available operations for the connected API.
→Fetch the user profile using the get-user-details tool.
→Create a new resource using the provided API schema.
→Search for items in the API matching the query 'example'.

Frequently Asked Questions

What are the key features of OpenAPI MCP Server?

Dynamic conversion of OpenAPI operations into MCP tools. Support for multiple authentication methods including static headers and dynamic providers. Advanced tool filtering by tags, resources, or operations. Multiple transport support including stdio and HTTP. Intelligent tool naming with character limit enforcement.

What can I use OpenAPI MCP Server for?

Integrating internal REST APIs into Claude Desktop for natural language interaction. Rapidly prototyping LLM-based interfaces for existing OpenAPI-compliant services. Automating API workflows by allowing Claude to chain multiple endpoint calls. Standardizing access to disparate microservices through a unified MCP interface.

How do I install OpenAPI MCP Server?

Install OpenAPI MCP Server by running: npm install -g @lucid-spark/openapi-mcp-server

What MCP clients work with OpenAPI MCP Server?

OpenAPI MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep OpenAPI MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare