Skip to main content
Glama
bazi-lab-mcp

bazi-lab-mcp

by Zsmboom

bazi-lab-mcp

MCP server for accurate BaZi (Four Pillars of Destiny) — bridges Claude, ChatGPT, Cursor and other MCP clients to the free, deterministic engine hosted at bazi-lab.com.

This process stores nothing and calls no AI model. It is a thin stdio bridge: every tool call is forwarded to the hosted engine, which computes with calendar code and returns structured JSON. Results carry a source attribution with canonical page URLs so any answer can be verified on the site.

Why not let the LLM compute BaZi?

LLMs asked from memory reliably get BaZi wrong: the month pillar turns at exact solar-term moments (not month boundaries), the year turns at 立春 (not Chinese New Year), and the hour pillar must be corrected to the birthplace's true solar time — legal UTC offset including historical daylight saving (China used DST in 1986–1991) plus longitude × 4 minutes. This server does all of that with calendar code, so the model only interprets — it never calculates.

Related MCP server: ming-metaphysics-mcp

Tools

Tool

What it returns

calculate_chart

Four pillars with ten gods, day master element, zodiac, true-solar-time correction

luck_pillars

Ten 10-year pillars (大运) with direction, start age, favourable elements, best/worst years

life_trajectory

Year-by-year OHLC candles on a fixed 0–100 scale for ~96 years (comparable across people)

match_compatibility

0–100 love score from year-branch relations and the two day masters

get_almanac

Chinese almanac (黄历): day pillar, lunar date, do (宜) / avoid (忌) lists, activity matching

search_knowledge

BM25 search over BaZi Lab's bilingual guides, returning excerpts with page URLs

Setup

Hosted (recommended, no install) — point any client that supports remote MCP at:

https://www.bazi-lab.com/mcp
  • Claude (desktop, web, mobile): Settings → Connectors → Add custom connector → paste the URL.

  • ChatGPT: enable Developer mode under Settings → Apps & Connectors → add the URL as a connector.

  • Cursor / other remote-capable clients: add a remote MCP server with the URL.

stdio via this package — for clients that only support local servers:

{
  "mcpServers": {
    "bazi-lab": {
      "command": "npx",
      "args": ["-y", "bazi-lab-mcp"]
    }
  }
}

Claude Code: claude mcp add bazi-lab -- npx bazi-lab-mcp

Environment: set BAZI_MCP_URL to override the hosted endpoint (defaults to https://www.bazi-lab.com/mcp; useful for tests).

Privacy & fair use

  • No API key, no signup, no account.

  • Birth data sent to a tool call is used to compute the response and is not persisted.

  • Fair-use rate limits apply per IP: 30 requests/minute and 600/day (one tool call ≈ 2–3 requests through this bridge). The server is read-only — it cannot write data or spend credits. Reports, saved charts and sharing live on the website.

Accuracy notes

  • Hour pillar: corrected from the birthplace legal clock time to local solar time (legal UTC offset + longitude × 4 minutes). Historical DST is included — a June-1990 Beijing birth is corrected by UTC+9, not UTC+8.

  • Year pillar turns at 立春, months at exact solar-term moments.

  • The 0–100 trajectory is a pure function of the twelve flow months of each year: same input, same output, two charts are directly comparable.

  • Pass longitude (and country) whenever known — without them the engine falls back to 120°E and the nominal timezone, which shifts the true solar time by minutes (the four pillars usually stay the same).

Development

npm install
npm run build   # tsc -> dist/
npm test        # stdio smoke test (initialize + tools/list, no network)
node test/live-check.mjs   # optional: one real call through the hosted engine

BAZI_MCP_URL points the bridge elsewhere for local testing.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides professional Chinese astrology calculations including Four Pillars, Five Elements, zodiac signs, and lunar calendar details. It allows users to perform accurate Bazi analysis with global timezone support directly within MCP-compatible clients.
      15 npm
      10
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Provides five Chinese metaphysics engines (BaZi, QMDJ, ZWDS, Feng Shui, I Ching) as MCP tools for analysis and forecasting.
      6
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      MCP server for computing BaZi (Four Pillars) charts. Supports Gregorian, lunar, or direct Four Pillars input, with optional true solar time correction, and outputs strength, pattern, and useful god.
      1
      1
      Apache 2.0
    • A
      license
      A
      quality
      D
      maintenance
      Enables users to compute a full Chinese Bazi (Four Pillars of Destiny) chart from a birth date, time, and place, with True Solar Time correction and historical daylight saving adjustments, running fully offline via MCP.
      2
      53 npm
      MIT