Product Architecture · One-pager

A Fortnox MCP for Claude & ChatGPT

A standalone token-broker + reconciliation engine, sold via the Fortnox Partner portal, targeting accounting firms (byrå) and business owners.

One remote MCP server Claude · ChatGPT · Cursor EU data residency Buy-via-Fortnox billing

The core idea

You build one remote MCP server over HTTPS. Because ChatGPT and Claude both consume remote MCP servers with OAuth, that single endpoint covers every AI client at once. The MCP tools are the thin part — the value is the token broker underneath and a server-side matching engine that also powers a standalone web dashboard.

Architecture — two chained OAuth layers

AI client Claude · ChatGPT Cursor · API the end user YOUR MCP server (token broker) curated MCP tools user → tenant mapping scope enforcement matching engine audit log Fortnox API REST · 377 ops per-company scoped access OAuth #1 OAuth #2 Supabase (EU) encrypted tokens · audit · matches WorkOS AuthKit DCR · authenticates user (OAuth 2.1) refresh token / 45d access token / 1h (OAuth 2.0 code)
OAuth #1 — AI client ↔ WorkOS AuthKit (who is the human? · DCR) OAuth #2 — your server ↔ Fortnox (which company's books?)

The broker is the hard, valuable engineering: multi-tenant encrypted Fortnox refresh-token storage, silent refresh, mapping each authenticated MCP user to the right Fortnox tenant, scope enforcement, and an immutable audit trail. It also holds the keys to companies' full accounting — so it warrants a dedicated security review. OAuth #1 = WorkOS AuthKit — it provides the Dynamic Client Registration + token issuance MCP clients need to connect; Supabase Third-Party Auth trusts that same token, so the dashboard and RLS run off one identity with no DIY auth server.

MCP tool surface — curate, don't dump 377

Read
  • list_unpaid_invoices
  • get_account_balance
  • get_ledger
  • period_comparison
  • search_customers
  • list_supplier_invoices
  • export_sie
Write · confirm-gated
  • create_invoice
  • create_voucher
  • approve_supplier_invoice

Two-step: preview → human confirms → commit. Tag with MCP destructiveHint so clients prompt. Never alter/delete posted vouchers — only corrections.

Matching · the moat
  • get_unmatched_transactions
  • suggest_matches
  • apply_match

~15–25 intent-shaped tools, not 377 raw ops.

The matching engine — the differentiator

Deterministic pass (decides)

A real server-side engine matches payments to verifications on OCR/bankgiro ref, amount, date proximity, and counterparty — returning ranked candidates with a confidence score.

LLM tail (reasons)

The model handles only the ambiguous remainder — missing OCR, partial payments, fees/rounding, fuzzy text. It explains and orchestrates; it never eyeballs rows and guesses.

This engine is valuable without any AI client — it powers a standalone reconciliation dashboard. That's what makes "standalone product" true and is hard to replicate.

Data model (core tables)

TableHoldsNotes
orgsyour customer (firm or business owner)billing identity
usersOAuth #1 identityid = WorkOS sub; trusted by Supabase via Third-Party Auth
fortnox_connectionsper Fortnox company: encrypted refresh token, scopes, expirySupabase Vault / pgcrypto; RLS by org
membershipsuser ↔ company access + rolebyrå: one user, many client companies
match_runs / match_candidatesreconciliation results + confidencepowers dashboard & MCP tools
audit_loguser · timestamp · tool · payload · resultappend-only; a selling feature

Everything in an EU region (GDPR + bokföringslagen). Writes auditable; posted verifications immutable.

Build plan

Phase0

Token broker

Fortnox developer license + sandbox. Stand up OAuth #1 ↔ #2, encrypted token storage, silent refresh. Hardest infra — do it first.

Phase1

Read tools + first writes

~15 curated read tools + 3 confirm-gated writes. Live in Claude & ChatGPT. Private beta with 1–2 friendly accounting firms.

Phase2

Matching engine + dashboard

Deterministic engine + LLM tail, exposed as MCP tools and a standalone web reconciliation view. The wedge.

Phase3

Byrå scale + launch

Multi-company, roles, audit export. Publish via Buy-via-Fortnox. Gather reviews from beta firms.

Design principles

Sources: Fortnox Developer Portal & authorization docs · OpenAI Apps SDK / ChatGPT MCP connectors. · Architecture one-pager, June 2026.