Lunar Calendar Service(万年历)

Created By
wouhao2 months ago
中文万年历 MCP 服务。支持公农历转换、二十四节气、法定节假日、黄历宜忌、八字五行、黄道吉日查询,共 9 个工具,直接接入 Claude/Cursor 使用。
Overview

lunar-calendar-service

🗓️ 给 AI Agent 使用的中文万年历 MCP 服务。提供公农历转换、二十四节气、法定节假日、黄历宜忌、八字五行等查询能力。

线上服务: https://cheerful-trust-production-065e.up.railway.app/sse


快速接入

Claude Desktop

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "lunar-calendar": {
      "url": "https://cheerful-trust-production-065e.up.railway.app/sse",
      "transport": "sse"
    }
  }
}

Cursor / Windsurf

在 MCP 设置里添加:

Name: lunar-calendar
URL:  https://cheerful-trust-production-065e.up.railway.app/sse
Type: SSE

本地运行(stdio 模式)

git clone https://github.com/wouhao/lunar-calendar-service
cd lunar-calendar-service
uv sync

# Claude Desktop 本地接入
# claude_desktop_config.json:
# {
#   "mcpServers": {
#     "lunar-calendar": {
#       "command": "uv",
#       "args": ["run", "python", "server.py"],
#       "cwd": "/path/to/lunar-calendar-service"
#     }
#   }
# }
uv run python server.py

可用工具(9 个)

基础功能

工具参数说明
get_date_infodate: YYYY-MM-DD返回公历/农历/干支/生肖/星座/节气/节假日完整信息
solar_to_lunardate: YYYY-MM-DD公历 → 农历
lunar_to_solaryear, month, day, leap_month?农历 → 公历(支持闰月)
get_solar_termsyear: int查询某年全部 24 节气日期
is_holidaydate: YYYY-MM-DD是否节假日 / 调休上班
get_holidaysyear: int某年全部法定节假日列表

黄历

工具参数说明
get_almanacdate: YYYY-MM-DD每日宜忌、吉神方位(喜/福/财)、纳音、彭祖百忌

高级

工具参数说明
get_advanced_infodate: YYYY-MM-DD, hour?: 0-23八字、五行、星宿、胎神、佛历、道历、黄道黑道
get_lucky_daysstart_date, end_date, purpose?查询范围内的黄道吉日,可指定用途

使用示例

接入后,你可以这样问 Claude:

  • "今天是什么日子?有没有节气?"
  • "明天黄历上宜什么忌什么?"
  • "2025 年春节是哪天?"
  • "下个月有哪些黄道吉日适合开业?"
  • "帮我查一下 2025 年全年节假日安排"
  • "农历正月初一是公历几号?"

技术栈

层次技术
语言Python 3.11+
包管理uv
底层历法库lunar-python 1.4.8
服务层FastMCP (MCP SDK)
SchemaPydantic v2
节假日数据静态 JSON(2025 年)
部署Railway

本地开发

# 安装依赖
uv sync

# 运行测试
uv run pytest tests/ -v

# CLI 快捷查询
uv run python cli.py today

# 本地 HTTP/SSE 模式
MCP_TRANSPORT=sse PORT=8000 uv run python server.py
curl http://localhost:8000/health

自行部署到 Railway

项目已包含 railway.jsonProcfile

  1. Fork 本仓库
  2. Railway 创建项目,导入 GitHub 仓库
  3. 部署完成后,MCP endpoint 为 https://<your-app>.up.railway.app/sse

路线图

  • Phase 1:核心功能(公农历/节气/节假日)
  • Phase 2:黄历增强(宜忌/方位/纳音)
  • Phase 3:高级功能(八字/五行/吉日)
  • Phase 4:Railway 云端部署
  • 补充 2026 年节假日数据
  • 更多年份节假日支持

License

MIT


如有问题或建议,欢迎提 Issue 或 PR。

Server Config

{
  "mcpServers": {
    "lunar-calendar": {
      "url": "https://cheerful-trust-production-065e.up.railway.app/sse",
      "transport": "sse"
    }
  }
}
Project Info
Created At
2 months ago
Updated At
a month ago
Author Name
wouhao
Star
-
Language
-
License
-
Category

Recommend Servers

View All
GovQL
@Alex Stout

# govql-mcp-server An MCP (Model Context Protocol) server for [GovQL](https://govql.us) — gives AI clients like Claude Desktop, Claude Code, and Cursor direct access to the US Congressional GraphQL API at [api.govql.us/graphql](https://api.govql.us/graphql) without bespoke HTTP wiring. For the design rationale (why FastMCP-Python, the passthrough+curated philosophy, roadmap through v0.4), see [design.md](https://github.com/govql/govql/blob/main/mcp-server/docs/design.md). ## What you can do with it Ask an agent questions like: - *"How did Vermont's two senators vote on the most recent nomination?"* - *"Which legislators in the 118th Congress switched parties during their service?"* - *"Compare Senator Sanders' voting record to Senator Murkowski's on cloture votes in the most recent Congress."* The agent picks the right tool, writes the GraphQL query against the live schema, and parses the response — no manual API wrangling. ## Install The server runs as a per-client subprocess over stdio. Pick your client: ### Claude Desktop Edit `claude_desktop_config.json` (Settings → Developer → Edit Config): ```json { "mcpServers": { "govql": { "command": "uvx", "args": ["govql-mcp-server"] } } } ``` Restart Claude Desktop. The `govql` tools appear in the tools panel. ### Claude Code Add to `.mcp.json` in your project (or `~/.mcp.json` for global): ```json { "mcpServers": { "govql": { "command": "uvx", "args": ["govql-mcp-server"] } } } ``` ### Cursor Settings → MCP → Add Server. Use the same `command` / `args` as above. ### Other clients Any MCP-compatible client that supports stdio servers will work. The command is `uvx govql-mcp-server` with no required arguments. ## Tools | Tool | Purpose | |---|---| | `execute_graphql` | Run any GraphQL query against the GovQL endpoint. Returns the result plus an `last_ingest` timestamp so the agent can reason about data freshness. | | `list_types` | Returns the names and kinds of every type in the GovQL schema. Optional `kind` filter (`"OBJECT"`, `"INPUT_OBJECT"`, `"ENUM"`, etc.) to narrow further. Start here when you don't know what's queryable. | | `describe_type` | Returns one type's full details — fields, arg signatures, input fields, enum values. Call after `list_types` to learn the shape of a specific type before writing a query. | ## Configuration All env vars are optional — the package is zero-config for end users. | Env var | Default | Purpose | |---|---|---| | `GOVQL_ENDPOINT` | `https://api.govql.us/graphql` | Endpoint to query. Override to point at a local dev stack. | | `GOVQL_TIMEOUT_MS` | `30000` | Per-request HTTP timeout. | | `LOG_LEVEL` | `INFO` | Logging level. Logs go to stderr only (stdout is reserved for the MCP transport). | ## Limits (enforced by the upstream API) - Max query depth: 10 - Max query complexity: ~10 billion points (`first: N` multiplies child cost by N — keep page sizes reasonable on deeply nested queries) - Rate limit: 100 requests / 60 s per source IP A depth or complexity violation surfaces as a GraphQL `errors` entry in the tool response so the agent can adjust and retry. ## Data freshness Every `execute_graphql` response includes a `last_ingest` ISO timestamp. Vote data refreshes hourly; legislator data refreshes daily. ## Status Version 0.1.0 ships three foundational tools: a GraphQL passthrough (`execute_graphql`) and two narrow schema-discovery tools (`list_types`, `describe_type`). Curated higher-level tools (`find_legislator`, `get_voting_record`, `compare_voters`, etc.) are planned for subsequent releases — see [design.md](https://github.com/govql/govql/blob/main/mcp-server/docs/design.md) for the roadmap. ## Links - [GovQL project site](https://govql.us) - [GraphQL API](https://api.govql.us/graphql) - [Source / issues](https://github.com/govql/govql)

a day ago