Shikamaru

io.github.JayOfemi由 GitHub 帳號 JayOfemi 發布v1.1.1更新於 Oct 27, 2026

Provably correct day-count, calendar, business-day, and schedule math, verified against QuantLib.

已驗證STDIO僅桌面金融開發者工具

概覽

AI 產生的概覽

本機 MCP 伺服器,提供確定性的天數計算、假日行事曆、營業日與付息排程計算,並與 QuantLib 對照驗證。

可以做什麼
  • 依七種市場慣例計算兩個日期之間的天數分數,含帶零頭期的 ACT/ACT ICMA
  • 依名目金額、利率與天數分數計算單利應計利息
  • 用假日行事曆與 ISDA 調整慣例判斷營業日、調整日期或推算日期,包括 T+N 交割
  • 產生付息排程,支援頻率、前滾或後滾、短零頭期或長零頭期以及月底規則
  • 除純文字結果外也回傳具輸出結構定義的 JSON,所有工具皆標註為唯讀
適用情境
適合助理需要給出精確日期或利息數字的金融情境,例如交割日、應計利息、票息排程,靠猜測風險較高時。適用於必須套用特定慣例與行事曆的固定收益、資金或後台類任務。
執行需求
以 npm 套件形式透過 stdio 在本機執行(需要 Node.js),可用 npx 啟動或從原始碼建置。未宣告任何帳號、API 金鑰、環境變數或請求標頭。假日行事曆以規則內建,無需資料來源或網路存取。
安裝前請注意
工具標註為唯讀,且不索取任何憑證。結果取決於行事曆版本:一次性休市會隨修補版本發布,處理近期日期時應保持套件為最新。僅計算單利應計利息,並非完整的定價或風險引擎。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Shikamaru,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

shikamaru

[CI]

Provably correct day-count, holiday-calendar, business-day, and payment-schedule calculations. A small, dependency-light TypeScript library and an MCP server, so an AI agent can get the exact date or number instead of guessing.

Why

LLMs are unreliable at date and money math: they pick the wrong day-count convention, forget market holidays, and miscompute accrued interest. shikamaru does it deterministically and proves it against published reference values. Do not let a model guess your interest accrual or your settlement date.

What it does

  • Day-count fraction between two dates under seven market conventions: 30/360, 30E/360, 30E/360 ISDA, ACT/360, ACT/365F, ACT/ACT ISDA, ACT/ACT ICMA (with reference periods and stub decomposition).
  • Simple accrued interest: notional x rate x day-count fraction.
  • Holiday calendars as rules in code, no data feed: us-federal, nyse, sifma-us, target, uk.
  • Business-day math: is-business-day, next/previous, ISDA adjustment conventions (following, modified-following, preceding, modified-preceding), T+N settlement.
  • Payment schedules: monthly to annual, backward or forward roll, short or long stubs, end-of-month rule, per-period unadjusted and adjusted dates.
  • All of it exposed as a library and as an MCP server.
  • Every MCP tool is annotated read-only and returns structured output (typed JSON under an output schema) alongside the plain-text result, so an agent client can consume the numbers without parsing text.

Calendar maintenance contract

Calendars are published rules plus a short pinned table of historical one-off closures, current as of this version. Rules generate correct dates arbitrarily far forward; one-off closures (a mourning day, a proclaimed extra holiday) are added when announced and ship in a patch release. A scheduled CI run re-checks every calendar against the latest QuantLib weekly, so drift is detected, not discovered.

Install

npm install @jayofemi/shikamaru

Library usage

ts
import {	accruedInterest, addBusinessDays, adjustDate, dayCountFraction,	generateSchedule, isBusinessDay,} from "@jayofemi/shikamaru";
dayCountFraction("2003-11-01", "2004-05-01", "ACT/ACT ISDA"); // 0.4977...accruedInterest({	notional: 1_000_000,	rate: 0.05,	start: "2024-01-01",	end: "2024-04-01",	convention: "ACT/365F",});
isBusinessDay("2024-06-19", "nyse"); // false (Juneteenth)adjustDate("2024-03-29", "modified-following", "target"); // "2024-03-28" (Good Friday, stays in March)addBusinessDays("2024-07-02", 2, "us-federal"); // "2024-07-05" (T+2 over July 4th)
generateSchedule({	effective: "2024-01-15",	termination: "2026-01-15",	frequency: "semiannual",	calendar: "target",}); // four periods with unadjusted and adjusted dates

Dates are strict ISO YYYY-MM-DD. Rate is an annual decimal (0.05 = 5%).

MCP server [shikamaru MCP server]

[shikamaru MCP server]

From source (local dev):

npm installnpm run buildnode dist/cli.js

Or launch the published package directly:

npx @jayofemi/shikamaru

Point any MCP client (Claude Desktop, an IDE, etc.) at that command over stdio.

Claude Code users can also install it as a plugin, which registers the MCP server automatically:

/plugin marketplace add JayOfemi/shikamaru/plugin install shikamaru@shikamaru

Verify the MCP server

The test suite exercises the server end to end in memory, covering tool listing, read-only annotations, structured output against each output schema, and a call to every tool. For an interactive check, use the official MCP Inspector:

npm run buildnpx @modelcontextprotocol/inspector node dist/cli.js

It opens a local UI, connects over stdio, lists the tools, and lets you call them. Sanity check: day_count_fraction with start 2003-11-01, end 2004-05-01, convention ACT/ACT ISDA returns about 0.4977.

Correctness

Conventions follow the ISDA 2006 definitions; calendars follow their published sources (OPM, NYSE rules, SIFMA recommendations, ECB TARGET rules, gov.uk proclamations). The test suite checks published reference vectors (ISDA worked examples, official holiday lists, the OpenGamma conventions guide), property checks, and differential batteries against QuantLib, the de-facto reference: day-count fractions, full per-calendar holiday lists across decades, business-day adjustment and advancing, schedules compared date by date, and ACT/ACT ICMA fractions including stubs.

To (re)generate the QuantLib batteries (needs Python + pip):

pip install QuantLibnpm run vectors

This writes test/vectors/quantlib.json and test/vectors/quantlib-calendar.json (commit both). npm test then checks shikamaru against every QuantLib value. CI regenerates the batteries from the latest QuantLib on every push AND on a weekly schedule (the drift watchdog), so a real-world calendar change surfaces as a red run even when the repo is quiet. The proof is the product.

Develop

npm installnpm run buildnpm test

License

MIT. Copyright (c) 2026 Jay Ofemi.

來源:README.md,提交 861a025

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.1.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分