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 分