@jsamuel1/xero-mcp-server
v0.0.17
Published
A MCP server for Xero (fork of @xeroapi/xero-mcp-server with OAuth2 Web App support)
Readme
Xero MCP Server
This is a Model Context Protocol (MCP) server implementation for Xero. It provides a bridge between the MCP protocol and Xero's API, allowing for standardized access to Xero's accounting and business features.
Features
- Xero OAuth2 authentication — three modes supported (see below)
- Contact management
- Chart of Accounts management
- Invoice creation and management
- Bank transactions and payments
- Financial reports (P&L, Balance Sheet, Trial Balance, Aged Receivables/Payables)
- Payroll management (employees, timesheets, leave)
- MCP protocol compliance
Prerequisites
- Node.js (v24 or higher)
- npm
- A Xero developer account with API credentials
Docs and Links
Setup
Create a Xero Account
If you don't already have a Xero account and organisation, you can create one by signing up at xero.com. We recommend using a Demo Company to start with — it comes with pre-loaded sample data.
Authentication
Three authentication modes are supported. Choose one.
Mode 1: OAuth2 Web App (Free — recommended)
This uses the standard OAuth2 Authorization Code flow with PKCE. It works with a free Xero Web App integration — no paid Custom Connection subscription required.
On first use, a browser window opens for you to authorize access to your Xero organisation. Tokens are persisted to ~/.xero-mcp-tokens.json and automatically refreshed.
Step 1: Create a Web App in Xero
- Go to developer.xero.com/app/manage → New App
- Enter a name (e.g. "My MCP Server")
- Select Web app as the integration type
- Company URL: any valid URL (e.g.
https://example.com) - Redirect URI:
http://localhost:5000/callback - Accept terms → Create app
- Go to Configuration → Generate a secret
- Note the Client ID and Client Secret
Step 2: Configure your MCP client
Add the following to your MCP client config (e.g. claude_desktop_config.json):
{
"mcpServers": {
"xero": {
"command": "npx",
"args": ["-y", "@jsamuel1/xero-mcp-server"],
"env": {
"XERO_CLIENT_ID": "your_client_id_here",
"XERO_CLIENT_SECRET": "your_client_secret_here",
"XERO_REDIRECT_URI": "http://localhost:5000/callback"
}
}
}
}Step 3: Authorize
On first use, a browser window will open asking you to log in to Xero and authorize access to your organisation. After authorizing, you can close the browser tab — tokens are saved automatically and will be refreshed as needed.
Mode 2: Custom Connections (Paid)
This uses the OAuth2 client_credentials grant type. It requires a Xero Custom Connection subscription (paid add-on).
Configuring your Xero Developer account
Set up a Custom Connection following these instructions.
Required Scopes
Custom connections require different scopes depending on when they were created:
| Custom Connection Created | Required Scopes | |---------------------------|-----------------| | Before Apr 29, 2026 | SCOPES_V1 (bundled permissions) | | From Apr 29, 2026 | SCOPES_V2 (granular permissions) |
The MCP server automatically tries V1 scopes first and falls back to V2 if needed. You can override these by setting the
XERO_SCOPESenvironment variable to a space-separated list of scopes.
MCP Client Config
{
"mcpServers": {
"xero": {
"command": "npx",
"args": ["-y", "@jsamuel1/xero-mcp-server"],
"env": {
"XERO_CLIENT_ID": "your_client_id_here",
"XERO_CLIENT_SECRET": "your_client_secret_here"
}
}
}
}Mode 3: Bearer Token
Use a pre-obtained bearer token. Suitable for testing or when you manage token acquisition externally.
{
"mcpServers": {
"xero": {
"command": "npx",
"args": ["-y", "@jsamuel1/xero-mcp-server"],
"env": {
"XERO_CLIENT_BEARER_TOKEN": "your_bearer_token"
}
}
}
}Note:
XERO_CLIENT_BEARER_TOKENtakes precedence over all other settings if defined.
Environment Variable Reference
| Variable | Mode | Description |
|----------|------|-------------|
| XERO_CLIENT_ID | 1, 2 | OAuth2 client ID from your Xero app |
| XERO_CLIENT_SECRET | 1, 2 | OAuth2 client secret |
| XERO_REDIRECT_URI | 1 | Redirect URI for OAuth2 Web App flow (e.g. http://localhost:5000/callback). Setting this activates Mode 1. |
| XERO_CLIENT_BEARER_TOKEN | 3 | Pre-obtained bearer token. Takes highest priority if set. |
| XERO_SCOPES | 2 | Optional: override OAuth scopes (space-separated). Only applies to Custom Connection mode. |
Available MCP Commands
list-accounts— Retrieve a list of accountslist-contacts— Retrieve a list of contacts from Xerolist-credit-notes— Retrieve a list of credit noteslist-invoices— Retrieve a list of invoiceslist-items— Retrieve a list of itemslist-manual-journals— Retrieve a list of manual journalslist-organisation-details— Retrieve details about an organisationlist-profit-and-loss— Retrieve a profit and loss reportlist-quotes— Retrieve a list of quoteslist-tax-rates— Retrieve a list of tax rateslist-payments— Retrieve a list of paymentslist-trial-balance— Retrieve a trial balance reportlist-bank-transactions— Retrieve a list of bank account transactionslist-payroll-employees— Retrieve a list of Payroll Employeeslist-report-balance-sheet— Retrieve a balance sheet reportlist-payroll-employee-leave— Retrieve a Payroll Employee's leave recordslist-payroll-employee-leave-balances— Retrieve a Payroll Employee's leave balanceslist-payroll-employee-leave-types— Retrieve a list of Payroll leave typeslist-payroll-leave-periods— Retrieve a list of a Payroll Employee's leave periodslist-payroll-leave-types— Retrieve a list of all available leave types in Xero Payrolllist-timesheets— Retrieve a list of Payroll Timesheetslist-aged-receivables-by-contact— Retrieves aged receivables for a contactlist-aged-payables-by-contact— Retrieves aged payables for a contactlist-contact-groups— Retrieve a list of contact groupslist-tracking-categories— Retrieve a list of tracking categoriescreate-bank-transaction— Create a new bank transactioncreate-contact— Create a new contactcreate-credit-note— Create a new credit notecreate-invoice— Create a new invoicecreate-item— Create a new itemcreate-manual-journal— Create a new manual journalcreate-payment— Create a new paymentcreate-quote— Create a new quotecreate-payroll-timesheet— Create a new Payroll Timesheetcreate-tracking-category— Create a new tracking categorycreate-tracking-option— Create a new tracking optionupdate-bank-transaction— Update an existing bank transactionupdate-contact— Update an existing contactupdate-invoice— Update an existing draft invoiceupdate-item— Update an existing itemupdate-manual-journal— Update an existing manual journalupdate-quote— Update an existing draft quoteupdate-credit-note— Update an existing draft credit noteupdate-tracking-category— Update an existing tracking categoryupdate-tracking-options— Update tracking optionsupdate-payroll-timesheet-line— Update a line on an existing Payroll Timesheetapprove-payroll-timesheet— Approve a Payroll Timesheetrevert-payroll-timesheet— Revert an approved Payroll Timesheetadd-payroll-timesheet-line— Add new line on an existing Payroll Timesheetdelete-payroll-timesheet— Delete an existing Payroll Timesheetget-payroll-timesheet— Retrieve an existing Payroll Timesheet
For Developers
Installation
npm installBuilding
npm run buildRunning locally
npm start