Skip to main content
Glama
legend-saju

legend-saju

by SihyeonJeon

Legend Saju

不是把四柱几个字丢给 LLM 的包装器。 是将计算式、流派、出处、不确定性结构化后返回的东方命理引擎。

CI License TypeScript

同样的出生年月日,用多种传统各自推算。计算路径内不存在隐藏的 LLM 调用。

可追溯出处的知识 777 条 · 大六壬 720 局 · 韩国人名用汉字观测 9,495 条 · 计算路径模型调用 0 次

Legend Saju 在同一个引擎中处理四柱·命理、紫微斗数、奇门遁甲、大六壬、铁板神数、姓名学等不同传统的计算。流派不同就不强行统一为单一结论,出生时间不明也不会臆造一个时辰。

最快上手

当前公版同时提供本地 STDIO MCP 与 HTTPS 远程 MCP。本地服务器只要装有 Node.js 20 或更高版本,无需另配 API 密钥即可运行。

无需安装,直连远程服务器

公开 MCP 端点地址如下。

https://legend-saju-mcp-production.up.railway.app/mcp

在 Codex 中可用以下命令连接。

codex mcp add legend-saju-remote --url https://legend-saju-mcp-production.up.railway.app/mcp

远程服务器不保存输入值,也不调用模型 API。公开端点设有请求大小、每分钟请求数、并发执行数等限制。如果不想将出生日期或姓名发给外部服务器,请改用下面的本地方案。

Codex 一行连上

在终端中运行以下命令。

codex mcp add legend-saju -- npx -y --package=github:SihyeonJeon/legend-saju#main legend-saju-mcp

检查是否连接成功。

codex mcp list

重启 Codex 后,在 /mcp 中看到 legend-saju,即表示安装完成。现在无需提任何工具名或 JSON,可以像平常一样直接提问了。

女生,2000 年 7 月 30 日上午 8 点 44 分出生。请综合看事业、财运、婚姻和未来三年。

男生 1999 年 7 月 14 日上午 11 点 24 分出生,女生 2000 年 7 月 30 日上午 8 点 44 分出生。请一起看配对和可能结婚的时间。

名字是 김상수,汉字名是 金相洙。请与四柱分开,单看姓名学依据。

Codex CLI、Codex IDE 扩展、ChatGPT 桌面应用共用同一份 Codex MCP 配置。更详细的连接说明请见 OpenAI 的 MCP 指南。

从其他 MCP 客户端连接

只要客户端支持 STDIO MCP,就可以使用下面的运行配置。不同客户端的配置位置略有差异。

{
  "mcpServers": {
    "legend-saju": {
      "command": "npx",
      "args": ["-y", "--package=github:SihyeonJeon/legend-saju#main", "legend-saju-mcp"]
    }
  }
}

如果希望固定使用本地源码,可先 build 本项目,再直接运行 CLI 包装器。

{
  "mcpServers": {
    "legend-saju": {
      "command": "node",
      "args": ["/절대/경로/legend-saju/bin/legend-saju-mcp.js"]
    }
  }
}

本地方式需在谱系仓库根目录运行一次 npm ci && npm run build。

可以在 ChatGPT 网页直接用吗

HTTPS 远程 MCP 服务器已经就绪,但“拥有了公网 URL”和“进入 ChatGPT 插件目录”是两个阶段。开发者模式或支持远程 MCP 的客户端可以直接使用上面的 URL;要作为可安装普通插件面向大众,还需要单独的注册审查流程。

Related MCP server: fatenava-mcp

MCP 做什么

MCP 服务器提供三个只读工具。

소

负责

legend_saju_manifest

查看当前引擎包含的算道、出处和数据范围

legend_saju_capabilities

根据自然语言提问匹配对应算法

legend_saju_resolve

接受提问和输入值,一并运行关联的计算法

只有三个工具,并不意味着功能也只有三项。这三个工具只是通往一个更大功能注册表的查、找、跑三扇小门。

사용자의 자연어 질문
        ↓
호스트 모델이 입력을 정리하고 계산법을 탐색
        ↓
Legend Saju MCP가 결정론적 계산 수행
        ↓
출처·유파·충돌·누락 정보가 포함된 구조화 결과
        ↓
호스트 모델이 사람이 읽기 쉬운 한국어로 설명

Legend Saju MCP 本身不读取 OpenAI 或 Anthropic 的 API 密钥,也不调用模型。对话和解释用的都是当前 Codex、Claude 或其他客户端已有的模型会话。

MCP 与附带的谱系插件的区别

  • 只用 MCP,即可立即使用计算引擎和三个工具。

  • 在 plugins/legend-saju/ 中附带的 Codex 插件会把 MCP 配置和自然语言使用方法放到同一套配置里,避免用户自己去选,的宿主模型也不用再自己挑能力 ID 或输入结构。

  • 计算能力不会在插件里缩水,MCP 和插件都用同一套公开的引擎入口。

自然语言输入

项目设计的交互方式就是对话,而不是填写表单或从意图菜单里挑选项。模型只从对话中提取确定信息,找到需要的计算法,再去解释引擎返回的依据。

2004년 8월 3일 양력 남자고 태어난 시간은 몰라.
경기도 구리에서 태어났어. 앞으로 3년 직업과 돈을 봐줘.

如果用户说不知道出生时间,引擎不会随手填入午时(中午 12 点)。而是把子时双旦的两种界界、两个日期和候选方式放置在两条候选路径,完整分开返回。

开发者运行

git clone https://github.com/SihyeonJeon/legend-saju.git
cd legend-saju
npm ci
npm test
npm run build
npm run demo

需要 Node.js 20 或更高版本。这个存储库只支持 ESM,当前未发布到 npm。

import { resolve } from "./dist/index.js";

const result = resolve({
  birth: {
    year: 2000,
    month: 7,
    day: 30,
    hour: 8,
    minute: 44,
    calendar: "solar",
    gender: "여",
    birthTimeAccuracy: "recorded"
  },
  question: "직업과 재물, 연애 결혼, 앞으로 3년",
  timelineRange: { startYear: 2026, endYear: 2028 }
});

console.log(result.dossier?.claims);
console.log(result.dossier?.conflicts);
console.log(result.routes);

返回的不是形成整段“断语”的句子,而是计算与解读的“史料”。

{
  selection: { requested: string[]; selected: string[]; unsupported: string[] };
  routes: CapabilityPreflight[];
  dossier?: {
    claims: EngineClaim[];
    conflicts: ClaimConflict[];
    synthesis: DomainSynthesis[];
    timeline?: LifeTimeline;
    blockedSystems: { capabilityId: string; reason: string }[];
  };
  evidence: SajuEvidence[];
  nameAnalysis?: KoreanNameAnalysis;
  noModelCalls: true;
  interpretationBoundary: string;
}

为什么做这个

不少命理 AI 服务是从 prompt 起家的,Legend Saju 选择再往下一层,从计算和依据出发。

  • 确定性预设: 同样输入,即便没有 LLM 也能生成同样的结果。

  • 保存流派差别: 命理观察方式或紫微斗数四化派系不同时,各自保留结论。

  • 出生时间未知: 物理时间未知时把它作为候选点处理,而不是顺手假装成午时。

  • 出处可追踪: 每一项功能都记录成熟度、发挥的作用、所属流派、出处 ID,以及哪方面还缺失。

  • 没有“命运评分”: 不会把星体系中多种冲突和依据压成一个总分。

实际含有的的资料资产

这个存储库并不只发布了模型调用接口,还公开了难处理的数据和规则工程。

资产

公开情况

多语言

36 个领域,777 条依据项

命理术语表

韩文·汉字·中文·日文,777 个词条

紫微斗数术语表

按语言排序,214 个词条

五曜取格?

日干 × 月令 120 格,及可运行的后续例外值 66 项

紫微斗数宫星理论

163 条结构化规则,以及 3 组独四四五方体系

大六壬

60 日辰 × 12 天盘,封闭的 720 局全盘表

铁板神数问时路径

卦 1,500 格,先天 144 行,终身 2,028 行

韩国姓名学

大法院人名用汉字观测 9,495 条,笔画变体 2,003 条

明确出处的 81 数

81 行完整,并对照原始出处

解梦研究数据

周易解梦 988 条、阿尔忒米多被 1,983 条、跨文化检验种子 5 个

可核查的原始资料都放在 data/ 里。运行必需的知识已打进运行时,不会临时依赖外部数据库或隐藏的检索服务。

提取结果按文件预置,唯一做过加速的路径是紫微斗数 144 个组合,检定后与现有结果逐字节一致,详见 docs/PARITY.md。

实现范围

体系

当前实现边界

万年历 / 四柱原算

公历 / 农历 / 闰月转换、四柱八字、大运、日期边界

命理

月令、通根、地支藏干、十神、合冲害破、用神取法 3 套、穷通宝鉴 120 局

紫微斗数

12 宫、三方四正、多套四化、星链联结、重叠运限

大六壬

60 日辰 × 12 天盘、封闭的 720 局盘、有明确的取传原则

奇门遁甲

时家转盘、九宫、九星、八门、八神、直符 · 直使、空亡

铁板神数

三个版本刻的皇极数序、单独问时 20 路、六卷(?),以及众生序列表、先天数、108 年条文流

姓名字

人名用汉字 9,495 条、Unicode / 字形拆分、用户指定笔画体系下的五格计算、出处明确的八十局

比起照抄 README 给出的静态功能数量,用 getEngineManifest 查看当前注册表更准确。

出生时辰按(当地民用计时)解释。timezone 与 longitudeE 保留为出生地元数据,但默认盘不会悄悄修正为近似真太阳时。这种缺失会写入功能与输入审计元数据。

错误出生信息会以结构化 blocked 路径返回,并与其他结果一起请求修正。不可能存在的 targetDate 或 questionDateTime 会导致所有日期相关计算都无法安全进行,因此会直接拒绝整个请求。

一个开放的入口

import { resolve } from "./dist/index.js";

resolve({ question, ...inputs }) 会搜索当前注册表、路由提问、调用可运行的计算器,并返还给用户,不会把缺失输入偷偷隐藏。requestedCapabilities 接受的不是封闭枚举,而是一组普通字符串。因此,即使后续在引擎中加入新模块,也无需所有客户端同步改 schema。

resolve 继续可用,与原有计算式用户兼容;异步版只有在传了名字时,才会懒加载大型姓名数据。因此一般四柱算或消费解析的场景,启动成本不会增加。

如果传入 name 给 resolveAsync,就能进入独立的韩国姓名学完整流程:把真实姓氏和名字汉字与 9,495 条观测快照对照,并记录合法性结论、官方读音、笔画候选、Unicode、字形拆解、用户指定的五格机制,以及 81 数表的对应层级。

resolve 保留同步模式专门供纯算的用户使用,只处理问八字类逻辑。analyze({ ...birth }) 是类型的出生说明 API;query({ intent, ... }) 则是旧系统的容器习惯的 26 个 intent 兼容接口。内容创建、提示词、写作自动化都不放入计算核心。

性能

仓库自带有可复现的 benchmark。

npm run benchmark

当前 Apple Silicon 开发机和 Node 26 下,优化基准分别为:四柱原局查询中位数约 1.13ms,常规完整出生原始中位数约 600ms,全新进程 import 中位数约 63.1ms。具体中位数随时间而不同,测量方法参见 PERFORMANCE.md。

出生时间未知时

const result = analyze({
  birth: {
    year: 2004,
    month: 8,
    day: 3,
    calendar: "solar",
    gender: "남",
    birthTimeAccuracy: "unknown"
  },
  question: "전체 인생"
});

引擎会把固定柱、不同关系、不同时柱候选分别返回。即使用衣过去的事件来往之间,也不会由它一锤的.

方法论优先

项目把下面的步骤严格分开:

  1. 历法推算与原局计算

  2. 局部结构观察

  3. 按流派解读结果

  4. 跨体系综合推断

  5. 由人或 LLM 写描述

做回真正产品级论点之前,建议先读 方法论 与 能力边界。

实际开发过程 里记录了开发顺序、多语种调查、可复现智能体指令;给维护用的 GitHub 发布清单在 docs/RELEASING.md。

发布状态

分发形态就是可公开的 GitHub 源码。package.json 标为 private,避免误发到 npm。npm run release:check 会检查发布文件与源码快照是否一致,是否有常见的密钥字符串。数据的出处与发布范围已写入数据标注文件 DATA_LICENSES.md 中。

下一步

  • 为不使用 MCP 的人提供可选输入界面

  • 远程 MCP 稳定运行和可选认证

  • 默认非公开的独立出生时间录入页面

  • 单独授权的解梦数据包

  • 增加附加刻度与各流派独立核验

负责任的使用

Legend Saju 是对传统命理体系本体的复现与比较。通过软件验证意味着其能够,按文档化步骤计算结果,不意味着它拥有被验证了的实际预测能力。它不应该被用于代替医学、法律、财务或心理医生的判断。

许可

项目代码采用 Apache-2.0。第三方库与数据延用其各自的许可。详情见 DATA_LICENSES.md 与 THIRD_PARTY_NOTICES.md。

Available Tools

9 tools
legend_saju_analyze_compatibilityAnalyze two-person compatibilityA
Read-only
Inspect

Use this when the user asks 궁합, 결혼 가능성, relationship compatibility, or wants two birth charts compared. Requires both people's birth data.

Inputs: birth (required), question (required), partnerBirth (required), maxClaims, +4 more. Returns: mode, error, claims, routes, +23 more

legend_saju_analyze_nameAnalyze a Korean nameA
Read-only
Inspect

Use this for 작명, 성명학, 81수, 이름 한자, 인명용 한자, 획수, or 파자 questions. It keeps legal Hanja observations, declared stroke standards, and birth-based naming guidance separate.

Inputs: question (required), name, birth, maxClaims, +4 more. Returns: mode, error, claims, routes, +23 more

legend_saju_capabilitiesFind a calculation methodA
Read-only
Inspect

Use this when a user asks which Saju, Myeongri, Zi Wei, Qimen, Daliuren, I Ching, Tieban, Dang Saju, Tojeong, Feng Shui, naming, dream, or other traditional calculation method fits a specialized question. Do not use it for an ordinary fortune reading.

Inputs: limit, query, systems. Returns: hits, error, query, capabilityCount, +1 more

legend_saju_cast_divinationCast a traditional divination chartA
Read-only
Inspect

Use this for 기문둔갑, 대육임, 주역, 점괘, or a concrete decision cast from a question time or six line values. Do not use it for a general natal fortune reading.

Inputs: question (required), birth, maxClaims, lineValues, +3 more. Returns: mode, error, claims, routes, +23 more

legend_saju_interpret_dreamInterpret a dream from audited traditionsA
Read-only
Inspect

Use this for 해몽, 꿈풀이, or dream interpretation. It currently handles five cross-culturally audited concepts and returns both shared motifs and conflicting conditions with primary-source excerpts; it does not turn the remaining raw corpus into invented meanings.

Inputs: dream (required), question (required), maxClaims, outputMode, +3 more. Returns: mode, error, claims, routes, +23 more

legend_saju_manifestInspect Legend SajuA
Read-only
Inspect

Return the live, source-traceable deterministic engine manifest. No model or network call.

Inputs: no named parameters. Returns: error, naming, version, knowledge, +6 more

legend_saju_read_fortuneRead a Saju fortuneA
Read-only
Inspect

Use this when the user says 사주 봐줘, 운세 봐줘, 올해 운세, 재물운, 사업운, 직업운, 연애운, 결혼운, 건강운, 개운법, 구체적 액션, or asks what to do over a future period. Read structuredContent, especially recommendations for action requests. Use detailLevel=expert for a deep one-call analysis; do not search capability IDs first.

Inputs: birth (required), question (required), asOfYear, maxClaims, +5 more. Returns: mode, error, claims, routes, +23 more

legend_saju_run_methodsRun specific or mixed traditional methodsA
Read-only
Inspect

Use this for expert, mixed-system, or named-method requests. It covers Myeongri details such as 십성·지장간·투간·통근·합충형파해·삼합·방합·육합·월령·격국·조후·억부·통관·병약·궁통보감·적천수·삼명통회·연해자평·종격·화격·특수격; Zi Wei 12궁·삼방사정·대한·유년·유월·유일·유시·생년사화·궁간사화·자화·비성·흠천사화·중주파; and Qimen, Daliuren, I Ching, Tieban, Dang Saju, Tojeong, Feng Shui, naming, 81-number, Hanja decomposition, and dream traditions. Pass discovered capability IDs together in requestedCapabilities, or let the server plan from the question. Use focused tools for ordinary single-goal requests.

Inputs: question (required), name, birth, dream, +18 more. Returns: mode, error, claims, routes, +23 more

legend_saju_select_datesSelect auspicious datesA
Read-only
Inspect

Use this only when the user explicitly asks for 택일, 좋은 날, 계약일, 이사일, 개업일, 수술일, or another date-selection task. Do not use it merely because a fortune request mentions this year.

Inputs: birth (required), question (required), targetDate (required), purpose, +4 more. Returns: mode, error, claims, routes, +23 more

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 9 tools

    Disambiguation4/5

    Each focused tool has a clear primary intent: fortune readings, compatibility checks, date selection, divination, name analysis, and dream interpretation. The only real ambiguity is among the metadata/router tools (manifest, capabilities, and run_methods), which can be confused when an agent needs to distinguish listing capabilities from executing a specialized method.

    Naming Consistency4/5

    Seven of the nine tools follow a consistent verb_noun pattern: read_fortune, analyze_compatibility, select_dates, cast_divination, analyze_name, interpret_dream, and run_methods. The two noun-only names, manifest and capabilities, are a small deviation, but the shared legend_saju_ prefix keeps the overall naming recognizable.

    Tool Count5/5

    Nine tools is well-scoped for a server with such a broad traditional-calculus surface. It provides one focused entry point per major user intent plus introspection and expert-runner tools, without turning the tool list into an overwhelming flat API.

    Completeness5/5

    The surface covers discovery, ordinary fortune reading, relationship compatibility, date selection, divination, naming, dream interpretation, and mixed expert methods. There is no obvious missed lifecycle step: about every major request route lands on a dedicated tool or the catch-all run_methods tool.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Provides tools for Bazi (Chinese astrology) chart calculation and analysis, enabling LLMs to generate accurate birth charts, determine patterns, and answer follow-up questions based on actual calculations rather than model knowledge.
      2
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents to cast deterministic BaZi, Zi Wei Dou Shu, and Western astrology natal charts from birth details, with no setup or API key.
      1
      53 npm
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Provides stateless tools for calculating BaZi charts, casting I Ching hexagrams, drawing tarot cards, and generating Zi Wei twelve-palace charts. Agents can call these tools without an account or model key and interpret the structured results with their own model.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents and MCP clients to run deterministic BaZi, Zi Wei Dou Shu, Qi Men Dun Jia, astrology, divination, almanac, and election-day computations through versioned remote tools with reproducible results.
      38
      MIT