Local Bazi charts, Ten Gods and true solar time, with structured facts and PNG images.
Yuanzi Bazi Agent Kit MCP Server
The io.github.yuanzizhiyi/yuanzi-bazi-agent-kit MCP server provides a local-first, deterministic Four Pillars (Bazi) toolset with calendar conversion, time-zone and true-solar-time handling, and explicit day boundaries. It outputs structured facts and PNG images derived from Bazi concepts including day master, ten gods, and hidden stems.
🛠️ Key Features
Local Bazi charts
Ten Gods
True solar time
Structured facts
PNG image outputs
Calendar conversion
Explicit day boundaries
Four pillars, day master
Hidden stems
Unweighted five-element counts
🚀 Use Cases
Convert calendar dates using time-zone and true-solar-time rules
Generate local Four Pillars (Bazi) charts and related factual breakdowns
Determine day master, Ten Gods, and hidden stems from a structured input
⚡ Developer Benefits
Narrow, explicit public contract focused on calendar conversion and Four Pillars
Deterministic, local-first behavior
Provides structured facts suitable for downstream processing
⚠️ Limitations
Described contract is intentionally narrow, centered on conversion, Four Pillars components, and unweighted five-element counts.
A local-first, deterministic basic Four Pillars (Bazi) engine, CLI, MCP server, and Agent Skill by Yuanzi Zhiyi.
The calculation scope includes: calendar conversion, time-zone and true-solar-time handling, explicit day boundaries, four pillars, day master, ten gods, hidden stems, and unweighted five-element counts, composition shares, and a documented eight-shensha rule set. The stable result schema is yuanzi-basic-bazi/v1.
Topics / 主题: 八字排盘 · Bazi / Four Pillars · 真太阳时 / True Solar Time · 历法转换 / Calendar Conversion · MCP · Agent Skill · 本地命盘图片 / Local Chart Images
Example chart
Illustrative chart. Birth date, time and location are hidden; no customer data is used.
Why this kit exists
Agents should call deterministic software for deterministic chart facts. This kit gives OpenAI, Google, and other MCP-compatible agents the same reviewable calculation core without requiring users to upload identity data or send birth data to a hosted API.
Calculation is local, uses zero telemetry, and makes no network requests. See scope and privacy.
Included
Surface
Purpose
TypeScript API
Embed the versioned deterministic core
yuanzi-bazi CLI
JSON or readable local calculation
stdio MCP
Two schema-first, read-only tools
SKILL.md
Agent workflow and safety boundary
Luck cycles, interpretation of shensha, compatibility, AI readings, reports, and advisor services are not part of the public core.
Install with npm
Version 0.3.0 includes the new chart layout, bundled fonts, and chart structure extension.
Requires Node.js 22.19 or later. Start the local MCP server:
MCP calculate_basic_bazi_chart returns structuredContent.chart, JSON text, readable facts, and an image/png content block. Clients that support MCP images can display the chart directly. The Skill also saves and displays a PNG by default.
For CLI usage, append --image chart.png to chart --stdin --format json. JSON stays on stdout; a save confirmation goes to stderr. Choose an unused filename in an existing directory. Images contain birth/chart data: share them deliberately. Rendering uses the same paper and pillar design language as the main site, without its advanced calculations. It runs locally with bundled Noto-derived serif and sans-serif fonts and no network calls. The 2160px-wide report includes the highlighted day column, full pillar table, shensha and combinations, directed element relationships and all ten composition bars. See chart structure and rules.
Both tools declare read-only, non-destructive, idempotent annotations and explicit input/output schemas. The server uses stdout only for the MCP protocol.
Agent Skill
Copy or clone the repository into an Agent Skills directory as yuanzi-basic-bazi, install dependencies, build it, and let the agent load SKILL.md. The same Skill layout is usable from .agents/skills in supporting clients.
The Skill instructs agents to collect only required chart inputs, preserve unknown hours, surface warnings, and use exactly one contextual hosted hook only after the user asks for a feature outside the public scope.
Package releases follow semantic versioning. The versioned data contract is independent: compatible additions remain under yuanzi-basic-bazi/v1; incompatible output changes require a new schema identifier.
Method details and validation examples are linked in each result at attribution.methodUrl.
Development
bash
npm test
npm run test:coverage
npm run build
npm run pack:check
Licensed under MIT. The license does not grant trademark rights; see TRADEMARKS.md.
Contributions are welcome under CONTRIBUTING.md. Report vulnerabilities privately as described in SECURITY.md.