- Type of work
- MCP server for accounting data
- Whose work
- Our founder’s earlier engineering work
- Status
- Built and packaged for deployment
- Stack
- Model Context Protocol (MCP), Xero API, OAuth 2.0, Google Cloud Run, Secret Manager, Gemini Enterprise
In brief
- Problem. Accounting data is among the most sensitive a company holds, and one Xero login can reach more than one organization. An AI assistant that reads it needs tighter limits than a general connector gives.
- Work. Our founder built a Model Context Protocol (MCP) server that offers an enterprise AI assistant read-only tools over the Xero API, packaged to run on Google Cloud Run.
- Controls. Each person connects with their own token. The server checks that the person owns the Xero organization before it reads anything, and no credentials are stored in code.
What was the problem?
The assistant in question was Gemini Enterprise. The goal was to let people ask it about accounting records held in Xero without giving the assistant, or anyone using it, more access than they already had.
Xero calls each organization a tenant, and one authorized connection can cover several tenants. A connector that trusts whatever tenant it is asked for will read the wrong company’s books for the right person. That risk shaped the design.
What did our founder build?
- Read-only tools. The server defines tools that read accounting data. It defines none that create, change or delete a record.
- A token per person. Requests carry the individual user’s bearer token. There is no shared account that can see everything.
- Tenant ownership checks. Before any read, the server confirms that the requested Xero tenant belongs to the person asking.
- No credentials in code. Secrets are held in Secret Manager and supplied to the service when it runs.
- A deployable package. The server is packaged as a container for Cloud Run.
Why check tenant ownership on every request?
A tool call arrives with parameters, and a tenant identifier is one of them. If the server uses that identifier without checking it, anyone who learns or guesses another organization’s identifier can ask for its data. The check closes that gap: the identifier has to appear among the tenants the caller’s own connection is authorized for, or the request is refused.
The same rule applies to any connector that serves more than one customer, company or department. The caller’s identity decides what can be read. A parameter never does.
What about keeping the connection alive?
Connections to Xero use OAuth 2.0 with short-lived access tokens and refresh tokens that are replaced each time they are used. If two processes refresh at once, one of them can be left holding a token that no longer works. In related work on a Xero accounting integration running on Cloud Run, our founder stopped repeated refresh-token failures by adding backoff to the refresh step, and kept its scheduler running through failed jobs.
What would this look like for your team?
The pattern is the same for other accounting and ERP systems that have an API: read-only tools, a token per person and an ownership check on every request. We start by listing the five questions people most want answered and the records each one needs. Then we build only the tools those questions require. MCP servers and AI connectors sets out the scope and the tests.
Frequently asked questions
Can an AI assistant change records in our accounting system?
Not through a read-only connector. The server decides which operations exist, and this one defines only reads. Letting an assistant write, for example to draft an invoice, is a separate decision that needs approval steps and its own tests.
What is a tenant ownership check?
It is a server-side test that the organization named in a request belongs to the person making it. Without it, a connector that serves several organizations can be asked for one organization’s data by a user of another.
Does the AI provider see our accounting data?
The assistant receives the rows a tool returns so that it can answer. Each tool should therefore return only what the question needs, and your agreement with the assistant’s provider should be reviewed before rollout. We raise both points during scoping.
Tell us which system and which questions
Tell us which accounting or ERP system holds the data and what people want to ask. Describe the connector you need, or see how the same approach worked for business reports and for Dynamics 365 Business Central.
This example describes engineering work our founder, Meet Vaghasia, carried out in an earlier role. The organization is not named and project figures are left out. On a call we can walk through the approach in more detail.