- Explore MCP Servers
- mcp-api-gateway
Mcp Api Gateway
What is Mcp Api Gateway
The MCP (Model Context Protocol) API Gateway is a server designed for integrating any API with Claude Desktop, leveraging Docker configurations for ease of deployment and management. It allows users to run containerized applications that interface with various APIs efficiently.
Use cases
Use cases include integration of internal company APIs for operations, handling APIs with local Swagger definitions, and creating REST wrappers for GraphQL APIs. It caters to both development and production environments by enabling API exploration and execution through natural language commands.
How to use
To use the MCP API Gateway, add configuration details in the claude_desktop_config.json
file, specifying the API names, Swagger URLs, base URLs, and authentication headers as environment variables. You can either run it via Docker Hub or build it locally, followed by testing the integration.
Key features
Key features include support for multiple APIs, flexible configuration through environment variables, easy Docker deployment, and the ability to handle various authentication methods. It also provides capabilities for exploring API endpoints and executing operations via natural language.
Where to use
This API Gateway is ideal for use in environments where an aggregation of different APIs is required, especially in applications needing to communicate with multiple services simultaneously. It is suitable for both internal enterprise applications as well as external APIs.
Overview
What is Mcp Api Gateway
The MCP (Model Context Protocol) API Gateway is a server designed for integrating any API with Claude Desktop, leveraging Docker configurations for ease of deployment and management. It allows users to run containerized applications that interface with various APIs efficiently.
Use cases
Use cases include integration of internal company APIs for operations, handling APIs with local Swagger definitions, and creating REST wrappers for GraphQL APIs. It caters to both development and production environments by enabling API exploration and execution through natural language commands.
How to use
To use the MCP API Gateway, add configuration details in the claude_desktop_config.json
file, specifying the API names, Swagger URLs, base URLs, and authentication headers as environment variables. You can either run it via Docker Hub or build it locally, followed by testing the integration.
Key features
Key features include support for multiple APIs, flexible configuration through environment variables, easy Docker deployment, and the ability to handle various authentication methods. It also provides capabilities for exploring API endpoints and executing operations via natural language.
Where to use
This API Gateway is ideal for use in environments where an aggregation of different APIs is required, especially in applications needing to communicate with multiple services simultaneously. It is suitable for both internal enterprise applications as well as external APIs.
Content
mcp/api-gateway
A universal MCP (Model Context Protocol) server to integrate any API with Claude Desktop using only Docker configurations.
Quick Installation
1. Using Docker Hub (Recommended)
Add to your claude_desktop_config.json
:
{
"mcpServers": {
"my-api": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--pull",
"always",
"-e",
"API_1_NAME=my-api",
"-e",
"API_1_SWAGGER_URL=https://api.example.com/swagger.json",
"-e",
"API_1_BASE_URL=https://api.example.com/v1",
"-e",
"API_1_HEADER_AUTHORIZATION=Bearer YOUR_TOKEN",
"rflpazini/mcp-api-gateway:latest"
]
}
}
}
2. Local Build
# Clone the repository
git clone https://github.com/rflpazini/mcp-api-gateway
cd mcp-api-gateway
# Build the image
docker build -t mcp-api-gateway .
# Local test
docker run --rm -it \
-e API_1_NAME=test \
-e API_1_SWAGGER_URL=https://petstore.swagger.io/v2/swagger.json \
-e API_1_BASE_URL=https://petstore.swagger.io/v2 \
mcp-api-gateway
API Configuration
Environment Variables
Variable | Description | Required |
---|---|---|
API_N_NAME |
Unique API name | Yes |
API_N_SWAGGER_URL |
Swagger/OpenAPI file URL | Yes |
API_N_BASE_URL |
API base URL (overrides Swagger) | No |
API_N_HEADER_* |
Custom headers | No |
API_N_HEADERS |
JSON with multiple headers | No |
Configuration Examples
Simple API with Authentication
{
"mcpServers": {
"github-api": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"API_1_NAME=github",
"-e",
"API_1_SWAGGER_URL=https://api.github.com/swagger.json",
"-e",
"API_1_HEADER_AUTHORIZATION=token ghp_xxxxxxxxxxxx",
"mcp-api-gateway:latest"
]
}
}
}
Multiple APIs
Using in Claude
Available Commands
-
View available APIs
- “What APIs are configured?”
- “Show me the available endpoints”
-
Explore endpoints
- “How do I create a user?”
- “What parameters do I need to search for products?”
-
Execute operations
- “Create a user named John with email [email protected]”
- “List all orders from today”
- “Update product ID 123 with new price $99.90”
Conversation Examples
You: “Create a new customer named Mary Smith”
Claude: “I’ll create the customer for you. Using the customers API…”
{
"id": "12345",
"name": "Mary Smith",
"createdAt": "2024-01-15T10:30:00Z"
}
“Customer Mary Smith created successfully! ID: 12345”
Publishing to Docker Hub
# Build for multiple architectures
docker buildx create --use
docker buildx build --platform linux/amd64,linux/arm64 \
-t your-username/mcp-api-gateway:latest \
-t your-username/mcp-api-gateway:1.0.0 \
--push .
Use Cases
1. Internal Company API
2. API with Local Swagger
3. GraphQL API (via REST wrapper)
Security
Best Practices
- Never commit tokens: Use environment variables or secrets
- Use limited scope tokens: Only necessary permissions
- Rotate tokens regularly: Update your tokens periodically
- Always use HTTPS: Ensure your APIs use HTTPS
Example with Docker Secrets
# Create the secret
echo "your_token_here" | docker secret create api_token -
# Use in claude_desktop_config.json
"args": [
"run", "--rm", "-i",
"-e", "API_1_HEADER_AUTHORIZATION=Bearer $(cat /run/secrets/api_token)",
"--secret", "api_token",
"mcp-api-gateway:latest"
]
Troubleshooting
API not showing up
- Check if the Swagger URL is accessible
- Confirm environment variables are correct
- Check logs:
docker logs <container_id>
Authentication error
- Verify token is correct
- Confirm header format (Bearer, Basic, etc)
- Test the API directly first
Slow performance
- Use
--pull always
only the first time - Consider caching the image locally
- Check API latency
Contributing
PRs are welcome! Some ideas:
- [ ] OAuth authentication support
- [ ] Smart response caching
- [ ] WebSocket support
- [ ] Web configuration interface
- [ ] Metrics and observability
License
MIT License - see LICENSE file for details.