Skip to main content

TuViMCP — Vietnamese Tử Vi Library & MCP Server

CI PyPI version Documentation Status License: Apache 2.0

TuViMCP MCP server

English · Tiếng Việt · Full Documentation (ReadTheDocs)

TuViMCP Demo


English

TuViMCP is a stateless Python library and Model Context Protocol (MCP) server for Vietnamese Tử Vi Đẩu Số chart calculation (Thiên Lương conventions), transit analysis (Vận Hạn), Solar ↔ Lunar conversion, and auspicious date evaluation (Lịch Vạn Niên).

Highlights

  • Full Birth Charts: Computes Thiên Bàn, 12-house Địa Bàn (100+ stars, static house geometry, Tuần/Triệt), and 51 Cách Cục Trung Châu Phái formations from Solar or Lunar dates.
  • Vận Hạn (Transits): Yearly transit stars (Lưu tinh) plus active Đại Hạn, Tiểu Hạn, Nguyệt Hạn, and Nhật Hạn cycles.
  • Auspicious Almanac & Calendar: Hoàng Đạo / Hắc Đạo, 12 Trực, 28 Tú, 24 Tiết Khí, travel directions, 12 auspicious hours, and strict Ho Ngọc Đức / Meeus Solar ↔ Lunar conversion.
  • Print-Ready PNG Charts: Bundled Roboto Unicode fonts render crisp Vietnamese diacritics on headless/serverless environments, with optional custom .ttf overrides.
  • Zero External Services: Runs 100% locally and statelessly — no API keys, no database required.

Installation

pip install tuvi-mcp-server

MCP Server Setup

Run locally over stdio (default for Claude Desktop & Cursor) or Streamable HTTP:

tuvi-mcp                              # stdio transport
tuvi-mcp --http --port 1850           # streamable-http transport

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "tuvi-horoscope": {
      "command": "/path/to/.venv/bin/tuvi-mcp",
      "args": []
    }
  }
}

Available MCP Tools

Tool Description Docs
generate_horoscope Build a full Tử Vi chart (+ optional PNG image & timezone) Reference
get_van_han Yearly Lưu tinh and Đại / Tiểu / Nguyệt / Nhật Hạn for a Lunar period Reference
convert_calendar Solar ↔ Lunar conversion with leap-month & 29/30-day validation Reference
get_auspicious_info Hoàng Đạo, 12 Trực, 28 Tú, Tiết Khí, directions & hours Reference

Python Library Quickstart

from tuvi_mcp import Horoscope

h = Horoscope.from_birth(
    name="Nguyễn Văn A",
    year=1995, month=6, day=10,
    hour="14:30",      # also accepts "Mùi", 14, or 8 (branch index)
    gender="Nam",      # also accepts "male", 1, or Gender.MALE
    calendar="solar",  # or "lunar" / Calendar.LUNAR
)

chart = h.chart()                                  # Thiên Bàn + Địa Bàn + 51 Cách Cục
van_han = h.transit(year=2026, month=5, day=15)    # Đại / Tiểu / Nguyệt / Nhật Hạn
auspicious = h.auspicious(day=27, month=7, year=2026)
png_path = h.render_chart(chart, year=2026)        # PNG chart with bundled Roboto font

Note on Tradition: Vietnamese Tử Vi spans multiple lineages. tuvi_mcp implements Thiên Lương conventions (Số Tử Vi dưới mắt khoa học) and should be used as an objective computational reference. See Methodology & School Rules for full details.


Tiếng Việt

TuViMCP là thư viện Python và máy chủ Model Context Protocol (MCP) không trạng thái (stateless) chuyên lập lá số Tử Vi Đẩu Số Việt Nam (theo hệ phái Thiên Lương), phân tích Vận Hạn, chuyển đổi Dương lịch ↔ Âm lịch và tra cứu ngày giờ Hoàng Đạo.

Tính năng nổi bật

  • Lập lá số Tử Vi đầy đủ: Tính toán Thiên Bàn, 12 cung Địa Bàn (hơn 100 sao, quan hệ tam hợp/xung chiếu/nhị hợp/giáp cung, Tuần/Triệt) và nhận diện tự động 51 Cách Cục Trung Châu Phái.
  • Xem Vận Hạn: Tính bộ sao lưu niên (Lưu tinh) cùng các cung kích hoạt Đại Hạn, Tiểu Hạn, Nguyệt Hạn và Nhật Hạn.
  • Lịch Vạn Niên & Chuyển đổi lịch: Đánh giá Ngày/Giờ Hoàng Đạo, 12 Trực, 28 Tú, 24 Tiết Khí, hướng xuất hành và chuyển đổi Dương ↔ Âm lịch chính xác theo thuật toán Hồ Ngọc Đức / Meeus.
  • Xuất ảnh lá số PNG sắc nét: Tích hợp sẵn font Roboto Unicode hiển thị chuẩn dấu tiếng Việt trên mọi môi trường (kể cả server Linux không có font hệ thống), hỗ trợ truyền font .ttf tùy chọn.
  • Chạy hoàn toàn cục bộ: Không cần API key, không cần cơ sở dữ liệu.

Cài đặt

pip install tuvi-mcp-server

Khởi chạy Máy chủ MCP

tuvi-mcp                              # Chế độ stdio (Claude Desktop, Cursor)
tuvi-mcp --http --port 1850           # Chế độ Streamable HTTP

Cấu hình Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "tuvi-horoscope": {
      "command": "/path/to/.venv/bin/tuvi-mcp",
      "args": []
    }
  }
}

Danh sách công cụ MCP

Công cụ Chức năng Tài liệu
generate_horoscope Lập lá số Tử Vi đầy đủ (tùy chọn xuất ảnh PNG & timezone) Chi tiết
get_van_han Tính Lưu tinh và Đại / Tiểu / Nguyệt / Nhật Hạn theo ngày Âm lịch Chi tiết
convert_calendar Chuyển đổi Dương lịch ↔ Âm lịch (kiểm tra tháng nhuận & 29/30 ngày) Chi tiết
get_auspicious_info Xem ngày giờ Hoàng Đạo, 12 Trực, 28 Tú, Tiết Khí & hướng xuất hành Chi tiết

Dùng nhanh bằng Python

from tuvi_mcp import Horoscope

h = Horoscope.from_birth(
    name="Nguyễn Văn A",
    year=1995, month=6, day=10,
    hour="14:30",      # chấp nhận "Mùi", 14, hoặc 8 (chỉ số Địa Chi)
    gender="Nam",      # chấp nhận "male", 1, hoặc Gender.MALE
    calendar="solar",  # hoặc "lunar" / Calendar.LUNAR
)

chart = h.chart()                                  # Thiên Bàn + Địa Bàn + 51 Cách Cục
van_han = h.transit(year=2026, month=5, day=15)    # Đại / Tiểu / Nguyệt / Nhật Hạn
auspicious = h.auspicious(day=27, month=7, year=2026)
png_path = h.render_chart(chart, year=2026)        # Xuất ảnh PNG bằng font Roboto tích hợp sẵn

Lưu ý về học phái: Tử Vi Việt Nam có nhiều trường phái khác nhau. tuvi_mcp áp dụng quy chuẩn Thiên Lương (Số Tử Vi dưới mắt khoa học) để làm công cụ tính toán tham khảo khách quan. Xem chi tiết tại Methodology & School Rules.

Tài liệu & Liên kết


License

Licensed under the Apache License 2.0 — see LICENSE and NOTICE for details. Derivative works and distributions must preserve author attribution as specified in NOTICE.

Metadata

Release files for tuvi-mcp-server 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tuvi-mcp-server 0.6.1
File Size Uploaded Provenance Actions
tuvi_mcp_server-0.6.1.tar.gz 473.7 kB With provenance Details for tuvi_mcp_server-0.6.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tuvi-mcp-server 0.6.1
File Interpreter ABI Platform Actions
tuvi_mcp_server-0.6.1-py3-none-any.whl Python 3 none any Details for tuvi_mcp_server-0.6.1-py3-none-any.whl

Total release size: 930.5 kB

Release files / tuvi_mcp_server-0.6.1.tar.gz

Download URL tuvi_mcp_server-0.6.1.tar.gz
Size 473.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f27f9d058b3989a0c647e8a5d87681add8e3226122af24d3d9675a1919b81fb0
BLAKE2b-256 checksum
How to use checksums
c191f5861c37a4d6efc8cc9763a13ad7d846f4468e5101dde8d0dab9385c3463
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / tuvi_mcp_server-0.6.1-py3-none-any.whl

Download URL tuvi_mcp_server-0.6.1-py3-none-any.whl
Size 456.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4eb60ac29ebe4825b770f8a7c15383fd9eae3c3936cfad7c0351a439e7e85b95
BLAKE2b-256 checksum
How to use checksums
78d354fba3b6c3c983793d9007c4ec674dc585a3caa0a4b486d47587432e3a6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for tuvi-mcp-server 0.6.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tuvi_mcp_server-0.6.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page