As a former tech CFO turned full-stack developer, I've seen firsthand what happens when people try to get AI to calculate financial math.

If you ask Claude, ChatGPT, or Cursor to spread a $12,000 annual contract across 12 months, it gives you a clean $1,000/month answer that looks completely fine on the surface. But the problem starts as soon as real-world accounting mechanics hit:

  • Mid-month start dates requiring daily-ratable proration (exact day-count math)
  • Leap years (28 vs 29 days in Feb)
  • Rounding-cent allocation logic across multi-year schedules
  • Closed period locks (e.g. attempting to post revenue to March when the books are already shut for pricing changes, contract cancellations, etc.)
  • Processing complex renewals

LLMs are probabilistic text predictors rather than math engines. Asking an AI assistant to calculate revenue recognition waterfalls will almost certainly result in silent audit errors.

The Solution: Orchestration vs. Calculation

The ideal workflow isn't to ban AI assistants from finance, but to restrict what they are allowed to calculate.

LLMs excel at an orchestration role—understanding user intent in a chat session, detecting nuance, and extracting structured parameters. But the math must be offloaded to a deterministic engine.

This is where the Model Context Protocol (MCP) comes in. MCP is an open standard that lets AI tools like Claude Code or Cursor securely call external microservices.

┌─────────────┐ MCP Call (JSON) ┌──────────────────────┐ │ │ ─────────────────────────> │ │ │ Claude Code │ │ defrr Engine (MCP) │ │ │ <───────────────────────── │ │ └─────────────┘ Deterministic Output └──────────────────────┘ 

How It Works in Practice

Once connected to an MCP server, you prompt your agent in plain English:

"Create a contract for Acme Corp: original term 1 Jan 2026 to 31 Dec 2026 at $12,000, then a renewal from 1 Jan 2027 to 31 Dec 2027 at $18,000. End dates included. Smooth recognition. Show the terms and month-by-month schedule."

Claude translates this request into structured parameters and invokes the engine tool (defrr_create_contract):

{ "name": "defrr_create_contract", "arguments": { "schedule": { "recognition": "smooth", "endDateIncluded": true, "terms": [ { "startDate": "2026-01-01", "endDate": "2026-12-31", "price": 12000 }, { "endDate": "2027-12-31", "price": 18000 } ] } } } 

The engine runs the exact math deterministically and returns the balanced waterfall JSON:

{ "contractSummary": { "totalPrice": 30000.0, "totalBilled": 30000.0, "totalRevenue": 30000.0, "recognitionBasis": "smooth", "balanced": true }, "schedule": [ { "period": "2026-01", "billing": 12000.0, "revenue": 1000.0, "endingDeferredBalance": 11000.0 }, { "period": "2026-02", "billing": 0.0, "revenue": 1000.0, "endingDeferredBalance": 10000.0 }, "... 22 remaining periods ..." ] } 

In the chat session, Claude formats the output into an executive summary:

🤖 Claude: I've calculated your schedule using defrr. Here is the summary:

  • Original Term: 1 Jan 2026 – 31 Dec 2026 ($12,000 billed Jan 2026, recognised at $1,000/mo)
  • Renewal Term: 1 Jan 2027 – 31 Dec 2027 ($18,000 billed Jan 2027, recognised at $1,500/mo)
  • Total Contract Value: $30,000.00 | Recognition Basis: Smooth | Balanced: Yes

The schedule spans 24 months, starting with an $11,000 deferred balance in Jan 2026 and stepping cleanly down to $0.00 at the end of Dec 2027.

Key Architectural Principles

Stateless by Default: The basic calculation tool calculates and returns results in memory without persisting data. Your financial schedules aren't stored anywhere unless explicitly instructed.

Human-in-the-Loop Permissions: If an agent has workspace permissions to save contracts, it pushes entries to a Draft Contracts queue. An API key used by an AI agent can create/save drafts, but cannot approve them. Live ledger updates require human approval in the workspace.

Closed-Period Safeguards: If an agent attempts to draft revenue into an accounting period marked as "closed", the engine throws an explicit error rather than allowing backdated entries.

Try It Out

You can connect your Claude Code session to defrr via HTTP transport in under 2 minutes:

Grab a free API key (includes 40 calculation credits, no credit card required) at defrr.com/developers/account.

In your terminal, run:

claude mcp add --transport http defrr [https://defrr.com/v1/mcp](https://defrr.com/v1/mcp) \ --header "Authorization: Bearer dfr_live_YOUR_KEY" 

Let me know how you get on or if you run into any edge-case contract schedules!