Are you the author? Sign in to claim
Give your AI agent the ability to read Chinese Bazi (ๅ ซๅญ) charts โ an open-source MCP server ๐ฎ
๐จ๐ณ ไธญๅฝๅ ซๅญ (Four Pillars of Destiny) ใป ๐ฏ๐ต ๅๆฑๆจๅฝ (ใใกใ ใใใใใ) ใป ๐ฐ๐ท ์ฌ์ฃผํ์ (ๅๆฑๅ ซๅญ)
The calculation engine (and MCP server) behind Shunshi.AI / ้กบๆถ, open-sourced.
๐ฏ๐ต ๆฅๆฌใฎ้็บ่ ใฎๆนใธ: ใใใฏไธญๅฝใฎใๅ ซๅญ (bฤzรฌ)ใโ ๆฅๆฌใง่จใ ๅๆฑๆจๅฝ ใฎ่จ็ฎใจใณใธใณ + MCP ใตใผใใผใงใใ็ๅนดๆๆฅใปๅบ็ๆๅปใปๅบ็ๅฐใใๅๆฑ / ๅ็ฅ / ๅคง้ / ไบ่กใใฉใณในใ่จ็ฎใงใใพใใ็ๅคช้ฝๆ๏ผๅๆๅทฎ๏ผ่ฃๆญฃใซใๅฏพๅฟใใฆใใใAI ใจใผใธใงใณใ (Claude / Cursor / Cline ใชใฉ) ใใ็ดๆฅๅผใณๅบใใพใใ
๐ฐ๐ท ํ๊ตญ ๊ฐ๋ฐ์๋ถ๋ค๊ป: ์ค๊ตญ์ "ๅ ซๅญ (bฤzรฌ)" โ ํ๊ตญ์์๋ ์ฌ์ฃผํ์๋ผ๊ณ ๋ถ๋ฅด๋ ๋ช ๋ฆฌํ์ ๊ณ์ฐ ์์ง + MCP ์๋ฒ์ ๋๋ค. ์๋ ์์ผยท์ถ์์๊ฐยท์ถ์์ง๋ก๋ถํฐ ์ฌ์ฃผ / ์ญ์ฑ / ๋์ด / ์คํ ๊ท ํ์ ๊ณ์ฐํฉ๋๋ค. ์งํ์์ ๋ณด์ ๋ ์ง์ํ๋ฉฐ, AI ์์ด์ ํธ (Claude / Cursor / Cline ๋ฑ) ์์ ๋ฐ๋ก ์ฌ์ฉํ ์ ์์ต๋๋ค.
| Package | What it is | Install |
|---|---|---|
shunshi-bazi-core | Pure TypeScript calculation library. Zero framework deps. Use it from any Node.js / browser app. | npm install shunshi-bazi-core |
shunshi-bazi-mcp | Thin Model Context Protocol server wrapping the core library. Drop-in tool for Claude Desktop / Cursor / Cline / any MCP client. | npx -y shunshi-bazi-mcp |
Both packages share the same calculation engine that powers Shunshi.AI's production backend. Both are parity-tested on every release.
Most existing open-source Bazi libraries (in any language) have at least one of these problems:
shunshi-bazi-core + shunshi-bazi-mcp fix all four:
city or longitude/latitude).sect=1 (23:00 = tomorrow's day pillar), matching ้ฎ็ๅ
ซๅญ.cantian-tymext's calculateRelation() (5/5 on ๅๅฒๅไผ pair-wise subset).npm install shunshi-bazi-core
import { getBaziChart } from 'shunshi-bazi-core';
const chart = getBaziChart({
year: 1990, month: 3, day: 24, hour: 10, minute: 28,
gender: 1, // 0 = ๅฅณ, 1 = ็ท
city: 'ๅนฟๅท', // triggers true solar time correction
});
console.log(chart.ๅ
ซๅญ.ๅๆฑ); // "ๅบๅ ๅทฑๅฏ ๆๅญ ไธๅทณ"
console.log(chart.็ๅคช้ณๆถ?.ไฟฎๆญฃๅ้); // -33.85 (minutes of correction applied)
โ Full API and output reference: packages/bazi-core/README.md
Add this to your MCP config (e.g. claude_desktop_config.json):
{
"mcpServers": {
"shunshi-bazi": {
"command": "npx",
"args": ["-y", "shunshi-bazi-mcp"]
}
}
}
Then restart the client and ask your AI agent in natural language:
"ๅธฎๆ็ฎไธไธ 1990 ๅนด 3 ๆ 24 ๆฅ ไธๅ 10 ็น 28 ๅๅบ็ๅจๅนฟๅท็็ท็็ๅ ซๅญใ"
The server exposes two tools:
getBaziChart โ full Bazi (Four Pillars) chart with true-solar-time correction, ๅคง่ฟ, ๅๅฒๅไผ, ็ฅ็
.getHuangli โ ้ปๅ (่้ปๅ / Chinese almanac) for any day: ๅฎ/ๅฟ, ๅฝญ็ฅ็พๅฟ, ็ฅ็
, ๅปบ้ค, ไบๅๅ
ซๅฎฟ, ๅ็ฅๆนไฝ, 12 ๆถ่พฐๅฎๅฟ. Accepts ๅ
ฌๅ or ๅๅ input; omit the date for today."ไปๅคฉ็้ปๅๅฎๅฟๆฏไปไน๏ผ"
โ Full MCP tool docs, alternate client configs, troubleshooting: packages/bazi-mcp/README.md
bazi-reader-mcp/
โโโ package.json # npm workspace root (private)
โโโ tsconfig.base.json # shared TypeScript config
โโโ LICENSE # MIT
โโโ README.md # you are here
โโโ packages/
โโโ bazi-core/ # โ publishes as "shunshi-bazi-core"
โ โโโ src/
โ โ โโโ index.ts
โ โ โโโ lib/{bazi,relations,shensha,solarTime,cityCache}.ts
โ โโโ tests/{parity,relations-vs-cantian,smoke}.ts
โ โโโ package.json
โ โโโ README.md
โโโ bazi-mcp/ # โ publishes as "shunshi-bazi-mcp"
โโโ src/{mcp,stdio}.ts
โโโ tests/smoke-stdio.ts
โโโ package.json
โโโ README.md
# install deps for both packages
npm install
# build both packages
npm run build
# run bazi-core tests (parity + relations-vs-cantian)
npm test
# run the MCP server locally via tsx (no build required)
npm run dev:mcp
# stdio smoke test for the MCP (spawns the built dist/stdio.js)
cd packages/bazi-mcp && npm run smoke
packages/bazi-core/tests/parity.test.ts โ 5 golden cases hand-labeled from screenshots of ้ฎ็ๅ
ซๅญ, cross-checked against Shunshi.AI's Python backend on ๅๆฑ / ๅ็ฅ / ็ฉบไบก / ็บณ้ณ / ่ๅนฒ.packages/bazi-core/tests/relations-vs-cantian.test.ts โ 5/5 match vs cantian-tymext's calculateRelation() on ๅๅฒๅไผ (pair-wise subset: ๅ / ๅฒ / ๅ / ๅฎณ / ็ ด / ๅ
).packages/bazi-mcp/tests/smoke-stdio.ts โ End-to-end stdio handshake + tools/list + tools/call, asserts the real ๅๆฑ output and the ๆฐๆฎๆฅๆบ attribution block. Uses the real MCP SDK client so it exercises the exact same code path as Claude Desktop.tyme4ts by 6tail โ the TypeScript lunar/solar calendar primitives this library builds on.cantian-ai/bazi-mcp โ pioneering open-source Bazi MCP. We use their cantian-tymext as a dev dependency for relations parity testing. The two MCPs are complementary, not competing โ we made different defaults (sect=1, true solar time on by default) based on what matches professional practice in the Chinese-speaking world.๐ Website: https://shunshi.ai ๐ฆ X / Twitter: @shunshiai2026 ๐ Product Hunt: Shunshi.AI
Shunshi.AI (้กบๆถ) is an AI-powered Bazi reading platform supporting English, ไธญๆ, ๆฅๆฌ่ช, and ํ๊ตญ์ด. Free to try, no credit card required.
We open-sourced the calculation engine behind our production backend so:
MIT ยฉ 2026 Shunshi.AI
Run analytics queries on ClickHouse โ explore schemas, execute SQL, fetch results
Run Claude Code as an MCP server so any agent can delegate coding tasks to it
Browser automation using accessibility snapshots instead of screenshots
Google's universal MCP server supporting PostgreSQL, MySQL, MongoDB, Redis, and 10+ databases