modelforge

modelforge

Financial model factory MCP server: turns a spec into a live-formula Excel workbook. 14 templates (LBO, DCF, M\&A, IPO, restructuring, project finance, NPL, structured credit, 3-statement) with every cell formulated and every number source-traced to its document page.

Category
Visit Server

README

ModelForge

<!-- mcp-name: io.github.Whatsonyourmind/modelforge -->

Version Tests Trust MCP Templates SBOM

Bulge-tier Excel financial model factory for credit & structured finance. Every cell live-formulated. Every number traceable back to the source document page it came from.

A developer tool for analysts and engineers who build credit and corporate-finance models programmatically. Covers unitranche, sponsor-backed LBO, project finance, real estate credit, NPL, structured credit, restructuring, M&A, DCF and IPO templates. Extensible to any asset class.


๐Ÿš€ Using ModelForge in production โ€” or want managed features, priority support, or a specific template/connector? Tell me about your use case โ†’ โ€” I read every one.


What this solves

  • Your agent needs to produce an Excel model from a structured spec โ€” without an LLM hallucinating numbers directly into cells. ModelForge keeps the model deterministic: the LLM writes a typed YAML spec with source IDs, and a Python builder emits the live-formula workbook.
  • You need every output number to be auditable back to where it came from โ€” without manually maintaining a sources sheet. Each hardcoded input carries a source ID, and the model's linkage graph is persisted to SQLite so a cell can be traced to its driver, source, and document page.
  • You want a model that recalculates instead of being a static dump โ€” without writing formula strings by hand. Every cell is a real Excel formula, with named ranges, sign conventions, and WORST/BASE/BEST scenario toggles wired across sheets.
  • You need to gate a workbook for review โ€” without eyeballing it. The QC tool runs an automated structural check suite (QC sheet present, named ranges populated, source references resolve, print areas set, no orphan sheets) and returns a per-check pass/fail report.
  • You need to triage many candidate deals fast โ€” without building a workbook for each one. The screening tool filters and ranks a directory of spec YAMLs by quantitative criteria (margins, leverage, IRR) on their screening: block alone.
  • You want the whole pipeline available to an AI assistant โ€” without bespoke glue code. ModelForge ships an MCP server (modelforge-mcp) so agents in Claude Code, Cursor, Cline, or ChatGPT Enterprise can list templates, build, QC, trace lineage, ingest a data room, and export deliverables.

Use it inside Claude Code, Cursor, ChatGPT Enterprise (MCP-native)

PyPI name: modelforge-finance (the unscoped modelforge was taken by source{d}'s ML library). Import name stays modelforge.

pip install "modelforge-finance[mcp,export]"

# wire into your MCP client config:
{
  "mcpServers": {
    "modelforge": { "command": "modelforge-mcp" }
  }
}

Then in your AI assistant:

"Build me a unitranche LBO model from this YAML spec, export the committee deck."

Tools available: list_templates ยท build_model ยท qc_workbook ยท list_sources ยท lineage_walk ยท ingest_dataroom ยท screen_deals ยท compute_tax ยท export_pptx ยท export_docx ยท plus 7 unified-feed tools (data_providers_status ยท quote ยท history ยท fundamentals ยท search_filings ยท entity_lookup ยท search_securities) across an 11-provider data stack.

The architectural principle

LLMs produce specs + sources + narrative. Deterministic Python produces the workbook.

The LLM never writes a number into a cell. It writes a typed YAML spec with source IDs. A deterministic builder emits the Excel via openpyxl. A QC gate validates before export. Excel is a render of a linkage graph; the graph is persisted to SQLite and is the canonical artifact.

Quality standards (bulge-tier, non-negotiable)

Formatting

  • Blue = hardcoded input. Black = formula. Green = cross-sheet link. Red = warning.
  • No mixed formulas (no magic numbers embedded). Named ranges for every driver.
  • Costs NEGATIVE (sign convention enforced and checked).
  • EN primary labels, multi-language secondary (DE / ES / IT shipped; SV / NO / DA / NL on the v0.10 roadmap as design-partner asks).
  • Historical vs Projected column separator, obvious.
  • Check row at top of every sheet (BS balance, CFS tie, covenant headroom โ€” TRUE or 0).

Sourcing

  • Every hardcoded cell has a comment with source ID (S-001, S-002, ...).
  • Sources sheet lists each source: doc, page, publisher, date, URL, verified-flag.
  • Assumptions (not sourced) tagged A-001 with rationale + confidence H/M/L.

Scenarios

  • WORST / BASE / BEST toggle on Assumptions. Drives every sheet via CHOOSE.
  • Every sheet respects the toggle โ€” no orphan assumptions.

Audit

  • QC sheet with 8 automated checks, all must pass.
  • Revision log on Cover.
  • Named ranges mandatory.
  • Print areas set. Print-ready on every sheet.

Quick start

pip install "modelforge-finance[mcp,export,data]"

# Build any of 16 templates from a YAML spec (14 shipped + 2 preview)
modelforge build examples/unitranche_cdmo.yaml

# QC the workbook (8 structural checks + Trust Layer plausibility)
modelforge qc output/unitranche_cdmo.xlsx --trust-strict

# Audit every example (CI uses the same gate)
modelforge audit-all examples/ --report AUDIT_REPORT.md

Trust Layer v1 (new in v0.9.7)

Why should a buyer trust the number in cell B42?

The Trust Layer is a semantic gate (separate from the structural QC gate). It answers the question every IC asks in the first five minutes: is this number plausible? It catches issues like a DCF EV that's 8ร— the company's real market cap before the model ever leaves QA.

25+ built-in rules cover all shipped templates:

  • DCF: WACC band (3-25%), terminal growth โ‰ค GDP + 1%, EV vs market-cap deviation, terminal-value share, sensitivity-table monotonicity
  • Three-statement: balance-sheet integrity, cash reconciliation, retained-earnings link
  • NPL: cumulative recovery โ‰ค 100%, vintage staircase monotone
  • Project finance: DSCR floor, wire degradation > 0, P90 < P50
  • Sponsor LBO: XIRR plausibility, multiple expansion vs entry
  • M&A / fairness / structured credit / unitranche / credit memo: per-template plausibility

Each violation produces a RedFlags worksheet inside the built workbook with severity (info / warn / fail), the rule that fired, expected-vs-actual, and the recommended remediation.

modelforge audit-all examples/   # 14/14 shipped templates, 0 FAIL violations in current ship

See AUDIT_REPORT.md for the current ship's audit.

Data-room ingestion (v0.3.1)

Turn a directory of PDFs, XLSXs and CSVs into a validated ModelForge YAML spec using Claude Opus. Every extracted number traces back to a doc page via the auto-built Sources registry.

pip install -e .[ingest]                # installs anthropic, pdfplumber, pypdf
export ANTHROPIC_API_KEY=sk-ant-...      # required

modelforge ingest path/to/dataroom/ \
    --template project_finance \
    -o output/my_deal.yaml --verbose

# Review output/my_deal.yaml + output/my_deal.ingestion.md
# (INGESTION_REPORT.md lists every extracted field, S-id, confidence)

modelforge build output/my_deal.yaml     # produces the workbook
modelforge qc output/my_deal.xlsx        # 8/8 quality gate

Supported template: project_finance (MVP). Templates 1, 3, 5-8 queued for v0.3.2.

Package layout

modelforge/
โ”œโ”€โ”€ graph/            # First-class linkage graph (nodes, edges, SQLite persistence)
โ”œโ”€โ”€ spec/             # Pydantic schemas per template
โ”‚   โ”œโ”€โ”€ base.py       # Source, Assumption, Scenario, Target (shared types)
โ”‚   โ””โ”€โ”€ unitranche.py # Template 1: Unitranche LBO
โ”œโ”€โ”€ builder/          # Deterministic openpyxl writer
โ”‚   โ”œโ”€โ”€ styles.py     # Bulge-tier formatting library
โ”‚   โ”œโ”€โ”€ formulas.py   # Formula string builders
โ”‚   โ”œโ”€โ”€ i18n.py       # EN/IT label dictionary
โ”‚   โ”œโ”€โ”€ workbook.py   # Top-level builder
โ”‚   โ””โ”€โ”€ sheets/       # One module per sheet (cover, sources, assumptions, ...)
โ”œโ”€โ”€ qc/               # Quality gate (8 structural checks + PDF report)
โ”œโ”€โ”€ data/             # Market data loaders (Damodaran, ECB, Borsa minibond)
โ””โ”€โ”€ cli.py            # modelforge build|qc|sources|inspect

Templates (16: 14 shipped + 2 preview)

  1. โœ… Unitranche LBO โ€” Mid-market direct lending (Cash sweep + IFRS 9 EIR + covenant package)
  2. โœ… Minibond / Private Placement Bond โ€” Direct private debt instrument (Gross YTM + Net YTM + jurisdiction-specific WHT)
  3. โœ… Credit Memo โ€” Extends Unitranche with recovery waterfall + PDร—LGDร—EAD
  4. โœ… Project Finance โ€” Construction + operating phases, DSCR-driven
  5. โœ… Real Estate โ€” NOI build, exit cap, LP/GP promote waterfall
  6. โœ… NPL Portfolio โ€” Collection curves, servicing fees, senior/mezz capital structure
  7. โœ… Structured Credit โ€” Tranche waterfall with attachment/detachment points
  8. โœ… 3-Statement โ€” P&L + BS + CFS with BS balance integrity check
  9. โœ… DCF โ€” WACC build, fade, terminal normalization, 2D sensitivity (Trust Layer protected)
  10. โœ… Merger โ€” Accretion/dilution, breakeven, contribution, collar, PPA
  11. โœ… Fairness Opinion โ€” Selected comps, regression, premium analysis
  12. โœ… Sponsor LBO โ€” Returns waterfall, debt schedule, 14-story block
  13. โœ… IPO โ€” Float build, lock-up, stabilization, fee schedule
  14. โœ… Restructuring โ€” Going-concern recovery, plan-feasibility, creditor classes
  15. ๐Ÿ”ฌ HGB Carveout (preview) โ€” German HGB carve-out financials
  16. ๐Ÿ”ฌ Portfolio Review (preview) โ€” Multi-asset portfolio performance review

Run modelforge list-templates to see them all (preview templates are flagged). Each shipped template has an anonymized example YAML in examples/.

Tax jurisdictions (7)

US  ยท Federal CIT + state + NOL + R&D credit + GILTI + BEAT + ASC 740
UK  ยท FRS 102 + main rate + marginal relief + RDEC + AIA + WDA + group relief
DE  ยท KSt + SolZ + GewSt (Hebesatz + ยง 8 add-backs + min-tax loss CF) โ€” HGB roadmap v0.10
FR  ยท IS + small-profits + social surcharge + CVAE + CIR + 88% participation
ES  ยท IS + SME 23% + newly-created 15% + 95% participation + R&D + min-tax 15%
JP  ยท NCT + LCT + Enterprise Tax + Special Local Corp Tax + R&D credit
IT  ยท IRES / IRAP / SIIQ / PEX

Data providers (11, unified Provider Protocol)

Tier-0 (free, live today): EDGAR ยท OpenFIGI ยท GLEIF Tier-1 (low-cost paid): Polygon ($29/mo) ยท FMP ($19/mo) ยท Finnhub ยท Tiingo Tier-2 (institutional): Bloomberg ยท Refinitiv ยท FactSet ยท S&P Capital IQ

Tier-1 and Tier-2 are interface-complete โ€” paid keys activate them via env vars. Local TTL cache prevents rate-limit blow-ups.

Security & SBOM

  • CycloneDX 1.5 SBOM auto-generated by CI on every push and attached to every GitHub release (scripts/generate_sbom.py)
  • CI gates: pytest across Python 3.11 + 3.12, ruff lint, SBOM structure validation (.github/workflows/ci.yml)
  • Audit log with append-only SQLite (modelforge/audit_log.py)
  • Trust Layer semantic gates auto-injected into every built workbook
  • Security policy: see SECURITY.md

Procurement-grade controls (SOC 2 Type II, ISO 27001, pen-test, multi-tenant SaaS with SSO/SCIM) are Phase-B work.

The pitch

Bulge-tier Excel models, every cell live-formulated, every number traceable back to the data room page it came from.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured