八字计算MCP服务器 logo

八字计算MCP服务器

Organization
mymcp-fun

专业的八字计算MCP服务器

Publishermymcp-fun
Repositorybazi
LanguageJavaScript
Forks
3
Stars
10
Available tools
1
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    八字计算MCP服务器 exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 1 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    10 stars and 3 forks from the linked repository.

八字计算MCP服务器

🔮 专业的八字计算MCP服务器

npm version License: MIT

✨ 特性

  • 🚀 一行命令启动: npx @mymcp-fun/bazi
  • 📊 完整八字分析: 四柱、五行、生肖、星座、农历日期
  • 🌍 时区支持: 支持全球时区的准确计算
  • 🔗 MCP协议兼容: 无缝集成Claude Desktop等MCP客户端
  • ⚡ TypeScript构建: 类型安全,性能优异
  • 🧪 完整测试: 100%测试覆盖率

🚀 快速开始

直接使用 (推荐)

bash
npx @mymcp-fun/bazi

全局安装

bash
npm install -g @mymcp-fun/bazi
bazi  # 安装后可直接使用 bazi 命令

🔧 MCP客户端配置

Claude Desktop

在 claude_desktop_config.json 中添加:

json
{
  "mcpServers": {
    "bazi": {
      "command": "npx",
      "args": ["-y", "@mymcp-fun/bazi"]
    }
  }
}

其他MCP客户端

本服务器兼容所有标准MCP客户端,包括:

  • Claude Desktop
  • Zed Editor
  • VS Code (通过MCP扩展)
  • 自定义MCP客户端

📊 工具API

get_bazi_details

计算生辰八字和五行信息

输入参数:

  • year (number): 出生年份 (1900-2100)
  • month (number): 出生月份 (1-12)
  • day (number): 出生日期 (1-31)
  • hour (number): 出生时间 (0-23)
  • gender (string, 可选): 性别 "male" 或 "female",默认 "male"
  • timezone (string, 可选): 时区,默认 "Asia/Shanghai"

返回结果:

json
{
  "四柱": {
    "年柱": "乙酉",
    "月柱": "己丑",
    "日柱": "丁巳",
    "时柱": "壬子"
  },
  "五行": {
    "木": 1,
    "火": 2,
    "土": 2,
    "金": 1,
    "水": 2
  },
  "生肖": "鸡",
  "星座": "水瓶",
  "农历": {
    "农历年": 2005,
    "农历月": 12,
    "农历日": 29,
    "是否闰月": false,
    "农历月名": "腊月"
  },
  "日主": "丁"
}

🧪 开发和测试

克隆项目

bash
git clone https://github.com/mymcp-fun/bazi.git
cd bazi

安装依赖

bash
npm install

开发模式

bash
npm run dev

构建项目

bash
npm run build

运行测试

bash
# 运行所有测试
npm test

# 单独运行测试
npm run test:basic      # 基础功能测试
npm run test:mcp        # MCP服务器测试  
npm run test:lunar      # lunar-javascript API测试
npm run test:accuracy   # 准确性测试

📁 项目结构

bazi/
├── src/
│   ├── server.ts           # MCP服务器主入口
│   ├── bazi-service.ts     # 八字计算服务
│   └── types.ts           # TypeScript类型定义
├── tests/                 # 测试文件
├── dist/                 # 编译输出
└── package.json          # npm配置

🔧 技术栈

  • MCP SDK: @modelcontextprotocol/sdk (最新版本)
  • 八字计算: lunar-javascript (权威库,1600+周下载量)
  • 开发语言: TypeScript 5.0+
  • 运行环境: Node.js 18+
  • 依赖管理: npm

📦 作为库使用

本包除了可以作为 MCP 服务器使用,还可以作为 npm 库直接在项目中使用:

bash
npm install @mymcp-fun/bazi

可用的导出模块

  • @mymcp-fun/bazi/service - 八字计算服务类
  • @mymcp-fun/bazi/types - TypeScript 类型定义
  • @mymcp-fun/bazi - 完整的 MCP 服务器

📝 使用示例

在Claude Desktop中使用

  1. 配置MCP服务器后重启Claude Desktop
  2. 看到工具图标表示服务器已连接
  3. 提问示例:
请帮我计算一下2006年1月28日23时50分出生的人的八字信息

Claude会自动调用八字计算工具并返回详细分析:

八字四柱:乙酉 己丑 丁巳 壬子
生肖:鸡
星座:水瓶座
农历:2005年腊月廿九
五行分布:木1 火2 土2 金1 水2
日主:丁

编程调用示例

typescript
// 导入八字计算服务
import { MCPBaziService } from '@mymcp-fun/bazi/service';
import { BaziResult } from '@mymcp-fun/bazi/types';

const service = new MCPBaziService();
const result: BaziResult = await service.calculateBazi({
  year: 2006,
  month: 1, 
  day: 28,
  hour: 23
});

console.log(`四柱: ${result.四柱.年柱} ${result.四柱.月柱} ${result.四柱.日柱} ${result.四柱.时柱}`);
console.log(`生肖: ${result.生肖}`);
console.log(`星座: ${result.星座}`);

🎯 准确性保证

技术基础

  • 使用lunar-javascript作为计算引擎,这是最受信任的中文农历计算库之一
  • 周下载量1600+,远超其他同类包
  • 由专业开发者6tail维护,专门为中文传统算法设计

测试验证

  • ✅ 传统命理学经典案例测试通过
  • ✅ 边界时间处理测试通过
  • ✅ 全时区计算验证通过
  • ✅ 100%测试覆盖率

计算特色

  • 支持完整的天干地支计算
  • 准确的五行分析和权重计算
  • 正确的生肖和星座判断
  • 精确的农历日期转换

🌟 为什么选择这个包?

  1. 传播简单: 一行npm命令,无需复杂环境配置
  2. 计算准确: 基于权威lunar-javascript库,保证结果可靠
  3. 功能完整: 不仅有四柱,还包含生肖、星座、农历、五行分析
  4. 开发友好: TypeScript类型安全,现代化开发体验
  5. 生态兼容: 完美支持MCP协议,可与各种AI客户端集成

📞 支持

📄 许可证

MIT License - 查看 LICENSE 文件了解详情。


🌟 如果这个项目对你有帮助,请给个Star支持一下!

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "mymcp-fun-bazi": {
      "command": "npx",
      "args": [
        "-y",
        "@mymcp-fun/bazi"
      ]
    }
  }
}

Available Tools

  • get_bazi_details

    计算生辰八字和五行信息。输入出生年月日时,返回四柱、五行、生肖等完整的八字分析。

Use 八字计算MCP服务器 MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once 八字计算MCP服务器 is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add 八字计算MCP服务器 as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the 八字计算MCP服务器 MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "mymcp-fun-bazi": {
      "command": "npx",
      "args": [
        "-y",
        "@mymcp-fun/bazi"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the 八字计算MCP服务器 MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the 八字计算MCP服务器 MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use 八字计算MCP服务器 to help me with this task?
八字计算MCP服务器
Sure. I read it.
Here is what I found using 八字计算MCP服务器.

Frequently asked questions

What is the 八字计算MCP服务器 MCP server used for?

八字计算MCP服务器 is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use 八字计算MCP服务器 MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use 八字计算MCP服务器 with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use 八字计算MCP服务器 MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With 八字计算MCP服务器 connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect 八字计算MCP服务器 MCP to TypingMind?

八字计算MCP服务器 runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does 八字计算MCP服务器 MCP provide in TypingMind?

八字计算MCP服务器 exposes 1 MCP tools that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use 八字计算MCP服务器 MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If 八字计算MCP服务器 requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇