zhiji-bazi
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@zhiji-bazi帮排个八字:男,1990年5月15日14:30,北京时间"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
zhiji-bazi
八字排盘的核心算法,TypeScript 写的。输入出生时间,输出四柱、身强弱、格局、用神。
这是知己排盘的计算引擎,从生产环境里拆出来开源的部分。它只做计算,不生成解读文案,也不做任何预测。
bun add github:AmsonntagChow/zhiji-bazi还没发到 npm,暂时从 GitHub 装。仓库里放的是 TypeScript 源码,没有编译产物,所以要用 Bun,或者用能直接吃 TS 的构建工具。Node 直接 require 用不了。
import { computeChart, displayString } from "zhiji-bazi";
const r = computeChart({
birthDate: new Date("2000-01-01T04:00:00Z"), // 北京时间 2000-01-01 12:00
timeZone: "Asia/Shanghai",
isMale: true,
});
console.log(displayString(r.bazi)); // 己卯 丙子 戊午 戊午
console.log(r.strength.level); // strong
console.log(r.pattern.pattern); // zhengCai
console.log(r.yongShen.yongShen); // metal四层,可信度不一样
这个仓库里的四层东西性质不同,用之前建议分清楚。
第一层,历法与四柱。 公历、农历、节气、干支的换算。有唯一正确答案,可以拿天文数据核对。年柱以立春换年不以元旦,月柱以节气分界不以农历月,晚子时的日柱归属提供三种规则。
第二层,真太阳时。 经度校正加时差方程。也有唯一正确答案。
很多排盘实现只做了经度校正,漏掉时差方程,而时差方程全年在 -14 到 +16 分钟之间波动,时柱以两小时为一界,这十几分钟足以让时柱错一位。
import { correctToTrueSolarTime, equationOfTime } from "zhiji-bazi";
// 乌鲁木齐用北京时间,真太阳时比钟表早两小时以上
const corrected = correctToTrueSolarTime({
date: new Date("2000-01-01T04:00:00Z"),
longitude: 87.6,
tzOffsetMinutesStandard: 480, // 必须是剥离夏令时之后的标准偏移
});
// 校正前时柱戊午,校正后丁巳,差一柱tzOffsetMinutesStandard 必须先剥离夏令时。夏令时只是把钟拨快了,不改变太阳的位置,用带夏令时的偏移会让标准子午线整体算错一个时区。
第三层,身强弱。 按得令、得地、得势三要素打分。这一层开始有立场了。
第四层,格局与用神。 定格、判成败、取用神。各流派口径差别很大,这里给的是一种算法口径。
Related MCP server: shunshi-bazi-mcp
MCP server
仓库自带一个 MCP server,AI agent 可以直接连上算盘。
bun run mcp/server.ts # 默认监听 8787一个工具 bazi_compute,输入支持公历、农历、直接给四柱三种方式,给了 longitude 就按真太阳时校正。默认限频每个 IP 每分钟 60 次,用 MCP_CALLS_PER_MIN 改。
initialize 返回的 instructions 字段里写了转述结果时该守的边界,接上就会进 agent 的上下文。
不想自己跑的话,知己排盘有托管的端点,功能更全:
https://zhijipaipan.com/bazi-api/mcp
https://api.szxishe.cn/mcp已知局限
格局判定有已知的假阳性。 内部审计发现从格判得偏松,会把一些本该按正格论的盘判成从格,找到六个根因,代码里 R1、R2严、R5 几处注释就是那轮修正留下的。现在比审计前收紧了,但不能说已经解决。
身强弱、格局、用神是有争议的判定。 同一张盘,格局派、旺衰派、盲派会给出不同甚至相反的结论。这个仓库实现的是一种口径,不是标准答案。拿它的输出对用户说话时,建议说明这一点。
阈值是调出来的,不是推导出来的。 强弱分档、成格败格的边界都来自实践校准,换一批盘重调,结果会变。
没有跨实现的一致性保证。 跟其他排盘软件对不上是常态,尤其在晚子时、闰月、节气交界这几个地方。这里的选择在代码注释里都写了理由。
不在这个仓库里的
神煞、大运流年、关系合盘、纳音、地理五行、AI 解读文案,这些都不在。想要完整结果去 zhijipaipan.com,或者连上面那个托管的 MCP 端点。
免责
八字属于传统文化范畴,不构成任何形式的决策依据。这个仓库提供的是符号系统的计算,不预测事件,不给投资、医疗、法律建议。
出生时间是个人数据。仓库里的测试和示例一律用合成盘或者历法边界日期,不含任何真实个人信息,建议你也这么做。
开发
bun install
bun test # 15 个测试,覆盖历法、立春换年、晚子时、时差方程、端到端
bun run typecheckLicense
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityCmaintenanceProvides professional Chinese astrology calculations including Four Pillars, Five Elements, zodiac signs, and lunar calendar details. It allows users to perform accurate Bazi analysis with global timezone support directly within MCP-compatible clients.1610MIT
- AlicenseAqualityCmaintenanceBazi (Four Pillars) charting MCP server with true solar time correction and multilingual output in Chinese, English, Japanese, and Korean.110MIT
- Alicense-qualityDmaintenanceMCP server for accurate Bazi calculations, enabling personality analysis, destiny forecasting, and Chinese calendar queries via AI agents.184ISC
- Alicense-qualityDmaintenanceA Model Context Protocol (MCP) server for Chinese traditional calendar functions, including BaZi calculation, calendar conversion, Huangli query, daily fortune, solar terms, and Wu Xing analysis.5MIT
Related MCP Connectors
Generate BaZi charts from birth details. Explore Four Pillars, solar terms, and Luck Pillars for d…
Horoscope MCP — wraps the keyless Horoscope App API.
Chinese almanac: lunar calendar, BaZi 八字, daily 宜忌, lucky-day picker, public holidays.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/AmsonntagChow/zhiji-bazi'
If you have feedback or need assistance with the MCP directory API, please join our Discord server