Claude Code connects to Xero through DeepLedger's hosted MCP server: add https://mcp.deepledger.ai/mcp as an HTTP server, sign in with /mcp, then choose the Xero organisation by asking in the terminal. From there Claude Code can run Xero reports, search transactions and prepare drafts next to your scripts and files. This guide is for developers and technical finance staff who work in the terminal.
For chat in the browser, use Connect Claude to Xero. For hosted, self-hosted and connector-platform options, see the Xero MCP server guide.
What do you need before you start?
- Claude Code installed and signed in.
- A DeepLedger account with access to the Xero organisation.
- The organisation connected to DeepLedger: Companies → the company → Connections → Connect to Xero. The person who connects it approves DeepLedger on Xero's own sign-in page and picks only this company's organisation.
- A demo or test organisation, such as Xero's demo company, for the first session.
Two sign-ins are involved. The organisation's Xero authorisation lives in DeepLedger and is made once. Claude Code's sign-in to DeepLedger is yours, made with the command below.
How do I add DeepLedger to Claude Code?
Run:
claude mcp add --transport http deepledger https://mcp.deepledger.ai/mcp
Then start a Claude Code session, run /mcp, choose deepledger and complete the DeepLedger sign-in in the browser. claude mcp list shows the status, and claude mcp get deepledger shows the details. The commands follow Claude Code's MCP documentation.
By default the server is private to you in the current project. Add --scope user to use it in every project, or --scope project to share the definition through .mcp.json. Share the address, never a credential. Each teammate signs in as themselves and reaches only the companies they are assigned to.
The sign-in names you, not an organisation. Ask Claude Code to pick one:
List the companies I can access with their ledgers. Switch to Fernhill Plumbing Ltd, confirm it is a Xero organisation and show its base currency. Do not change anything.
Replace the name with your own. If two names look alike, switch by the company id from the list.
What can Claude Code do in Xero?
The address reaches DeepLedger's tools for the active Xero organisation:
| Area | What Claude Code can do |
|---|---|
| Reports | Profit and loss, balance sheet, trial balance, aged receivables and payables, saved report packs |
| Transaction search | Invoices, bills, credit notes, payments, bank transactions, transfers and manual journals, with lines and account codes |
| Sales and purchases | Invoices, quotes, repeating invoices, bills and credit notes, saved as drafts by default |
| Money movements | Payments, spend and receive money and transfers, which post straight away |
| Journals | Manual journals, saved as drafts by default |
| Lists | Accounts, contacts, items, tax rates and tracking categories |
| Workflow | Tasks, the company's AI Brain, documents, month-end close and reconciliation prep |
There is no bank feed for Xero in DeepLedger. The AI reads the bank transactions recorded in Xero and whether they are reconciled; Xero does not share its bank feed or statement lines, so a reconciliation is prepared from your statement and finished in Xero. The general ledger report is not available yet, because it needs a Xero permission that Xero must approve for DeepLedger first.
This is live access to real books. Use reads for the setup test.
How should the first Claude Code session go?
1. Confirm the organisation. Ask Claude Code to read the organisation profile and state the name, base currency and lock date.
2. Run one bounded report. For example: "Run Fernhill Plumbing Ltd's profit and loss for October 1 to 31, 2026 on an accrual basis. Do not change anything." Naming the dates and basis makes the result easy to compare in Xero.
3. Look at the work. Ask: "List spend money transactions in October coded to General Expenses and say what each one probably is. Do not record anything."
4. Set the write boundary. Before a bookkeeping session, say whether Claude Code may save drafts or must only propose them. Drafts do not change the reports until someone approves them.
5. Send uncertain items to Tasks. Ask Claude Code to create a DeepLedger task for anything it cannot decide. A person answers it on the company's Tasks tab, then hands it back.
How do I check one organisation and one report?
In DeepLedger, open Companies and find the organisation. If it is not connected, an authorised person connects it from the Connections tab.
With the server enabled, ask:
Using DeepLedger, list the companies I can access and show the active one. Ask me which to use. After I choose, switch to it and confirm its name, ledger and company id. Do not create or change anything.
Then use the confirmed name:
Using DeepLedger for [confirmed organisation], run the profit and loss for October 1 to 31, 2026 on an accrual basis. Show the organisation name, dates, basis, currency, total income, total operating expenses and net profit. Do not create or change anything.
In Xero, open Reporting → All reports → Profit and Loss for the same organisation, dates and basis, and compare section by section. A connected status or a fluent summary is not proof; matching totals are. The Xero profit and loss walkthrough lists what to compare.
Which terminal workflows suit Xero?
- Migration checks: compare a conversion script's output with Xero balances from the trial balance before an import.
- Supplier invoice batches: read PDFs in a local folder, check each supplier's open bills, and save draft bills with the file attached.
- Analysis files: pull a report into a local notebook while keeping the organisation, period and basis with the data.
- Reconciliation prep: list the Xero transactions that should match a statement you supply, and anything missing or duplicated.
- Month-end preparation: work through the close checklist in DeepLedger, with draft adjusting journals for a person to review.
A request to read a CSV is not permission to import it. Put the boundary in the request when local scripts and ledger tools sit in the same session. Files Claude Code writes to disk are client data; keep them out of version control.
How do API keys and headless runs work?
A personal sign-in reaches every company you can access, and the active company is shared across your AI apps. For a script or a machine with no browser, use a DeepLedger API key. Any team member can create one under Settings → API keys → Create key, for All my companies or One company. The key acts as the person who created it, with that person's access, and has no read-only switch of its own.
Keep the key in an environment variable and let .mcp.json read it:
{
"mcpServers": {
"deepledger": {
"type": "http",
"url": "https://mcp.deepledger.ai/mcp",
"headers": {
"Authorization": "Bearer ${DEEPLEDGER_API_KEY}"
}
}
}
}
A One company key stays in that organisation and cannot switch, which suits a job that must never touch another client. For parallel jobs, give each its own One company key, or send an X-Organization-Id header on every request. The LangChain and CrewAI guides cover framework code.
Which safeguards apply to Xero writes?
Some controls are enforced by DeepLedger's server, and some are instructions the AI is told to follow. Know which is which.
- Enforced: every write must name its company, or DeepLedger refuses it and nothing is written. Nothing dated on or before the organisation's lock date can change. Voiding a document with payments, credits or reconciliation applied is refused. Read-only members cannot write.
- Drafts by default: invoices, bills, credit notes and manual journals stay drafts unless the request asks to approve them.
- Confirmation: voids and emailing a document need confirmation.
- Instructions the AI follows: searching for duplicates before a write, and sending uncertain items to Tasks. Review what it proposes.
DeepLedger records each tool call in Audit history, and Xero keeps its own history on each record. Open the returned Xero record to check an important write rather than relying on a chat summary.
Troubleshooting
Sign-in is still pending. Run /mcp and finish the browser sign-in. If it fails, read the error before you remove and add the server again.
Claude Code is in the wrong organisation. Ask it to list companies and switch. Signing in again is not how you change organisation.
An organisation is missing. Check your DeepLedger membership or assignment. Signing in from a new app does not add companies.
The organisation is listed but reports fail. Its Xero authorisation may have lapsed. An admin reconnects it from the company's Connections tab.
"Rate limited." Xero limits calls per organisation per minute. Narrow the date range and retry.
A write timed out. Check Xero before you retry. A timeout is not proof that nothing was saved. More fixes are in Xero MCP troubleshooting.
Frequently asked questions
How do I connect Xero to Claude Code?
Connect the Xero organisation to DeepLedger, then run claude mcp add --transport http deepledger https://mcp.deepledger.ai/mcp. Open /mcp in a Claude Code session, sign in with your DeepLedger account, and ask Claude Code which company is active before you read the books.
Do I need a Xero developer app for Claude Code?
No. An admin connects the organisation to DeepLedger once through Xero's own sign-in, and Claude Code signs in to DeepLedger, not to Xero. You do not register a Xero app or handle Xero tokens.
Can I use a DeepLedger API key in Claude Code instead of signing in?
Yes. Create a key under Settings, API keys, Create key, keep it in an environment variable and send it as a bearer token in the server's Authorization header. The key acts as the person who created it, and a key made for One company cannot switch organisations.
Can Claude Code change my Xero books?
Yes, if your DeepLedger access allows writes. New invoices, bills, credit notes and manual journals are saved as drafts unless you ask to approve them, while payments, spend and receive money and transfers post straight away. Read-only members cannot write.
Does switching organisations in Claude Code affect my other AI apps?
Yes, for a personal sign-in. DeepLedger stores one active company per person, so a switch in Claude Code also moves Claude, ChatGPT or Grok signed in as you. Check the company named in each result before a write.
How do I remove DeepLedger from Claude Code?
Run claude mcp remove deepledger. To end DeepLedger's access for this sign-in as well, revoke it under Settings, Connected apps in DeepLedger. Disconnecting Xero on the company's Connections tab stops every AI app from reaching that organisation.
Related guides
- Xero MCP server guide
- Connect Cursor to Xero
- Connect LangChain and LangGraph to Xero
- The QuickBooks Online version: connect Claude Code
- One sign-in, every company
See every supported app on AI platforms and integrations.