Sign inSign up

mekayelanik/openapi-mcp-server

By mekayelanik

โ€ขUpdated 12 days ago

Image
0

5.4K

mekayelanik/openapi-mcp-server repository overview

OpenAPI Logo

โ OpenAPI MCP Server

Docker Pulls Docker Stars GHCR License: GPL-3.0 Platforms GitHub Stars GitHub Forks GitHub Issues Last Commit

โ Multi-Architecture Docker Image for OpenAPI Integration

โ Table of Contents


โ ๐Ÿ˜Ž Buy Me a Coffee โ˜•๏ธŽ

Your support encourages me to keep creating/supporting my open-source projects. If you found value in this project, you can buy me a coffee to keep me inspired.

Buy Me A Coffee โ 

โ Overview

OpenAPI MCP Server is a Model Context Protocol server that bridges OpenAPI specifications with LLMs (Large Language Models). It loads OpenAPI specs from URLs or local files and exposes the API operations as MCP tools. Built on Alpine Linux for minimal footprint and maximum security, wrapped with mcp-proxy for HTTP/SSE/WebSocket transport.

โ Key Features
  • OpenAPI Spec Loading - Load specs from URL or local file path
  • Multiple Authentication Types - Supports none, basic, bearer, api_key, and AWS Cognito
  • Multi-Architecture Support - Native support for x86-64 and ARM64
  • Multiple Transport Protocols - HTTP, SSE, and WebSocket support
  • Secure by Design - Alpine-based with minimal attack surface, HAProxy with TLS/CORS support
  • High Performance - ZSTD compression for faster deployments
  • Production Ready - Stable releases with comprehensive testing
  • Easy Configuration - Simple environment variable setup

โ Supported Architectures

ArchitectureTag PrefixStatus
x86-64amd64-<version>Stable
ARM64arm64v8-<version>Stable

Multi-arch images automatically select the correct architecture for your system.


โ Available Tags

TagStabilityDescriptionUse Case
stableHighMost stable releaseRecommended for production
latestHighLatest stable releaseStay current with stable features
1.1.6HighSpecific versionSpecific version
betaLowBeta releasesTesting only
โ System Requirements
  • Docker Engine: 23.0+
  • RAM: Minimum 512MB
  • CPU: Single core sufficient

CRITICAL: Do NOT expose this container directly to the internet without proper security measures (reverse proxy, SSL/TLS, authentication, firewall rules).


โ Quick Start

services:
  openapi-mcp-server:
    image: mekayelanik/openapi-mcp-server:stable
    container_name: openapi-mcp-server
    restart: unless-stopped
    ports:
      - "8050:8050"
    environment:
      - PORT=8050
      - INTERNAL_PORT=38011
      - PUID=1000
      - PGID=1000
      - TZ=Asia/Dhaka
      - PROTOCOL=SHTTP
      - ENABLE_HTTPS=false
      - HTTP_VERSION_MODE=auto
      # OpenAPI configuration
      - API_NAME=my-api
      - API_BASE_URL=https://api.example.com
      - API_SPEC_URL=https://api.example.com/openapi.json
      # - API_SPEC_PATH=/specs/openapi.json
      # Authentication (choose one)
      - AUTH_TYPE=none
      # - AUTH_TYPE=bearer
      # - AUTH_TOKEN=your-bearer-token
      # - AUTH_TYPE=api_key
      # - AUTH_API_KEY=your-api-key
      # - AUTH_API_KEY_NAME=X-API-Key
      # - AUTH_API_KEY_IN=header
      # Optional: require Bearer token auth at HAProxy layer
      # - API_KEY=replace-with-strong-secret
    hostname: openapi-mcp-server
    domainname: local

Deploy:

docker compose up -d
docker compose logs -f openapi-mcp-server
โ Docker CLI
docker run -d \
  --name=openapi-mcp-server \
  --restart=unless-stopped \
  -p 8050:8050 \
  -e PORT=8050 \
  -e INTERNAL_PORT=38011 \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Asia/Dhaka \
  -e PROTOCOL=SHTTP \
  -e ENABLE_HTTPS=false \
  -e HTTP_VERSION_MODE=auto \
  -e API_NAME=my-api \
  -e API_BASE_URL=https://api.example.com \
  -e API_SPEC_URL=https://api.example.com/openapi.json \
  -e AUTH_TYPE=none \
  mekayelanik/openapi-mcp-server:stable
โ Access Endpoints
ProtocolEndpointUse Case
HTTPhttp://host-ip:8050/mcpBest compatibility (recommended)
SSEhttp://host-ip:8050/sseReal-time streaming

When HTTPS is enabled (ENABLE_HTTPS=true), use TLS endpoints:

ProtocolEndpoint
SHTTPhttps://host-ip:8050/mcp
SSEhttps://host-ip:8050/sse

Security Warning: The container now defaults to HTTP (ENABLE_HTTPS=false) for easier local setup. Use ENABLE_HTTPS=true for production, public networks, or any untrusted environment.

ARM Devices: Allow 30-60 seconds for initialization before accessing endpoints.


โ Configuration

โ Environment Variables
โ Container Configuration
VariableDefaultDescription
PORT8050External server port
INTERNAL_PORT38011Internal MCP server port used by mcp-proxy
PUID1000User ID for file permissions
PGID1000Group ID for file permissions
TZAsia/DhakaContainer timezone (TZ databaseโ )
PROTOCOLSHTTPDefault transport protocol
โ API Configuration
VariableDefaultDescription
API_NAMEawslabs-openapi-mcp-serverAPI name identifier
API_BASE_URLhttps://localhost:8000Base URL for the API
API_SPEC_URL(empty)URL to OpenAPI specification (HTTP or HTTPS). Spec is prefetched into the container at startup, so upstream httpx never touches the network.
API_SPEC_PATH(empty)Local path to OpenAPI specification file (at least one of API_SPEC_URL / API_SPEC_PATH is required). When both are set, API_SPEC_PATH wins and the URL is ignored.
API_SPEC_SSL_VERIFYtrueTLS verification for the spec prefetch from API_SPEC_URL. Set to false to allow self-signed or private-CA endpoints (e.g. local dev APIs). Has no effect when API_SPEC_PATH is used.

Local / self-signed HTTPS APIs: Upstream awslabs.openapi-mcp-server fetches API_SPEC_URL via httpx with no flag to disable TLS verification or inject a custom CA bundle, which breaks startup against self-signed endpoints. To work around this, the entrypoint prefetches the spec with wget before launching the server and rewrites API_SPEC_URL โ†’ API_SPEC_PATH. For self-signed or private-CA hosts, set API_SPEC_SSL_VERIFY=false. Keep the default true for any public/internet-facing API to avoid MITM exposure. Configured AUTH_TYPE headers (api_key / bearer / basic) are forwarded on the prefetch request as well.

โ Authentication Configuration
VariableDefaultDescription
AUTH_TYPEnoneAuthentication type (none, basic, bearer, api_key, cognito)
AUTH_USERNAME(empty)Basic auth username
AUTH_PASSWORD(empty)Basic auth password
AUTH_TOKEN(empty)Bearer token
AUTH_API_KEY(empty)API key value
AUTH_API_KEY_NAMEapi_keyAPI key parameter name
AUTH_API_KEY_INheaderWhere to send API key (header, query, cookie)
โ AWS Cognito Authentication
VariableDefaultDescription
AUTH_COGNITO_CLIENT_ID(empty)Cognito client ID
AUTH_COGNITO_USERNAME(empty)Cognito username
AUTH_COGNITO_PASSWORD(empty)Cognito password
AUTH_COGNITO_CLIENT_SECRET(empty)Cognito client secret
AUTH_COGNITO_DOMAIN(empty)Cognito domain
AUTH_COGNITO_SCOPES(empty)Cognito scopes
AUTH_COGNITO_USER_POOL_ID(empty)Cognito user pool ID
AUTH_COGNITO_REGIONus-east-1AWS region for Cognito
โ Server Configuration
VariableDefaultDescription
SERVER_DEBUGfalseEnable debug mode (passes --debug to upstream)
SERVER_MESSAGE_TIMEOUT60Message timeout in seconds (forwarded to upstream as env var)
LOG_LEVELINFOUpstream log level: DEBUG, INFO, WARNING, ERROR, CRITICAL

Note: Upstream awslabs.openapi-mcp-server runs with stdio transport only inside this container โ€” the HTTP layer is provided by supergateway on INTERNAL_PORT and exposed externally through HAProxy on PORT. Upstream env vars like SERVER_HOST/SERVER_PORT/SERVER_TRANSPORT are forwarded to the child process as-is but have no user-visible effect in this image.

LOG_LEVEL is not read by upstream as an env var (upstream only honors --log-level on the CLI). This entrypoint forwards it by translating to --log-level for convenience.

โ Metrics & Monitoring
VariableDefaultDescription
ENABLE_PROMETHEUSfalseEnable the Prometheus metrics endpoint
PROMETHEUS_PORT9090Port for the Prometheus metrics server
ENABLE_OPERATION_PROMPTStrueGenerate operation-specific prompts from the OpenAPI spec
โ Graceful Shutdown
VariableDefaultDescription
UVICORN_GRACEFUL_SHUTDOWNtrueEnable graceful shutdown handling
UVICORN_TIMEOUT_GRACEFUL_SHUTDOWN5.0Graceful shutdown timeout (seconds)
โ TLS / HTTPS Configuration
VariableDefaultDescription
ENABLE_HTTPSfalseEnables TLS termination in HAProxy
TLS_CERT_PATH/etc/haproxy/certs/server.crtTLS cert path
TLS_KEY_PATH/etc/haproxy/certs/server.keyTLS private key path
TLS_PEM_PATH/etc/haproxy/certs/server.pemCombined PEM file used by HAProxy
TLS_CNlocalhostCN for auto-generated certificate
TLS_SANDNS:<TLS_CN>SAN for auto-generated certificate
TLS_DAYS365Auto-generated cert validity period
TLS_MIN_VERSIONTLSv1.3Minimum TLS protocol (TLSv1.2 or TLSv1.3)
HTTP_VERSION_MODEautoauto, all, h1, h2, h3, h1+h2
โ Security Configuration
VariableDefaultDescription
API_KEY(empty)Enables Bearer token auth at HAProxy layer (Authorization: Bearer <API_KEY>)
CORS(empty)Comma-separated CORS origins, supports *
RATE_LIMIT0Max requests per RATE_LIMIT_PERIOD per IP (0 = disabled)
RATE_LIMIT_PERIOD10sSliding window for rate limiting (e.g., 10s, 1m, 1h)
MAX_CONNECTIONS_PER_IP0Max concurrent connections per IP (0 = disabled)
IP_ALLOWLIST(empty)Comma-separated IPs/CIDRs to allow (all others blocked)
IP_BLOCKLIST(empty)Comma-separated IPs/CIDRs to block
โ HTTPS and HTTP Version Notes
  • If ENABLE_HTTPS=true and cert files are missing, the container auto-generates a self-signed certificate.
  • If TLS_CERT_PATH and TLS_KEY_PATH exist, they are merged into TLS_PEM_PATH and used directly.
  • HTTP_VERSION_MODE=h3 (or auto) enables HTTP/3 only when HAProxy build includes QUIC; otherwise it safely falls back.
โ API Key Authentication Notes
  • Set API_KEY to enforce authentication at reverse proxy level.
  • Expected header format: Authorization: Bearer <API_KEY>.
  • Localhost health checks remain accessible for liveness/readiness.
โ Rate Limiting and IP Access Control
  • Rate limiting: Set RATE_LIMIT=100 to allow 100 requests per RATE_LIMIT_PERIOD (default 10s) per IP. Exceeding the limit returns HTTP 429 with a Retry-After header.
  • Connection limiting: Set MAX_CONNECTIONS_PER_IP=50 to cap concurrent connections per IP. Exceeding returns HTTP 429.
  • IP blocklist: Set IP_BLOCKLIST=192.0.2.0/24,198.51.100.5 to block specific IPs/CIDRs. Blocked IPs receive HTTP 403.
  • IP allowlist: Set IP_ALLOWLIST=10.0.0.0/8,192.168.1.0/24 to allow only listed IPs/CIDRs. All others receive HTTP 403. Localhost is always allowed.
  • All features default to disabled. Combine as needed โ€” blocklist is checked before allowlist.
โ User & Group IDs

Find your IDs and set them to avoid permission issues:

id username
# uid=1000(user) gid=1000(group)
โ Timezone Examples
- TZ=Asia/Dhaka        # Bangladesh
- TZ=America/New_York  # US Eastern
- TZ=Europe/London     # UK
- TZ=UTC               # Universal Time


โ Memory & Concurrency Tuning

This image embeds mcp-proxy (sparfenyuk/mcp-proxy) as the stdioโ†”HTTP bridge.

  • MCP_PROXY_STATELESS=false (default): one stdio backend child is shared across all MCP sessions, JSON-RPC-id-multiplexed. Minimal memory.
  • MCP_PROXY_STATELESS=true: per-request transport instance. Use only when full session isolation is required.
  • HAPROXY_FRONTEND_MAXCONN / HAPROXY_SERVER_MAXCONN: HAProxy-level caps. Defaults 64/16.
  • WebSocket transport is no longer supported (mcp-proxy upstream does not implement it).

Root cause: supergateway 3.4.3 stateless mode leaks child processes (supercorp-ai/supergateway#108).

โ MCP Client Configuration

โ Transport Support
ClientHTTPSSERecommended
VS Code (Cline/Roo-Cline)YesYesNo
Claude DesktopYesYesExperimental
Claude CLIYesYesExperimental
Codex CLIYesYesExperimental
Codeium (Windsurf)YesYesExperimental
CursorYesYesExperimental

โ VS Code (Cline/Roo-Cline)

Configure in .vscode/settings.json:

{
  "mcp.servers": {
    "openapi-mcp": {
      "url": "http://host-ip:8050/mcp",
      "transport": "http"
    }
  }
}

โ Claude Desktop App/Claude Code

With API_KEY:

claude mcp add-json openapi-mcp '{"type":"http","url":"http://localhost:8050/mcp","headers":{"Authorization":"Bearer <YOUR_API_KEY>"}}'

Without API_KEY:

claude mcp add-json openapi-mcp '{"type":"http","url":"http://localhost:8050/mcp"}'

โ Codex CLI

Configure in ~/.codex/config.json:

{
  "mcpServers": {
    "openapi-mcp": {
      "transport": "http",
      "url": "http://host-ip:8050/mcp"
    }
  }
}

โ Codeium (Windsurf)

Configure in .codeium/mcp_settings.json:

{
  "mcpServers": {
    "openapi-mcp": {
      "transport": "http",
      "url": "http://host-ip:8050/mcp"
    }
  }
}

โ Cursor

Configure in ~/.cursor/mcp.json:

{
  "mcpServers": {
    "openapi-mcp": {
      "transport": "http",
      "url": "http://host-ip:8050/mcp"
    }
  }
}

โ Testing Configuration

Verify with MCP Inspectorโ :

npm install -g @modelcontextprotocol/inspector
mcp-inspector http://host-ip:8050/mcp

โ Network Configuration

โ Comparison
Network ModeComplexityPerformanceUse Case
BridgeEasyGoodDefault, isolated
HostModerateExcellentDirect host access
MACVLANAdvancedExcellentDedicated IP

โ Bridge Network (Default)
services:
  openapi-mcp-server:
    image: mekayelanik/openapi-mcp-server:stable
    ports:
      - "8050:8050"

Benefits: Container isolation, easy setup, works everywhere Access: http://localhost:8050/mcp


โ Host Network (Linux Only)
services:
  openapi-mcp-server:
    image: mekayelanik/openapi-mcp-server:stable
    network_mode: host

Benefits: Maximum performance, no NAT overhead, no port mapping needed Considerations: Linux only, shares host network namespace Access: http://localhost:8050/mcp


โ MACVLAN Network (Advanced)
services:
  openapi-mcp-server:
    image: mekayelanik/openapi-mcp-server:stable
    mac_address: "AB:BC:CD:DE:EF:01"
    networks:
      macvlan-net:
        ipv4_address: 192.168.1.100

networks:
  macvlan-net:
    driver: macvlan
    driver_opts:
      parent: eth0
    ipam:
      config:
        - subnet: 192.168.1.0/24
          gateway: 192.168.1.1

Benefits: Dedicated IP, direct LAN access Considerations: Linux only, requires additional setup Access: http://192.168.1.100:8050/mcp


โ Updating

โ Docker Compose
docker compose pull
docker compose up -d
docker image prune -f
โ Docker CLI
docker pull mekayelanik/openapi-mcp-server:stable
docker stop openapi-mcp-server && docker rm openapi-mcp-server
# Run your original docker run command
docker image prune -f
โ One-Time Update with Watchtower
docker run --rm \
  -v /var/run/docker.sock:/var/run/docker.sock \
  containrrr/watchtower \
  --run-once \
  openapi-mcp-server

โ Troubleshooting

โ Pre-Flight Checklist
  • Docker Engine 23.0+
  • Port 8050 available
  • Sufficient startup time (ARM devices)
  • Latest stable image
  • Correct configuration
โ Common Issues
โ Container Won't Start
# Check Docker version
docker --version

# Verify port availability
sudo netstat -tulpn | grep 8050

# Check logs
docker logs openapi-mcp-server
โ Permission Errors
# Get your IDs
id $USER

# Update configuration with correct PUID/PGID
# Fix volume permissions if needed
sudo chown -R 1000:1000 /path/to/volume
โ Client Cannot Connect
# Test connectivity
curl http://localhost:8050/mcp
curl http://host-ip:8050/mcp
curl -k https://localhost:8050/mcp
curl -k https://host-ip:8050/mcp

# Check firewall
sudo ufw status

# Verify container
docker inspect openapi-mcp-server | grep IPAddress
โ Slow ARM Performance
  • Wait 30-60 seconds after start
  • Monitor: docker logs -f openapi-mcp-server
  • Check resources: docker stats openapi-mcp-server
  • Use faster storage (SSD vs SD card)
โ Debug Information

When reporting issues, include:

# System info
docker --version && uname -a

# Container logs
docker logs openapi-mcp-server --tail 200 > logs.txt

# Container config
docker inspect openapi-mcp-server > inspect.json

โ Additional Resources

โ Documentation
โ Docker Resources
โ Monitoring

โ ๐Ÿ˜Ž Buy Me a Coffee โ˜•๏ธŽ

Your support encourages me to keep creating/supporting my open-source projects. If you found value in this project, you can buy me a coffee to keep me inspired.

Buy Me A Coffee โ 

โ Support & License

โ Getting Help

Docker Image Issues:

OpenAPI MCP Issues:

โ Contributing

We welcome contributions:

  1. Report bugs via GitHub Issues
  2. Suggest features
  3. Improve documentation
  4. Test beta releases
โ License

GPL License. See LICENSEโ  for details.

OpenAPI MCP server has its own license - see upstream repositoryโ .


Tag summary

Content type

Image

Digest

sha256:4df6c8a5eโ€ฆ

Size

77 MB

Last updated

12 days ago

docker pull mekayelanik/openapi-mcp-server