Timestamp-first perpetual calendar interop for AI agents — MCP server for cross-calendar conversion across East/West calendar systems.
Project description
Clawlendar
Timestamp-first perpetual calendar interop for AI agents.
Clawlendar = Claw (AI agent) + Calendar
Clawlendar helps agents speak the same time language across systems, regions, and calendar traditions. It normalizes an instant first (Unix timestamp), then projects to multiple calendars with a stable JSON contract.
Available as an MCP server (for Claude Desktop / Claude Code), a FastAPI HTTP service, and a CLI tool.
GitHub Pages Showcase
This repo includes a showcase page at docs/index.html for GitHub Pages.
Enable it via:
- GitHub repository Settings -> Pages
- Build and deployment -> Source =
Deploy from a branch - Branch =
main, Folder =/docs - Save, then open:
https://hosuke.github.io/Clawlendar/
Install as MCP Server
From PyPI
pip install clawlendar
From source
git clone https://github.com/Hosuke/Clawlendar.git
cd Clawlendar
pip install -e .
Claude Desktop configuration
Add to your claude_desktop_config.json:
{
"mcpServers": {
"clawlendar": {
"command": "clawlendar"
}
}
}
Config file location:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Claude Code
claude mcp add clawlendar -- clawlendar
MCP Tools
Once connected, Claude has access to six tools:
| Tool | Description |
|---|---|
capabilities |
List all supported calendars, payload schemas, and optional provider status |
convert |
Convert a date from one calendar to one or more target calendars |
timeline |
Normalize an instant (timestamp-first) and project into multiple calendar systems |
astro_snapshot |
Return seven governors, four remainders, and major aspects (approximate) |
calendar_month |
Resolve true month boundaries and day list for non-Gregorian month mode |
day_profile |
One-call day details: calendar profile + solar term + sexagenary + optional astro |
Supported Calendars
gregorianjulianiso_weekunix_epochminguobuddhistjapanese_erasexagenary(approximate)solar_term_24(approximate)
Optional (install extras)
pip install clawlendar[all] # all optional calendars
pip install clawlendar[lunar] # Chinese lunar only
pip install clawlendar[extra-calendars] # Islamic, Hebrew, Persian
chinese_lunar— vialunardateislamic/hebrew/persian— viaconvertdate
CLI Usage
pip install -e .
# List calendars
python3 scripts/calendar_bridge.py capabilities
# Convert a date
python3 scripts/calendar_bridge.py convert \
--source gregorian \
--targets julian,iso_week,minguo,buddhist,japanese_era,sexagenary,solar_term_24 \
--date-json '{"year": 2026, "month": 3, "day": 9}' \
--locale zh-TW
# Timeline projection
python3 scripts/calendar_bridge.py timeline \
--input-json '{"timestamp": 1773014400}' \
--timezone 'Asia/Taipei' \
--date-basis local \
--targets minguo,japanese_era,sexagenary,solar_term_24 \
--locale zh-CN
# Astro snapshot (seven governors + four remainders)
python3 scripts/calendar_bridge.py astro \
--input-json '{"timestamp": 1773014400}' \
--timezone 'Asia/Taipei'
# Day profile (calendar details + optional astro)
python3 scripts/calendar_bridge.py day-profile \
--input-json '{"timestamp": 1773014400}' \
--timezone 'Asia/Taipei' \
--locale zh-TW
# True month boundary mode (example: Minguo 115/03)
python3 scripts/calendar_bridge.py calendar-month \
--source minguo \
--month-json '{"year":115,"month":3}'
HTTP API (FastAPI)
pip install -e ".[api]"
./scripts/run_api.sh
Endpoints: GET /health · GET /capabilities · POST /convert · POST /timeline · POST /astro · POST /day-profile · POST /calendar-month
# Smoke test
./scripts/curl_examples.sh
# Convert a date
curl -sS -X POST http://127.0.0.1:8000/convert \
-H "Content-Type: application/json" \
-d '{
"source": "gregorian",
"targets": ["julian", "iso_week", "minguo"],
"source_payload": {"year": 2026, "month": 3, "day": 9},
"locale": "zh-CN"
}' | python3 -m json.tool
Docker
docker build -t clawlendar:mvp .
docker run --rm -p 8000:8000 clawlendar:mvp
Architecture
- Parse input as an instant (
timestamp,timestamp_ms,iso_datetime, orlocal_datetime+ timezone). - Normalize to UTC.
- Choose projection date basis (
localorutc). - Convert from canonical Gregorian bridge date to target calendars.
- Return structured JSON plus warnings for optional/approximate providers.
Repository Structure
src/clawlendar/
__init__.py # package version
bridge.py # core calendar conversion engine
server.py # MCP server entry point
scripts/
calendar_bridge.py # CLI wrapper
api_server.py # FastAPI service layer
run_api.sh # API launch helper
curl_examples.sh # HTTP smoke examples
references/
integration-contract.md
time-wheel-model.md
calendar-landscape.md
mvp-release-notes.md
Known Limitations (MVP)
sexagenaryyear boundary is approximate.solar_term_24is fixed-date approximation, not ephemeris-accurate astronomy.sexagenaryandsolar_term_24keep stable machine keys and add localized display fields vialocale(zh-CN,zh-TW, etc.).- Some calendars are available only when optional dependencies are installed.
Roadmap
- Astronomical solar-term provider.
- Higher-precision Chinese lunar provider with regression fixtures.
- Publish to PyPI and MCP server directory.
中文说明
Clawlendar 是一个给 AI agents 用的「时间与历法互通层」,同时也是一个 MCP Server(可直接接入 Claude Desktop / Claude Code)。
核心做法是先用时间戳统一「绝对时间」,再投影到不同时区与历法,输出稳定 JSON,方便多工具接入。
安装
pip install clawlendar
在 Claude Desktop 的 claude_desktop_config.json 中加入:
{
"mcpServers": {
"clawlendar": {
"command": "clawlendar"
}
}
}
支持的历法
- 公历、儒略历、ISO 周、Unix 纪元
- 民国纪年、佛历、日本年号
- 干支(近似)、二十四节气(近似)
- 干支/节气支持本地化显示(可传
locale=zh-CN或locale=zh-TW,同时保留机器可读 key) - 可选:农历(
lunardate)、伊斯兰历、希伯来历、波斯历(convertdate)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clawlendar-0.2.1.tar.gz.
File metadata
- Download URL: clawlendar-0.2.1.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac57b73346a24cebe5b80adca82e3c784c835f69f631922ec851156c2f7342a9
|
|
| MD5 |
f5fde87dad13ee1c0f32bcf52ceabc24
|
|
| BLAKE2b-256 |
831722af7a2f635e278e0342ba7b1d514bdddcdee119e4454696a97246989c72
|
File details
Details for the file clawlendar-0.2.1-py3-none-any.whl.
File metadata
- Download URL: clawlendar-0.2.1-py3-none-any.whl
- Upload date:
- Size: 19.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7411ba5f6d514748b03df462458452e8bd433ef5bfcef773f152f078de76e92c
|
|
| MD5 |
fc564a80d45edf3067a83ffc23924669
|
|
| BLAKE2b-256 |
bac315dff6c99e41a63c323a3e0c79d8a9ea4f57c2effc872ff0006d8145e7ad
|