
bazi-mcp
com.bazi-lab.www/bazi-mcp
Deterministic Chinese BaZi (Four Pillars) astrology MCP server with true solar time correction.
Documentation
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.
🌐 Website: bazi-lab.com — the free calculator, luck-pillars curve and on-site agent behind this engine 📖 Developer docs: bazi-lab.com/developers/mcp
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.
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(andcountry) 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.
Related
- BaZi Lab — the free website calculator, luck-pillars curve and on-site agent
- Developer docs for this server
License
No installation packages available.