shunshi-bazi-mcp
Bazi (Four Pillars) charting MCP server with true solar time correction and multilingual output in Chinese, English, Japanese, and Korean.
README
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 |
|---|---|---|
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.
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-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
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.md
Development
# 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
Test 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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.