Skip to main content
XE

Xero

v0.2.0OAuth2

Global accounting, #2 ERP (UK/AU/NZ leader). Contacts, invoices, payments, items, accounts, balance sheet. Together with QuickBooks covers ~80% of global SMB accounting.

24 tools2 env vars๐ŸŒ GLOBALstable on npm

Install

terminal
$ npm install @codespar/mcp-xero

Quickstart

Add this entry to your claude_desktop_config.json (or any MCP-compatible client config).

claude_desktop_config.json
{
  "mcpServers": {
    "xero": {
      "command": "npx",
      "args": [
        "-y",
        "@codespar/mcp-xero"
      ],
      "env": {
        "XERO_ACCESS_TOKEN": "<your_xero_access_token>",
        "XERO_TENANT_ID": "<your_xero_tenant_id>"
      }
    }
  }
}

After restart, your agent can call any of the 24 tools below โ€” try create_contact first.

Environment variables ยท 2

Required to authenticate the server. Stored encrypted when using CodeSpar managed hosting.

XERO_ACCESS_TOKEN
requiredsecret

Xero OAuth2 access token (Bearer). Obtain via Xero OAuth2 flow; rotate on expiry.

XERO_TENANT_ID
required

Xero tenant/organization id sent in the Xero-tenant-id header on every request.

Available tools ยท 24

Each tool is independent โ€” your agent loads only what it needs to reduce context and response time.

WRITEcreate_contact
Create a Xero contact (customer or supplier โ€” Xero uses one unified Contact object with IsCustomer/IsSupplier flags inferred from transactions).
READget_contact
Retrieve a single Xero contact by ContactID (UUID).
READlist_contacts
List Xero contacts. Supports Xero's where clause for server-side filtering (e.g. 'Name=="ACME Ltd"', 'IsCustomer==true').
WRITEcreate_invoice
Create an invoice in Xero. Type ACCREC = accounts-receivable (sales invoice to a customer), ACCPAY = accounts-payable (bill from a supplier). Default Status=DRAFT; set AUTHORISED to issue immediately.
READget_invoice
Retrieve a single invoice by InvoiceID (UUID) or InvoiceNumber.
READlist_invoices
List invoices with optional Xero where-clause filtering. Common filters: Status=="AUTHORISED", Type=="ACCREC", Contact.ContactID==guid("..."), Date>=DateTime(2026,1,1).
READemail_invoice
Email an AUTHORISED invoice to the contact's email address on file. Xero uses the default invoice email template. No body required.
WRITEcreate_payment
Record a payment against an invoice or credit note. Reduces the invoice's AmountDue and posts to the specified bank/payment account.

Compatible frameworks

MCP is a protocol โ€” any framework that speaks it can mount this server.

Claude Agent SDKAnthropic
OpenAI AgentsOpenAI
Vercel AI SDKVercel
LangChainLangChain
LlamaIndexLlamaIndex
CrewAICrewAI
MastraMastra
Any MCP clientProtocol

Frequently asked questions

All credentials are encrypted at rest in an isolated vault scoped per organization. OAuth2 tokens are automatically refreshed before expiry. Your agent code never sees raw secrets โ€” it receives scoped, short-lived session tokens.
Servers โ€” Every LatAm commerce API your agent needs | CodeSpar