shikamaru is a lightweight TypeScript library and also an MCP (Model Context Protocol) server, designed to provide AI agents with precise date and currency calculations, avoiding model guesswork. It focuses on deterministic calculations in financial domains such as day counts, accrued interest, holiday calendars, business days, and payment schedules.
Purpose
- Solves the problem of LLMs being unreliable at date and currency math, such as choosing the wrong day count convention, forgetting market holidays, or incorrectly calculating accrued interest.
- Provides deterministic calculation results, verified against public reference values.
Main capabilities
- Day count fractions: supports seven market conventions: 30/360, 30E/360, 30E/360 ISDA, ACT/360, ACT/365F, ACT/ACT ISDA, ACT/ACT ICMA (including reference periods and coupon splits).
- Simple accrued interest: notional amount × rate × day count fraction.
- Holiday calendars: provided as code rules, no data source required, including us-federal, nyse, sifma-us, target, uk.
- Business day math: is-business-day, next/previous business day, ISDA adjustment conventions (following, modified-following, preceding, modified-preceding), T+N settlement.
- Payment schedules: from monthly to annual, backward or forward roll, short or long coupons, end-of-month rules, unadjusted and adjusted dates for each period.
- All features are exposed through the library and the MCP server.
Usage
- As a library: develop locally from source, or directly start the published package.
- As an MCP server: point any MCP client (Claude Desktop, IDE, etc.) at the command, connecting via stdio. Claude Code users can also install it as a plugin, which automatically registers the MCP server.
- Every MCP tool is annotated as read-only and returns structured output (typed JSON based on an output schema) as well as plain text results, making it easy for agent clients to consume numbers directly without parsing text.
- Dates strictly use the ISO YYYY-MM-DD format. Rates are annualized decimals (0.05 = 5%).
Verification
- The test suite tests the server end-to-end in memory, covering the tool list, read-only annotations, structured output for each output schema, and invocation of each tool.
- Interactive inspection is possible using the official MCP Inspector: connect via stdio, list tools, and invoke. Sanity check example: day_count_fraction, start 2003-11-01, end 2004-05-01, convention ACT/ACT ISDA, returns approximately 0.4977.
- Conventions follow the ISDA 2006 definitions; calendars follow their published sources (OPM, NYSE rules, SIFMA recommendations, ECB TARGET rules, gov.uk announcements). The test suite checks public reference vectors (ISDA worked examples, official holiday lists, OpenGamma convention guides), property checks, and differential testing against QuantLib (the de facto reference): day count fractions, complete calendar holiday lists across decades, business day adjustment and roll, schedules compared date by date, and ACT/ACT ICMA fractions including coupon splits.
Calendar maintenance contract
- Calendars are published rules plus a small fixed table of historical one-off closures, as of the current version. The rules can generate correct dates arbitrarily far into the future; one-off closures (such as days of mourning or announced additional holidays) are added when announced and released via patches.
- A periodic CI run rechecks every calendar weekly against the latest QuantLib, so drift is detected rather than discovered.
Limitations
- Information about fees, pricing, platform restrictions, etc. is not currently provided.
- This introduction is based only on the provided materials and does not invent any features or usage steps.