DeepLedger
Menu

Connect an agent

Connect Grok to Xero: Setup Guide for Every Organisation

Connect Grok to all your Xero (beta) organisations with one DeepLedger custom connector or the xAI API, and switch between clients by asking Grok.

Published by DeepLedgerUpdated 8 min read

Grok connects to Xero through DeepLedger's hosted MCP server: add one custom connector at grok.com/connectors, sign in once, and Grok can work in every Xero organisation you can access, switching clients when you ask. Developers can reach the same tools from the xAI Responses API. This guide covers both routes and the one rule that matters when you run several organisations at once.

Xero support in DeepLedger is in beta. If Connect to Xero is not offered on a company's Connections tab, contact support.

Working in QuickBooks Online instead? Follow Connect Grok to QuickBooks Online, which also covers Grok Bot. The connector is the same one.

What you are connecting

https://mcp.deepledger.ai/mcp

That address is DeepLedger's hosted Xero MCP server. It gives Grok tools for the active Xero organisation (invoices, bills, quotes, credit notes, payments, bank transactions, transfers, manual journals, contacts, tracking categories and reports) plus Tasks, each client's AI Brain and the month-end close. An admin connects each organisation to DeepLedger once through Xero's sign-in. Grok signs in to DeepLedger, never to Xero.

RouteWho it is forHow it signs in
Grok custom connectorAnyone using Grok chatYour DeepLedger sign-in
Grok Business or EnterpriseTeams, after an admin adds itEach member's own sign-in
xAI Responses APIAgents your developers buildA DeepLedger API key

Why one sign-in for all your Xero organisations

Most AI connections to Xero start from a single organisation: you sign in, pick a file, and that file is what the AI sees.

DeepLedger's connector belongs to the person, not the file. Grok reaches every company your DeepLedger user can access, on Xero or QuickBooks Online, and moves between them in the conversation. Because the active company is stored per person, a switch in Grok also applies in Claude, ChatGPT or Cursor, so you keep one place you are working in, whatever app you open.

Before you start

  • A DeepLedger account (no card for the trial) with each Xero organisation connected: Companies → the company → Connections → Connect to Xero.
  • For Grok chat: the Custom option at grok.com/connectors. xAI's connector documentation is the reference for current availability.
  • For the API: an xAI API key and a DeepLedger API key.

How do I connect Grok to Xero?

  1. Open grok.com/connectors while signed in to Grok.
  2. Choose New Connector, then Custom.
  3. Paste https://mcp.deepledger.ai/mcp.
  4. Sign in with your DeepLedger account when Grok sends you to the sign-in page. There is no organisation to pick here; you choose the company in the chat.
  5. Start a new conversation and ask:

Which company am I in? List the Xero companies I can access.

Grok Business and Enterprise: a team admin adds the connector first in the xAI console under Grok Business → Connectors → Add Connector → Other, entering the same URL. Members then connect with their own DeepLedger sign-in. See xAI's connector management guide.

Switch companies by asking

DeepLedger's companies tool handles the switch with three operations: current, list and switch, by name or company id.

List my companies.

Switch to Tidewater Farms Ltd in Xero and show unpaid bills over 30 days.

Now do the same for Tidewater Farms Trust.

Use the exact company name. If a name matches more than one company, or none, DeepLedger refuses the switch; ask the AI to list your companies and switch by the company id. If a switch succeeds but a report fails with a reconnect message, that organisation's Xero authorisation has lapsed and an admin reconnects it from the company's Connections tab.

Using the xAI API for multi-organisation agents

For an agent you run yourself, add DeepLedger as a remote MCP tool. Create a DeepLedger API key under Settings → API keys → Create key and keep it in an environment variable.

curl https://api.x.ai/v1/responses \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-4.6",
    "input": [{"role": "user", "content": "List my companies, then show aged receivables for the active Xero company."}],
    "tools": [{
      "type": "mcp",
      "server_url": "https://mcp.deepledger.ai/mcp",
      "server_label": "deepledger",
      "authorization": "'"$DEEPLEDGER_API_KEY"'",
      "allowed_tools": ["companies", "xeroOrganisation", "xeroReports", "xeroFetchTransactions"]
    }]
  }'

allowed_tools limits what this client offers the model; it is not a read-only permission on the key. Field names follow xAI's remote MCP documentation.

The rule for agents that touch several organisations:

  • One agent, one company at a time. An All my companies key follows your active company, and companies with switch moves it. Fine for a single sequential job.
  • Parallel jobs need pinning. Give each job its own One company key, or send an X-Organization-Id header on every request. A pinned request cannot switch, so two jobs cannot pull each other into the wrong books.

Multi-organisation prompts to try

Weekly AR across clients

For each Xero company I can access, list the five largest overdue invoices with contact, amount and days overdue. One heading per company.

Unpaid bills

Switch to Tidewater Farms Ltd and list unpaid bills due in the next 10 days. Then do the same for Tidewater Farms Trust and give me the total per currency.

Intercompany

Compare the loan account between Tidewater Farms Trust and Tidewater Farms Ltd at September 30. Show both balances and any entries that appear on only one side.

Cash position

Show cash at bank for every Xero company I can access, with unreconciled bank transactions counted per account.

Coding with the client's rules

Switch to Tidewater Farms Ltd, read its AI Brain, then list last month's spend money transactions coded to General Expenses and suggest a better account for each. Open a Task for anything you are unsure of.

Close status

Which of my Xero companies have not started the October close? For those that have, which checklist items are still open?

Is it safe to let Grok write to Xero?

  • Drafts by default. New invoices, bills, credit notes and manual journals are drafts until approved; edits to approved documents change the books. Payments, spend money, receive money and transfers post straight away.
  • Confirmation for irreversible actions such as voids and emailing a document.
  • Unsafe changes are refused, such as voiding a document that has payments or reconciliation applied.
  • Per-person access. Each person reaches only their assigned companies; read-only members cannot write; Audit history records each tool call per company; uncertain work goes to Tasks.
  • Revocation. Remove the connector at grok.com/connectors, revoke the grant under Settings → Connected apps or the key under Settings → API keys, or disconnect Xero on the company's Connections tab.

Troubleshooting

No Custom option at grok.com/connectors. On Business and Enterprise, an admin must add the connector first. Otherwise check xAI's current connector documentation.

Grok answers from the wrong organisation. Ask "which company am I in?" and switch. Another app may have moved your active company.

The API returns an authentication error. The authorization field must carry a DeepLedger key starting with dl_live_, not your xAI key.

"Switch not allowed." The request is pinned by a header or uses a One company key. That is by design; change the key or header to work elsewhere.

Frequently asked questions

How do I connect Grok to Xero?

Through DeepLedger's MCP server. Connect your Xero organisations to DeepLedger, then open grok.com/connectors, choose New Connector, then Custom, and paste https://mcp.deepledger.ai/mcp. Sign in to DeepLedger when Grok asks, then ask Grok which company you are in.

Can Grok switch between Xero organisations?

Yes. One DeepLedger connector reaches every company you can access. Ask Grok to list your companies and switch to one by name, and every later request goes there until you switch again. Read the company name in each answer before you rely on it.

How do Grok Business and Enterprise teams add the connector?

A team admin adds it first in the xAI console under Grok Business, Connectors, Add Connector, Other, with the DeepLedger URL. Members then connect with their own DeepLedger sign-in, so each person reaches only the companies they are assigned to.

Can I use DeepLedger and Xero from the xAI API?

Yes. Add a tool of type mcp to a Responses API request with server_url set to https://mcp.deepledger.ai/mcp and authorization set to a DeepLedger API key. For a job that must stay in one Xero organisation, create the key for One company so it cannot switch.

Can two Grok agents work in different Xero organisations at the same time?

Yes, if each one is fixed to its company. Give each agent its own API key created for One company, or send an X-Organization-Id header on every request. Do not rely on the shared active company for jobs that run at the same time.

What does it cost to connect Grok to Xero?

DeepLedger is $20 per Xero connection per month, with unlimited users and a 14-day free trial that needs no credit card. Grok plans and xAI API usage are billed separately by xAI. Xero support in DeepLedger is in beta.

More apps are on AI platforms and integrations; prices are on the pricing page.

Ready to get started?

Connect QuickBooks and try your first task with an AI agent.

Create an Account