How to Convert Any OpenAPI / Swagger Spec into MCP, OpenAI & Claude Tools in 3 Seconds
Every time you wire an AI agent up to a third-party REST API - Stripe, Notion, Linear, internal microservices - you run into the exact same boilerplate wall:
- Nested
$refhell: Real-world OpenAPI 3.x and Swagger 2.0 specs bury request bodies and parameter types 4-6 levels deep inside#/components/schemas/...(often with circular self-references that crash naive scripts). - Incompatible tool schema dialects: OpenAI expects
{type: "function", function: {name, parameters}}, Anthropic Claude expects{name, input_schema}, and MCP expects{name, description, inputSchema}- plus strict^[a-zA-Z0-9_-]{1,64}$tool naming rules. - Agents also need docs, not just schemas: Tool schemas alone rarely explain rate limits, response codes, or workflow caveats, so your RAG index still needs clean Markdown endpoint documentation.
To eliminate that glue code, I built a deterministic 512 MB serverless converter that turns any JSON/YAML OpenAPI or Swagger spec into all three tool formats plus RAG-ready Markdown in one pass - and paired it with an incremental RSS/Changelog RAG monitor so your agent stays up to date automatically.
Recursive $ref Resolution Without Infinite Loops
Before emitting tool schemas, the converter tracks a per-branch seen set of JSON Pointers (#/components/schemas/...):
- Resolves
parameters,requestBody(application/json), and Swagger 2.0in: bodypayloads cleanly; - Preserves
requiredfields, property descriptions, andenum/typehints while halting gracefully on recursive schema graphs; - Generates deterministic, collision-free snake_case
toolNameidentifiers guaranteed to pass OpenAI, Claude, and MCP validation; - Computes a SHA-256
endpointHashper endpoint so CI/CD pipelines can detect breaking API schema changes automatically.
Verified Cloud Benchmark (petstore3.swagger.io, 512 MB container):
- 19 endpoints converted in ~3 seconds (
$0.00015underlying compute) - Zero LLM API calls, zero browser overhead
Try it live on Apify ($0.001 / endpoint): OpenAPI & Swagger to MCP Tools + RAG Chunks
Keeping Agent Knowledge Fresh via Incremental RSS & Changelog Sync
API schemas rarely change alone - SDK release notes, deprecation notices, and engineering blogs ship via RSS / Atom feeds (including every GitHub repository's /releases.atom feed). Instead of re-ingesting an entire feed every day:
- Pass any RSS/Atom URL - or a regular blog URL (it auto-discovers
<link rel="alternate">feeds); - Store seen entry IDs automatically in a named Apify Key-Value Store (
seenStoreName); - Previously seen items are skipped with
$0event charge, and newly published releases can trigger instant Slack, Discord, n8n, or Zapier webhooks.
Try the companion feed monitor ($0.001 / new item, $0 on seen items): RSS, Atom & Changelog to RAG Markdown
Connect All 5 Tools in Python or MCP
All runnable Python scripts (docs-to-rag-chunks, geo-readiness-auditor, webpage-diff-monitor, openapi-to-mcp-and-rag, and rss-feed-to-rag) plus a single Claude Desktop / Cursor MCP config are open-sourced here:
- GitHub Starter Kit (Python & MCP examples): https://github.com/onlywanggg/weiyi-ai-apify-starter
- Full Tool Stack on Apify Store: https://apify.com/weiyi-ai
- Updates on X: https://x.com/weiyi_ai
Comments
No comments yet. Start the discussion.