services:
# OpenAPI MCP Server - HTTP Transport
openapi-mcp-server:
build: .
container_name: openapi-mcp-server
restart: unless-stopped
ports:
- "3000:3000"
environment:
# Required configuration
- API_BASE_URL=${API_BASE_URL:-https://petstore.swagger.io/v2}
- OPENAPI_SPEC_PATH=${OPENAPI_SPEC_PATH:-https://raw.githubusercontent.com/readmeio/oas-examples/main/3.0/json/petstore.json}
# Transport configuration
- TRANSPORT_TYPE=http
- HTTP_PORT=3000
- HTTP_HOST=0.0.0.0
- ENDPOINT_PATH=/mcp
# Optional API authentication
- API_HEADERS=${API_HEADERS:-}
# Server configuration
- SERVER_NAME=${SERVER_NAME:-openapi-mcp-server}
- SERVER_VERSION=${SERVER_VERSION:-1.0.0}
- NAMESPACE=${NAMESPACE:-}
# Tool filtering
- TOOLS_MODE=${TOOLS_MODE:-all}
# Debug mode
- DEBUG=${DEBUG:-false}
volumes:
# Mount local OpenAPI specs if needed
- ./examples:/app/specs:ro
networks:
- mcp-network
healthcheck:
test:
[
"CMD",
"wget",
"--no-verbose",
"--tries=1",
"--spider",
"http://localhost:3000/mcp",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# Example: Multiple API servers
petstore-api:
build: .
container_name: petstore-mcp
restart: unless-stopped
ports:
- "3001:3000"
environment:
- API_BASE_URL=https://petstore.swagger.io/v2
- OPENAPI_SPEC_PATH=https://raw.githubusercontent.com/readmeio/oas-examples/main/3.0/json/petstore.json
- API_HEADERS=accept:application/json,api_key:special-key
- TRANSPORT_TYPE=http
- HTTP_PORT=3000
- HTTP_HOST=0.0.0.0
- SERVER_NAME=petstore-mcp-server
- NAMESPACE=petstore
networks:
- mcp-network
profiles:
- examples
jsonplaceholder-api:
build: .
container_name: jsonplaceholder-mcp
restart: unless-stopped
ports:
- "3002:3000"
environment:
- API_BASE_URL=https://jsonplaceholder.typicode.com
- OPENAPI_SPEC_INLINE={"openapi":"3.0.0","info":{"title":"JSONPlaceholder","version":"1.0.0"},"paths":{"/posts":{"get":{"operationId":"getPosts","responses":{"200":{"description":"List of posts"}}}},"/posts/{id}":{"get":{"operationId":"getPost","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"A post"}}}}}}
- TRANSPORT_TYPE=http
- HTTP_PORT=3000
- HTTP_HOST=0.0.0.0
- SERVER_NAME=jsonplaceholder-mcp-server
- NAMESPACE=jsonplaceholder
networks:
- mcp-network
profiles:
- examples
# Nginx reverse proxy (optional)
nginx:
image: nginx:alpine
container_name: mcp-proxy
restart: unless-stopped
ports:
- "80:80"
volumes:
- ./docker/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- openapi-mcp-server
networks:
- mcp-network
profiles:
- proxy
networks:
mcp-network:
driver: bridge
name: mcp-network
volumes:
mcp-data:
name: mcp-data