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

@xzkcz/iztro-mcp-server

v2.2.1

Published

MCP server exposing iztro astrology methods for Zi Wei Dou Shu astrolabe generation and horoscope analysis

Readme

iztro MCP Server

npm version License: MIT Node.js Version

A Model Context Protocol (MCP) server that exposes the iztro library methods for Zi Wei Dou Shu astrology calculations.

About

This MCP server provides a bridge between the powerful iztro astrology library and MCP-compatible clients, enabling seamless integration of Chinese astrology calculations into AI applications and workflows.

Features

This MCP server provides six main tools:

  1. get_astrolabe - Generate an astrolabe using solar calendar date
  2. get_horoscope_decades - Get all decadal data for whole life
  3. get_horoscope_ages - Get all age data for whole life
  4. get_horoscope_years - Get all yearly data for whole life
  5. get_horoscope_months - Get monthly data for one year
  6. get_mutaged_places - Get the 4 palaces affected by the four transformations (禄权科忌) from a specific palace
  7. gen_astrolabe - Generate an astrolabe, decades, years, ages, months in separate JSON files in a specific path

Installation

From npm

npm install -g @xzkcz/iztro-mcp-server

From source

git clone https://github.com/xzkcz/iztro-mcp-server.git
cd iztro-mcp-server
npm install
npm run build

Usage

As a Global Package

After installing globally, you can run the server directly:

@xzkcz/iztro-mcp-server

Development

To run the server in development mode:

npm run dev

Production

To build and run the server:

npm run build
npm start

Testing

Run the test suite:

npm run test            # Run tests once
npm run test:watch      # Run tests in watch mode
npm run test:coverage   # Run tests with coverage report
npm run test:ui         # Run tests with UI

MCP Tools

get_astrolabe

Generate an astrolabe using solar calendar date for Zi Wei Dou Shu astrology analysis.

Parameters:

  • date (string, required): Birth date in YYYY-M-D format (e.g., "2000-8-16")
  • hour (number, required): Birth hour in 24-hour format (0-23)
  • gender (enum, required): Gender of the person ("male" or "female")
  • fixLeap (boolean, optional): Whether to fix the leap month (default: true)
  • locale (enum, optional): Locale for the output ("zh-CN" or "en-US", default: "zh-CN")

get_horoscope_decades

Get all decadal data for whole life.

Parameters:

  • date (string, required): Birth date in YYYY-M-D format (e.g., "2000-8-16")
  • hour (number, required): Birth hour in 24-hour format (0-23)
  • gender (enum, required): Gender of the person ("male" or "female")
  • fixLeap (boolean, optional): Whether to fix the leap month (default: true)
  • locale (enum, optional): Locale for the output ("zh-CN" or "en-US", default: "zh-CN")

get_horoscope_ages

Get all age data for whole life.

Parameters:

  • date (string, required): Birth date in YYYY-M-D format (e.g., "2000-8-16")
  • hour (number, required): Birth hour in 24-hour format (0-23)
  • gender (enum, required): Gender of the person ("male" or "female")
  • fixLeap (boolean, optional): Whether to fix the leap month (default: true)
  • locale (enum, optional): Locale for the output ("zh-CN" or "en-US", default: "zh-CN")

get_horoscope_years

Get all yearly data for whole life.

Parameters:

  • date (string, required): Birth date in YYYY-M-D format (e.g., "2000-8-16")
  • hour (number, required): Birth hour in 24-hour format (0-23)
  • gender (enum, required): Gender of the person ("male" or "female")
  • fixLeap (boolean, optional): Whether to fix the leap month (default: true)
  • locale (enum, optional): Locale for the output ("zh-CN" or "en-US", default: "zh-CN")

get_horoscope_months

Get monthly data for one year.

Parameters:

  • year (number, required): Year to get monthly data for (e.g., 2024)
  • fixLeap (boolean, optional): Whether to fix the leap month (default: true)
  • locale (enum, optional): Locale for the output ("zh-CN" or "en-US", default: "zh-CN")

get_mutaged_places

Get the 4 palaces that are affected by the four transformations (禄权科忌) from a specific palace.

Parameters:

  • date (string, required): Birth date in YYYY-M-D format (e.g., "2000-8-16")
  • hour (number, required): Birth hour in 24-hour format (0-23)
  • gender (enum, required): Gender of the person ("male" or "female")
  • palaceName (number | string, required): Palace to analyze. Can be either:
    • A number (0-11): Palace index (0=命宫, 1=兄弟, 2=夫妻, 3=子女, 4=财帛, 5=疾厄, 6=迁移, 7=奴仆, 8=官禄, 9=田宅, 10=福德, 11=父母)
    • A Chinese string: Palace name (e.g., "命宫", "财帛", "官禄", "夫妻", "子女", "疾厄", "迁移", "奴仆", "田宅", "福德", "父母", "兄弟")
    • An English string: Palace name (e.g., "soul", "wealth", "career", "spouse", "children", "health", "surface", "friends", "property", "spirit", "parents", "siblings")
  • fixLeap (boolean, optional): Whether to fix the leap month (default: true)
  • locale (enum, optional): Locale for the output ("zh-CN" or "en-US", default: "zh-CN")

Returns: A structured response containing:

  • sourcePalace: Information about the source palace
  • mutagedPlaces: Array of 4 elements corresponding to the four transformations [禄, 权, 科, 忌]
  • metadata: Birth information and generation timestamp

gen_astrolabe

Generate an astrolabe, decades, years, ages, months in separate JSON files in a specific path.

Parameters:

  • date (string, required): Birth date in YYYY-M-D format (e.g., "2000-8-16")
  • hour (number, required): Birth hour in 24-hour format (0-23)
  • gender (enum, required): Gender of the person ("male" or "female")
  • path (string, required): Absolute path to the directory where the JSON files will be saved
  • fixLeap (boolean, optional): Whether to fix the leap month (default: true)
  • locale (enum, optional): Locale for the output ("zh-CN" or "en-US", default: "zh-CN")

Returns:

  • success: Boolean indicating success
  • files: Array of strings containing the paths of the generated files (astrolabe.json, decades.json, ages.json, years.json, months.json)

Example Usage

When connected to an MCP client, you can use these tools like:

{
  "tool": "get_astrolabe",
  "parameters": {
    "date": "2000-8-16",
    "hour": 2,
    "gender": "male",
    "fixLeap": true,
    "locale": "zh-CN"
  }
}
{
  "tool": "get_mutaged_places",
  "parameters": {
    "date": "2000-8-16",
    "hour": 2,
    "gender": "female",
    "palaceName": "命宫",
    "fixLeap": true,
    "locale": "zh-CN"
  }
}
{
  "tool": "get_mutaged_places",
  "parameters": {
    "date": "2000-8-16",
    "hour": 2,
    "gender": "male",
    "palaceName": 0,
    "fixLeap": true,
    "locale": "zh-CN"
  }
}
{
  "tool": "get_mutaged_places",
  "parameters": {
    "date": "2000-8-16",
    "hour": 2,
    "gender": "female",
    "palaceName": "soul",
    "fixLeap": true,
    "locale": "en-US"
  }
}

MCP Client Configuration

To use this server with an MCP client, add it to your client configuration:

{
  "mcpServers": {
    "iztro-astrology": {
      "command": "@xzkcz/iztro-mcp-server",
      "args": []
    }
  }
}

Requirements

  • Node.js >= 18.0.0
  • npm or yarn

Dependencies

  • fastmcp: TypeScript framework for building MCP servers
  • iztro: Lightweight JavaScript library for Zi Wei Dou Shu astrolabe generation
  • zod: Schema validation library

Development

Project Structure

src/
├── index.ts              # Main MCP server implementation
├── getAstroMonth.ts      # Utility for astrology month calculations
├── getAstroYear.ts       # Utility for astrology year calculations
├── hourToTimeIndex.ts    # Utility for time index conversion
└── tests/
    ├── bySolar.test.ts       # Tests for solar calendar functions
    ├── getAstroMonth.test.ts # Tests for astrology month utilities
    ├── getAstroYear.test.ts  # Tests for astrology year utilities
    ├── hourToTimeIndex.test.ts # Tests for time index utilities
    ├── integration.test.ts   # Integration tests
    ├── iztro.test.ts         # Tests for iztro library integration
    └── tools.test.ts         # Tests for MCP tools

Building

npm run build

Testing

npm run test:run          # Run all tests
npm run test:coverage     # Run tests with coverage

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for your changes
  5. Run the test suite
  6. Submit a pull request

Links

License

This project is licensed under the MIT License - see the LICENSE file for details.