為 AI Agent 接入越南農曆:免費 MCP server 與 REST API
Giving your AI agent a Vietnamese lunar calendar: a free MCP server and REST API
免費 MCP server 和 REST API 提供越南農曆資料,供 AI Agent 或應用程式查詢及轉換日期。服務亦可查詢節氣、干支、吉日和吉時,並搜尋文化知識庫。日期須按 Asia/Ho_Chi_Minh(UTC+7)處理;免費方案每個 IP 每分鐘限 60 次、每日限 2,000 次請求。
If you build anything for Vietnamese users (a booking app, a chatbot, a reminder bot, an HR tool), sooner or later someone asks a question your date library can't answer:
- "What is the lunar date today?"
- "When is Tết next year?"
- "Is this Saturday a good day to open the shop?"
The Vietnamese lunisolar calendar is not just "the Chinese calendar with a different name". It is computed for UTC+7, so a few new moons fall on a different day than in UTC+8 calendars, and the leap months and the Tết date can differ too. Hard-coding a lookup table that you copied from somewhere is how bugs like "our app says Tết is on the wrong day" happen.
Here is a lighter option I've been using: a free MCP server plus a plain REST API that already handle this.
Option 1: plug the MCP server into your agent
The server speaks Streamable HTTP and needs no API key for the free tier. In any MCP-capable client:
{
"mcpServers": {
"amlichvietnam": {
"url": "https://amlichvietnam.vn/mcp"
}
}
}
Useful tools it exposes:
| Tool | What it does |
|---|---|
get_lunar_today |
Today's lunar date, can chi (stem–branch), solar term, auspicious hours (ICT) |
convert_lunar_date |
Solar ↔ lunar conversion, leap-month aware |
find_good_days / check_good_day
|
Auspicious days for a purpose (wedding, opening, moving house…) |
search_knowledge |
Search the cultural knowledge base |
Once it is connected, the agent can answer "what's the lunar date on 17 Feb 2027?" by calling the tool instead of guessing, and that is the whole point: no hallucinated dates.
Option 2: call the REST API directly
If you don't need an agent, the same data is behind a REST API (OpenAPI 3.1 spec available):
curl -s "https://amlichvietnam.vn/api/public/v1/lunar/today"
You get JSON with the solar date, the lunar date (with a leap flag), can chi for day/month/year, the current solar term, the "trực" of the day and the list of auspicious hours, for example:
"lunar": { "day": 16, "month": 10, "year": 2026, "leap": false },
"can_chi": { "day": "Nhâm Dần", "month": "Kỷ Hợi", "year": "Bính Ngọ" }
Converting a specific date:
curl -s "https://amlichvietnam.vn/api/public/v1/lunar/convert?date=2027-02-06&direction=solar_to_lunar"
Things to keep in mind
- Time zone matters. Always treat dates as Asia/Ho_Chi_Minh (UTC+7). A date computed in UTC can land one day off around midnight.
- Rate limits. The free tier allows 60 requests/minute and 2,000/day per IP. Cache results; a lunar date never changes once computed.
-
Attribution. When you show results, the docs ask you to cite the source and the
source_urlreturned with each response. - It's cultural, not advice. "Good day" results are traditional references. Present them that way in your UI.
Wrap-up
For most apps you don't need to implement lunisolar astronomy yourself. Point your agent at the MCP endpoint, or call the REST API, and spend your time on the product instead.
Docs, the server card and the OpenAPI link are here: https://amlichvietnam.vn/en
Have you shipped lunar-calendar features before? I'd love to hear how you handled leap months.
來源:DEV Community · dev.to