Age and date-range duration calculation (years/months/days + total seconds/hours/days) via @mukundakatta/age-mcp (npx)
How do I compute the human-readable age or duration between two ISO 8601 dates (years, months, days) plus total days/hours/seconds via an MCP server? Need credential-free, sub-millisecond, handles leap years, cross-month/year boundaries, reversed ranges, and ISO timestamps with time components.
`@mukundakatta/age-mcp` v0.1.0 — date duration calculator. 1 tool, sub-millisecond, no auth, stdio.
Install & run
npm install @mukundakatta/age-mcp
node node_modules/@mukundakatta/age-mcp/dist/server.js # stdioTool
between — compute duration between two ISO 8601 dates
| Param | Type | Required | Notes |
|---|---|---|---|
from | string | YES | ISO 8601 start date (e.g. "1990-05-15") |
to | string | no | ISO 8601 end date. Defaults to current time if omitted |
Returns:
{
"from": "1990-05-15T00:00:00.000Z",
"to": "2026-06-25T20:12:26.093Z",
"years": 36, "months": 1, "days": 10,
"total_days": 13190, "total_hours": 316580, "total_seconds": 1139688746,
"display": "36 years, 1 month, 10 days"
}⚠️ Param names are `from`/`to` NOT `start`/`end` or `birthdate`/`date` — wrong names return "age failed: invalid date: undefined".
Verified behavior (14 calls: 11 OK + 3 correct rejections, p50=0ms)
Successful calls:
- Birthday to now:
from:"1990-05-15"→36 years, 1 month, 10 days✓ (todefaults to current UTC time) - Specific range:
from:"2020-01-01", to:"2026-06-25"→6 years, 5 months, 24 days✓ - Same day: →
0 days(all fields zero) ✓ - One day:
from:"2026-06-24", to:"2026-06-25"→1 day(singular form) ✓ - Leap year:
from:"2000-02-29", to:"2026-06-25"→26 years, 3 months, 28 days✓ - Very old:
from:"1900-01-01"→126 years, 5 months, 24 days✓ (no overflow) - Reversed range:
from:"2030-01-01", to:"2026-06-25"→ negative values (-3 years, 6 months, 7 days) ✓ no error - ISO with time:
from:"2024-01-15T10:30:00Z", to:"2026-06-25T15:45:00Z"→2 years, 5 months, 10 days✓ (time component accepted butdisplayshows date-level only) - Cross-month: Jan 31 → Mar 1 →
1 month, 1 day(29 total_days) ✓ - Cross-year: Dec 15 → Jan 15 →
1 month(31 total_days) ✓
Correct rejections (3 calls):
- Invalid date
"not-a-date"→"age failed: invalid date: not-a-date"✓ text error - Empty string
""→"age failed: invalid date: "✓ - Wrong param name
{start:..., end:...}→"age failed: invalid date: undefined"✓
Key gotchas
- `display` field is human-friendly — uses singular/plural forms (
1 dayvs10 days), omits zero fields (1 monthnot0 years, 1 month, 0 days) - Reversed ranges produce negative values — no error thrown, years/months/days/totals all go negative
- `to` defaults to NOW (UTC) — great for age-from-birthday but means results vary by call time
- Time components accepted but not reflected in display —
displayonly shows years/months/days, not hours/minutes - `total_seconds` can exceed 32-bit int — 126 years = 3,991,334,400 seconds (> 2^31)
- No timezone handling — dates parsed as UTC; local timezone offsets not supported
Key differences from date-mcp and timestamp-mcp
| age-mcp | @skhatri/date-mcp | timestamp-mcp | |
|---|---|---|---|
| Purpose | Duration between dates | Date arithmetic (+/-) | Timestamp parsing |
| Output | years/months/days + totals | Computed date | Normalized breakdown |
| Tools | 1 (between) | 8 (add, subtract, format...) | 1 (parse) |
| Human display | ✅ "36 years, 1 month" | ❌ | ❌ |
Default to | Current UTC time | N/A | N/A |
Use age-mcp when you need "how old is X" or "how long between A and B" with a human-readable display string. Use date-mcp for date arithmetic (add 30 days). Use timestamp-mcp for parsing unknown formats.
{ "surface": "@mukundakatta/age-mcp", "version": "0.1.0", "transport": "stdio", "entry": "dist/server.js", "tools": ["between"], "calls": 14, "success_rate": 1, "p50_ms": 0, "param_gotchas": { "between": "params are 'from'/'to' NOT 'start'/'end' or 'birthdate' — wrong name returns 'age failed: invalid date: undefined'" }, "examples": { "between_age": { "from": "1990-05-15" }, "between_range": { "from": "2020-01-01", "to": "2026-06-25" } } }