{
  "markdown": "# mcp-chainladder\n\n<!-- mcp-name: io.github.datalattice/mcp-chainladder -->\n\n[![PyPI](https://img.shields.io/pypi/v/mcp-chainladder.svg)](https://pypi.org/project/mcp-chainladder/)\n[![Python](https://img.shields.io/pypi/pyversions/mcp-chainladder.svg)](https://pypi.org/project/mcp-chainladder/)\n[![License](https://img.shields.io/pypi/l/mcp-chainladder.svg)](LICENSE)\n\n**Actuarial chain-ladder reserving for Claude.** A\n[Model Context Protocol](https://modelcontextprotocol.io) server that\nhands Claude the tools to compute IBNR, project ultimates, run Mack\n(1993) stochastic error estimates, check Mack (1994) model\nassumptions, and parse loss triangles from CSV — all from a natural-\nlanguage conversation.\n\n> **Calculation only — not actuarial advice.** This is a mechanical\n> chain-ladder calculator. Selection of data, factors, tails, and\n> exclusions, and the interpretation of stochastic error measures,\n> require professional actuarial judgement.\n\n---\n\n## What it does\n\nEight tools, exposed over MCP. Claude picks the right one when you ask\na question; you don't have to call them by name.\n\n| Tool | When Claude reaches for it |\n|---|---|\n| `compute_chain_ladder` | \"What's the IBNR on this triangle?\" — the workhorse |\n| `project_triangle` | \"What does the full projected triangle look like?\" |\n| `mack_stochastic` | \"What's the uncertainty on the total reserve?\" |\n| `mack_diagnostics` | \"Are there outliers or trend issues?\" |\n| `parse_csv_triangle` | \"Run the chain ladder on this CSV file\" |\n| `to_incremental` | \"Show me the incremental development pattern\" |\n| `to_cumulative` | \"Cumulate these incremental values\" |\n| `sample_triangle` | \"Show me a working example\" — quick demo |\n\nAll numerical conventions match the [Mack 1993](https://www.casact.org/sites/default/files/database/astin_vol23no2_213.pdf)\nand [Mack 1994](https://www.casact.org/sites/default/files/database/proceed_proceed94_94101.pdf) papers; results are stable to ~1e-12 against\nhand calculation on the textbook 10×10 triangle.\n\n---\n\n## Install\n\n```bash\npipx install mcp-chainladder\n# or, to run on demand without installing:\nuvx mcp-chainladder\n```\n\nPython 3.10 or newer; no other runtime dependencies beyond the official\nMCP SDK.\n\n## Hook into Claude Desktop\n\nEdit `~/Library/Application Support/Claude/claude_desktop_config.json`\n(macOS) or `%APPDATA%\\Claude\\claude_desktop_config.json` (Windows):\n\n```json\n{\n  \"mcpServers\": {\n    \"chainladder\": {\n      \"command\": \"uvx\",\n      \"args\": [\"mcp-chainladder\"]\n    }\n  }\n}\n```\n\nQuit and reopen Claude Desktop. The triangle tools appear under the 🔌\nicon in any conversation.\n\nFor Cursor / Cline / Continue / Zed — same `mcpServers` block, each app\nhas its own config file location (their docs walk you through it).\n\n---\n\n## Examples\n\n### Run the chain ladder on a CSV\n\n```\nMe: I have a paid-loss triangle at ~/Desktop/motor_2026Q1.csv.\n    Run the chain ladder and tell me the IBNR.\n\nClaude: [calls parse_csv_triangle, then compute_chain_ladder]\n        Loaded a 10×10 cumulative triangle. Using volume-weighted\n        factors:\n          • Total paid to date: 49,458,000 USD\n          • Total ultimate:     65,883,400 USD\n          • Total IBNR:         16,425,400 USD\n        Selected factors trend from 1.879 at the front of the\n        triangle down to 1.002 at the tail.\n```\n\n### Check whether you should worry about assumptions\n\n```\nMe: Same triangle — any reason not to trust the projection?\n\nClaude: [calls mack_diagnostics]\n        Three flags worth a look:\n        • Inflation trend: slope 0.053, p ≈ 1e-12 — STRONG evidence\n          link ratios are drifting upward across accident years.\n          This violates Mack's homogeneity assumption; consider\n          weighting recent years more.\n        • Calendar-year: Z = 0.0, p = 1.0 — no diagonal effect.\n        • Independence: Z = -0.35, p = 0.73 — no obvious dependence\n          across development columns.\n        • Outliers: 0 cells exceed |2σ|.\n\n        The inflation finding is the one to act on.\n```\n\n### Exclude an outlier and re-run\n\n```\nMe: Drop the link ratio at AY 3, dev period 2→3. What changes?\n\nClaude: [calls compute_chain_ladder with excluded=[[2, 1]]]\n        Excluding (AY 3, 2→3):\n          • Volume factor at 2→3 moves from 1.331 to 1.328\n          • Total IBNR moves from 16,425 to 16,389 (−36)\n          • Mack SE total moves from ±354.6 to ±348.2\n        Net: small enough to be a \"robustness check passes\" rather\n        than a finding.\n```\n\n---\n\n## Tool reference\n\nEach tool returns a JSON object (or a 2-D list, in the case of\n`project_triangle`/`to_incremental`/`to_cumulative`). Claude reads the\ndescriptions and types directly from the server — you don't need to\nmemorise the shapes — but here's the cheat sheet.\n\n### `compute_chain_ladder(triangle, selected_factors?, tail?, excluded?)`\n\nEnd-to-end chain ladder.\n\n| Field returned | Meaning |\n|---|---|\n| `volume_factors[j]` | All-year volume-weighted age-to-age factor for transition j→j+1 |\n| `simple_factors[j]` | Unweighted average of individual link ratios |\n| `selected_factors[j]` | The factor set actually used to project (defaults to volume) |\n| `individual_factors[i][j]` | Per-row link ratio `C[i,j+1] / C[i,j]`; null where the pair is unobserved |\n| `cdf[j]` | Cumulative dev factor to ultimate; `cdf[-1] == tail` |\n| `latest_diagonal[i]` | Most recent observed value per AY |\n| `ultimates[i]` | Projected ultimate per AY |\n| `ibnr[i]` | Ultimate − Latest per AY |\n| `total_*` | Sums of the three above |\n| `n_acc`, `n_dev` | Triangle dimensions |\n\n### `mack_stochastic(triangle, selected_factors, excluded?)`\n\nMack (1993) distribution-free standard errors. Returns σ̂²_j per dev\nperiod (tail-rule backfilled when only one observation), SE & CV per\nrow, and SE_total / CV_total including cross-row covariance per eq.\n5.15.\n\n### `mack_diagnostics(triangle, selected_factors, excluded?, outlier_threshold?)`\n\nReturns standardised residuals, outliers (`|r| > threshold`, default\n2.0), the calendar-year sign test, Spearman independence test across\nadjacent dev columns, and the inflation slope of mean log-link-ratio\nagainst accident-year index.\n\np-value bands to translate to plain English:\n\n```\np < 0.005 → strong evidence\np < 0.05  → significant\np < 0.10  → borderline\np ≥ 0.10  → no evidence\n```\n\n### `parse_csv_triangle(path)`\n\nReads a CSV from disk, treats blank / NA / NaN / N/A / − cells as\nunobserved, strips embedded thousand-separator commas, and skips\nheader / metadata rows. Returns the triangle + dimensions + the\nabsolute path read (useful for the assistant to confirm what it\nloaded).\n\n### `project_triangle(triangle, selected_factors)`\n\nFills the lower-right of the triangle with chain-ladder projections.\nReturns a fully-rectangular `list[list[float]]` (no nulls). NaN where\na row has no observation to project forward from.\n\n### `to_incremental(cumulative)` / `to_cumulative(incremental)`\n\nTwo conversions. Unobserved cells stay unobserved; the inverse on\nobserved cells is exact.\n\n### `sample_triangle()`\n\nReturns the textbook 10×10 cumulative paid triangle. Use as a\nself-check: pass it to `compute_chain_ladder` and you should get\n**Paid 49,458 / Ultimate 65,883 / IBNR 16,425**.\n\n---\n\n## Triangle format\n\n```python\n[\n    # AY 1 — fully developed\n    [1000, 1855, 2423, 2988, 3335, 3483, 3552, 3603, 3624, 3631],\n    # AY 2 — observed through dev 9\n    [1113, 2103, 2774, 3422, 3844, 4010, 4090, 4148, 4172, None],\n    # …\n    # AY 10 — only the first observation\n    [2640, None, None, None, None, None, None, None, None, None]\n]\n```\n\n- Outer index = accident year, oldest first\n- Inner index = development period, 0 = first age\n- Use `None` (or JSON `null`) for unobserved cells\n- All rows must be the same length — pad with trailing `null`\n\n---\n\n## Testing\n\n```bash\npipx install --editable mcp-chainladder\npytest -q\n```\n\nTests pin every public tool against the textbook triangle's well-known\nparity values to ~1e-9.\n\n## Pro tier\n\n<< UNDER REVIEW - COMING SOON >>\n\nThe free tier covers all 8 tools listed above. **Pro** unlocks\nadditional methods + bulk workflows, gated by a local license file\nat `~/.chainladder/license` (or wherever `$CHAINLADDER_LICENSE_FILE`\npoints).\n\n> **Pro licenses are currently for internal and testing purposes\n> only — not open to the public.** No purchase channel is available\n> at this time. The Pro tools are listed below for reference and\n> will continue to return `pro_license_required` for external users.\n\n| Pro tool | What it does |\n|---|---|\n| `pro_license_status` | Inspect current license state (free to call) |\n| `interpret_diagnostics` | Mack tests with verdict labels + plain-English summaries + recommended actions |\n| `sensitivity_analysis` | Drop each link ratio one-at-a-time and rank by IBNR impact |\n| `tail_extrapolation` | Fit exponential + inverse-power tail models, recommend best fit |\n| `bornhuetter_ferguson` | BF reserving method with side-by-side CL comparison |\n| `compare_methods` | Run CL + BF in one call, report deltas + largest divergence |\n| `generate_pdf_report` *(coming v1.2)* | Full 5-page actuarial PDF — cover / triangle / factors / results / 3D loss surface |\n| `batch_csv_processing` *(coming v1.2)* | Fold the chain ladder over a directory of CSV triangles |\n| `cape_cod`, `mack_bf` *(coming v1.3)* | Additional reserving methods, all returning side-by-side comparisons |\n\n### License file format\n\n```json\n{\n  \"product\":  \"mcp-chainladder-pro\",\n  \"owner\":    \"alice@example.com\",\n  \"expires\":  null,\n  \"key\":      \"CL-PRO-1A2B3C4D\",\n  \"signature\": \"…\"\n}\n```\n\nDrop it at `~/.chainladder/license` (the file's directory must exist;\nthe server doesn't create it). Pro tools immediately respond as\nunlocked the next time Claude calls them.\n\nWhen the license is missing or expired, every Pro tool returns\n`{\"error\": \"pro_license_required\", \"status\": {...}}` instead of\ncomputing — Claude reads the status and points you to the upgrade\nURL. The free-tier tools always work regardless of license state.\n\n## License\n\nMIT. See [`LICENSE`](LICENSE).\n\n\n",
  "bytes": 10028,
  "sha": "10caf1e895152ceadb5f2a3d6156993ce3b9560f180fabc388caa04b95f478fe",
  "repo_slug": "datalattice/mcp-chainladder",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_datalattice_mcp_chainladder_cb4536ff/readme"
}