@teamnetwork-nz/xero-mcp-server 1.16.2 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +40 -36
- package/README.md +481 -434
- package/dist/index.js +3 -1
- package/dist/resources/agent-playbook-content.js +2 -0
- package/dist/resources/capabilities.js +48 -0
- package/dist/resources/register-resources.js +2 -12
- package/dist/response-policy.js +130 -0
- package/dist/strict-tools.js +2 -0
- package/dist/tools/tool-factory.js +7 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,434 +1,481 @@
|
|
|
1
|
-
# TEAMnetwork Xero MCP Server
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
accounting
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
###
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
###
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
|
163
|
-
|
|
164
|
-
| `
|
|
165
|
-
| `
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
|
175
|
-
|
|
176
|
-
| `
|
|
177
|
-
| `
|
|
178
|
-
| `
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
|
182
|
-
|
|
183
|
-
| `
|
|
184
|
-
| `
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
|
190
|
-
|
|
191
|
-
| `
|
|
192
|
-
| `
|
|
193
|
-
| `
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
|
200
|
-
|
|
201
|
-
| `
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
|
205
|
-
|
|
206
|
-
| `
|
|
207
|
-
| `
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
|
215
|
-
|
|
216
|
-
| `list-
|
|
217
|
-
| `create-
|
|
218
|
-
| `
|
|
219
|
-
| `list-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
|
226
|
-
|
|
227
|
-
| `
|
|
228
|
-
| `
|
|
229
|
-
| `
|
|
230
|
-
| `
|
|
231
|
-
| `
|
|
232
|
-
| `
|
|
233
|
-
| `
|
|
234
|
-
| `list-
|
|
235
|
-
|
|
236
|
-
###
|
|
237
|
-
| Tool | Description |
|
|
238
|
-
|---|---|
|
|
239
|
-
| `list-
|
|
240
|
-
| `list-
|
|
241
|
-
| `list-
|
|
242
|
-
| `
|
|
243
|
-
| `
|
|
244
|
-
|
|
245
|
-
`
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
tools
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
invoice `
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
-
|
|
310
|
-
|
|
311
|
-
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
|
412
|
-
|
|
413
|
-
| `
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
1
|
+
# TEAMnetwork Xero MCP Server
|
|
2
|
+
|
|
3
|
+
## Versioned implementation knowledge
|
|
4
|
+
|
|
5
|
+
Read `xero://capabilities/1.0.0` with MCP `resources/read`, or call the read-only
|
|
6
|
+
`get_capabilities` tool with `{}`. Both publish the same contract version,
|
|
7
|
+
documentation version, package version, content hash, local field meanings,
|
|
8
|
+
limitations, and the exact enabled runtime input schemas. Mutation/report/payroll
|
|
9
|
+
tool availability follows the configured profile. Cross-system meanings of
|
|
10
|
+
user-defined references belong to the shared knowledge service, not this server.
|
|
11
|
+
|
|
12
|
+
The detailed `xero://guidance/agent-playbook` resource is embedded from AGENTS.md
|
|
13
|
+
at build time, so it is present in published packages without requiring a
|
|
14
|
+
repository checkout. Run `npm run build` after editing AGENTS.md. No credentials
|
|
15
|
+
or customer records are included in these resources. Facades must explicitly
|
|
16
|
+
preserve or remap their URIs/tool names and apply authorization.
|
|
17
|
+
|
|
18
|
+
Tools accept optional `outputFormat: "json"` to return valid JSON text. The option is removed locally and is never sent to the Xero API.
|
|
19
|
+
|
|
20
|
+
## Streamable HTTP
|
|
21
|
+
|
|
22
|
+
Set `XERO_TRANSPORT=http` to serve stateless MCP at `/mcp`. It binds to `127.0.0.1` by default; remote binding requires `XERO_HTTP_BEARER_TOKEN` and `XERO_HTTP_ALLOWED_HOSTS`. Optional controls include `XERO_HTTP_PORT`, `XERO_HTTP_ALLOWED_ORIGINS`, and `XERO_HTTP_MAX_BODY_BYTES`. A health endpoint is available at `/health`.
|
|
23
|
+
|
|
24
|
+
A [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server for Xero, maintained by [TEAMnetwork](https://teamnetwork.co.nz). Forked and extended from the [official Xero MCP Server](https://github.com/XeroAPI/xero-mcp-server).
|
|
25
|
+
|
|
26
|
+
Provides AI agents and MCP-compatible clients (e.g. Claude Desktop) with tools to read and write Xero accounting data, manage invoice attachments, and download invoice PDFs.
|
|
27
|
+
|
|
28
|
+
## Features
|
|
29
|
+
|
|
30
|
+
- **Invoices** - create, list, structured search, native batch lookup, settlement/history inspection, update, authorise, void, get full detail, download as PDF
|
|
31
|
+
- **Contacts** - create, list, identifier-based resolution, update, archive
|
|
32
|
+
- **Quotes** — create, list, update, convert to invoice
|
|
33
|
+
- **Payments & Credit Notes** — create, list, update
|
|
34
|
+
- **Bank Transactions & Manual Journals** — create, list, update
|
|
35
|
+
- **Accounts, Items, Tax Rates, Tracking** — list, create, update
|
|
36
|
+
- **Financial Reports** — Trial Balance, Profit & Loss, Balance Sheet, Aged Payables/Receivables
|
|
37
|
+
- **Invoice Attachments** — list, upload (e.g. Crystal Reports PDFs), download, delete
|
|
38
|
+
- **Payroll** — employees, leave, timesheets *(optional, off by default)*
|
|
39
|
+
- **Modular scopes** — only request the Xero API permissions your use case needs
|
|
40
|
+
|
|
41
|
+
## Prerequisites
|
|
42
|
+
|
|
43
|
+
- Node.js v18 or higher
|
|
44
|
+
- A Xero developer account with API credentials
|
|
45
|
+
|
|
46
|
+
## Docs and Links
|
|
47
|
+
|
|
48
|
+
- [Xero Public API Documentation](https://developer.xero.com/documentation/api/)
|
|
49
|
+
- [Xero API Explorer](https://api-explorer.xero.com/)
|
|
50
|
+
- [Xero-Node SDK Docs](https://xeroapi.github.io/xero-node/accounting)
|
|
51
|
+
- [MCP Protocol Specification](https://modelcontextprotocol.io/)
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Setup
|
|
56
|
+
|
|
57
|
+
### 1. Create a Xero Developer App
|
|
58
|
+
|
|
59
|
+
Set up a **Custom Connection** following Xero's guide:
|
|
60
|
+
https://developer.xero.com/documentation/guides/oauth2/custom-connections/
|
|
61
|
+
|
|
62
|
+
When configuring scopes in your Xero app, include the scopes for the feature groups you plan to use (see [Feature Groups](#feature-groups) below). At minimum you need:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
accounting.transactions
|
|
66
|
+
accounting.contacts
|
|
67
|
+
accounting.settings
|
|
68
|
+
accounting.attachments
|
|
69
|
+
accounting.journals.read
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 2. Authentication
|
|
73
|
+
|
|
74
|
+
There are two authentication modes:
|
|
75
|
+
|
|
76
|
+
#### Custom Connections (recommended)
|
|
77
|
+
|
|
78
|
+
Uses a Client ID and Secret tied to a specific Xero organisation. Best for Claude Desktop and single-org setups.
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"mcpServers": {
|
|
83
|
+
"xero": {
|
|
84
|
+
"command": "npx",
|
|
85
|
+
"args": ["-y", "tn-xero-mcp-server@latest"],
|
|
86
|
+
"env": {
|
|
87
|
+
"XERO_CLIENT_ID": "your_client_id_here",
|
|
88
|
+
"XERO_CLIENT_SECRET": "your_client_secret_here"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
#### Bearer Token
|
|
96
|
+
|
|
97
|
+
Use when your MCP client handles the OAuth flow (e.g. PKCE). The bearer token takes precedence over Client ID/Secret if both are set.
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"mcpServers": {
|
|
102
|
+
"xero": {
|
|
103
|
+
"command": "npx",
|
|
104
|
+
"args": ["-y", "tn-xero-mcp-server@latest"],
|
|
105
|
+
"env": {
|
|
106
|
+
"XERO_CLIENT_BEARER_TOKEN": "your_bearer_token"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
When obtaining a bearer token, request the scopes matching your enabled feature groups. See [Feature Groups](#feature-groups) for the full scope list.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Feature Groups
|
|
118
|
+
|
|
119
|
+
Scopes and tools are controlled by environment variables. This means you only provision the Xero API permissions your setup actually needs.
|
|
120
|
+
|
|
121
|
+
| Variable | Default | Scopes requested | Tools enabled |
|
|
122
|
+
|---|---|---|---|
|
|
123
|
+
| *(core — always on)* | — | `accounting.transactions` `accounting.contacts` `accounting.settings` `accounting.attachments` `accounting.journals.read` | All invoicing, contact, payment, attachment, PDF & journal tools |
|
|
124
|
+
| `XERO_ENABLE_REPORTS` | `true` | `accounting.reports.read` | Trial Balance, P&L, Balance Sheet, Aged Payables/Receivables |
|
|
125
|
+
| `XERO_ENABLE_PAYROLL` | `false` | `payroll.settings` `payroll.employees` `payroll.timesheets` | All payroll tools |
|
|
126
|
+
| `XERO_READWRITE` | `false` | No additional scopes | Create, update, and delete tools |
|
|
127
|
+
|
|
128
|
+
> **Note:** To use payroll tools, your Xero region must be **NZ** or **UK**, and your Xero app must have the payroll scopes provisioned.
|
|
129
|
+
|
|
130
|
+
`XERO_ENABLE_READWRITE=true` remains a deprecated compatibility alias for one release. `XERO_READWRITE` takes precedence when both are set.
|
|
131
|
+
|
|
132
|
+
### Full configuration example
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"mcpServers": {
|
|
137
|
+
"xero": {
|
|
138
|
+
"command": "npx",
|
|
139
|
+
"args": ["-y", "tn-xero-mcp-server@latest"],
|
|
140
|
+
"env": {
|
|
141
|
+
"XERO_CLIENT_ID": "your_client_id_here",
|
|
142
|
+
"XERO_CLIENT_SECRET": "your_client_secret_here",
|
|
143
|
+
"XERO_ENABLE_REPORTS": "true",
|
|
144
|
+
"XERO_ENABLE_PAYROLL": "false",
|
|
145
|
+
"XERO_READWRITE": "false",
|
|
146
|
+
"XERO_DOWNLOAD_PATH": "C:/Users/you/Downloads/Xero"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### `XERO_DOWNLOAD_PATH`
|
|
154
|
+
|
|
155
|
+
The local directory where downloaded invoice PDFs and attachments are saved.
|
|
156
|
+
Defaults to `~/Downloads` if not set.
|
|
157
|
+
|
|
158
|
+
### `DATETIMEFORMAT`
|
|
159
|
+
|
|
160
|
+
Controls which timezone is used when computing "today" defaults and displaying UTC timestamps from the API.
|
|
161
|
+
|
|
162
|
+
| Value | Behaviour |
|
|
163
|
+
|---|---|
|
|
164
|
+
| unset or `local` *(default)* | Use the system's local timezone (`Intl.DateTimeFormat` auto-detection) |
|
|
165
|
+
| IANA name e.g. `Pacific/Auckland` | Use this explicit timezone |
|
|
166
|
+
|
|
167
|
+
Date inputs to the Xero API (invoice dates, fromDate, toDate, etc.) are `YYYY-MM-DD` strings interpreted by Xero in the organisation's own timezone — no conversion is applied to those. The `DATETIMEFORMAT` setting affects "today" defaults and the display of UTC timestamps returned by the API (e.g. `UpdatedDateUTC`).
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Available Tools
|
|
172
|
+
|
|
173
|
+
### Invoices
|
|
174
|
+
| Tool | Description |
|
|
175
|
+
|---|---|
|
|
176
|
+
| `list-invoices` | List invoices and filter direction with `type=ACCREC` (AR sales invoices) or `type=ACCPAY` (AP purchase bills) |
|
|
177
|
+
| `xero_search_transactions` | Structured invoice/bill search; set `type=ACCREC` for AR or `type=ACCPAY` for AP, because contact filters do not infer direction |
|
|
178
|
+
| `xero_batch_invoice_lookup` | Native exact lookup for up to 100 invoice numbers with per-input duplicate/unmatched results |
|
|
179
|
+
| `xero_lookup_invoice` | Scalar exact invoice-number lookup for clients affected by Hermes array coercion |
|
|
180
|
+
| `get-invoice` | Get full details of a single invoice including all line items |
|
|
181
|
+
| `xero_get_bill_settlement` | Trace payments, credits, prepayments, overpayments and the outstanding balance |
|
|
182
|
+
| `xero_get_invoice_history` | Retrieve Xero-recorded invoice/bill history events (not a complete field-level audit trail) |
|
|
183
|
+
| `create-invoice` | Create a new draft invoice (AR or AP) |
|
|
184
|
+
| `update-invoice` | Update a draft invoice |
|
|
185
|
+
| `authorise-invoice` | Promote a DRAFT or SUBMITTED invoice to AUTHORISED |
|
|
186
|
+
| `void-invoice` | Void an AUTHORISED invoice, or delete a DRAFT invoice |
|
|
187
|
+
| `get-invoice-pdf` | Download the Xero-generated invoice PDF to local disk |
|
|
188
|
+
| `list-invoice-attachments` | List all file attachments on an invoice |
|
|
189
|
+
| `xero_list_bill_attachments` | Return compact structured attachment metadata without binary content |
|
|
190
|
+
| `upload-invoice-attachment` | Upload a local file (e.g. Crystal Reports PDF) as an invoice attachment |
|
|
191
|
+
| `get-invoice-attachment` | Download an invoice attachment to local disk |
|
|
192
|
+
| `xero_get_bill_attachment` | Explicit metadata-verified attachment download with a configurable size limit |
|
|
193
|
+
| `delete-invoice-attachment` | Delete an attachment from an invoice |
|
|
194
|
+
|
|
195
|
+
### Quotes
|
|
196
|
+
| Tool | Description |
|
|
197
|
+
|---|---|
|
|
198
|
+
| `list-quotes` | List quotes |
|
|
199
|
+
| `create-quote` | Create a new quote |
|
|
200
|
+
| `update-quote` | Update an existing quote |
|
|
201
|
+
| `convert-quote-to-invoice` | Convert a quote into a draft invoice, copying all line items |
|
|
202
|
+
|
|
203
|
+
### Contacts
|
|
204
|
+
| Tool | Description |
|
|
205
|
+
|---|---|
|
|
206
|
+
| `list-contacts` | List contacts; `contactRole=customer` filters AR customers and `contactRole=supplier` filters AP suppliers; omit it to include unclassified contacts |
|
|
207
|
+
| `xero_find_contact` | Resolve a contact without silently choosing ambiguous matches; `role` is optional because contacts may be customer, supplier, both, or `Unknown` |
|
|
208
|
+
| `create-contact` | Create a new contact |
|
|
209
|
+
| `update-contact` | Update an existing contact |
|
|
210
|
+
| `archive-contact` | Archive a contact (Xero does not support hard deletion) |
|
|
211
|
+
| `list-contact-groups` | List contact groups |
|
|
212
|
+
|
|
213
|
+
### Payments & Credit Notes
|
|
214
|
+
| Tool | Description |
|
|
215
|
+
|---|---|
|
|
216
|
+
| `list-payments` | List payments |
|
|
217
|
+
| `create-payment` | Record a payment against an invoice |
|
|
218
|
+
| `list-overpayments` | List overpayments (not returned by `list-payments`) |
|
|
219
|
+
| `list-prepayments` | List prepayments (not returned by `list-payments`) |
|
|
220
|
+
| `list-credit-notes` | List credit notes |
|
|
221
|
+
| `create-credit-note` | Create a credit note |
|
|
222
|
+
| `update-credit-note` | Update a draft credit note |
|
|
223
|
+
|
|
224
|
+
### Bank & Journals
|
|
225
|
+
| Tool | Description |
|
|
226
|
+
|---|---|
|
|
227
|
+
| `list-bank-transactions` | List bank transactions |
|
|
228
|
+
| `create-bank-transaction` | Create a bank transaction |
|
|
229
|
+
| `update-bank-transaction` | Update a bank transaction |
|
|
230
|
+
| `list-report-bank-summary` | Opening/closing balance and cash in/out per bank account (Xero's Bank Summary report) |
|
|
231
|
+
| `list-manual-journals` | List manual journals |
|
|
232
|
+
| `create-manual-journal` | Create a manual journal |
|
|
233
|
+
| `update-manual-journal` | Update a manual journal |
|
|
234
|
+
| `list-journals` | List the underlying GL posting stream (double-entry journal lines per account) |
|
|
235
|
+
|
|
236
|
+
### Settings & Configuration
|
|
237
|
+
| Tool | Description |
|
|
238
|
+
|---|---|
|
|
239
|
+
| `list-accounts` | List chart of accounts |
|
|
240
|
+
| `list-tax-rates` | List tax rates |
|
|
241
|
+
| `list-items` | List inventory items |
|
|
242
|
+
| `create-item` | Create an inventory item |
|
|
243
|
+
| `update-item` | Update an inventory item |
|
|
244
|
+
| `list-tracking-categories` | List tracking categories and options |
|
|
245
|
+
| `create-tracking-category` | Create a tracking category |
|
|
246
|
+
| `update-tracking-category` | Update a tracking category |
|
|
247
|
+
| `update-tracking-options` | Update tracking options |
|
|
248
|
+
| `create-tracking-option` | Create a tracking option |
|
|
249
|
+
| `list-organisation-details` | Get organisation details |
|
|
250
|
+
|
|
251
|
+
### Financial Reports *(requires `XERO_ENABLE_REPORTS=true`)*
|
|
252
|
+
| Tool | Description |
|
|
253
|
+
|---|---|
|
|
254
|
+
| `list-trial-balance` | Trial balance report |
|
|
255
|
+
| `list-profit-and-loss` | Profit and loss report |
|
|
256
|
+
| `list-report-balance-sheet` | Balance sheet report |
|
|
257
|
+
| `list-aged-receivables-by-contact` | Aged receivables for a contact |
|
|
258
|
+
| `list-aged-payables-by-contact` | Aged payables for a contact |
|
|
259
|
+
|
|
260
|
+
`list-profit-and-loss` enforces a single-calendar-month base range and returns
|
|
261
|
+
comparison-column metadata containing each label, MCP-derived date window, MTD flag,
|
|
262
|
+
`source: MCP_DERIVED`, and `verifiedCallShape: true`. Multi-month base ranges are rejected
|
|
263
|
+
because Xero can return misleading rolling totals. Comparison calls with `periods>=1` also
|
|
264
|
+
require the current calendar month as the base; completed-month comparisons are rejected.
|
|
265
|
+
For N completed monthly columns, request the current month with `periods=N` and ignore
|
|
266
|
+
the first MTD column, or make N separate calls with `periods=0`.
|
|
267
|
+
|
|
268
|
+
### Pagination
|
|
269
|
+
|
|
270
|
+
For tools with `page` and `pageSize`, `Found N` is the count for the current page, not a
|
|
271
|
+
total. To retrieve the complete filtered result set, increment `page` until a page contains
|
|
272
|
+
fewer records than `pageSize`. `xero_search_transactions` and `xero_find_contact` expose
|
|
273
|
+
`pagination.complete`, `pagination.truncated`, and `pagination.nextPage` instead. Xero does
|
|
274
|
+
not expose a configurable page size for `list-quotes`; continue until it returns an empty page.
|
|
275
|
+
|
|
276
|
+
Attachment filenames are non-authoritative and may contain amounts that differ from the
|
|
277
|
+
bill's gross total. Use Xero invoice `SubTotal`, `TotalTax`, and `Total` fields for financial
|
|
278
|
+
reconciliation, and retrieve binary attachment content only when explicitly needed.
|
|
279
|
+
|
|
280
|
+
### AP and AR filtering
|
|
281
|
+
|
|
282
|
+
Invoice direction is explicit. `ACCREC` means Accounts Receivable sales invoices (money owed
|
|
283
|
+
to you by customers); `ACCPAY` means Accounts Payable purchase bills (money you owe suppliers).
|
|
284
|
+
Use the `type` filter on `list-invoices`, `xero_search_transactions`, and exact invoice lookup
|
|
285
|
+
tools whenever direction matters. Omitting `type` searches both. A `supplier` or `contactId`
|
|
286
|
+
filter identifies the contact on the transaction but does not automatically select `ACCPAY`.
|
|
287
|
+
|
|
288
|
+
Contact role is related but separate. `customer` means Xero's `IsCustomer` flag is true and
|
|
289
|
+
`supplier` means `IsSupplier` is true. A contact can be a customer, supplier, both, or neither
|
|
290
|
+
(`Type: Unknown`). Omit `role`/`contactRole` when unclassified contacts must remain searchable.
|
|
291
|
+
These role filters do not filter invoice direction; combine contact resolution with an explicit
|
|
292
|
+
invoice `type` for an AP- or AR-specific workflow.
|
|
293
|
+
|
|
294
|
+
`xero_search_transactions` searches invoices and bills. Bank transactions are a separate Xero
|
|
295
|
+
resource accessed with `list-bank-transactions`, using `RECEIVE` and `SPEND` transaction types
|
|
296
|
+
rather than `ACCREC` and `ACCPAY`.
|
|
297
|
+
|
|
298
|
+
### Payroll *(requires `XERO_ENABLE_PAYROLL=true`)*
|
|
299
|
+
| Tool | Description |
|
|
300
|
+
|---|---|
|
|
301
|
+
| `list-payroll-employees` | List payroll employees |
|
|
302
|
+
| `list-payroll-employee-leave` | List an employee's leave records |
|
|
303
|
+
| `list-payroll-employee-leave-balances` | List an employee's leave balances |
|
|
304
|
+
| `list-payroll-employee-leave-types` | List leave types for an employee |
|
|
305
|
+
| `list-payroll-leave-periods` | List leave periods for an employee |
|
|
306
|
+
| `list-payroll-leave-types` | List all available leave types |
|
|
307
|
+
| `list-timesheets` | List timesheets |
|
|
308
|
+
| `create-payroll-timesheet` | Create a timesheet |
|
|
309
|
+
| `add-payroll-timesheet-line` | Add a line to a timesheet |
|
|
310
|
+
| `update-payroll-timesheet-line` | Update a timesheet line |
|
|
311
|
+
| `approve-payroll-timesheet` | Approve a timesheet |
|
|
312
|
+
| `revert-payroll-timesheet` | Revert an approved timesheet |
|
|
313
|
+
| `delete-timesheet` | Delete a timesheet |
|
|
314
|
+
| `get-payroll-timesheet` | Get a timesheet by ID |
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Agent guidance
|
|
319
|
+
|
|
320
|
+
The server supplies MCP `instructions` that are automatically delivered to the calling agent at session start. These cover:
|
|
321
|
+
|
|
322
|
+
- **Datetime handling** — `YYYY-MM-DD` date inputs, local-timezone "today" defaults, UTC timestamp display
|
|
323
|
+
- **Efficiency rules** — filter server-side first; never page through all records to find specific items
|
|
324
|
+
- **Xero terminology** — ACCREC/ACCPAY, AUTHORISED, IsReconciled explained
|
|
325
|
+
- **Read-only mode** — detecting and communicating when write tools are absent
|
|
326
|
+
- **API limitations** — reconciliation, aged reports, rate limits, page size guidance
|
|
327
|
+
|
|
328
|
+
For a full query playbook, see the MCP resource `xero://guidance/agent-playbook` (or `AGENTS.md` for local reference).
|
|
329
|
+
|
|
330
|
+
### Structured lookup contracts
|
|
331
|
+
|
|
332
|
+
The `xero_*` lookup tools return compact JSON with a consistent `matchStatus`
|
|
333
|
+
(`EXACT`, `MULTIPLE`, `CANDIDATES`, `NOT_FOUND`, or `ERROR`), an explicit
|
|
334
|
+
`ambiguous` flag, pagination completeness/continuation metadata where relevant,
|
|
335
|
+
and structured errors. Xero and external identifiers remain strings; money values
|
|
336
|
+
are returned as decimal strings with their currency code.
|
|
337
|
+
|
|
338
|
+
For TEAMlink purchase bills, live API verification confirmed that the convention
|
|
339
|
+
`<supplier-invoice-number> / <TEAMlink-orderId>` is stored in Xero's
|
|
340
|
+
`InvoiceNumber` field (for example `SYNTHETIC-BILL / TEST-REFERENCE`), while `Reference` is empty.
|
|
341
|
+
Exact and batch searches therefore use Xero's native `InvoiceNumbers` filter. The
|
|
342
|
+
separate `reference` search remains available for records that use that field.
|
|
343
|
+
|
|
344
|
+
`xero_batch_invoice_lookup.invoiceNumbers` is a native JSON string array. Numeric-
|
|
345
|
+
looking identifiers are intentionally not coerced to numbers. The reported Hermes
|
|
346
|
+
`coerce_tool_args` defect is outside this repository and must also be corrected in
|
|
347
|
+
the Hermes runtime if that client still rewrites valid JSON arrays before sending
|
|
348
|
+
the MCP request. Until then, use scalar `xero_lookup_invoice` for exact single-value
|
|
349
|
+
lookups or `xero_search_transactions` for broader matching.
|
|
350
|
+
|
|
351
|
+
## For Developers
|
|
352
|
+
|
|
353
|
+
### Local development setup
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
git clone https://github.com/your-org/tn-xero-mcp-server.git
|
|
357
|
+
cd tn-xero-mcp-server
|
|
358
|
+
npm install
|
|
359
|
+
cp .env.example .env
|
|
360
|
+
# Edit .env with your credentials
|
|
361
|
+
npm run build
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Linking to Claude Desktop for development
|
|
365
|
+
|
|
366
|
+
In your `claude_desktop_config.json`, point directly at the built file:
|
|
367
|
+
|
|
368
|
+
```json
|
|
369
|
+
{
|
|
370
|
+
"mcpServers": {
|
|
371
|
+
"xero": {
|
|
372
|
+
"command": "node",
|
|
373
|
+
"args": ["C:/path/to\\Xero-MCP\\dist\\index.js"],
|
|
374
|
+
"env": {
|
|
375
|
+
"XERO_CLIENT_ID": "your_client_id_here",
|
|
376
|
+
"XERO_CLIENT_SECRET": "your_client_secret_here",
|
|
377
|
+
"XERO_ENABLE_PAYROLL": "false",
|
|
378
|
+
"XERO_DOWNLOAD_PATH": "C:\\Users\\you\\Downloads\\Xero"
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
> **Windows note:** Backslashes in `args` paths must be escaped as `\\`.
|
|
386
|
+
|
|
387
|
+
### Publishing updates
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
npm run build
|
|
391
|
+
npm publish
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
## License
|
|
397
|
+
|
|
398
|
+
MIT
|
|
399
|
+
|
|
400
|
+
## Security
|
|
401
|
+
|
|
402
|
+
Do not commit your `.env` file or any credentials to version control. The `.gitignore` excludes `.env` by default.
|
|
403
|
+
|
|
404
|
+
<!-- BEGIN MCP configuration reference -->
|
|
405
|
+
## Environment variable reference
|
|
406
|
+
|
|
407
|
+
The server automatically loads `.env` from its working directory; environment variables already set by the client take precedence.
|
|
408
|
+
|
|
409
|
+
Copy `.env.example` for variable names and safe placeholders. Replace required placeholders privately. Optional variables should be omitted unless needed; an empty value may override a default. Never commit credentials, real identities, device profiles, exports, or logs.
|
|
410
|
+
|
|
411
|
+
| Variable | Required | Default | Purpose and accepted values |
|
|
412
|
+
|---|---|---|---|
|
|
413
|
+
| `DATETIMEFORMAT` | No | `local` | Output date setting: local or an IANA timezone; shared by SSLStore and Xero. |
|
|
414
|
+
| `XERO_CLIENT_BEARER_TOKEN` | Alternative | `unset` | Existing access token; use instead of a client ID/secret pair. Renew externally when expired. |
|
|
415
|
+
| `XERO_CLIENT_ID` | Alternative | `unset` | Custom Connection client ID; must be set together with XERO_CLIENT_SECRET. |
|
|
416
|
+
| `XERO_CLIENT_SECRET` | Alternative | `unset` | Custom Connection client secret; must be set together with XERO_CLIENT_ID. |
|
|
417
|
+
| `XERO_DOWNLOAD_PATH` | No | `user Downloads directory` | Download destination; choose a private directory outside source control. |
|
|
418
|
+
| `XERO_ENABLE_PAYROLL` | No | `false` | Literal true registers payroll tools; requires appropriate scopes. |
|
|
419
|
+
| `XERO_ENABLE_READWRITE` | Deprecated | `unset` | Compatibility alias for XERO_READWRITE; canonical variable wins. |
|
|
420
|
+
| `XERO_ENABLE_REPORTS` | No | `true` | Reports are enabled unless set to literal false. |
|
|
421
|
+
| `XERO_HTTP_ALLOWED_HOSTS` | Conditional | `unset` | Comma-separated Host allowlist required for non-loopback HTTP; use the public hostnames accepted by the listener. |
|
|
422
|
+
| `XERO_HTTP_ALLOWED_ORIGINS` | No | `unset` | Comma-separated browser Origin allowlist; configure when browser clients need access. |
|
|
423
|
+
| `XERO_HTTP_BEARER_TOKEN` | Conditional | `unset` | Private bearer secret required for non-loopback HTTP; clients send Authorization: Bearer <secret>. |
|
|
424
|
+
| `XERO_HTTP_HOST` | No | `127.0.0.1` | Listener bind address. Non-loopback binding requires a bearer token and explicit allowed hosts. |
|
|
425
|
+
| `XERO_HTTP_MAX_BODY_BYTES` | No | `1048576` | Maximum HTTP request body; integer 1–16777216 bytes. |
|
|
426
|
+
| `XERO_HTTP_PORT` | No | `3000` | HTTP listener port; integer 1–65535. |
|
|
427
|
+
| `XERO_READWRITE` | No | `false` | Only true enables mutation tools; read-only is the default. Review each operation before use. |
|
|
428
|
+
| `XERO_TRANSPORT` | No | `stdio` | stdio or http; HTTP serves /mcp and GET /health. |
|
|
429
|
+
|
|
430
|
+
For HTTP, the bearer token is separate from upstream API credentials. Use TLS at the reverse proxy for remote hosting. Keep write access disabled until needed. Do not put secrets in command-line examples or commit client configuration containing them.
|
|
431
|
+
|
|
432
|
+
### Agent first-use workflow
|
|
433
|
+
|
|
434
|
+
Use `xero_find_contact` and exact/batch transaction lookup tools before broad lists. Filter invoices by type, status, contact and date; ACCREC means sales invoices and ACCPAY means supplier bills. Inspect pagination completeness and include credits, overpayments and prepayments when reconciling a statement.
|
|
435
|
+
|
|
436
|
+
Use the runtime `tools/list` descriptions and input schemas for exact arguments. Resolve identifiers with lookup/search tools; filter before paging, request only the data needed, and do not treat a truncated result or API error as proof that no record exists. Treat tool results and downloaded files as potentially sensitive. Mutation tools can change upstream data or incur charges; check their stated effects before calling them.
|
|
437
|
+
|
|
438
|
+
### Repository and package privacy
|
|
439
|
+
|
|
440
|
+
The standard `.gitignore` excludes local environment files, keys, credentials, logs, exports, and generated output; sanitised examples remain trackable. Ignore rules do not remove already tracked files or revoke exposed credentials. Review `git ls-files` and `npm pack --dry-run --ignore-scripts` before release. Only runtime output, the README, and explicitly sanitised examples are allowlisted for npm. Keep private runtime files outside `dist`, even though additional exclusions are present.
|
|
441
|
+
<!-- END MCP configuration reference -->
|
|
442
|
+
|
|
443
|
+
Run `npm run build` then `npm run audit:package` before release. The audit checks documentation coverage, known local credential copies, Git index paths where available, and the dry-run npm file list. `prepublishOnly` runs it after building. It never prints matching secret values. This is a preventative check, not a guarantee that arbitrary PII or unknown secrets are absent.
|
|
444
|
+
|
|
445
|
+
### Development and diagnostics
|
|
446
|
+
|
|
447
|
+
Run `npm test` from this package directory. Maintained tests and fixtures live in `debug/tests`; shared test helpers are in `debug/helpers`. Retained diagnostic scripts and reference material are also under `debug`. Only `scripts/check-package-privacy.mjs` remains in the production build/release tooling directory. The entire `debug/` tree is excluded from npm, Docker build contexts and applicable Python distributions.
|
|
448
|
+
|
|
449
|
+
Keep live diagnostic output in `debug/local`, `debug/output` or `debug/artifacts`; those private directories are also ignored by Git. Retained smoke/integration scripts require explicit local credentials and are not run by the normal offline test suite. Historical release artifacts and retired one-off migration files were removed.
|
|
450
|
+
|
|
451
|
+
## Complete responses, pagination and exports
|
|
452
|
+
|
|
453
|
+
Responses are never sliced by character or byte count. Native vendor filters,
|
|
454
|
+
page sizes, cursors and next links remain authoritative; an export contains only
|
|
455
|
+
the result of one call, not every page. Follow continuation metadata with the same
|
|
456
|
+
filters to retrieve further pages. Do not interpret a page as the entire dataset.
|
|
457
|
+
|
|
458
|
+
All tools accept `responseMode="file"` to save the complete, already-redacted MCP
|
|
459
|
+
result as a JSON resource. The default `responseMode="inline"` returns the entire
|
|
460
|
+
result. `MCP_MAX_RESPONSE_BYTES` optionally selects file delivery when the UTF-8
|
|
461
|
+
serialized result exceeds an operator-configured client threshold. Default: `0`
|
|
462
|
+
(no threshold). This is a delivery threshold, not a hard maximum on the final
|
|
463
|
+
envelope, and does not discard records. Invalid values fail server initialization.
|
|
464
|
+
|
|
465
|
+
Responses include `_meta.response`: `inlineComplete`, `truncated` (false when no
|
|
466
|
+
data was discarded for delivery), `datasetComplete` (null unless explicitly known
|
|
467
|
+
from the source), and `originalBytes`. Existing vendor pagination is preserved. sourceTruncated and sourcePagination expose known source truncation and continuation signals even when the result is delivered as a file.
|
|
468
|
+
For file delivery, `structuredContent` and text describe the export, its byte size,
|
|
469
|
+
SHA-256, expiry and resource URI. Use MCP `resources/read` on the supplied
|
|
470
|
+
`mcp-export://response/...` URI to retrieve the original MCP result as valid JSON.
|
|
471
|
+
No records or JSON fragments are returned as a misleading preview. Export is also
|
|
472
|
+
available for formatted text and binary MCP content, encoded in the result JSON.
|
|
473
|
+
|
|
474
|
+
Exports are scoped to the current server instance/session and expire after 24
|
|
475
|
+
hours. They are stored in a private temporary subdirectory of `MCP_EXPORT_DIR`
|
|
476
|
+
(default: OS temporary directory); files use owner-only permissions where
|
|
477
|
+
supported. Expired files are removed on subsequent export/read activity. Operators
|
|
478
|
+
must secure the directory on Windows and arrange cleanup of files left by stopped
|
|
479
|
+
processes. Remote clients should use the resource URI, not assume a local path is
|
|
480
|
+
accessible. If storage fails, the complete result remains inline with
|
|
481
|
+
`exportError="EXPORT_UNAVAILABLE"`; do not repeat successful mutations.
|