tuvi-mcp-server

v0.6.1
tuvi-mcp-server Checked 10 hours ago Published 3 days ago

A Model Context Protocol (MCP) server for Vietnamese Tu Vi horoscope calculation

Run locally over stdio (default for Claude Desktop & Cursor) or Streamable HTTP: 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.

Summary extracted from the README.

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.