@teamnetwork-nz/xero-mcp-server 1.6.0 → 1.8.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/README.md
CHANGED
|
@@ -129,6 +129,17 @@ Scopes and tools are controlled by environment variables. This means you only pr
|
|
|
129
129
|
The local directory where downloaded invoice PDFs and attachments are saved.
|
|
130
130
|
Defaults to `~/Downloads` if not set.
|
|
131
131
|
|
|
132
|
+
### `DATETIMEFORMAT`
|
|
133
|
+
|
|
134
|
+
Controls which timezone is used when computing "today" defaults and displaying UTC timestamps from the API.
|
|
135
|
+
|
|
136
|
+
| Value | Behaviour |
|
|
137
|
+
|---|---|
|
|
138
|
+
| unset or `local` *(default)* | Use the system's local timezone (`Intl.DateTimeFormat` auto-detection) |
|
|
139
|
+
| IANA name e.g. `Pacific/Auckland` | Use this explicit timezone |
|
|
140
|
+
|
|
141
|
+
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`).
|
|
142
|
+
|
|
132
143
|
---
|
|
133
144
|
|
|
134
145
|
## Available Tools
|
|
@@ -228,6 +239,18 @@ Defaults to `~/Downloads` if not set.
|
|
|
228
239
|
|
|
229
240
|
---
|
|
230
241
|
|
|
242
|
+
## Agent guidance
|
|
243
|
+
|
|
244
|
+
The server supplies MCP `instructions` that are automatically delivered to the calling agent at session start. These cover:
|
|
245
|
+
|
|
246
|
+
- **Datetime handling** — `YYYY-MM-DD` date inputs, local-timezone "today" defaults, UTC timestamp display
|
|
247
|
+
- **Efficiency rules** — filter server-side first; never page through all records to find specific items
|
|
248
|
+
- **Xero terminology** — ACCREC/ACCPAY, AUTHORISED, IsReconciled explained
|
|
249
|
+
- **Read-only mode** — detecting and communicating when write tools are absent
|
|
250
|
+
- **API limitations** — reconciliation, aged reports, rate limits, page size guidance
|
|
251
|
+
|
|
252
|
+
For a full query playbook, see the MCP resource `xero://guidance/agent-playbook` (or `AGENTS.md` for local reference).
|
|
253
|
+
|
|
231
254
|
## For Developers
|
|
232
255
|
|
|
233
256
|
### Local development setup
|
|
@@ -11,6 +11,11 @@ export class XeroMcpServer {
|
|
|
11
11
|
instructions: [
|
|
12
12
|
"You are connected to the Xero accounting API via MCP tools.",
|
|
13
13
|
"",
|
|
14
|
+
"DATETIME HANDLING:",
|
|
15
|
+
"- Date inputs (invoice dates, fromDate, toDate, etc.) use YYYY-MM-DD format, interpreted by Xero in the organisation's own timezone.",
|
|
16
|
+
"- 'Today' defaults are computed in the configured local timezone (DATETIMEFORMAT env var, default: system timezone). Do not calculate today manually — omit the date parameter to use the server default.",
|
|
17
|
+
"- UTC timestamps from the API (e.g. UpdatedDateUTC) are converted to the configured local timezone for display. Present them to the user as-is.",
|
|
18
|
+
"",
|
|
14
19
|
"CRITICAL EFFICIENCY RULES — always follow these:",
|
|
15
20
|
"- NEVER page through all records looking for specific items. Filter server-side first.",
|
|
16
21
|
"- Unreconciled transactions: list-bank-transactions with isReconciled=false. Never scan pages.",
|
|
@@ -8,7 +8,11 @@ const ListContactsTool = CreateXeroTool("list-contacts", "List contacts from Xer
|
|
|
8
8
|
"Common patterns: " +
|
|
9
9
|
"find a customer by name → searchTerm=<name>, contactRole=customer; " +
|
|
10
10
|
"all active suppliers → contactRole=supplier, status=ACTIVE; " +
|
|
11
|
-
"recently updated contacts → fromDate=<date>."
|
|
11
|
+
"recently updated contacts → fromDate=<date>. " +
|
|
12
|
+
"Each contact in the response includes: name, contactID, firstName, lastName, emailAddress, " +
|
|
13
|
+
"accountNumber (user-defined), taxNumber (NZBN/ABN/VAT), isCustomer/isSupplier flags, " +
|
|
14
|
+
"phones (type + number, short form), addresses (type + line1/city/region/postcode/country, short form), " +
|
|
15
|
+
"AR/AP tax types, defaultCurrency, contactStatus, contactGroups, and lastUpdated.", {
|
|
12
16
|
page: z.number().optional().describe("Page number for pagination (starts at 1)."),
|
|
13
17
|
searchTerm: z.string().optional().describe("Case-insensitive search across Name, FirstName, LastName, ContactNumber, EmailAddress. Use this instead of listing all contacts."),
|
|
14
18
|
contactRole: z.enum(["customer", "supplier"]).optional().describe("Filter to customers only (IsCustomer==true) or suppliers only (IsSupplier==true). Use customer for AR work, supplier for AP work."),
|
|
@@ -46,6 +50,28 @@ const ListContactsTool = CreateXeroTool("list-contacts", "List contacts from Xer
|
|
|
46
50
|
contact.emailAddress
|
|
47
51
|
? `Email: ${contact.emailAddress}`
|
|
48
52
|
: "No email",
|
|
53
|
+
contact.accountNumber ? `Account Number: ${contact.accountNumber}` : null,
|
|
54
|
+
contact.taxNumber ? `Tax Number: ${contact.taxNumber}` : null,
|
|
55
|
+
contact.phones?.filter((p) => p.phoneNumber).length
|
|
56
|
+
? `Phones:\n${contact.phones
|
|
57
|
+
.filter((p) => p.phoneNumber)
|
|
58
|
+
.map((p) => {
|
|
59
|
+
const num = [p.phoneCountryCode, p.phoneAreaCode, p.phoneNumber]
|
|
60
|
+
.filter(Boolean)
|
|
61
|
+
.join(" ");
|
|
62
|
+
return ` [${p.phoneType ?? "DEFAULT"}] ${num}`;
|
|
63
|
+
})
|
|
64
|
+
.join("\n")}`
|
|
65
|
+
: null,
|
|
66
|
+
contact.addresses?.filter((a) => a.addressLine1 || a.city || a.country).length
|
|
67
|
+
? `Addresses:\n${contact.addresses
|
|
68
|
+
.filter((a) => a.addressLine1 || a.city || a.country)
|
|
69
|
+
.map((a) => {
|
|
70
|
+
const parts = [a.addressLine1, a.city, a.region, a.postalCode, a.country].filter(Boolean);
|
|
71
|
+
return ` [${a.addressType ?? "UNKNOWN"}] ${parts.join(", ")}`;
|
|
72
|
+
})
|
|
73
|
+
.join("\n")}`
|
|
74
|
+
: null,
|
|
49
75
|
contact.accountsReceivableTaxType
|
|
50
76
|
? `AR Tax Type: ${contact.accountsReceivableTaxType}`
|
|
51
77
|
: null,
|