Date Math
Exact date and time math for AI agents, paid per call. LLMs are unreliable at business days, DST, recurring schedules and holiday calendars. Date Math gives them deterministic answers over HTTP or MCP.
- Price: $0.001 per call in USDC on Base, via x402
- Free to try: 25 free MCP tool calls per day, works in any MCP app (Claude Desktop, Cursor, ...)
- Access: no signup, no API keys
- Base URL:
https://date-math.datemath.workers.dev
- MCP endpoint:
https://date-math.datemath.workers.dev/mcp (Streamable HTTP)
- Docs for agents:
/llms.txt · /openapi.json
Tools
Use it in your app
The first 25 tool calls per day are free in all of these. No signup, no API key.
Claude Code
Claude Desktop / claude.ai: Settings → Connectors → Add custom connector, and paste https://date-math.datemath.workers.dev/mcp. Or use the local package in claude_desktop_config.json:
Cursor (~/.cursor/mcp.json)
VS Code (.vscode/mcp.json)
Windsurf (~/.codeium/windsurf/mcp_config.json)
Cline (MCP Servers → Configure)
Any app that only runs local commands: npx -y date-math-mcp (npm package). Set DATE_MATH_PRIVATE_KEY to a wallet with USDC on Base and it pays for calls beyond the free tier automatically.
Vercel AI SDK
LangChain / LangGraph (Python)
Business-day tools take workdays (weekday numbers, 0 = Sunday) for other workweeks, e.g. [0,1,2,3,4] for Sun–Thu or [1,2,3,4,5,6] for Mon–Sat.
Every response is a JSON object. Errors look like {"error":{"code","message","example"}}, where example is a valid request body for that tool. Full schemas and examples are in /openapi.json.
Examples
Paying from code
Any x402 client pays automatically. With the official TypeScript client:
The wallet needs USDC on Base. No ETH is required, because the facilitator pays gas.
Using it over MCP
- Endpoint:
https://date-math.datemath.workers.dev/mcp (Streamable HTTP, stateless)
- Listing tools (
tools/list) is free.
- The first 25 tool calls per day are free (per IP, reset at 00:00 UTC). Each free result carries
_meta["date-math/free_calls_remaining"].
- After that, each tool call costs $0.001 via x402 MCP. Payment travels in the tool call's
_meta, and x402-aware clients handle it automatically:
MCP clients without x402 support can use the free daily calls; after those, calls return "Payment required". A client that attaches a payment never uses up free calls.
The free tier is MCP only. Plain HTTP calls always need payment (an unpaid call returns 402), because x402 discovery services check for that.
Run your own copy
The service is a single Cloudflare Worker and fits the free plan: every tool uses 0–6 ms of CPU per call.
Set your own wallet and price in worker/wrangler.toml:
Optional secrets (set with npx wrangler secret put):
CDP_API_KEY_ID, CDP_API_KEY_SECRET: settle through Coinbase's facilitator first.
POCKET_PREFIX: a private, unpaid path for trusted relays.
To check your deployment against x402scan's discovery rules, run node tools/x402scan-audit.mjs https://your-worker.workers.dev.
To check that it can actually take payments (HTTP and MCP, the way agents pay), run API_URL=https://your-worker.workers.dev EXPECTED_PAY_TO=0xYourWallet node worker/scripts/payment-monitor.mjs.
How it's built
- Stack: Hono on Cloudflare Workers, plus
@x402/hono and @x402/mcp.
- Discovery: OpenAPI with
x-payment-info, /.well-known/x402, x402 Bazaar metadata on every 402, llms.txt, and an MCP Server Card at /mcp/server-card listed in /.well-known/ai-catalog.json.
- Precomputed data: the holiday and city tables are built at build time (
worker/scripts/build-*.mjs), so lookups are O(1) per request.
- Time zones: UTC offsets come from cached
Intl formatters and a week-segment cache. They're tested against direct lookups for tricky zones (Morocco, Lord Howe, Chatham).
- Cron: a built-in engine (
worker/src/cron.ts), checked against cron-parser on 400 random expressions.
- Workers-specific shim: x402's Bazaar route validator uses Ajv code generation (
new Function), which Workers blocks. wrangler.toml aliases it to a no-op shim (worker/src/shims/bazaar.ts).
Data and license
- Code: MIT, see LICENSE. Third-party data notices are in NOTICE.
- Holiday data: derived from date-holidays (CC BY 3.0). Lunar or government-proclaimed dates are rule-based estimates.
- City data: derived from city-timezones (MIT), based on Natural Earth (public domain).
Contact: see info.contact in /openapi.json.