shunshi-bazi-mcp
bazi-reader-mcp
๐จ๐ณ ไธญๅฝๅ ซๅญ (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 ๋ฑ) ์์ ๋ฐ๋ก ์ฌ์ฉํ ์ ์์ต๋๋ค.
This repository is a monorepo with two published npm packages:
Package | What it is | Install |
Pure TypeScript calculation library. Zero framework deps. Use it from any Node.js / browser app. |
| |
Thin Model Context Protocol server wrapping the core library. Drop-in tool for Claude Desktop / Cursor / Cline / any MCP client. |
|
Both packages share the same calculation engine that powers Shunshi.AI's production backend. Both are parity-tested on every release.
Why this exists
Most existing open-source Bazi libraries (in any language) have at least one of these problems:
No true solar time correction. Clock time gets used as-is, which gives wrong charts for births far from the timezone's standard meridian (ๆฐ็ / ้ป้พๆฑ / the U.S. West Coast / ๅๆตท้). A 30-minute error shifts the whole hour pillar.
Inconsistent ๅญๆถ handling. Some libraries put 23:00-23:59 in "yesterday's" day pillar, others in "tomorrow's". If you don't pick, your charts disagree with professional reference tools.
No parity baseline. You compute a chart locally, compare against a paid service, get different numbers, and have no way to tell who's right.
Raw data only, no multilingual context. Output is Chinese-centric, hard to wire into JP/KR/EN AI assistants.
shunshi-bazi-core + shunshi-bazi-mcp fix all four:
โ True solar time built-in, default on (just pass
cityorlongitude/latitude).โ Default
sect=1(23:00 = tomorrow's day pillar), matching ้ฎ็ๅ ซๅญ.โ Parity-tested against Shunshi.AI's Python backend (5/5 golden cases) and
cantian-tymext'scalculateRelation()(5/5 on ๅๅฒๅไผ pair-wise subset).โ Multilingual discoverability via keywords (bazi / ๅ ซๅญ / ๅๆฑๆจๅฝ / ์ฌ์ฃผํ์ / saju / shichu-suimei) so JP/KR/EN developers can find the package.
Quick start
If you're embedding Bazi calc in your own app
npm install shunshi-bazi-coreimport { 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
If you want Claude / Cursor / Cline to compute Bazi charts
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 ๅๅบ็ๅจๅนฟๅท็็ท็็ๅ ซๅญใ"
โ Full MCP tool docs, alternate client configs, troubleshooting: packages/bazi-mcp/README.md
Repository layout
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.mdDevelopment
# 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 smokeTest coverage
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 vscantian-tymext'scalculateRelation()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.
Related projects
tyme4tsby 6tail โ the TypeScript lunar/solar calendar primitives this library builds on.cantian-ai/bazi-mcpโ pioneering open-source Bazi MCP. We use theircantian-tymextas 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.
About Shunshi.AI
๐ 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:
Any developer can compute Bazi charts with the same accuracy as our paid product.
The ็ๅคช้ณๆถ / ๅญๆถ edge cases get solved once and for all, instead of each project getting them wrong in a slightly different way.
JP/KR/EN developers finally have a TypeScript library that speaks their terminology (ๅๆฑๆจๅฝ / ์ฌ์ฃผํ์).
License
MIT ยฉ 2026 Shunshi.AI
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/shunshi-ai/bazi-reader-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server