TuViMCP — Vietnamese Tử Vi Library & MCP Server
English · Tiếng Việt · Full Documentation (ReadTheDocs)
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
.ttfoverrides. - 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_mcpimplements 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.
Links
- Full Documentation · MCP Setup Guide · Output Schemas
- Sample JSON Outputs & Scripts · Changelog · Contributing
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
.ttftù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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tuvi_mcp_server-0.6.0.tar.gz | 473.1 kB | With provenance | Details for tuvi_mcp_server-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tuvi_mcp_server-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for tuvi_mcp_server-0.6.0-py3-none-any.whl |
Total release size: 929.4 kB
Release files / tuvi_mcp_server-0.6.0.tar.gz
| Download URL | tuvi_mcp_server-0.6.0.tar.gz |
|---|---|
| Size | 473.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b87d96e76627d9c670a12a35f5c6d95b8cf11637807d2e9d9511094d0bf136b8
|
|
BLAKE2b-256 checksum How to use checksums |
c9a2288f0e219392f792fe0c0da038b892f87a6fff96da3a6d1e3ac4c520b86e
|
| 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 logRelease files / tuvi_mcp_server-0.6.0-py3-none-any.whl
| Download URL | tuvi_mcp_server-0.6.0-py3-none-any.whl |
|---|---|
| Size | 456.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a4fce3e2532ddfa2314a5aa1aa66acb87aaeecfb46786ed1b27ec45890a57b0
|
|
BLAKE2b-256 checksum How to use checksums |
eac82080ce3c0ee7b367ac9f52865327d7934d6df7fbc332d774b808d19e6427
|
| 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 logSecurity for tuvi-mcp-server 0.6.0
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.
Attestation for tuvi_mcp_server-0.6.0.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 logA 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.