OpenAPI to MCP Server: Connect Any API to Claude
Generate MCP servers from OpenAPI specs with mcp-gen CLI. When to use native vs generated MCP.
Any REST API with an OpenAPI spec can now become an MCP server in under a minute using mcp-gen. This means your AI assistant can call arbitrary APIs as tools without custom integration code. For search APIs specifically, the choice is between generated MCP wrappers and native MCP servers that handle auth, pagination, and error recovery out of the box.
How mcp-gen works
The mcp-gen CLI reads an OpenAPI 3.x spec (JSON or YAML), maps each endpoint to an MCP tool definition, generates type-safe parameter schemas from the spec, and outputs a runnable MCP server. One command turns a 50-endpoint API into 50 callable tools. The generated server handles JSON serialization, parameter validation, and HTTP transport automatically.
# Install mcp-gen
npm install -g mcp-gen
# Generate MCP server from any OpenAPI spec
mcp-gen --spec https://api.example.com/openapi.json --output ./my-mcp-server
# Run the generated server
cd my-mcp-server && npm startWhen generated MCP makes sense
Generated servers are ideal for internal APIs, niche SaaS tools, and any service that does not offer a native MCP server. If you have a proprietary inventory API, a custom CRM, or an internal analytics service with an OpenAPI spec, mcp-gen gives your assistant access in minutes. The generated code is readable and editable, so you can add custom logic after generation.
When native MCP is better
Native MCP servers are built specifically for the MCP protocol and optimize for the assistant experience. They handle authentication flows, rate limiting, pagination, retries, and error messages designed for LLM consumption. A generated wrapper passes through raw HTTP errors; a native server translates them into actionable tool responses.
Scavio native MCP vs generated
Scavio provides a native MCP server at mcp.scavio.dev/mcp. It exposes search, shopping, social, and video tools with optimized response shapes. You could also generate an MCP server from the Scavio OpenAPI spec, but the native server handles streaming, result truncation for context windows, and structured error messages that the generated version would not include.
{
"mcpServers": {
"scavio-native": {
"type": "sse",
"url": "https://mcp.scavio.dev/mcp",
"headers": { "x-api-key": "YOUR_KEY" }
},
"internal-api": {
"command": "node",
"args": ["./generated-mcp-servers/internal-api/index.js"],
"env": { "API_BASE": "https://internal.company.com" }
}
}
}Hybrid config: native + generated
The practical setup is native MCP for services that offer it (Scavio, GitHub, Slack, Notion) and generated MCP for everything else. Your .mcp.json ends up with a mix of SSE-based native servers and stdio-based generated servers. The assistant sees all of them as equal tools and picks the right one per task.
Generating from the Scavio OpenAPI spec
If you want to customize the Scavio MCP tools (add caching, filter platforms, limit response size), you can generate from the spec and modify the output.
# Generate from Scavio OpenAPI spec
mcp-gen --spec https://api.scavio.dev/openapi.json --output ./scavio-custom-mcp
# Edit the generated tools to add caching, filtering, etc.
# Then run alongside the native server for comparisonPractical guidance
Start with native MCP servers for your core tools. Use mcp-gen for internal APIs and niche services. Do not generate wrappers for APIs that already have native MCP servers unless you need custom behavior. The generated server is a starting point, not a finished product. Add retry logic, response trimming, and error translation for production use. The combination of native and generated MCP servers gives your assistant access to your entire tool ecosystem without writing integration code for each service.
Cost comparison
Generated MCP servers are free to create and run locally. The cost is the underlying API calls. For Scavio, that is $0.005 per credit whether you use the native MCP server or a generated wrapper. The native server saves you maintenance time; the generated server gives you customization freedom. Both hit the same API at the same price.