<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Weiyi Wang</title>
    <description>The latest articles on DEV Community by Weiyi Wang (@weiyi_wang_5fbdb721f38016).</description>
    <link>https://dev.to/weiyi_wang_5fbdb721f38016</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4266181%2F3a62a4b8-e73c-4cf6-b51f-ca9d09d34f7c.png</url>
      <title>DEV Community: Weiyi Wang</title>
      <link>https://dev.to/weiyi_wang_5fbdb721f38016</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/weiyi_wang_5fbdb721f38016"/>
    <language>en</language>
    <item>
      <title>How to Convert Any OpenAPI / Swagger Spec into MCP, OpenAI &amp; Claude Tools in 3 Seconds</title>
      <dc:creator>Weiyi Wang</dc:creator>
      <pubDate>Thu, 26 Nov 2026 13:50:47 +0000</pubDate>
      <link>https://dev.to/weiyi_wang_5fbdb721f38016/how-to-convert-any-openapi-swagger-spec-into-mcp-openai-claude-tools-in-3-seconds-2fke</link>
      <guid>https://dev.to/weiyi_wang_5fbdb721f38016/how-to-convert-any-openapi-swagger-spec-into-mcp-openai-claude-tools-in-3-seconds-2fke</guid>
      <description>&lt;p&gt;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:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Nested &lt;code&gt;$ref&lt;/code&gt; hell&lt;/strong&gt;: Real-world OpenAPI 3.x and Swagger 2.0 specs bury request bodies and parameter types 4–6 levels deep inside &lt;code&gt;#/components/schemas/...&lt;/code&gt; (often with circular self-references that crash naive scripts).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Incompatible tool schema dialects&lt;/strong&gt;: OpenAI expects &lt;code&gt;{type: "function", function: {name, parameters}}&lt;/code&gt;, Anthropic Claude expects &lt;code&gt;{name, input_schema}&lt;/code&gt;, and MCP expects &lt;code&gt;{name, description, inputSchema}&lt;/code&gt;—plus strict &lt;code&gt;^[a-zA-Z0-9_-]{1,64}$&lt;/code&gt; tool naming rules.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agents also need docs, not just schemas&lt;/strong&gt;: Tool schemas alone rarely explain rate limits, response codes, or workflow caveats, so your RAG index still needs clean Markdown endpoint documentation.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To eliminate that glue code, I built a deterministic &lt;strong&gt;512 MB&lt;/strong&gt; serverless converter that turns any JSON/YAML OpenAPI or Swagger spec into &lt;strong&gt;all three tool formats plus RAG-ready Markdown&lt;/strong&gt; in one pass—and paired it with an &lt;strong&gt;incremental RSS/Changelog RAG monitor&lt;/strong&gt; so your agent stays up to date automatically.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Recursive &lt;code&gt;$ref&lt;/code&gt; Resolution Without Infinite Loops
&lt;/h2&gt;

&lt;p&gt;Before emitting tool schemas, the converter tracks a per-branch &lt;code&gt;seen&lt;/code&gt; set of JSON Pointers (&lt;code&gt;#/components/schemas/...&lt;/code&gt;):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Resolves &lt;code&gt;parameters&lt;/code&gt;, &lt;code&gt;requestBody&lt;/code&gt; (&lt;code&gt;application/json&lt;/code&gt;), and Swagger 2.0 &lt;code&gt;in: body&lt;/code&gt; payloads cleanly;&lt;/li&gt;
&lt;li&gt;Preserves required fields, property descriptions, and enum/type hints while halting gracefully on recursive schema graphs;&lt;/li&gt;
&lt;li&gt;Generates deterministic, collision-free snake_case &lt;code&gt;toolName&lt;/code&gt; identifiers guaranteed to pass OpenAI, Claude, and MCP validation;&lt;/li&gt;
&lt;li&gt;Computes a SHA-256 &lt;code&gt;endpointHash&lt;/code&gt; per endpoint so CI/CD pipelines can detect breaking API schema changes automatically.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Verified Cloud Benchmark (&lt;code&gt;petstore3.swagger.io&lt;/code&gt;, 512 MB container)&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;19 endpoints converted in ~3 seconds&lt;/strong&gt; (&lt;code&gt;$0.00015&lt;/code&gt; underlying compute)&lt;/li&gt;
&lt;li&gt;Zero LLM API calls, zero browser overhead&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Try it live on Apify (&lt;code&gt;$0.001 / endpoint&lt;/code&gt;):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://apify.com/weiyi-ai/openapi-to-mcp-and-rag" rel="noopener noreferrer"&gt;OpenAPI &amp;amp; Swagger to MCP Tools + RAG Chunks&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. Keeping Agent Knowledge Fresh via Incremental RSS &amp;amp; Changelog Sync
&lt;/h2&gt;

&lt;p&gt;API schemas rarely change alone—SDK release notes, deprecation notices, and engineering blogs ship via &lt;strong&gt;RSS / Atom feeds&lt;/strong&gt; (including every GitHub repository's &lt;code&gt;/releases.atom&lt;/code&gt; feed).&lt;/p&gt;

&lt;p&gt;Instead of re-ingesting an entire feed every day:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pass any RSS/Atom URL—or a regular blog URL (it auto-discovers &lt;code&gt;&amp;lt;link rel="alternate"&amp;gt;&lt;/code&gt; feeds);&lt;/li&gt;
&lt;li&gt;Store seen entry IDs automatically in a named Apify Key-Value Store (&lt;code&gt;seenStoreName&lt;/code&gt;);&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Previously seen items are skipped with &lt;code&gt;$0&lt;/code&gt; event charge&lt;/strong&gt;, and newly published releases can trigger instant &lt;strong&gt;Slack, Discord, n8n, or Zapier webhooks&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Try the companion feed monitor (&lt;code&gt;$0.001 / new item&lt;/code&gt;, &lt;code&gt;$0&lt;/code&gt; on seen items):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://apify.com/weiyi-ai/rss-feed-to-rag" rel="noopener noreferrer"&gt;RSS, Atom &amp;amp; Changelog to RAG Markdown&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. Connect All 5 Tools in Python or MCP
&lt;/h2&gt;

&lt;p&gt;All runnable Python scripts (&lt;code&gt;docs-to-rag-chunks&lt;/code&gt;, &lt;code&gt;geo-readiness-auditor&lt;/code&gt;, &lt;code&gt;webpage-diff-monitor&lt;/code&gt;, &lt;code&gt;openapi-to-mcp-and-rag&lt;/code&gt;, and &lt;code&gt;rss-feed-to-rag&lt;/code&gt;) plus a single Claude Desktop / Cursor MCP config are open-sourced here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Starter Kit (Python &amp;amp; MCP examples):&lt;/strong&gt; &lt;a href="https://github.com/onlywanggg/weiyi-ai-apify-starter" rel="noopener noreferrer"&gt;https://github.com/onlywanggg/weiyi-ai-apify-starter&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full Tool Stack on Apify Store:&lt;/strong&gt; &lt;a href="https://apify.com/weiyi-ai" rel="noopener noreferrer"&gt;https://apify.com/weiyi-ai&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Updates on X:&lt;/strong&gt; &lt;a href="https://x.com/weiyi_ai" rel="noopener noreferrer"&gt;https://x.com/weiyi_ai&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>openapi</category>
      <category>python</category>
    </item>
    <item>
      <title>Why I Ditched Headless Browsers for Docs-to-RAG Ingestion (10 Pages in 4s, $0.001 Compute)</title>
      <dc:creator>Weiyi Wang</dc:creator>
      <pubDate>Thu, 26 Nov 2026 06:59:19 +0000</pubDate>
      <link>https://dev.to/weiyi_wang_5fbdb721f38016/why-i-ditched-headless-browsers-for-docs-to-rag-ingestion-10-pages-in-4s-0001-compute-4k01</link>
      <guid>https://dev.to/weiyi_wang_5fbdb721f38016/why-i-ditched-headless-browsers-for-docs-to-rag-ingestion-10-pages-in-4s-0001-compute-4k01</guid>
      <description>&lt;p&gt;If you have ever built a production RAG pipeline over external developer docs, you probably hit the same three walls I did:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Headless browser tax&lt;/strong&gt;: Spinning up Playwright/Chromium just to fetch static Docusaurus, Mintlify, or MkDocs documentation takes 45–90 seconds for 10 pages and burns gigabytes of RAM.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Broken Markdown chunking&lt;/strong&gt;: Naive &lt;code&gt;^#&lt;/code&gt; regex splitters mistake &lt;code&gt;# this is a python comment&lt;/code&gt; inside fenced code blocks for H1 headings—splitting code snippets mid-function and dropping language tags (&lt;code&gt;&lt;/code&gt;`&lt;code&gt;python&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wasted re-embedding spend&lt;/strong&gt;: Running a weekly cron job re-scrapes and re-embeds all 500 pages even when only 3 changed.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is the deterministic, zero-browser architecture I built to fix all three—plus two companion tools for &lt;strong&gt;GEO (Generative Engine Optimization)&lt;/strong&gt; audits and &lt;strong&gt;scheduled webpage/pricing diff monitoring&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The Docs-to-RAG Discovery Waterfall (&lt;code&gt;llms.txt&lt;/code&gt; First)
&lt;/h2&gt;

&lt;p&gt;Before touching HTML crawling, check lightweight machine-readable indexes in order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;/llms-full.txt&lt;/code&gt;&lt;/strong&gt;: Many modern doc sites publish their entire documentation as clean Markdown in one HTTP response.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;/llms.txt&lt;/code&gt;&lt;/strong&gt;: Curated Markdown index of doc links.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;/sitemap.xml&lt;/code&gt; / &lt;code&gt;sitemap_index.xml&lt;/code&gt;&lt;/strong&gt; (plus &lt;code&gt;robots.txt&lt;/code&gt; &lt;code&gt;Sitemap:&lt;/code&gt; directives).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prefix-locked link crawl&lt;/strong&gt;: Only as a fallback, staying strictly inside the target docs path prefix.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  2. Framework-Aware DOM Pruning + Code-Safe Chunking
&lt;/h2&gt;

&lt;p&gt;Instead of converting the whole &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; and cleaning up navigation crumbs afterward, target the framework's primary article container first:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Docusaurus (&lt;code&gt;.theme-doc-markdown&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;MkDocs Material (&lt;code&gt;.md-content__inner&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Mintlify (&lt;code&gt;#content-area&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;VitePress (&lt;code&gt;.vp-doc&lt;/code&gt;), GitBook, Nextra, Starlight, Sphinx, ReadMe, Zendesk, Intercom&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two subtle engineering bugs worth watching out for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pygments &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; code blocks&lt;/strong&gt;: Calling &lt;code&gt;el.get_text("\n")&lt;/code&gt; inserts a newline between every highlighted token (&lt;code&gt;import&lt;/code&gt; &lt;code&gt;\n&lt;/code&gt; &lt;code&gt;httpx&lt;/code&gt;). Convert &lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt; tags explicitly and call &lt;code&gt;.get_text()&lt;/code&gt; without separators on the inner &lt;code&gt;&amp;lt;code&amp;gt;&lt;/code&gt; element.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Heading breadcrumbs&lt;/strong&gt;: Prepending &lt;code&gt;Document: Page Title &amp;gt; H2 &amp;gt; H3&lt;/code&gt; to every chunk dramatically improves vector recall when chunks lack standalone context.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Benchmark on a 512 MB container (&lt;code&gt;python-httpx.org&lt;/code&gt;, 10 pages)&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Duration&lt;/strong&gt;: 4 seconds&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Output&lt;/strong&gt;: 179 &lt;code&gt;tiktoken&lt;/code&gt;-bounded chunks&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Underlying compute&lt;/strong&gt;: ~$0.001&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to try it without maintaining your own scrapers (also works as an Apify MCP server for Claude/Cursor):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://apify.com/weiyi-ai/docs-to-rag-chunks" rel="noopener noreferrer"&gt;Docs to RAG Chunks&lt;/a&gt;&lt;/strong&gt; (&lt;code&gt;$0.002/page&lt;/code&gt;, &lt;code&gt;$0&lt;/code&gt; on unchanged pages via &lt;code&gt;previousPageHashes&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. Two Companion Tools for AI Search &amp;amp; Monitoring
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://apify.com/weiyi-ai/geo-readiness-auditor" rel="noopener noreferrer"&gt;GEO &amp;amp; AI Search Readiness Auditor&lt;/a&gt;&lt;/strong&gt; (&lt;code&gt;$0.004/domain&lt;/code&gt;): Scores any website 0–100 across &lt;code&gt;robots.txt&lt;/code&gt; AI crawler permissions (&lt;code&gt;GPTBot&lt;/code&gt;, &lt;code&gt;ClaudeBot&lt;/code&gt;, &lt;code&gt;PerplexityBot&lt;/code&gt;, &lt;code&gt;OAI-SearchBot&lt;/code&gt;), &lt;code&gt;llms.txt&lt;/code&gt;, JSON-LD schemas, SSR extractability, and sitemaps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://apify.com/weiyi-ai/webpage-diff-monitor" rel="noopener noreferrer"&gt;Webpage, Pricing &amp;amp; Policy Diff Monitor&lt;/a&gt;&lt;/strong&gt; (&lt;code&gt;$0.002/check&lt;/code&gt;): Persists cleaned snapshots automatically across scheduled runs, strips dynamic footer noise, extracts added/removed currency prices, and triggers Slack/Discord/n8n webhooks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Full Python examples &amp;amp; MCP config: &lt;a href="https://apify.com/weiyi-ai" rel="noopener noreferrer"&gt;weiyi-ai on Apify&lt;/a&gt; · &lt;a href="https://onlywanggg.github.io/zh/" rel="noopener noreferrer"&gt;Personal Site&lt;/a&gt; · &lt;a href="https://x.com/weiyi_ai" rel="noopener noreferrer"&gt;X (@weiyi_ai)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub Starter Kit (Python &amp;amp; MCP examples):&lt;/strong&gt; &lt;a href="https://github.com/onlywanggg/weiyi-ai-apify-starter" rel="noopener noreferrer"&gt;https://github.com/onlywanggg/weiyi-ai-apify-starter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rag</category>
      <category>python</category>
      <category>llm</category>
    </item>
  </channel>
</rss>
