Skip to main content
Glama
shunshi-ai

shunshi-bazi-mcp

bazi-reader-mcp

๐Ÿ‡จ๐Ÿ‡ณ ไธญๅ›ฝๅ…ซๅญ— (Four Pillars of Destiny) ใƒป ๐Ÿ‡ฏ๐Ÿ‡ต ๅ››ๆŸฑๆŽจๅ‘ฝ (ใ—ใกใ‚…ใ†ใ™ใ„ใ‚ใ„) ใƒป ๐Ÿ‡ฐ๐Ÿ‡ท ์‚ฌ์ฃผํŒ”์ž (ๅ››ๆŸฑๅ…ซๅญ—)

The calculation engine (and MCP server) behind Shunshi.AI / ้กบๆ—ถ, open-sourced.

License: MIT Powered by Shunshi.AI Node

๐Ÿ‡ฏ๐Ÿ‡ต ๆ—ฅๆœฌใฎ้–‹็™บ่€…ใฎๆ–นใธ: ใ“ใ‚Œใฏไธญๅ›ฝใฎใ€Œๅ…ซๅญ— (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:

  1. 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.

  2. 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.

  3. 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.

  4. 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 city or longitude/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's calculateRelation() (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 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.


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

Install Server
A
security โ€“ no known vulnerabilities
A
license - permissive license
A
quality - A tier

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