<?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: Martin Liu</title>
    <description>The latest articles on DEV Community by Martin Liu (@martinliu).</description>
    <link>https://dev.to/martinliu</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%2F333968%2F37c889a0-fd7a-44b8-9016-76c5300f6362.jpeg</url>
      <title>DEV Community: Martin Liu</title>
      <link>https://dev.to/martinliu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/martinliu"/>
    <language>en</language>
    <item>
      <title>How we exposed our docs as a grounded MCP server (Cloudflare AI Search + a stateless Worker)</title>
      <dc:creator>Martin Liu</dc:creator>
      <pubDate>Tue, 13 Oct 2026 03:39:33 +0000</pubDate>
      <link>https://dev.to/martinliu/how-we-exposed-our-docs-as-a-grounded-mcp-server-cloudflare-ai-search-a-stateless-worker-479i</link>
      <guid>https://dev.to/martinliu/how-we-exposed-our-docs-as-a-grounded-mcp-server-cloudflare-ai-search-a-stateless-worker-479i</guid>
      <description>&lt;p&gt;LLMs hallucinate most confidently about exactly the domain we publish on — Chinese&lt;br&gt;
licenses, store policies, cloud partitions. I run chinaready.co, an editorial site&lt;br&gt;
about China market entry for Western software teams (full disclosure: it's my site;&lt;br&gt;
the server below is free and MIT-licensed, no account needed). This post documents&lt;br&gt;
how we turned that corpus into a public MCP server anyone can add to their AI&lt;br&gt;
client — and the protocol and platform quirks we hit along the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we built
&lt;/h2&gt;

&lt;p&gt;An endpoint your MCP client can use right now:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://mcp.chinaready.co/mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Three read-only tools:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;search&lt;/td&gt;
&lt;td&gt;Hybrid (BM25 + vector) search; ranked excerpts, each with its absolute source URL&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;list_topics&lt;/td&gt;
&lt;td&gt;Topic catalog with example queries and hub pages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;get_article&lt;/td&gt;
&lt;td&gt;Any site page as clean Markdown&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;I verified the flow end-to-end in Cursor and opencode: exact terms like "B25"&lt;br&gt;
(the ICP license threshold) land on the right article, answers carry full&lt;br&gt;
chinaready.co URLs to cite.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F09kbs56i2ajnl3npx3s8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F09kbs56i2ajnl3npx3s8.png" alt="Ask question in OpenCode" width="800" height="674"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjutmhp9cyi68fef7gu3h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjutmhp9cyi68fef7gu3h.png" alt="Ask question in Cursor" width="800" height="528"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Install snippets are on our docs page (Cursor and VS Code have working one-click&lt;br&gt;
links): &lt;a href="https://chinaready.co/docs/api/" rel="noopener noreferrer"&gt;https://chinaready.co/docs/api/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Retrieval: why hybrid matters
&lt;/h2&gt;

&lt;p&gt;The corpus is ~2,700 chunks extracted at build time from published guides&lt;br&gt;
(legal pages and forms excluded). Retrieval runs on Cloudflare AI Search&lt;br&gt;
(&lt;a href="https://developers.cloudflare.com/ai-search/" rel="noopener noreferrer"&gt;https://developers.cloudflare.com/ai-search/&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;We started vector-only. That misses exact terms — a query for "B25" (a specific&lt;br&gt;
license threshold) returned semantically-near-but-wrong articles. Switching the&lt;br&gt;
index to hybrid (BM25 keyword + vector, RRF fusion) made exact-term queries land&lt;br&gt;
first try. If your corpus has codes, product names, or policy numbers, hybrid&lt;br&gt;
is not optional.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The MCP layer: a stateless Worker, no SDK
&lt;/h2&gt;

&lt;p&gt;Cloudflare AI Search hosts an MCP endpoint itself, but it couldn't give us two&lt;br&gt;
things some clients and directories expect: tool annotations (&lt;code&gt;readOnlyHint&lt;/code&gt;,&lt;br&gt;
&lt;code&gt;title&lt;/code&gt;) and a branded &lt;code&gt;serverInfo.name&lt;/code&gt; (it reports "Cloudflare AI Search").&lt;/p&gt;

&lt;p&gt;So the public endpoint is a thin wrapper — a stateless Cloudflare Worker&lt;br&gt;
implementing Streamable HTTP JSON-RPC directly (initialize / tools/list /&lt;br&gt;
tools/call), about 300 lines, no SDK and no session state:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://github.com/chinaready/mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Stateless JSON responses (no SSE stream) turned out to be fine for every client&lt;br&gt;
we tested; the MCP spec allows both.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Tool design for citations
&lt;/h2&gt;

&lt;p&gt;The rule we settled on: every machine-readable result carries a human-checkable&lt;br&gt;
absolute URL. &lt;code&gt;search&lt;/code&gt; dedupes chunks to article level and prints title + URL +&lt;br&gt;
relevance + snippet; &lt;code&gt;get_article&lt;/code&gt; returns Markdown negotiated via&lt;br&gt;
&lt;code&gt;Accept: text/markdown&lt;/code&gt; (with an HTML-stripping fallback for subrequests that&lt;br&gt;
skip the converter).&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Discovery surfaces
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;llms.txt with the endpoints: &lt;a href="https://chinaready.co/llms.txt" rel="noopener noreferrer"&gt;https://chinaready.co/llms.txt&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;MCP server card: /.well-known/mcp/server-card.json&lt;/li&gt;
&lt;li&gt;OpenAPI 3.1 for the REST side: /openapi.json&lt;/li&gt;
&lt;li&gt;A plain REST search endpoint for agents that don't speak MCP:
&lt;a href="https://search.chinaready.co/search" rel="noopener noreferrer"&gt;https://search.chinaready.co/search&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Gotchas (the honest list)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Every configuration PUT on AI Search triggers a full corpus re-index — batch
your config changes.&lt;/li&gt;
&lt;li&gt;The hosted endpoint's rate limit is aggregate across all callers, not per-IP.&lt;/li&gt;
&lt;li&gt;The hosted MCP endpoint can't emit tool annotations; if you need them, you're
writing a wrapper too.&lt;/li&gt;
&lt;li&gt;Worker subrequests to your own zone may not get the zone's Markdown converter —
keep a fallback.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The wrapper is MIT and makes a decent template if you want to expose your own&lt;br&gt;
docs the same way. Questions and PRs welcome.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>cloudflarechallenge</category>
      <category>tutorial</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
