MCP.so
Sign In
Servers

紫微斗数

@xavieryang007

紫微斗数排盘

Overview

What is 紫微斗数?

A microservice developed in Go for Zi Wei Dou Shu (Purple Star Astrology) chart calculation. It supports both solar and lunar calendar date inputs and provides two REST API endpoints. This service is intended for developers integrating Chinese astrology calculations into their applications.

How to use 紫微斗数?

Clone the repository, run go mod tidy and go run main.go to start the server (Go 1.23+ required). The service listens on 127.0.0.1:3000 by default; use --host and --port flags to customize. Send GET requests to /ziwei_yangli (solar calendar) or /ziwei_nongli (lunar calendar) with the required query parameters (year, month, day, hour, minute, sex). The response is a standard JSON object containing the calculated chart.

Key features of 紫微斗数

  • Supports both solar and lunar calendar calculations
  • Automatic conversion of clock hours to traditional Chinese two-hour periods
  • Returns structured JSON data for easy integration
  • Built with Go for fast performance and simple deployment
  • Runnable as a standalone microservice via command line

Use cases of 紫微斗数

  • Generating a personal Zi Wei Dou Shu birth chart for analysis or display
  • Integrating astrology calculation into a backend system via API
  • Building educational tools or apps related to Chinese metaphysics

FAQ from 紫微斗数

How do I configure the host and port?

Use the --host and --port command-line flags when running the server, for example go run main.go --host 127.0.0.1 --port 3000.

What are the required API parameters?

The endpoints require six parameters: year, month, day, hour, minute (all numbers) and sex (string: "男" or "女").

Does the service automatically convert hour values to traditional Chinese two-hour periods?

Yes, the hour value (0–23) is mapped to the corresponding two-hour period (e.g., 0 is 子时 23:00–01:00, 1 is 丑时 01:00–03:00, etc.) before calculation.

What is the difference between the two endpoints?

/ziwei_yangli treats the input date as solar calendar, while /ziwei_nongli treats it as lunar calendar. Both return a chart in the same JSON format.

What runtime environment is required?

Go version 1.23 or higher is needed to compile and run the service.

More from Other