kcz/iztro-mcp-server
If you are the rightful owner of iztro-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
A Model Context Protocol (MCP) server that integrates the iztro library for Zi Wei Dou Shu astrology calculations.
@feida/iztro-mcp-server
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 three main tools:
- generate_astrolabe_by_solar - Generate an astrolabe using solar calendar date
- get_horoscope_analysis - Get horoscope analysis for a specific date
- get_palace_info - Get detailed information about all palaces in an astrolabe
Installation
From npm
npm install -g @feida/iztro-mcp-server
From source
git clone https://github.com/kcz/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:
@feida/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 test # Run tests in watch mode
npm run test:run # Run tests once
npm run test:coverage # Run tests with coverage report
npm run test:ui # Run tests with UI
MCP Tools
generate_astrolabe_by_solar
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")isDST(boolean, optional): Whether daylight saving time was in effect (default: false)locale(string, optional): Locale for the output (default: "en-US")
get_horoscope_analysis
Get horoscope analysis for a specific date using an existing astrolabe.
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")isDST(boolean, optional): Whether daylight saving time was in effect (default: false)locale(string, optional): Locale for the output (default: "en-US")targetDate(string, optional): Target date for horoscope analysis (defaults to current date)
get_palace_info
Get detailed information about all palaces in an astrolabe.
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")isDST(boolean, optional): Whether daylight saving time was in effect (default: false)locale(string, optional): Locale for the output (default: "en-US")
Example Usage
When connected to an MCP client, you can use these tools like:
{
"tool": "generate_astrolabe_by_solar",
"parameters": {
"date": "2000-8-16",
"hour": 2,
"gender": "male",
"isDST": false,
"locale": "en-US"
}
}
MCP Client Configuration
To use this server with an MCP client, add it to your client configuration:
{
"mcpServers": {
"iztro-astrology": {
"command": "@feida/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
├── iztro.test.ts # Tests for iztro library integration
├── mcp-tools.test.ts # Tests for MCP tools
└── integration.test.ts # Integration tests
Building
npm run build
Testing
npm run test:run # Run all tests
npm run test:coverage # Run tests with coverage
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for your changes
- Run the test suite
- Submit a pull request
Links
- Repository: https://github.com/kcz/iztro-mcp-server
- Issues: https://github.com/kcz/iztro-mcp-server/issues
- npm Package: https://www.npmjs.com/package/@feida/iztro-mcp-server
- iztro Library: https://github.com/SylarLong/iztro
- Model Context Protocol: https://modelcontextprotocol.io/
License
This project is licensed under the MIT License - see the file for details.