npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@iflow-mcp/wuunicorn-ziwei-mcp-server

v1.0.0

Published

紫微斗数 MCP 服务器 - 基于 iztro 库

Readme

紫微斗数 MCP 服务器

License: MIT Node.js Version iztro

一个基于 Model Context Protocol (MCP) 的紫微斗数计算服务器,使用强大的 iztro 库提供精确的紫微斗数排盘和运限分析功能。

✨ 功能特性

  • 🌟 完整的紫微斗数排盘 - 支持阳历和农历生日计算
  • 📅 精确的时间处理 - 获取当前系统时间和详细信息
  • 🔮 运限分析 - 大限、流年等运势分析
  • 🌐 多语言支持 - 简体中文、繁体中文、英文、日文、韩文、越南文
  • 🔄 MCP 协议兼容 - 可与支持 MCP 的 AI 助手无缝集成
  • 轻量高效 - 基于 Node.js,响应快速
  • 📊 结构化数据 - 返回完整的 JSON 格式星盘数据

🛠️ 技术栈

  • Node.js (≥18.0.0) - 运行环境
  • iztro (v2.5.3) - 紫微斗数核心计算库
  • MCP Protocol (2024-11-05) - 模型上下文协议

📦 安装

前置要求

  • Node.js 18.0.0 或更高版本
  • npm 包管理器

克隆仓库

git clone https://github.com/wuunicorn/MCPIztro.git
cd MCPIztro

安装依赖

npm install

⚙️ 配置

1. 创建配置文件

ziwei_mcp_config.json 中的路径修改为您的实际项目路径:

{
  "mcpServers": {
    "ziwei": {
      "command": "node",
      "args": ["/path/to/your/project/ziwei_mcp_server.js"],
      "env": {
        "NODE_PATH": "/path/to/your/project/node_modules"
      }
    }
  }
}

2. 在 MCP 客户端中配置

将配置文件内容添加到您的 MCP 客户端配置中(如 Claude Desktop、Cursor 等)。

🚀 使用方法

直接启动服务器

npm start
# 或
node ziwei_mcp_server.js

运行测试

npm test
# 或
node test_ziwei.js

📖 API 文档

服务器提供以下三个主要工具:

1. get_current_time

获取当前系统时间的详细信息。

参数:

返回:

{
  "success": true,
  "data": {
    "year": 2024,
    "month": 8,
    "day": 1,
    "hour": 15,
    "minute": 30,
    "second": 45,
    "datetime_str": "2024-08-01 15:30:45",
    "weekday": "Thursday",
    "weekday_cn": "星期四",
    "timestamp": 1722513045
  }
}

2. calculate_ziwei

计算指定生辰的紫微斗数星盘。

参数:

  • birthday (必需): 生日,格式 YYYY-MM-DD
  • hour (可选): 出生时辰 (0-23),默认 0
  • gender (可选): 性别 ("男"/"女"),默认 "男"
  • type (可选): 日期类型 ("solar"/"lunar"),默认 "solar"
  • isLeapMonth (可选): 是否闰月,默认 false
  • language (可选): 语言设置,默认 "zh-CN"

示例请求:

{
  "birthday": "1990-08-16",
  "hour": 14,
  "gender": "女",
  "type": "solar",
  "language": "zh-CN"
}

返回: 完整的星盘数据,包含十二宫信息、星耀分布、亮度等。

3. get_horoscope

获取指定生辰在特定时间的运限信息。

参数:

  • birthday (必需): 生日,格式 YYYY-MM-DD
  • hour (可选): 出生时辰 (0-23),默认 0
  • gender (可选): 性别 ("男"/"女"),默认 "男"
  • type (可选): 日期类型 ("solar"/"lunar"),默认 "solar"
  • isLeapMonth (可选): 是否闰月,默认 false
  • targetDate (可选): 目标日期,格式 YYYY-MM-DD,默认当前日期
  • language (可选): 语言设置,默认 "zh-CN"

返回: 运限信息,包含大限、流年、年龄等数据。

🌐 支持的语言

| 语言代码 | 语言名称 | |---------|----------| | zh-CN | 简体中文 | | zh-TW | 繁体中文 | | en-US | 英语 | | ja-JP | 日语 | | ko-KR | 韩语 | | vi-VN | 越南语 |

📝 使用示例

在 MCP 客户端中使用

配置完成后,您可以在支持 MCP 的客户端中直接使用自然语言查询:

请帮我排一个1990年8月16日下午2点出生的女性的紫微斗数星盘
我想看看这个人在2024年的运势如何

直接 API 调用

# 获取当前时间
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "get_current_time", "arguments": {}}}' | node ziwei_mcp_server.js

# 计算星盘
echo '{"jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {"name": "calculate_ziwei", "arguments": {"birthday": "1990-08-16", "hour": 14, "gender": "女"}}}' | node ziwei_mcp_server.js

🏗️ 项目结构

MCPIztro/
├── README.md                 # 项目介绍文档
├── package.json             # 项目配置和依赖
├── package-lock.json        # 依赖锁定文件
├── ziwei_mcp_server.js      # MCP 服务器主程序
├── ziwei_mcp_config.json    # MCP 配置文件模板
├── test_ziwei.js           # 测试脚本
└── node_modules/           # 依赖包目录

🔧 开发

测试服务器功能

node test_ziwei.js

检查语法

node -c ziwei_mcp_server.js

验证依赖

node -e "import { astro } from 'iztro'; console.log('依赖加载成功');"

🤝 贡献

欢迎提交 Issue 和 Pull Request!

  1. Fork 本仓库
  2. 创建您的特性分支 (git checkout -b feature/AmazingFeature)
  3. 提交您的修改 (git commit -m 'Add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 打开一个 Pull Request

📄 许可证

本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。

🙏 致谢

📞 联系

如果您有任何问题或建议,请通过以下方式联系:


注意: 紫微斗数仅供参考和娱乐,请理性对待运势分析结果。