For developers · Model Context Protocol

BaZi MCP Server for AI Agents

Connect Claude, ChatGPT, Cursor or any MCP client to the deterministic BaZi engine behind BaZi Lab: charts corrected to true solar time, ten-year luck pillars, a year-by-year 0-100 trajectory, the Chinese almanac and compatibility scoring. Every number comes from calendar code, never from a memory guess.

https://www.bazi-lab.com/mcp

Works with Claude · ChatGPT · Cursor · any MCP-compatible client

The MCP bridge is open source (MIT): github.com/Zsmboom/bazi-lab-mcp

Add the server in under a minute

Claude (desktop, web and mobile)

  1. Open Settings → Connectors
  2. Choose "Add custom connector"
  3. Paste the server URL and save
  4. Ask Claude to cast a BaZi chart for a birth date and place

ChatGPT

  1. Enable Developer mode under Settings → Apps & Connectors
  2. Add a custom connector with the same server URL
  3. Ask ChatGPT to calculate a BaZi chart or look up the almanac

Cursor and other MCP clients

  1. Add a remote MCP server pointing at the same server URL
  2. For stdio-only clients, wrap it with npx mcp-remote

The six tools

All tools are read-only and deterministic: same input, same output, no model in the loop. Birth data is accepted as structured JSON, in solar or lunar calendar.

ToolWhat it returnsInputOutput
calculate_chartCalculate chart. Four pillars with ten gods, day master element and the true solar time correction.gender, birth date and time, solar/lunar, birthplace or timezonefour pillars, ten gods, day master, zodiac, corrected time
luck_pillarsLuck pillars. Ten 10-year pillars (大运) with direction, start age, favourable elements and peak/trough years.same birth datapillar list with year ranges, day-master strength, best and worst years
life_trajectoryLife trajectory. Year-by-year OHLC candles on a fixed 0-100 scale for roughly 96 years.same birth dataper-year open/high/low/close scores with ganZhi
match_compatibilityCompatibility. 0-100 love score from year-branch relations and the two day masters.two birth datasetsscore, relations named, strengths, challenges, advice
get_almanacAlmanac. Chinese almanac (黄历): day pillar, lunar date, do/avoid lists, activity matching.start date, 1-31 days, optional activity termper-day yi/ji lists with match verdict
search_knowledgeKnowledge search. BM25 search over BaZi Lab bilingual guides and blog articles.query, locale (en/zh)ranked excerpts with absolute page URLs

Example call

{
  "name": "calculate_chart",
  "arguments": {
    "birth": {
      "gender": "male",
      "calendarType": "solar",
      "birthYear": 1990, "birthMonth": 6, "birthDay": 15,
      "birthHour": 10, "birthMinute": 30,
      "location": "Beijing", "country": "CN"
    }
  }
}

Every response also carries a source object with the canonical page for the topic, so the answers can be verified on the site.

BaZi MCP Server card: six deterministic tools served over streamable HTTP with true solar time
Six deterministic tools over one remote endpoint — the same engine as the site calculator.

Why this engine is worth connecting to

True solar time, not clock time

The hour pillar is corrected from the birthplace legal clock time to local solar time: legal UTC offset (including historical DST such as China 1986-1991) plus longitude × 4 minutes. Details on the true solar time page.

Calendar rules, not guesses

The year turns at 立春, months turn at exact solar-term moments, and luck-pillar direction and start age come from gender and year-stem polarity — the rules generic models get wrong when they compute from memory.

Deterministic 0-100 scoring

The life trajectory scores each year from its twelve flow months with a pure function on a fixed 0-100 scale, so two charts are directly comparable. See the luck pillars page for a live example.

One engine everywhere

The website calculator, the on-site BaZi Agent and this MCP server all call the same engine — what you verify through MCP is what the site serves.

Background reading: true solar time · luck pillars and the 0-100 curve · a chart read pillar by pillar

Free, read-only, nothing stored

No API key and no signup; fair-use rate limits apply per IP. The server is read-only: birth data sent in a tool call is used to compute the response and is not persisted, and the server cannot write data or spend credits — saved charts, monthly reports and sharing stay on the website.

Frequently asked questions

Is the BaZi MCP server free?

Yes. There is no API key and no signup: add the server URL to Claude, ChatGPT or Cursor and call the tools. Fair-use rate limits apply per IP, and the six tools run on the same deterministic engine as the free website calculator.

What does "true solar time" mean on this server?

Birth hours are corrected from the legal clock time of the birthplace to local solar time: the legal UTC offset (including historical daylight saving, for example China 1986-1991) plus longitude × 4 minutes. This is the same correction our website applies and documents, and it is where most memory-based AI calculations go wrong.

Which tools are included?

Six read-only tools: calculate_chart (four pillars with ten gods), luck_pillars (ten 10-year pillars with favourable elements), life_trajectory (year-by-year OHLC on a fixed 0-100 scale), match_compatibility (0-100 love score), get_almanac (Chinese almanac with do/avoid lists) and search_knowledge (BM25 search over our bilingual guides).

Does the server store birth data?

No. Birth data sent in a tool call is used to compute the response and is not persisted. There is no account, no database write and no per-user state on this endpoint; the only counter kept is an anonymous per-IP rate limit.

Can the MCP server generate the paid monthly reports?

No, by design. Reports and their credit system stay on the website; the MCP tools are read-only and deterministic, and nothing on this server can write data or spend credits. If a conversation needs a report, the client should send the user to the website.

How accurate is it compared with asking an LLM directly?

LLMs asked from memory regularly pick the wrong month pillar (solar terms), the wrong year boundary (立春, not Chinese New Year) and skip true solar time. This server computes all of that with calendar code and returns structured results, so the model only interprets — it never calculates.

Prefer a human interface?

The same engine also runs as a free website calculator and an on-site agent:

BaZi calculator · luck pillars curve · love compatibility · daily almanac