Skip to main content
Glama
Xero MCP Safe

Xero MCP Safe

by dwadlane

Xero MCP Safe

$34,880 overdue across 5 invoices, chase plan ready. That is what Claude finds in the demo books in one question. Read-only by default, drafts only when you switch writes on, never approved and never sent.

Xero MCP Safe: Who owes us money? Claude finds $34,880 overdue across 5 invoices, chase plan ready

CI License: MIT

Ask Claude who owes you money. "Who should we chase today?" "Draft the invoice for the Coburg switchboard job." "Here is a supplier invoice, can you bill it?"

An MCP server by Gaps2Gains that connects Claude to Xero. It reads by default. Writes are off until you set XERO_ALLOW_WRITES=1, every write is a dry run until confirm=true, and everything it creates lands as a DRAFT that a person approves inside Xero.

Status: the Xero calls are modelled on Xero's published API reference and are untested against a live Xero organisation. The demo books and the tests are real. Try it on a demo company or a copy first. See What We Modelled.

What an Owner Can Ask

You: Who owes us money?

Claude: $34,880 overdue across 5 invoices, chase plan ready. The oldest is Keilor Builders, INV-0044, 96 days late.

You: Who should we chase today?

Claude: 4 invoices to chase: 1 friendly reminder, 1 firm reminder, 2 calls for the Owner. 3 skipped, 1 of them because a payment is pending.

You: Invoice Northside Cafe for 3 hours labour at $120/hr, materials $450 and a call out fee $90.

Claude: Dry run. Nothing created in Xero. $900 plus $90 GST is $990. Say the word and it goes into Xero as a DRAFT for you to approve.

Related MCP server: Python Xero MCP Server for BYB

Tools

Tool

What it does

Writes?

overdue_invoices

Unpaid customer invoices past due, most overdue first, with ageing: 1 to 30, 31 to 60, 61 to 90 and over 90 days. Drafts, voided and paid invoices are never counted

No

chase_plan

For every open invoice, one of four outcomes: Friendly reminder (7 to 20 days late), Firm reminder (21 to 40), Call the Owner (over 40, no email), or Skip because a payment is pending (or not due, too early, on the skip list). One line of reasoning per row

No

cash_summary

What customers owe, money in and out over recent days, and what we owe suppliers. Movement only: no bank balance is claimed

No

aged_receivables

Receivables by customer in ageing buckets. Pass contact_id to use Xero's AgedReceivablesByContact report for one contact

No

find_contacts

Search contacts by name or email and get the contact ID

No

invoice_from_job

Turns a job description into a DRAFT sales invoice (ACCREC) with line items and 10% GST. Dry run until confirm=true. Never AUTHORISED

Yes, gated

bill_from_document

Reads the text of a supplier invoice, extracts the fields, checks the GST maths in whole cents and proposes a DRAFT supplier bill (ACCPAY). Dry run until confirm=true

Yes, gated

The two write tools are only registered when XERO_ALLOW_WRITES=1 (always on in demo mode, where nothing leaves your machine). They carry MCP annotations that say so: read tools are readOnlyHint, write tools are not read-only and not destructive.

How the Chase Plan Decides

Days overdue

Outcome

Not due yet

Skip

1 to 6

Skip, too early

7 to 20

Friendly reminder

21 to 40

Firm reminder

Over 40

Call the Owner

A payment is pending when that customer logged a payment in the last 7 days, or money from them has landed as a RECEIVE bank transaction in the last 14 days and is not reconciled yet. Chasing them would be wrong, so the invoice is skipped with the reason. Disputed invoices go on the skip list: set XERO_SKIP_INVOICES to a comma separated list of invoice numbers, or pass skip.

Bills From Documents

bill_from_document takes OCR-style text and proposes a bill:

  • Deterministic by default. A plain parser, no model and no network. It reads supplier, ABN, invoice number, dates, line items, subtotal, GST and total, and leaves a field out rather than guess.

  • GST maths in whole cents. Line items must add to the subtotal, GST must be 10% (or total divided by 11 for GST-inclusive documents), and subtotal plus GST must equal the total, all within 2 cents. If it does not add up, the bill is blocked even with confirm=true.

  • Optional Claude mode. mode=claude sends the document text to the Anthropic API, then runs the result through the same checks. It needs ANTHROPIC_API_KEY. The model comes from XERO_EXTRACT_MODEL and falls back to claude-haiku-5-5.

  • Known supplier only. It will not create contacts. The supplier must already exist in Xero, or pass contact_id. A bill number that already exists for that supplier is blocked.

For the full documents pipeline, with confidence scores, duplicate checks, a human review queue and an accuracy gate in CI, see messy-docs-to-records.

Quick Start

With no Xero credentials it runs on demo books for a fictional Melbourne electrician, Bright Spark Electrical.

git clone https://github.com/dwadlane/xero-mcp-safe.git
cd xero-mcp-safe
npm install && npm run build
claude mcp add xero -- node "$(pwd)/dist/index.js"

Or add it to Claude Desktop's claude_desktop_config.json:

{
  "mcpServers": {
    "xero": { "command": "node", "args": ["/full/path/to/xero-mcp-safe/dist/index.js"] }
  }
}

Connect Your Xero Organisation

Create an app in the Xero developer portal, complete the OAuth 2.0 flow, and keep the tenant ID of the organisation you chose.

Variable

What it is

XERO_TENANT_ID

The organisation's tenant ID. Sent as the xero-tenant-id header

XERO_ACCESS_TOKEN

OAuth 2.0 bearer token

XERO_REFRESH_TOKEN, XERO_CLIENT_ID, XERO_CLIENT_SECRET

Optional. The server refreshes an expired token through identity.xero.com/connect/token and retries

XERO_TOKEN_FILE

Optional. Xero refresh tokens are single use, so we keep the newest pair in this file (mode 600)

XERO_ALLOW_WRITES=1

Registers invoice_from_job and bill_from_document. Off by default

XERO_SKIP_INVOICES

Invoice numbers or IDs the chase plan always leaves alone

XERO_SALES_ACCOUNT_CODE, XERO_BILL_ACCOUNT_CODE

Optional account codes for draft lines. Left off unless set

ANTHROPIC_API_KEY, XERO_EXTRACT_MODEL

Optional, for bill_from_document Claude mode only

Credentials stay on your machine and go only to Xero (and to Anthropic in Claude mode).

When It Stops

We built this to hand off, not to push on.

  • Read-only by default. No write tool exists until you set XERO_ALLOW_WRITES=1.

  • Dry run until confirm=true. Both write tools preview first and create nothing.

  • DRAFT only, never AUTHORISED. The request's Status is a fixed DRAFT, not an input. Nothing is approved, sent or paid. A person reviews it inside Xero.

  • Over 40 days goes to the Owner as a call. An email is the wrong tool by then, so chase_plan says call.

  • A pending payment pauses the chase. Recent payments and unreconciled receipts both count.

  • Bad GST, unknown suppliers and duplicate bill numbers are blocked, even with confirm=true. We never invent prices either: job lines without an amount are not charged.

  • No retry on writes. A 429 waits for Retry-After and tries again (Xero allows 60 calls a minute). A server error is retried for reads only, so a write is never sent twice. Each write carries an Idempotency-Key.

  • This server cannot send email. There is nothing here that contacts your customers.

What We Modelled

Xero Accounting API, base https://api.xero.com/api.xro/2.0/, OAuth 2.0 bearer token plus the xero-tenant-id header. Untested against a live Xero organisation.

Endpoint

Used for

GET Invoices with where (Type, Status, InvoiceNumber) and page

Overdue, chase plan, cash, aged receivables, duplicate bill check

POST Invoices (always Status: DRAFT)

invoice_from_job (ACCREC), bill_from_document (ACCPAY)

GET Contacts with searchTerm

find_contacts, resolving customers and suppliers

GET Payments with where on type and date

Pending payment detection, cash in

GET BankTransactions with where

Unreconciled receipts, cash in and out

GET Reports/AgedReceivablesByContact

aged_receivables with contact_id

POST identity.xero.com/connect/token

Token refresh

Dates are read in both Xero formats, ISO and /Date(ms+0000)/. Lists page with page and pageSize=100, up to 20 pages. Please tell us what a live org shows that we got wrong.

How It's Built

  • TypeScript on the official MCP SDK, zod for inputs.

  • A DemoClient with fictional data for Bright Spark Electrical, so the tools run the same code with or without Xero.

  • Injected fetch and sleep, so rate limit and refresh behaviour is tested without waiting.

  • Tests on every tool, the HTTP layer, the GST maths and a stdio smoke test that starts the real server: npm test.

Also From Us

  • myob-mcp: the same overdue and chase tools for MYOB AccountRight.

  • agent-action-gate: every write proposed, approved, run once and logged. Put it in front of any agent that can change records.

  • messy-docs-to-records: messy faxes and invoices in, draft records out, with a human review queue.

Not affiliated with or endorsed by Xero.

License

MIT


Built by Gaps2Gains. Book a Free Discovery Call

Available Tools

7 tools
aged_receivablesAged receivablesA
Read-only

Receivables by customer in ageing buckets (current, 1 to 30, 31 to 60, 61 to 90, over 90). With contact_id it returns Xero's own AgedReceivablesByContact report for that one contact.

Inputs: contact_id.

bill_from_documentDraft bill from a supplier documentA
Idempotent

Read the text of a supplier invoice (OCR style), extract the fields, check the GST maths in whole cents and propose a DRAFT supplier bill (ACCPAY). Deterministic parser by default; mode=claude is optional and sends the text to the Anthropic API. Dry run by default. If the GST does not add up, the supplier is unknown or the bill number already exists, it is blocked even with confirm=true. Created as DRAFT only, never approved.

Inputs: text (required), mode, confirm, contact_id.

cash_summaryCash summaryA
Read-only

What customers owe, money in and out over recent days, and what we owe suppliers. Money movement only: Xero's Accounting API gives no bank balance, so none is claimed.

Inputs: days.

chase_planChase planA
Read-only

For every open customer invoice, decide one of four outcomes: Friendly reminder (7 to 20 days overdue), Firm reminder (21 to 40), Call the Owner (over 40, no email), or Skip (not due, too early, on the skip list, or a payment is pending). Each row says why in one line.

Inputs: skip.

find_contactsFind contactsA
Read-only

Search Xero contacts by name or email. Returns the contact ID the write tools need.

Inputs: search (required).

invoice_from_jobDraft invoice from a jobA
Idempotent

Turn a job description into a DRAFT sales invoice (ACCREC) with line items and 10% GST. Example: '3 hours labour at $120/hr, materials $450, call out fee $90'. Dry run by default: with confirm=false it returns the preview and creates nothing. With confirm=true it creates the invoice as DRAFT only. It is never approved or sent. Lines without a price are not charged.

Inputs: job_description (required), items, confirm, contact, +4 more.

overdue_invoicesOverdue invoicesA
Read-only

Unpaid customer invoices past their due date, most overdue first, with an ageing breakdown (1 to 30, 31 to 60, 61 to 90, over 90 days). Drafts, voided and paid invoices are never counted. Use for 'who owes us money?'

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 7 tools

    Disambiguation3/5

    The receivables tools overlap significantly: overdue_invoices, aged_receivables, and chase_plan all operate on the same open/overdue invoice pool and multiple expose ageing buckets, so an agent asking 'who owes us money by age' could reasonably pick any of them. The rich descriptions help separate an action list (chase_plan) from a raw report (aged_receivables) and a cash-flow view (cash_summary), but the boundaries are not crisp. The two document/job creation tools are clearly distinct.

    Naming Consistency3/5

    Names mix conventions: noun phrases (overdue_invoices, chase_plan, cash_summary, aged_receivables), a verb_noun (find_contacts), and X_from_Y patterns (bill_from_document, invoice_from_job). All are readable and snake_case, but there is no single predictable verb_noun scheme, making the set feel ad hoc.

    Tool Count5/5

    Seven tools is well within a sensible range and each earns its place in the AR/cash workflow: reporting, chase planning, contact lookup, and two guarded draft-creation flows. Nothing feels redundant enough to cut or thin enough to be a gap.

    Completeness3/5

    Coverage is read-heavy plus two draft creators, but there is no way to record payments, send reminders/invoices, approve or void bills, or list all invoices despite chase_plan generating actions that cannot be executed through the surface. The draft-only 'safe' scope is intentional, but these gaps limit end-to-end workflows.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables interaction with the Xero Accounting API to manage contacts, invoices, payments, accounts, and financial reports. It provides a suite of tools for natural language access to accounting records and business performance data.
      20
      1
      Apache 2.0
    • -
      license
      Not graded
      quality
      D
      maintenance
      Enables interaction with Xero accounting API for financial reporting, sales analysis, grant tracking, and bill management using natural language.
      1
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to read an organisation's contacts, invoices and bills, payments, chart of accounts and financial reports, and — only on explicit request — to create contacts, invoices and payments or change an invoice's status.
      Apache 2.0
    • A
      license
      A
      quality
      B
      maintenance
      Enables Claude Desktop and Claude Code to retrieve read-only accounting and sales-invoice data and build profit-and-loss statements, balance sheets, year-over-year comparisons, monthly trends, and dimension-filtered financial reports.
      12
      1
      MIT