OpenAPI to MCP

OpenAPI to MCP

Automatically converts any OpenAPI specification or Postman Collection into an MCP server, enabling AI assistants like Claude to directly interact with REST APIs without writing any code.

Category
访问服务器

README

OpenAPI to MCP

Turn any OpenAPI spec or Postman Collection into an MCP server. Like, instantly.

Docker Pulls License CI

<table> <tr> <td align="center"><strong>Developed by</strong></td> <td align="center"><strong>Inspired by</strong></td> </tr> <tr> <td align="center"> <a href="https://procoders.tech/?utm_source=github"> <img src="https://procoders.tech/wp-content/uploads/2024/05/Index-featured-social-fb-1.png" alt="Procoders" width="200"/> </a> <br/> <em>We develop your ideas</em> </td> <td align="center"> <a href="https://mcpize.com/?utm_source=github"> <img src="https://mcpize.com/assets/logo-CoSOeOrS.svg" alt="MCPize" width="120"/> </a> <br/> <em>Monetize MCPs world</em> </td> </tr> </table>

Got a REST API with an OpenAPI spec or a Postman Collection? Cool, now Claude can use it directly. No code required.

Quick Start

docker run -p 8080:8080 procoders/openapi-mcp-ts \
  --spec-url https://petstore3.swagger.io/api/v3/openapi.json \
  --upstream-url https://petstore3.swagger.io/api/v3

Point Claude Desktop at it:

{
  "mcpServers": {
    "petstore": {
      "url": "http://localhost:8080/mcp"
    }
  }
}

Done. Your API is now available as MCP tools. Go grab a coffee.

What's the Deal?

  • OpenAPI 3.0 / 3.1 - We parse your spec and turn each endpoint into an MCP tool
  • Postman Collections - Got a Postman collection instead? Works the same way
  • Auto-detection - We figure out what format you're using. You just point, we parse
  • Zero code - Just point at your spec, we handle the rest
  • Safe by default - DELETE methods are disabled unless you say otherwise
  • Auth built-in - API Key, Bearer, Basic - all supported
  • Filter tools - Use globs to include/exclude specific operations
  • Production-ready - Health checks, graceful shutdown, structured logging

Installation

Docker (the easy way)

docker pull procoders/openapi-mcp-ts:latest

From Source (if you're into that)

git clone https://github.com/procoders/openapi-mcp-ts.git
cd openapi-mcp-ts
npm install
npm run build
npm start -- --spec-url <url> --upstream-url <url>

Usage

OpenAPI

# From a URL
docker run -p 8080:8080 procoders/openapi-mcp-ts \
  --spec-url https://api.example.com/openapi.json \
  --upstream-url https://api.example.com

# From a local file
docker run -p 8080:8080 \
  -v ./my-api.yaml:/spec.yaml:ro \
  procoders/openapi-mcp-ts \
  --spec-file /spec.yaml \
  --upstream-url https://api.example.com

Postman Collections

Same deal, just point at your collection. We auto-detect the format:

# From a Postman collection URL
docker run -p 8080:8080 procoders/openapi-mcp-ts \
  --spec-url https://your-postman-collection.json \
  --upstream-url https://api.example.com

# From a local collection file
docker run -p 8080:8080 \
  -v ./my-collection.json:/spec.json:ro \
  procoders/openapi-mcp-ts \
  --spec-file /spec.json \
  --upstream-url https://api.example.com

Want to be explicit? Use --format:

docker run -p 8080:8080 procoders/openapi-mcp-ts \
  --spec-file /spec.json \
  --format postman \
  --upstream-url https://api.example.com

Postman v2.0 and v2.1 collection formats are both supported. Nested folders become tags, path variables (:id) become OpenAPI-style ({id}), and all body types (raw JSON, form-data, urlencoded) just work.

With Auth

# Bearer token
docker run -p 8080:8080 \
  -e AUTH_TYPE=bearer \
  -e AUTH_VALUE="your-token-here" \
  procoders/openapi-mcp-ts \
  --spec-url https://api.example.com/openapi.json \
  --upstream-url https://api.example.com

With a Config File

For more complex setups, use a YAML config:

# config.yaml
spec:
  url: https://api.example.com/openapi.json

upstream:
  baseUrl: https://api.example.com
  timeout: 30000
  headers:
    X-Request-ID: "{{REQUEST_ID}}"  # System variables ftw
    X-Timestamp: "{{TIMESTAMP}}"

tools:
  include: ["get_*", "list_*"]      # Only expose read operations
  exclude: ["*_admin_*"]             # Hide admin stuff
  autoDisable:
    methods: ["DELETE"]              # Safety first
    deprecated: true

auth:
  type: apiKey
  in: header
  name: X-API-Key
  value: "${API_KEY}"               # Env var interpolation

logging:
  level: info
  format: json

Then run:

docker run -p 8080:8080 \
  -v ./config.yaml:/config.yaml:ro \
  -e API_KEY="your-key" \
  procoders/openapi-mcp-ts \
  --config /config.yaml

CLI Options

Flag What it does Default
--spec-url <url> Fetch spec from URL -
--spec-file <path> Load spec from local file -
--format <format> Force format: openapi or postman auto
--upstream-url <url> Base URL for API requests -
--port <port> Server port 8080
--host <host> Host to bind 0.0.0.0
--config <path> Config file path -
--include-tools <glob> Only include matching tools -
--exclude-tools <glob> Exclude matching tools -
--log-level <level> debug/info/warn/error info
--log-format <format> json/pretty json

Environment Variables

Everything can be set via env vars too:

Variable What it does
SPEC_URL Spec URL (OpenAPI or Postman)
SPEC_FILE Path to spec file
SPEC_FORMAT Force format: openapi or postman
UPSTREAM_URL Upstream API base URL
PORT Server port
LOG_LEVEL Log level
AUTH_TYPE none/apiKey/bearer/basic
AUTH_NAME Header or query param name
AUTH_VALUE The actual auth value
INCLUDE_TOOLS Comma-separated include patterns
EXCLUDE_TOOLS Comma-separated exclude patterns

Endpoints

Endpoint What's there
GET /health Health check (for load balancers)
GET /tools List all available tools as JSON
POST /mcp The MCP protocol endpoint

Dynamic Tool Filtering

Different AI agents need different tools? No problem:

http://localhost:8080/mcp?tools=get_user,list_users

Only those tools will be available in that session. Pretty handy.

System Variables

You can use these in your upstream headers config:

Variable Value
{{TIMESTAMP}} Unix timestamp in ms
{{REQUEST_ID}} UUID for request tracing
{{ISO_DATE}} ISO 8601 formatted date
{{USER_IP}} Client IP address

Tool Naming

We convert your operationId to snake_case:

  • getPetByIdget_pet_by_id
  • listUserslist_users
  • createNewOrdercreate_new_order

No operationId? We generate from method + path:

  • GET /pets/{id}get_pets_id

For Postman collections, the request name becomes the tool name:

  • "Get All Users"get_all_users
  • "Create New Post"create_new_post

Safety Stuff

Auto-disabled Methods

DELETE operations are disabled by default. Enable them explicitly if you need them.

Tool Count Warning

We'll warn you if you enable more than 10 tools. LLMs tend to get confused with too many options.

Development

npm install
npm run dev -- --spec-url https://petstore3.swagger.io/api/v3/openapi.json \
               --upstream-url https://petstore3.swagger.io/api/v3

# Other commands
npm run build      # Compile TypeScript
npm run typecheck  # Type check only
npm run lint       # ESLint

Don't Want to Self-Host?

Check out MCPize - we'll host it for you. Deploy from your OpenAPI spec in 60 seconds, no infrastructure needed.

Get Started Free →

Contributing

See CONTRIBUTING.md. We're friendly, promise.

License

Apache 2.0 - do what you want, just keep the license.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选