Skip to main content
XE

Xero

v0.2.1OAuth2

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

What your agent can do

Xero gives your agent 24 tools it calls directly β€” pick the ones it needs, in Claude, Cursor, or any MCP client.

  • create_contact β€” Create a Xero contact (customer or supplier β€” Xero uses one unified Contact object with IsCustomer/IsSupplier flags inferred from transactions).
  • get_contact β€” Retrieve a single Xero contact by ContactID (UUID).
  • list_contacts β€” List Xero contacts. Supports Xero's where clause for server-side filtering (e.g. 'Name=="ACME Ltd"', 'IsCustomer==true').
Example call
// Your agent calls a tool directly β€” no glue code.
// CodeSpar's managed tier handles OAuth2, token rotation and rate limits.
const result = await session.call("create_contact", { /* ... */ });

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

Run `npx -y @codespar/mcp-xero` and add the config block above to your MCP client β€” Claude, Cursor, VS Code, or any MCP-compatible client. No build step, no SDK required. Prefer hosted? CodeSpar's managed tier runs it for you with auth handled.
Xero β€” MCP server Β· 24 tools | CodeSpar