DEV Community

DatanestDigital
DatanestDigital

Posted on • Originally published at precisioncalc-mcp.pages.dev

I built an MCP server that gives AI agents exact, high-precision finance math

LLMs are shockingly bad at arithmetic. Ask an agent to chain a CAC payback with a churn-adjusted LTV, convert it to EUR, and discount three years of cash flows, and you will get an answer that looks right and is quietly wrong. Floating point, dropped steps, and confident hallucination are a bad combination when the output is a number someone makes a decision on.

So I built PrecisionCalc MCP — a deterministic Model Context Protocol server that gives AI agents a calculator they can actually trust. Every monetary/financial value is computed with arbitrary-precision decimals (never floats), and every response includes the exact value, the formula used, the inputs, the unit, and any assumptions — so the agent (and you) can audit it.

It's live, free to start, and takes about 30 seconds to add.

Add it to your agent

It's a remote server over Streamable HTTP — no install:

https://precisioncalc-mcp.pages.dev/mcp
Enter fullscreen mode Exit fullscreen mode

Cursor (~/.cursor/mcp.json) or any generic client:

{
  "mcpServers": {
    "precisioncalc": {
      "url": "https://precisioncalc-mcp.pages.dev/mcp"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Claude Desktop (uses the mcp-remote bridge):

{
  "mcpServers": {
    "precisioncalc": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://precisioncalc-mcp.pages.dev/mcp"]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Also works with VS Code, Windsurf, Cline, Zed, and anything speaking MCP. It's listed in the official MCP Registry as io.github.inity13/precisioncalc-mcp.

What it does

11 tools, all returning the same clean, parseable envelope:

  • calculate_metric — 14 SaaS/business metrics: LTV, CAC, LTV:CAC, payback, gross margin, churn, MRR growth, ARR, break-even units, NRR, GRR, Rule of 40, magic number
  • currency_convert — 9 major currencies, live + historical ECB rates (with an offline fallback)
  • business_days — add/count/next/previous business days with US/UK/EU holidays + custom holidays
  • compound_growth — future value, present value, CAGR (7 compounding frequencies incl. continuous)
  • net_present_value / internal_rate_of_return — NPV/DCF and IRR (Newton + bisection)
  • loan_amortization — payment, total interest, payoff, full schedule
  • depreciation — straight-line, declining-balance, sum-of-years-digits
  • batch_calculate, list_metrics, health_check

Why it's trustworthy

A call to net_present_value with rate=0.10, cashflows=[-10000, 3000, 4200, 6800] returns:

{
  "status": "success",
  "value": "1307.2877535687...",
  "formatted_value": "$1,307.29",
  "formula": "NPV = sum(CF_t / (1 + rate)^t) for t = 0..n",
  "inputs_used": { "rate": "0.10", "cashflows": ["-10000","3000","4200","6800"] },
  "unit": "USD",
  "notes": ["Period 0 cashflow is not discounted.", "..."]
}
Enter fullscreen mode Exit fullscreen mode

The full-precision value is serialized as a string so no precision is lost in JSON transport. The engine is pure and deterministic — same inputs, same output, every time. It ships with a unit-test suite plus Hypothesis property tests that assert invariants like PV↔FV round-trips and NPV(IRR) ≈ 0.

Under the hood

  • Canonical server: Python 3.11+ using the decimal module and the official MCP SDK. Runs over stdio or streamable HTTP, with optional API-key auth, rate limiting, structured logging, and OpenTelemetry.
  • Hosted edge server: a Cloudflare Pages Function that mirrors the Python engine in decimal.js — verified with 17/17 exact output parity against the Python implementation. That's what powers the free public endpoint.

Pricing

  • Free — 15 calls/day, no key needed (static FX, no batch)
  • Starter — $12/mo — 5,000 calls/day, live FX + batch
  • Pro — $39/mo — 50,000 calls/day

When an agent hits the free limit, the tool returns a structured error containing the checkout URL — so an autonomous agent can surface the paywall and the user is two clicks from a key. Prefer to self-host? The whole thing is MIT-licensed with a Docker image and Fly.io/Render blueprints — run it with unlimited calls and your own keys.

Links

If you build agents that touch money, give it a try and tell me what tool you'd want next. I'm considering bond pricing, WACC, and options (Black-Scholes).

Top comments (0)