Skip to main content
Glama
alexsu1212

freebazi-mcp

freebazi-mcp

English | 繁體中文

A Model Context Protocol server that computes a full Chinese Bazi (八字, Four Pillars of Destiny) chart from a birth date, time, and place.

It wraps the same calculation engine that powers freebazi.com: an offline engine that corrects for True Solar Time and historical daylight saving, and is cross-validated against established Bazi libraries. No API key, no network calls, everything runs locally.

What it returns

Give it a birth moment and a city, and compute_bazi_chart returns:

  • The Four Pillars (Year, Month, Day, Hour), each as a Heavenly Stem and Earthly Branch

  • Your Day Master (日干) and the Ten Gods (十神) of every character

  • Hidden Stems (藏干), Na Yin (纳音), and the Twelve Growth Stages (十二长生)

  • Five Elements distribution, both visible and including hidden stems

  • Shen Sha (神煞) and branch relations (合冲刑害)

  • Luck Pillars (大运) with the current period flagged, and the current year's pillar

  • A link to the full interactive chart on freebazi.com

Related MCP server: Bazi (Eight Characters) Calculation MCP Server

Install

Requires Node.js 18+.

Run directly with npx:

npx freebazi-mcp

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "freebazi": {
      "command": "npx",
      "args": ["-y", "freebazi-mcp"]
    }
  }
}

Other MCP clients (Cline, Continue, Cursor, etc.) take the same command / args.

Tools

compute_bazi_chart

Compute a full chart.

Argument

Type

Notes

year, month, day

number

Birth date

hour, minute

number

Local clock time as recorded (omit if timeUnknown)

gender

"male" | "female"

Needed for luck-pillar direction

city

string

e.g. "Taipei", "New York". Resolved to longitude + time zone for True Solar Time

longitude, utcOffset

number

Alternative to city

timeUnknown

boolean

Hour pillar becomes tentative

trueSolarTime

boolean

Default true

dayRule

"zi23" | "midnight"

Day boundary, default 23:00

yearRule

"lichun" | "cny"

Year boundary, default Li Chun

search_cities

Search about 490 major world cities by English or Chinese name. Returns each match's country, longitude, and IANA time zone, so you can pass an exact city to compute_bazi_chart.

Example

Compute the Bazi chart for someone born 15 June 1990, 9:30 AM, in New York.

The server resolves New York, applies True Solar Time (9:30 AM becomes 8:34 AM, 56 minutes earlier, which shifts the Hour pillar), and returns the four pillars 庚午 壬午 辛亥 壬辰 with a Xin (辛) yin Metal Day Master, all Ten Gods, elements, luck pillars, and more.

Accuracy and honesty

Solar-term boundaries are computed from the sun's apparent longitude with standard astronomical formulas, and time zones (including historical daylight saving) are resolved from the IANA database. The engine's four pillars match established libraries character for character across thousands of test charts.

Bazi is a traditional framework for reflection on temperament, tendencies, and timing. This tool describes a chart; it does not predict events.

Credits

City data from GeoNames (CC BY 4.0). Simplified to Traditional conversion via OpenCC.

License

MIT


繁體中文

一個 Model Context Protocol 伺服器,依出生的日期、時間與地點,排出完整的八字(四柱)命盤。

它使用與 freebazi.com 相同的排盤引擎:完全離線,會校正真太陽時與歷史上的日光節約時間,並和主流八字程式庫逐字對拍。無需 API key、不連網,全部在本機執行。

回傳內容

給它一個出生時刻與城市,compute_bazi_chart 會回傳:

  • 四柱(年、月、日、時),每柱含天干與地支

  • 日干與每個字的十神

  • 藏干納音十二長生

  • 五行分布(含藏干與不含藏干兩種)

  • 神煞與地支刑沖合害

  • 大運(標出當前運)與當年流年

  • 一條連往 freebazi.com 完整互動命盤的連結

安裝

需要 Node.js 18+。直接以 npx 執行:

npx freebazi-mcp

Claude Desktop 及其他 MCP 客戶端(Cline、Continue、Cursor 等)的設定與上方英文段相同。

工具

  • compute_bazi_chart:排出完整命盤,參數見上方英文表格。

  • search_cities:以中文或英文搜尋約 490 個世界主要城市,回傳國家、經度與 IANA 時區,方便傳給 compute_bazi_chart

連結

八字是一套用於反思性格、傾向與時機的傳統框架。本工具只描述命盤,不預測具體事件。

Available Tools

2 tools
compute_bazi_chartCompute a Bazi (Four Pillars) chartA

Compute a full Chinese Bazi (八字, Four Pillars of Destiny) chart from a birth date, time, and place. Returns the four pillars, Day Master, Ten Gods, Hidden Stems, Five Elements, Na Yin, Growth Stages, Shen Sha, branch relations, Luck Pillars, and the current year, computed with True Solar Time and historical daylight-saving handling. Provide a birth city (use search_cities to resolve it) for accurate true solar time, or pass longitude and utcOffset directly.

ParametersJSON Schema
NameRequiredDescriptionDefault
dayYesBirth day 1-31
cityNoBirth city name, e.g. 'Taipei' or 'New York'. Resolved to longitude and IANA time zone for true solar time. Use search_cities first if unsure.
hourNoBirth hour 0-23 (local clock time as recorded)
yearYesBirth year, e.g. 1990
monthYesBirth month 1-12
genderYesNeeded for the luck-pillar direction
minuteNoBirth minute 0-59
dayRuleNoWhen a new day begins: 23:00 Zi hour (default) or midnightzi23
yearRuleNoYear boundary: Li Chun (default) or Lunar New Yearlichun
longitudeNoBirth longitude in degrees East (negative = West). Use instead of city.
utcOffsetNoUTC offset in hours (e.g. 8 for China). Use with longitude when no city is given.
timeUnknownNoTrue if the birth time is unknown; the hour pillar is then tentative
trueSolarTimeNoApply true-solar-time correction (recommended)

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure, and it delivers: it specifies True Solar Time correction, historical daylight-saving handling, and the tentativeness of the hour pillar when birth time is unknown via the schema. It also makes clear that gender is needed for luck-pillar direction. This is a rich, honest account of how the computation behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three focused sentences: the first states the core purpose and outputs, the second explains computation specifics, and the third gives coordinate/city guidance. It is front-loaded with the tool's primary function and every sentence contributes meaningful information without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 13 parameters, no annotations, and no output schema, the description is strong: it names the full set of return fields and explains the key computational approach. It does not describe the exact structure of the return object or what happens when neither city nor longitude/utcOffset is supplied, but the input schema covers the parameter rules and the listed outputs are broad enough for an agent to understand the result.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3, and the description goes beyond it by explaining the relationship between city and longitude/utcOffset and linking these to true-solar-time accuracy. It adds cross-parameter context that the schema alone does not fully convey, though much of the parameter detail is already present in the schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific action ('Compute a full Chinese Bazi chart'), identifies the required inputs (birth date, time, place), and enumerates the detailed output components. It clearly distinguishes this tool from its sibling search_cities, which is only referenced as a helper for resolving city names, not as an alternative computation path.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives actionable usage guidance: use search_cities to resolve a birth city for accurate true solar time, or pass longitude and utcOffset directly. It does not explicitly state when not to use the tool, but there is no competing sibling tool, so the context is clear enough for an agent to select and invoke it correctly.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_citiesSearch birth citiesA

Search the built-in city list (about 490 major world cities) by English or Chinese name. Returns matches with their country, longitude, and IANA time zone, so you can pass an exact city to compute_bazi_chart for accurate True Solar Time.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesCity name or prefix, English or Chinese, e.g. 'Taipei', '台北', 'New York'

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden. It states the tool searches a built-in, finite list and names the returned fields: country, longitude, and IANA time zone. This makes the read-only, bounded nature clear, though matching behavior and result limits are not detailed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences deliver the core purpose, result contents, and downstream use case with no filler. The most useful guidance (returns fields and compute_bazi_chart integration) appears early and compactly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter search tool, the description is complete enough: it names the input language options, the source list size, the return fields, and the intended downstream workflow. Since there is no output schema, listing the return fields in prose is especially valuable.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, and the query parameter already documents types and examples. The tool description adds contextual value by explaining the purpose of the query but does not substantially extend parameter semantics beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Search the built-in city list') and the resource, with specificity about the ~490 cities and name input. It also distinguishes itself from sibling compute_bazi_chart by positioning itself as the lookup step before that chart computation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly connects usage to compute_bazi_chart: 'so you can pass an exact city to compute_bazi_chart for accurate True Solar Time.' This gives clear context for when to use the tool, though it does not explicitly mention when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A4.5/5.0
Disambiguation5/5

The two tools have completely distinct purposes: one searches for cities and the other computes a Bazi chart. There is no overlapping functionality, and the reference from compute_bazi_chart to search_cities makes the intended workflow clear.

Naming Consistency5/5

Both tool names follow a consistent snake_case verb_noun pattern: search_cities and compute_bazi_chart. The names are descriptive, predictable, and aligned with their actions.

Tool Count4/5

Two tools is slightly below the typical 3-15 range, but the narrow domain of Bazi chart computation is well served by a single core computation tool plus a supporting city search utility. The count feels minimal but not inadequate for this purpose.

Completeness5/5

The tool surface fully covers the stated purpose: resolving a birth location via search_cities and computing a comprehensive Bazi chart via compute_bazi_chart. The returned chart includes the major Bazi components, luck pillars, and current year, leaving no obvious dead ends or missing core capabilities.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    Calculates Chinese BaZi (Four Pillars of Destiny) charts based on birth date, time, and location, including solar term information, decade luck cycles, and true solar time corrections.
    2
  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides 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.
    22
    10
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables Chinese metaphysics Ba Zi (Four Pillars) birth chart calculation and Huangli (almanac) queries via natural language, with lightweight offline setup.
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    MCP server for computing BaZi (Four Pillars) charts. Supports Gregorian, lunar, or direct Four Pillars input, with optional true solar time correction, and outputs strength, pattern, and useful god.
    448
    Apache 2.0

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/alexsu1212/freebazi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server