Overview
Turns existing APIs and databases into MCP servers by analyzing OpenAPI specs and SQL sources.
Setup
Run with npx:
npm install -g mcp-gateway && mcp-gateway serveConfiguration
Provide OpenAPI spec URL or SQL connection string; gateway generates MCP tools automaticallyDocumentation
MCP Gateway
Overview
MCP Gateway transforms existing APIs and databases into MCP servers by analyzing OpenAPI specifications and SQL sources to generate tool definitions. This eliminates the need to manually write MCP server code for every API or database you want to expose to AI agents.
Features
- OpenAPI analysis: Automatically parses OpenAPI specs to generate MCP tools
- SQL source analysis: Analyzes database schemas to create data access tools
- Automatic tool generation: No manual MCP server coding required
- API-to-MCP conversion: Turns any REST API into an MCP server
- Database-to-MCP conversion: Exposes databases as MCP-compatible data sources
Installation
npm install -g mcp-gateway
Configuration
{
"mcpServers": {
"mcp-gateway": {
"command": "mcp-gateway",
"args": ["serve"],
"env": {
"OPENAPI_URL": "https://api.example.com/openapi.json"
}
}
}
}
Available Tools
| Tool | Description |
|---|---|
| analyze_openapi | Parse OpenAPI spec and generate MCP tools |
| analyze_sql | Analyze SQL database and generate data access tools |
| generate_server | Create MCP server from analyzed source |
| serve | Start the MCP server with generated tools |
Usage Examples
# Generate MCP server from OpenAPI spec
mcp-gateway analyze https://api.example.com/openapi.json
# Generate MCP server from database
mcp-gateway analyze --sql "postgresql://localhost/mydb"
# Start the generated MCP server
mcp-gateway serve --config gateway-config.json
Pros
- ✅ Automates MCP server creation from existing APIs
- ✅ No manual tool definition coding
- ✅ Supports both OpenAPI and SQL sources
- ✅ Reduces integration time significantly
Cons
- ❌ Generated tools may need refinement for complex use cases
- ❌ Quality depends on OpenAPI spec completeness
- ❌ May not handle all edge cases of custom APIs
When to Use
- You have existing APIs you want to expose to AI agents
- You need to quickly create MCP servers from OpenAPI specs
- You want to expose databases to AI agents without custom code
