
Mcp Chainladder
io.github.datalattice由 GitHub 帳號 datalattice 發布v1.2.2更新於 Oct 24, 2026
Actuarial chain-ladder reserving: IBNR, Mack stochastic stats, and assumption diagnostics.
概覽
本機 MCP 伺服器,讓助理執行精算鏈梯法準備金計算:IBNR、最終賠款、Mack 隨機誤差與假設診斷。
- 可以做什麼
- 計算鏈梯法準備金:逐年進展因子(體積加權與簡單平均)、累積進展因子、各事故年度的最終賠款與 IBNR,可指定因子、尾部因子與排除儲存格
- 補齊整個三角形投影,並在累積值與增量值之間互相轉換
- 以 Mack (1993) 方法估算不確定性:各期與各列的標準誤、變異係數及總準備金誤差
- 執行 Mack (1994) 假設診斷:標準化殘差、離群值、日曆年符號檢定、獨立性檢定與通膨趨勢
- 從磁碟讀取 CSV 損失三角形,將空白或 NA 儲存格視為未觀測
- 回傳教科書 10x10 範例三角形供自我檢查
- 適用情境
- 適合在對話中需要對損失三角形進行鏈梯法計算的情況:估算 IBNR、預測最終賠款,或檢驗投影假設是否成立。它只是機械式計算器,不能取代精算判斷。
- 執行需求
- 以 Python 套件 mcp-chainladder 透過 uvx 或 pipx 在本機以 stdio 執行,需要 Python 3.10 或更新版本。未宣告驗證、API 金鑰或環境變數。CSV 解析會讀取本機磁碟檔案,因此助理需要三角形檔案的路徑。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Mcp Chainladder,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
mcp-chainladder
Actuarial chain-ladder reserving for Claude. A Model Context Protocol server that hands Claude the tools to compute IBNR, project ultimates, run Mack (1993) stochastic error estimates, check Mack (1994) model assumptions, and parse loss triangles from CSV — all from a natural- language conversation.
Calculation only — not actuarial advice. This is a mechanical chain-ladder calculator. Selection of data, factors, tails, and exclusions, and the interpretation of stochastic error measures, require professional actuarial judgement.
What it does
Eight tools, exposed over MCP. Claude picks the right one when you ask a question; you don't have to call them by name.
All numerical conventions match the Mack 1993 and Mack 1994 papers; results are stable to ~1e-12 against hand calculation on the textbook 10×10 triangle.
Install
Python 3.10 or newer; no other runtime dependencies beyond the official MCP SDK.
Hook into Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json
(macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
Quit and reopen Claude Desktop. The triangle tools appear under the 🔌 icon in any conversation.
For Cursor / Cline / Continue / Zed — same mcpServers block, each app
has its own config file location (their docs walk you through it).
Examples
Run the chain ladder on a CSV
Check whether you should worry about assumptions
Exclude an outlier and re-run
Tool reference
Each tool returns a JSON object (or a 2-D list, in the case of
project_triangle/to_incremental/to_cumulative). Claude reads the
descriptions and types directly from the server — you don't need to
memorise the shapes — but here's the cheat sheet.
compute_chain_ladder(triangle, selected_factors?, tail?, excluded?)
End-to-end chain ladder.
mack_stochastic(triangle, selected_factors, excluded?)
Mack (1993) distribution-free standard errors. Returns σ̂²_j per dev period (tail-rule backfilled when only one observation), SE & CV per row, and SE_total / CV_total including cross-row covariance per eq. 5.15.
mack_diagnostics(triangle, selected_factors, excluded?, outlier_threshold?)
Returns standardised residuals, outliers (|r| > threshold, default
2.0), the calendar-year sign test, Spearman independence test across
adjacent dev columns, and the inflation slope of mean log-link-ratio
against accident-year index.
p-value bands to translate to plain English:
parse_csv_triangle(path)
Reads a CSV from disk, treats blank / NA / NaN / N/A / − cells as unobserved, strips embedded thousand-separator commas, and skips header / metadata rows. Returns the triangle + dimensions + the absolute path read (useful for the assistant to confirm what it loaded).
project_triangle(triangle, selected_factors)
Fills the lower-right of the triangle with chain-ladder projections.
Returns a fully-rectangular list[list[float]] (no nulls). NaN where
a row has no observation to project forward from.
to_incremental(cumulative) / to_cumulative(incremental)
Two conversions. Unobserved cells stay unobserved; the inverse on observed cells is exact.
sample_triangle()
Returns the textbook 10×10 cumulative paid triangle. Use as a
self-check: pass it to compute_chain_ladder and you should get
Paid 49,458 / Ultimate 65,883 / IBNR 16,425.
Triangle format
- Outer index = accident year, oldest first
- Inner index = development period, 0 = first age
- Use
None(or JSONnull) for unobserved cells - All rows must be the same length — pad with trailing
null
Testing
Tests pin every public tool against the textbook triangle's well-known parity values to ~1e-9.
Pro tier
<< UNDER REVIEW - COMING SOON >>
The free tier covers all 8 tools listed above. Pro unlocks
additional methods + bulk workflows, gated by a local license file
at ~/.chainladder/license (or wherever $CHAINLADDER_LICENSE_FILE
points).
Pro licenses are currently for internal and testing purposes only — not open to the public. No purchase channel is available at this time. The Pro tools are listed below for reference and will continue to return
pro_license_requiredfor external users.
License file format
Drop it at ~/.chainladder/license (the file's directory must exist;
the server doesn't create it). Pro tools immediately respond as
unlocked the next time Claude calls them.
When the license is missing or expired, every Pro tool returns
{"error": "pro_license_required", "status": {...}} instead of
computing — Claude reads the status and points you to the upgrade
URL. The free-tier tools always work regardless of license state.
License
MIT. See LICENSE.
來源:README.md,提交 36825b6
工具
0版本歷史
1- v1.2.2最新Sep 16, 2026
評分
已滿足適用檢查項的 40%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
請在儲存庫或註冊中心條目中宣告授權條款。