OpenAPI MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@OpenAPI MCP Serverlist all pets with status available from the petstore API"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
OpenAPI MCP Server
This project is a server that dynamically creates Model Context Protocol (MCP) tools and resources from OpenAPI specifications. It allows Large Language Models (LLMs) to interact with APIs through the Model Context Protocol.
Origin and derivation
This is an independently maintained fork of the awslabs/mcp OpenAPI MCP Server. The implementation, AWS copyright notices, LICENSE, and NOTICE are retained in accordance with the Apache License 2.0. The fork is maintained at samuelcaldas/openapi-mcp-server, while AWS remains the credited upstream origin.
The server defaults to stdio for local MCP clients and also supports Streamable HTTP (/mcp) and legacy SSE (/sse). Network transports are unauthenticated at the MCP layer: keep the default loopback bind, or place remote deployments behind an operator-managed, authenticated gateway.
Upstream synchronization is deliberately manual. Run ./scripts/sync-upstream.sh from a clean main checkout after installing git-filter-repo, or dispatch the Sync upstream workflow on main. The script keeps the filtered AWS history under refs/remotes/upstream/main, creates chore(sync): update from awslabs/mcp only when the merge changes the tree, and aborts on conflicts.
Related MCP server: mcp-openapi
Features
Dynamic Tool Generation: Automatically creates MCP tools from OpenAPI endpoints
Intelligent Route Mapping: Maps GET operations with query parameters to TOOLS instead of RESOURCES
Makes API operations with query parameters easier for LLMs to understand and use
Improves usability of search and filtering endpoints
Configurable via the route_patch module
Tag-based Filtering: Control which operations are exposed to LLMs
Include only specific tags:
--include-tags pet,storeExclude specific tags:
--exclude-tags admin,internalConfigurable via CLI args or
INCLUDE_TAGS/EXCLUDE_TAGSenv vars
Enriched Tool Descriptions: Automatically appends response codes and parameter examples from the OpenAPI spec to tool descriptions, helping LLMs make better tool selections
Multi-spec Composition: Combine multiple OpenAPI specs into a single MCP server
Configure via
--additional-specsCLI arg orADDITIONAL_SPECSenv varEach spec gets its own HTTP client with independent authentication (per-entry
auth_type,auth_token, etc.)SSRF-protected: URLs are validated against DNS resolution and IP allowlisting before fetching
Output Validation Toggle: Disable response schema validation for APIs with loose specs via
--no-validate-outputorVALIDATE_OUTPUT=falseDynamic Prompt Generation: Creates helpful prompts based on API structure
Operation-Specific Prompts: Generates natural language prompts for each API operation
API Documentation Prompts: Creates comprehensive API documentation prompts
Prompt Optimization: Implements token efficiency strategies to reduce costs and enhance clarity
Follows MCP-compliant structure with name, description, arguments, and metadata
Achieves 70-75% reduction in token usage while maintaining functionality
Uses concise descriptions with essential information for better developer experience
Transport:
stdioby default; Streamable HTTP (--transport httpor--transport streamable-http) at/mcp; legacy SSE (--transport sse) at/sseFlexible Configuration: Configure via environment variables or command line arguments
OpenAPI Support: Works with OpenAPI 3.x specifications in JSON or YAML format
OpenAPI Specification Validation: Validates specifications without failing startup if issues detected, logging warnings instead to work with specs having minor issues or non-standard extensions
Authentication Support: Supports multiple authentication methods (Basic, Bearer Token, API Key, Cognito)
AWS Best Practices: Implements AWS best practices for caching, resilience, and observability
Comprehensive Testing: Includes extensive unit and integration tests with high code coverage
Metrics Collection: Tracks API calls, tool usage, errors, and performance metrics
Installation
Kiro | Cursor | VS Code |
From PyPI
pip install "awslabs.openapi-mcp-server"Optional Dependencies
The package supports several optional dependencies:
# For YAML OpenAPI specification support
pip install "awslabs.openapi-mcp-server[yaml]"
# For Prometheus metrics support
pip install "awslabs.openapi-mcp-server[prometheus]"
# For testing
pip install "awslabs.openapi-mcp-server[test]"
# For all optional dependencies
pip install "awslabs.openapi-mcp-server[all]"From Source
git clone https://github.com/samuelcaldas/openapi-mcp-server.git
cd openapi-mcp-server
pip install -e .Using MCP Configuration
Example configuration for Kiro (~/.kiro/settings/mcp.json):
{
"mcpServers": {
"awslabs.openapi-mcp-server": {
"command": "uvx",
"args": ["awslabs.openapi-mcp-server@latest"],
"env": {
"API_NAME": "your-api-name",
"API_BASE_URL": "https://api.example.com",
"API_SPEC_URL": "https://api.example.com/openapi.json",
"LOG_LEVEL": "ERROR",
"ENABLE_PROMETHEUS": "false",
"ENABLE_OPERATION_PROMPTS": "true",
"UVICORN_TIMEOUT_GRACEFUL_SHUTDOWN": "5.0",
"UVICORN_GRACEFUL_SHUTDOWN": "true"
},
"disabled": false,
"autoApprove": []
}
}
}Windows Installation
For Windows users, the MCP server configuration format is slightly different:
{
"mcpServers": {
"awslabs.openapi-mcp-server": {
"disabled": false,
"timeout": 60,
"type": "stdio",
"command": "uv",
"args": [
"tool",
"run",
"--from",
"awslabs.openapi-mcp-server@latest",
"awslabs.openapi-mcp-server.exe"
],
"env": {
"API_NAME": "your-api-name",
"API_BASE_URL": "https://api.example.com",
"API_SPEC_URL": "https://api.example.com/openapi.json",
"LOG_LEVEL": "ERROR",
"ENABLE_PROMETHEUS": "false",
"ENABLE_OPERATION_PROMPTS": "true",
"UVICORN_TIMEOUT_GRACEFUL_SHUTDOWN": "5.0",
"UVICORN_GRACEFUL_SHUTDOWN": "true"
}
}
}
}Usage
Basic Usage
# Start with Petstore API example
awslabs.openapi-mcp-server --api-name petstore --api-url https://petstore3.swagger.io/api/v3 --spec-url https://petstore3.swagger.io/api/v3/openapi.jsonCustom API
# Use a different API
awslabs.openapi-mcp-server --api-name myapi --api-url https://api.example.com --spec-url https://api.example.com/openapi.jsonNetwork Transports
stdio is the default. Use Streamable HTTP (/mcp) or legacy SSE (/sse) when an MCP client needs a network endpoint:
# Streamable HTTP on loopback; HTTP path defaults to /mcp
awslabs.openapi-mcp-server --transport http --host 127.0.0.1 --port 8000 --api-url https://api.example.com --spec-url https://api.example.com/openapi.json
# Remote bind only behind an operator-managed authenticated gateway
awslabs.openapi-mcp-server --transport streamable-http --host 0.0.0.0 --port 8000 --http-path /mcp --allow-remote-bind --allowed-origins https://mcp.example.com --api-url https://api.example.com --spec-url https://api.example.com/openapi.jsonRemote bind does not add inbound MCP authentication. Protect the endpoint with an authenticated gateway; --allowed-origins accepts exact HTTP(S) origins, not paths or wildcards. Host and Origin checks remain enabled, including for remote binds. Use --http-path to select the Streamable HTTP endpoint. SSE is retained for compatibility and uses /sse.
Authenticated API
# Basic Authentication
awslabs.openapi-mcp-server --api-url https://api.example.com --spec-url https://api.example.com/openapi.json --auth-type basic --auth-username YOUR_USERNAME --auth-password YOUR_PASSWORD # pragma: allowlist secret
# Bearer Token Authentication
awslabs.openapi-mcp-server --api-url https://api.example.com --spec-url https://api.example.com/openapi.json --auth-type bearer --auth-token YOUR_TOKEN # pragma: allowlist secret
# API Key Authentication (in header)
awslabs.openapi-mcp-server --api-url https://api.example.com --spec-url https://api.example.com/openapi.json --auth-type api_key --auth-api-key YOUR_API_KEY --auth-api-key-name X-API-Key --auth-api-key-in header # pragma: allowlist secretFor detailed information about authentication methods, configuration options, and examples, see AUTHENTICATION.md.
Local OpenAPI Specification
# Use a local OpenAPI specification file
awslabs.openapi-mcp-server --spec-path ./openapi.jsonTag Filtering
# Only expose pet-related operations
awslabs.openapi-mcp-server --api-url https://petstore3.swagger.io/api/v3 --spec-url https://petstore3.swagger.io/api/v3/openapi.json --include-tags pet
# Hide admin and internal operations
awslabs.openapi-mcp-server --api-url https://api.example.com --spec-url https://api.example.com/openapi.json --exclude-tags admin,internalMulti-spec Composition
# Combine multiple APIs into one MCP server (each with its own auth)
awslabs.openapi-mcp-server --api-url https://api.example.com --spec-url https://api.example.com/openapi.json \
--additional-specs '[{"name":"payments","spec_url":"https://payments.example.com/openapi.json","base_url":"https://payments.example.com","auth_type":"bearer","auth_token":"your-payments-bearer-token"}]'
# Additional specs may also use a local OpenAPI file via spec_path
awslabs.openapi-mcp-server --api-url https://api.example.com --spec-url https://api.example.com/openapi.json \
--additional-specs '[{"name":"payments","spec_path":"./specs/payments-openapi.json","base_url":"https://payments.example.com"}]'
# Allow HTTP URLs and private networks (for internal/development APIs)
awslabs.openapi-mcp-server --api-url https://api.example.com --spec-url https://api.example.com/openapi.json \
--allow-insecure-http --allow-private-networks \
--additional-specs '[{"name":"internal","spec_url":"http://10.0.0.5:8080/openapi.json","base_url":"http://10.0.0.5:8080"}]'Note: Additional specs do not inherit the primary API's credentials. Each entry must declare its own
auth_type/auth_token/auth_api_keyor defaults to no authentication. See the Security section for details.
Disable Output Validation
# For APIs with loose specs that don't match their own response schemas
awslabs.openapi-mcp-server --api-url https://api.example.com --spec-url https://api.example.com/openapi.json --no-validate-outputYAML OpenAPI Specification
# Use a YAML OpenAPI specification file (requires pyyaml)
pip install "awslabs.openapi-mcp-server[yaml]"
awslabs.openapi-mcp-server --spec-path ./openapi.yamlLocal Development and Testing
For local development and testing, you can use the uvx command with the --refresh and --from options:
# Run the server from the local directory with the Petstore API
uvx --refresh --from . awslabs.openapi-mcp-server --api-url https://petstore3.swagger.io/api/v3 --spec-url https://petstore3.swagger.io/api/v3/openapi.json --log-level DEBUGCommand Options Explained:
uvx- The uv package manager's execution tool for running Python packages--refresh- Refreshes the package cache to ensure the latest version is used (important during development)--from .- Uses the package from the current directory instead of installing from PyPIawslabs.openapi-mcp-server- The package name to run--api-url- The base URL of the API--spec-url- The URL of the OpenAPI specification--log-level DEBUG- Sets the logging level to DEBUG for more detailed logs (useful for development) When to Use These Options:Use
--refreshwhen you've made changes to your code and want to ensure the latest version is usedUse
--log-level DEBUGwhen you need detailed logs for troubleshooting or development
Note: The Petstore API is a standard OpenAPI schema endpoint that can be used for simple testing without any API authentication configuration. It's perfect for testing your MCP server implementation without setting up your own API.
Configuration
Environment Variables
# Server configuration
export SERVER_NAME="My API Server"
export SERVER_DEBUG=true
export SERVER_MESSAGE_TIMEOUT=60
export SERVER_HOST="127.0.0.1" # Default loopback bind; non-loopback needs ALLOW_REMOTE_BIND
export SERVER_PORT=8000
export SERVER_TRANSPORT="stdio" # Options: stdio, http, streamable-http, sse
export SERVER_HTTP_PATH="/mcp" # Streamable HTTP endpoint; SSE uses /sse
export ALLOW_REMOTE_BIND="false" # Set true only behind an authenticated secure gateway
export ALLOWED_ORIGINS="" # Comma-separated exact http(s) origins trusted for browser/proxy requests
export LOG_LEVEL="INFO" # Options: DEBUG, INFO, WARNING, ERROR, CRITICAL
# Metrics and monitoring configuration
export ENABLE_PROMETHEUS="false" # Enable/disable Prometheus metrics (default: false)
export PROMETHEUS_PORT=9090 # Port for Prometheus metrics server
export ENABLE_OPERATION_PROMPTS="true" # Enable/disable operation-specific prompts (default: true)
# Graceful shutdown configuration
export UVICORN_TIMEOUT_GRACEFUL_SHUTDOWN=5.0 # Timeout for graceful shutdown in seconds
export UVICORN_GRACEFUL_SHUTDOWN=true # Enable/disable graceful shutdown
# API configuration
export API_NAME="myapi"
export API_BASE_URL="https://api.example.com"
export API_SPEC_URL="https://api.example.com/openapi.json"
export API_SPEC_PATH="/path/to/local/openapi.json" # Optional: local file path
# Authentication configuration
export AUTH_TYPE="none" # Options: none, basic, bearer, api_key
export AUTH_USERNAME="PLACEHOLDER_USERNAME" # For basic authentication # pragma: allowlist secret
export AUTH_PASSWORD="PLACEHOLDER_PASSWORD" # For basic authentication # pragma: allowlist secret
export AUTH_TOKEN="PLACEHOLDER_TOKEN" # For bearer token authentication # pragma: allowlist secret
export AUTH_API_KEY="PLACEHOLDER_API_KEY" # For API key authentication # pragma: allowlist secret
export AUTH_API_KEY_NAME="X-API-Key" # Name of the API key (default: api_key)
export AUTH_API_KEY_IN="header" # Where to place the API key (options: header, query, cookie)
# Tag filtering
export INCLUDE_TAGS="pet,store" # Only expose operations with these tags
export EXCLUDE_TAGS="admin,internal" # Hide operations with these tags
# Output validation
export VALIDATE_OUTPUT="true" # Set to "false" to disable response schema validation
# Multi-spec composition
# Each additional spec requires base_url and either spec_url or spec_path
# Each entry can optionally include auth_type, auth_token, auth_api_key, auth_api_key_name, auth_username, auth_password
export ADDITIONAL_SPECS='[{"name":"payments","spec_url":"https://payments.example.com/openapi.json","base_url":"https://payments.example.com","auth_type":"api_key","auth_api_key":"PLACEHOLDER_API_KEY","auth_api_key_name":"X-API-Key"}]' # pragma: allowlist secret
# Security settings
export ALLOW_INSECURE_HTTP="false" # Set to "true" to permit http:// URLs
export ALLOW_PRIVATE_NETWORKS="false" # Set to "true" to permit private/loopback/link-local IPs
export ALLOWED_SPEC_DIRS="/app/specs:/data/api" # OS path-separated list of allowed directories for spec_path (use ; on Windows)Documentation
The OpenAPI MCP Server includes comprehensive documentation to help you get started and make the most of its features:
AUTHENTICATION.md: Detailed information about authentication methods, configuration options, and troubleshooting
DEPLOYMENT.md: Guidelines for deploying local stdio and network transports in Docker and AWS environments
AWS_BEST_PRACTICES.md: AWS best practices implemented in the server for resilience, caching, and efficiency
OBSERVABILITY.md: Information about metrics, logging, and monitoring capabilities
tests/README.md: Overview of the test structure and strategy
AWS Best Practices
The OpenAPI MCP Server implements AWS best practices for building resilient, observable, and efficient cloud applications. These include:
Caching: Robust caching system with multiple backend options
Resilience: Patterns to handle transient failures and ensure high availability
Observability: Comprehensive monitoring, metrics, and logging features
For detailed information about these features, including implementation details and configuration options, see AWS_BEST_PRACTICES.md.
Security
The server validates all URLs in additional_specs entries before fetching:
Blocked by default | Examples |
Private networks (RFC 1918) |
|
Loopback / link-local |
|
HTTP scheme |
|
Credential isolation: Additional specs never inherit the primary API's credentials. Each entry must declare its own auth_type/auth_token or defaults to no auth.
DNS pinning (rebinding protection): Spec URLs are validated and fetched against the same resolved IP — the loader connects only to the address(es) that passed validation, never re-resolving the hostname at fetch time. This closes the DNS-rebinding TOCTOU window where a hostname could resolve to a public IP during validation and to an internal/metadata IP during the fetch. This applies to both the primary spec URL and every additional_specs entry. Redirects are not followed (a 30x toward an internal host is rejected), and spec bodies are capped at 10 MiB.
Reference ($ref) resolution: Only internal, in-document references (#/components/...) are resolved. External references — remote http(s):///file:// targets, or relative multi-file references such as schemas.yaml#/Pet — are refused before parsing, so a hostile spec cannot use a $ref to reach internal services, cloud metadata, or local files (SSRF/LFI). Split multi-file specs must be bundled into a single document before loading.
Path traversal protection: spec_path is canonicalized, restricted to spec file extensions (.json, .yaml, .yml), and checked against a best-effort system directory blocklist. For production deployments, use --allowed-spec-dirs to explicitly restrict allowed paths.
Escape hatches for development/internal use:
Flag | Env Var | Effect |
|
| Permits |
|
| Permits private/loopback IPs |
|
| Restricts |
To report security issues, open a private report through the repository security policy or contact the maintainers.
Docker Deployment
The project includes a Dockerfile for containerized deployment. To build and run:
# Build the Docker image
docker build -t openapi-mcp-server:latest .
# Run Streamable HTTP behind an operator-managed secure gateway
docker run -p 127.0.0.1:8000:8000 \
-e API_NAME=petstore \
-e API_BASE_URL=https://petstore3.swagger.io/api/v3 \
-e API_SPEC_URL=https://petstore3.swagger.io/api/v3/openapi.json \
-e SERVER_TRANSPORT=http \
-e SERVER_HOST=0.0.0.0 \
-e SERVER_PORT=8000 \
-e ALLOW_REMOTE_BIND=true \
-e ALLOWED_ORIGINS=https://mcp.example.com \
-e TZ=America/Sao_Paulo \
openapi-mcp-server:latestThe default stdio transport needs no published port. The Docker example binds to host loopback so a same-host authenticated gateway can proxy it without exposing the unauthenticated endpoint externally. If the gateway runs on another host, use a separate trusted container network or firewall that allows only the gateway to reach the server; never publish the port to untrusted networks. Remote network transports have no inbound MCP authentication. See DEPLOYMENT.md for transport configuration and security requirements.
Testing
The project includes a comprehensive test suite covering unit tests, integration tests, and API functionality tests.
Running Tests
# Install test dependencies
pip install "awslabs.openapi-mcp-server[test]"
# Run all tests
pytest
# Run tests with coverage
pytest --cov=awslabs
# Run specific test modules
pytest tests/api/
pytest tests/utils/The test suite covers:
API Configuration: Tests for API configuration handling and validation
API Discovery: Tests for API endpoint discovery and tool generation
Caching: Tests for the caching system and providers
HTTP Client: Tests for the HTTP client with resilience features
Metrics: Tests for metrics collection and reporting
OpenAPI Validation: Tests for OpenAPI specification validation
For more information about the test structure and strategy, see the tests/README.md file.
Instructions
This server acts as a bridge between OpenAPI specifications and LLMs, allowing models to have a better understanding of available API capabilities without requiring manual tool definitions. The server creates structured MCP tools that LLMs can use to understand and interact with your API endpoints, parameters, and response formats.
Key Features
Dynamic Tool Generation: Automatically creates MCP tools from your API endpoints
Operation-Specific Prompts: Generates natural language prompts for each API operation
API Documentation: Creates comprehensive documentation prompts for the entire API
Authentication Support: Works with Basic Auth, Bearer Token, API Key, and Cognito authentication
Getting Started
Point the server to your API by providing its name, base URL, and OpenAPI specification URL or local file path.
Configure outbound API authentication if required; it does not authenticate inbound MCP clients.
Use the default
stdiotransport for local MCP clients, or configure a network transport and secure gateway as described above.
Monitoring and Metrics
The server includes built-in monitoring capabilities:
Prometheus metrics (disabled by default)
Detailed logging of API calls and tool usage
Performance tracking for API operations
Testing with Kiro
To test the OpenAPI MCP Server with Kiro, you need to configure Kiro to use your MCP server. Here's how:
Configure Kiro MCP Integration
Create or edit the MCP configuration file:
mkdir -p ~/.kiro/settings nano ~/.kiro/settings/mcp.jsonAdd the following configuration:
{ "mcpServers": { "awslabs.openapi-mcp-server": { "command": "python", "args": ["-m", "awslabs.openapi_mcp_server"], "cwd": "/path/to/your/openapi-mcp-server", "env": { "API_NAME": "petstore", "API_BASE_URL": "https://petstore3.swagger.io/api/v3", "API_SPEC_URL": "https://petstore3.swagger.io/api/v3/openapi.json", "LOG_LEVEL": "INFO", "ENABLE_PROMETHEUS": "false", "ENABLE_OPERATION_PROMPTS": "true", "UVICORN_TIMEOUT_GRACEFUL_SHUTDOWN": "5.0", "UVICORN_GRACEFUL_SHUTDOWN": "true", "PYTHONPATH": "/path/to/your/openapi-mcp-server" }, "disabled": false, "autoApprove": [] } } }Start Kiro CLI
Launch the Kiro CLI:
kiro-cli chatTest the Operation Prompts
Once connected, you can test the operation prompts by asking Kiro to help you with specific API operations:
I need to find a pet by ID using the Petstore APIKiro should respond with guidance using the natural language prompt.
This server cannot be deployed
Maintenance
Related MCP Connectors
Point Gecko at an OpenAPI spec; get first-call-correct, auth-hidden agent tools.
- TypeshipOAuthdev.typeship
Generate a typed SDK, CLI, and MCP server from any OpenAPI or GraphQL spec, and keep them current.
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
Any REST/SOAP/GraphQL/OData/SQL API as MCP tools for Claude & ChatGPT. 474 connectors: SAP, ERP.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceTransforms OpenAPI 3.x specifications into MCP tools, enabling Large Language Models to interact with REST APIs through standardized MCP protocol. Supports bearer token authentication and all HTTP methods for seamless API integration.2-
- AlicenseNot gradedqualityDmaintenanceTurn any OpenAPI/Swagger spec into MCP tools. Zero config, zero code. Supports Swagger 2.0, OpenAPI 3.x, Bearer/API-key/OAuth2 auth, flat parameter schemas for better LLM accuracy, and smart response truncation.229 npm3MIT

cod-api MCP Serverofficial
FlicenseNot gradedqualityDmaintenanceExposes REST API endpoints defined in an OpenAPI Specification as MCP tools, allowing AI models to call them via the ModelContext Protocol.-- FlicenseNot gradedqualityDmaintenanceDynamically exposes any OpenAPI/Swagger API as tools for AI assistants, automatically generating MCP tools from OpenAPI specs with authentication support.-