<?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>Forem: JasonG90</title>
    <description>The latest articles on Forem by JasonG90 (@jasonwagaobit).</description>
    <link>https://forem.com/jasonwagaobit</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3895584%2F9ea9c546-54d1-403f-9bc2-29d6aea688c5.jpg</url>
      <title>Forem: JasonG90</title>
      <link>https://forem.com/jasonwagaobit</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jasonwagaobit"/>
    <language>en</language>
    <item>
      <title>Monetizing 6 Ancient Chinese Divination APIs with x402 (MCP + USDC on Base)</title>
      <dc:creator>JasonG90</dc:creator>
      <pubDate>Mon, 27 Apr 2026 07:53:41 +0000</pubDate>
      <link>https://forem.com/jasonwagaobit/monetizing-6-ancient-chinese-divination-apis-with-x402-mcp-usdc-on-base-aid</link>
      <guid>https://forem.com/jasonwagaobit/monetizing-6-ancient-chinese-divination-apis-with-x402-mcp-usdc-on-base-aid</guid>
      <description>&lt;h2&gt;
  
  
  Why an MCP server for fortune-telling?
&lt;/h2&gt;

&lt;p&gt;I'm not joking. Hear me out.&lt;/p&gt;

&lt;p&gt;The Chinese divination corpus is &lt;strong&gt;deterministic computation&lt;/strong&gt; dressed up as mysticism. BaZi (八字) is a date conversion problem — given a Gregorian datetime, derive the four ganzhi pillars considering solar terms, true solar time, and timezone offsets. ZiWei (紫微斗数) takes those four pillars and runs a 12-palace placement algorithm with three layers of star transformations. None of this is "AI-able" — LLMs hallucinate the day pillar when crossing midnight, mix up shen-sha (神煞) names, and silently apply the wrong solar-term cutoff. Every engineer who has tried to put BaZi inside a system prompt has felt this pain.&lt;/p&gt;

&lt;p&gt;So I built it the boring way: 7 FastAPI endpoints with &lt;strong&gt;rule-based engines under each route&lt;/strong&gt;, exposed via MCP for agents and via x402 for monetization.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 7 endpoints
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Route&lt;/th&gt;
&lt;th&gt;Price&lt;/th&gt;
&lt;th&gt;What it computes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/bazi-matching&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;$0.02&lt;/td&gt;
&lt;td&gt;Compatibility score between two birth charts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/bazi-daily-fortune&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;$0.005&lt;/td&gt;
&lt;td&gt;Daily fortune for a person&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/qimen-timing&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;$0.05&lt;/td&gt;
&lt;td&gt;Auspicious time selection (Qi-Men Dun-Jia)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/ziwei-chart&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;$0.03&lt;/td&gt;
&lt;td&gt;Purple Star Astrology — 12 palaces + sihua + daxian&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/meihua-oracle&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;$0.01&lt;/td&gt;
&lt;td&gt;Plum Blossom divination from numbers/time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/liuyao-yijing&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;$0.02&lt;/td&gt;
&lt;td&gt;I-Ching with Najia (六亲六神) annotation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/liuren-daliuren&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;$0.03&lt;/td&gt;
&lt;td&gt;Da LiuRen 4-classes 3-transmissions&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The first 3 calls per unique UA are free, so you can play without paying.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why x402 is the right fit
&lt;/h2&gt;

&lt;p&gt;Traditional API gateways assume:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A monthly subscription tier&lt;/li&gt;
&lt;li&gt;A signup + KYC flow&lt;/li&gt;
&lt;li&gt;An API key to provision&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For an MCP server consumed by an autonomous agent, none of that fits. The agent doesn't have a credit card, doesn't want a 2-week free trial, and may need to call this once a quarter when a user asks about a specific date.&lt;/p&gt;

&lt;p&gt;x402 (Coinbase's payment-required HTTP standard, USDC-on-Base) gives you a &lt;strong&gt;per-call, no-account, &amp;lt; $0.05 settlement&lt;/strong&gt; primitive. The flow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Client → GET /bazi-matching?...
2. Server → 402 Payment Required + price + receiving address
3. Client → re-GET with X-PAYMENT header (signed USDC transfer)
4. Server → verifies on-chain → 200 with result
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This whole dance is &lt;strong&gt;wrapped by the MCP TS SDK&lt;/strong&gt; so the agent author doesn't see it — they just &lt;code&gt;npx -y xuanxue-bazi-matching&lt;/code&gt; and provide an &lt;code&gt;XUANXUE_PAYMENT_TOKEN&lt;/code&gt; env var.&lt;/p&gt;

&lt;h2&gt;
  
  
  Engineering edge cases (this is where I learned the most)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. The day-pillar boundary
&lt;/h3&gt;

&lt;p&gt;BaZi day pillars roll over at &lt;strong&gt;23:00 local true solar time&lt;/strong&gt;, not midnight. If a client says "I was born at 23:30 on April 15" and provides their longitude, the engine has to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Compute true solar time offset (equation of time + longitude correction)&lt;/li&gt;
&lt;li&gt;Decide whether 23:30 is "late April 15" or "early April 16 子时"&lt;/li&gt;
&lt;li&gt;Pick the right day pillar accordingly&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Get this wrong by 30 minutes and the entire chart shifts. We solved it by computing TST upfront and having a single canonical &lt;code&gt;effective_datetime&lt;/code&gt; propagate through all 4 pillar derivations.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Solar terms (节气)
&lt;/h3&gt;

&lt;p&gt;The boundary for the &lt;strong&gt;month pillar&lt;/strong&gt; is not the Gregorian month, but the 24 solar terms (立春, 雨水, 惊蛰...). These cutoffs vary year to year by hours. We use the VSOP87 short-period truncation (8 harmonic terms) which is good to ~30 seconds of accuracy — overkill for divination but eliminates the "did the month change yet" question entirely.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Leap months in lunar calendar
&lt;/h3&gt;

&lt;p&gt;Some BaZi schools want the lunar month even though the engine uses solar terms. We expose both and let the client pick. The MCP &lt;code&gt;meihua-oracle&lt;/code&gt; endpoint specifically uses lunar month-day-hour for the &lt;strong&gt;upper/lower trigram derivation&lt;/strong&gt;, so we needed a working lunar calendar regardless.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. QiMen Yin/Yang escape (阴阳遁)
&lt;/h3&gt;

&lt;p&gt;The Qi-Men Dun-Jia engine alternates between Yang escape (winter solstice → summer solstice) and Yin escape. There's a special exception during the 5-day "transition" near the solstices where some schools use the previous escape and some use the next. We implement the &lt;strong&gt;拆补法 (chai-bu-fa)&lt;/strong&gt; consistently — same school for the entire engine — to avoid silent regressions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's open vs. paid
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Calculation rules&lt;/strong&gt;: open (the npm package contains the rule engines, MIT license)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Aggregation, hosted endpoint, x402 settlement, MCP transport&lt;/strong&gt;: paid&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This split lets agent authors verify "no LLM in here" and even run their own instance for free if they want — the hosted version is just convenience + payment routing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;For agents:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; xuanxue-bazi-matching
&lt;span class="c"&gt;# then in your Claude Desktop config:&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"mcpServers"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"xuanxue"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="s2"&gt;"command"&lt;/span&gt;: &lt;span class="s2"&gt;"npx"&lt;/span&gt;,
      &lt;span class="s2"&gt;"args"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-y"&lt;/span&gt;, &lt;span class="s2"&gt;"xuanxue-bazi-matching"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For humans wanting a synthesized destiny report (~1000 words integrating all 6 systems): &lt;a href="https://decodeyourming.com" rel="noopener noreferrer"&gt;https://decodeyourming.com&lt;/a&gt; — $1.99 one-time.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Open-sourcing more of the engines&lt;/strong&gt; (currently the binary calculation tables are bundled but not auditable)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;More languages&lt;/strong&gt; — currently zh-CN/zh-TW/en. Vietnamese and Korean asked for.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Western astrology compatibility layer&lt;/strong&gt; — common requests, but the natal-chart math is a different rabbit hole. PRs welcome if anyone has a deterministic Western engine.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;If you're building an agent that touches dates, timing, or compatibility — this is a useful primitive. And if you find a calculation bug, please file an issue. I'd rather get a "your shensha is wrong" GitHub report than ship the wrong thing.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/jasonwagao-bit/m2m" rel="noopener noreferrer"&gt;https://github.com/jasonwagao-bit/m2m&lt;/a&gt;&lt;br&gt;
Docs: &lt;a href="https://api.decodeyourming.com/docs/agents" rel="noopener noreferrer"&gt;https://api.decodeyourming.com/docs/agents&lt;/a&gt;&lt;br&gt;
NPM: &lt;a href="https://www.npmjs.com/package/xuanxue-bazi-matching" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/xuanxue-bazi-matching&lt;/a&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>x402</category>
      <category>api</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Building a Deterministic Divination API for AI Agents with x402</title>
      <dc:creator>JasonG90</dc:creator>
      <pubDate>Fri, 24 Apr 2026 08:04:42 +0000</pubDate>
      <link>https://forem.com/jasonwagaobit/building-a-deterministic-divination-api-for-ai-agents-with-x402-4inb</link>
      <guid>https://forem.com/jasonwagaobit/building-a-deterministic-divination-api-for-ai-agents-with-x402-4inb</guid>
      <description>&lt;h2&gt;
  
  
  Why Deterministic?
&lt;/h2&gt;

&lt;p&gt;Most "AI fortune-telling" products layer an LLM on top of some birth data and ask it to "interpret" the chart. That sounds powerful until you notice the same query returns different answers on Tuesday vs Thursday. For an autonomous agent making decisions — scheduling a product launch, advising a user on timing — non-determinism is a bug, not a feature.&lt;/p&gt;

&lt;p&gt;BaZi (八字, Eight Characters) is a Chinese metaphysics system that encodes a person's birth year, month, day, and hour into four "pillars," each representing a Heavenly Stem and Earthly Branch. The compatibility and day-flow calculations are fully rule-based: given the same inputs, the output is always identical. No LLM needed.&lt;/p&gt;

&lt;p&gt;That makes it a perfect fit for agents: testable, auditable, and predictable cost.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Backend&lt;/strong&gt;: Python rule engine. No neural net — just ~3000 lines of classical BaZi rules encoded as lookup tables and interaction matrices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API layer&lt;/strong&gt;: FastAPI on Render, deployed at &lt;code&gt;api.decodeyourming.com&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Payment&lt;/strong&gt;: &lt;a href="https://x402.org" rel="noopener noreferrer"&gt;x402 protocol&lt;/a&gt; — HTTP 402 challenges resolved with USDC on Base. Agents pay per call, no account required.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MCP server&lt;/strong&gt;: TypeScript stdio server wrapping the seven endpoints. Distributed via npm.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The Two Endpoints
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;POST /agents/v1/bazi-matching&lt;/code&gt; — $0.02/call
&lt;/h3&gt;

&lt;p&gt;Takes two birth charts, returns:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"score"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;78&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"elements_balance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"wood"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.28&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"fire"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.18&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"earth"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.22&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"metal"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.17&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"water"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.15&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"narrative"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Strong day-pillar resonance between the two charts..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"strengths"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"complementary water-fire dynamic"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"challenges"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"competing fire energy in month pillars"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"recommendations"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"schedule key decisions on water days"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;POST /agents/v1/bazi-daily-fortune&lt;/code&gt; — $0.005/call
&lt;/h3&gt;

&lt;p&gt;Takes one birth chart + a target date, returns:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"luck_score"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;82&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"dominant_element"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"wood"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"favorable_activities"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"negotiation"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"creative work"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"unfavorable_activities"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"surgery"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"major financial moves"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"timing_advice"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Morning hours amplify wood energy..."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  The Python Rule Engine
&lt;/h2&gt;

&lt;p&gt;The core compatibility function looks like this (simplified):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;compute_compatibility&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chart_a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;BaziChart&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;chart_b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;BaziChart&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;CompatibilityResult&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;

    &lt;span class="c1"&gt;# Day-pillar resonance (highest weight: 35%)
&lt;/span&gt;    &lt;span class="n"&gt;dp_harmony&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;DAY_PILLAR_HARMONY_TABLE&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;chart_a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;day_stem&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;chart_b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;day_stem&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;dp_harmony&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.35&lt;/span&gt;

    &lt;span class="c1"&gt;# Five-elements balance (25%)
&lt;/span&gt;    &lt;span class="n"&gt;balance_a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;chart_a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;element_distribution&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;balance_b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;chart_b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;element_distribution&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;complement_score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;element_complement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;balance_a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;balance_b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;complement_score&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.25&lt;/span&gt;

    &lt;span class="c1"&gt;# Ten-Gods interaction (20%)
&lt;/span&gt;    &lt;span class="n"&gt;tg_score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;ten_gods_interaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chart_a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ten_gods&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;chart_b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ten_gods&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;tg_score&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.20&lt;/span&gt;

    &lt;span class="c1"&gt;# ... remaining rules ...
&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;CompatibilityResult&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;...)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No LLM call. No prompt injection surface. Same inputs → same output every time.&lt;/p&gt;




&lt;h2&gt;
  
  
  x402 Middleware
&lt;/h2&gt;

&lt;p&gt;The payment middleware intercepts requests before they hit the business logic:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;x402.middleware&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;X402Middleware&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add_middleware&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;X402Middleware&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;facilitator_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://x402.org/facilitator&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;endpoints&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/agents/v1/bazi-matching&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;price&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;0.02&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;currency&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;USDC&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;network&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;base&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/agents/v1/bazi-daily-fortune&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;price&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;0.005&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;currency&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;USDC&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;network&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;base&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="n"&gt;payment_address&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;0xcb99bf3d45d5f8bdeb72d00792fe77dffed2c6de&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If no &lt;code&gt;X-PAYMENT&lt;/code&gt; header, the response is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt; &lt;span class="m"&gt;402&lt;/span&gt; &lt;span class="ne"&gt;Payment Required&lt;/span&gt;
&lt;span class="na"&gt;X-Payment-Challenge&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;eyJ...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent resolves the challenge, retries with the token, and the request goes through. No OAuth, no API key management, no subscription.&lt;/p&gt;




&lt;h2&gt;
  
  
  Claude Desktop Integration
&lt;/h2&gt;

&lt;p&gt;Install the MCP server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"xuanxue-bazi"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"xuanxue-bazi-matching"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"XUANXUE_PAYMENT_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;your x402 payment token&amp;gt;"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude now has two new tools: &lt;code&gt;marriage_compatibility_check&lt;/code&gt; and &lt;code&gt;bazi_daily_fortune&lt;/code&gt;. You can ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Check compatibility between someone born 1990-05-15 10am male and 1993-08-22 2pm female."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Claude calls the tool, gets the JSON, and narrates the result — without ever hallucinating a chart.&lt;/p&gt;




&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Smithery / MCP Registry listing&lt;/strong&gt; — making the server discoverable to all Claude users&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Streamable HTTP transport&lt;/strong&gt; — so agents can connect without local npx&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;More tools&lt;/strong&gt; — Zi Wei Dou Shu (紫微斗数) yearly forecast, Qi Men Dun Jia (奇门遁甲) event timing&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;

&lt;p&gt;3 free calls available to dev.to readers — DM me or open an issue on the &lt;a href="https://github.com/jasonwagao-bit/m2m" rel="noopener noreferrer"&gt;repo&lt;/a&gt; for a payment token.&lt;/p&gt;

&lt;p&gt;Docs: &lt;a href="https://api.decodeyourming.com/docs/agents" rel="noopener noreferrer"&gt;api.decodeyourming.com/docs/agents&lt;/a&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>agents</category>
      <category>blockchain</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
