@teamnetwork-nz/xero-mcp-server 1.15.2 → 1.15.4

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.
Files changed (73) hide show
  1. package/.env.example +36 -0
  2. package/README.md +49 -2
  3. package/dist/helpers/reject-oversized-array.js +25 -0
  4. package/dist/helpers/xero-config.js +1 -1
  5. package/dist/strict-tools.js +1 -1
  6. package/dist/tools/create/convert-quote-to-invoice.tool.js +1 -1
  7. package/dist/tools/create/create-bank-transaction.tool.js +4 -4
  8. package/dist/tools/create/create-contact.tool.js +4 -4
  9. package/dist/tools/create/create-credit-note.tool.js +4 -4
  10. package/dist/tools/create/create-invoice.tool.js +11 -11
  11. package/dist/tools/create/create-item.tool.js +1 -1
  12. package/dist/tools/create/create-manual-journal.tool.js +5 -5
  13. package/dist/tools/create/create-payment.tool.js +9 -9
  14. package/dist/tools/create/create-payroll-timesheet.tool.js +2 -2
  15. package/dist/tools/create/create-quote.tool.js +4 -4
  16. package/dist/tools/create/create-tracking-category.tool.js +1 -1
  17. package/dist/tools/create/create-tracking-options.tool.js +3 -2
  18. package/dist/tools/create/upload-invoice-attachment.tool.js +1 -1
  19. package/dist/tools/delete/archive-contact.tool.js +1 -1
  20. package/dist/tools/delete/delete-invoice-attachment.tool.js +1 -1
  21. package/dist/tools/delete/delete-payroll-timesheet.tool.js +1 -1
  22. package/dist/tools/get/get-bill-attachment.tool.js +1 -1
  23. package/dist/tools/get/get-bill-settlement.tool.js +1 -1
  24. package/dist/tools/get/get-invoice-attachment.tool.js +1 -1
  25. package/dist/tools/get/get-invoice-history.tool.js +1 -1
  26. package/dist/tools/get/get-invoice-pdf.tool.js +1 -1
  27. package/dist/tools/get/get-invoice.tool.js +1 -1
  28. package/dist/tools/get/get-payroll-timesheet.tool.js +2 -2
  29. package/dist/tools/list/batch-invoice-lookup.tool.js +3 -2
  30. package/dist/tools/list/find-contact.tool.js +1 -1
  31. package/dist/tools/list/list-aged-payables-by-contact.tool.js +1 -1
  32. package/dist/tools/list/list-aged-receivables-by-contact.tool.js +1 -1
  33. package/dist/tools/list/list-bank-transactions.tool.js +1 -1
  34. package/dist/tools/list/list-bill-attachments.tool.js +1 -1
  35. package/dist/tools/list/list-contact-groups.tool.js +2 -2
  36. package/dist/tools/list/list-contacts.tool.js +1 -1
  37. package/dist/tools/list/list-credit-notes.tool.js +1 -1
  38. package/dist/tools/list/list-invoice-attachments.tool.js +1 -1
  39. package/dist/tools/list/list-invoices.tool.js +1 -1
  40. package/dist/tools/list/list-items.tool.js +1 -1
  41. package/dist/tools/list/list-journals.tool.js +1 -1
  42. package/dist/tools/list/list-manual-journals.tool.js +6 -6
  43. package/dist/tools/list/list-overpayments.tool.js +1 -1
  44. package/dist/tools/list/list-payments.tool.js +1 -1
  45. package/dist/tools/list/list-payroll-employee-leave-balances.tool.js +1 -1
  46. package/dist/tools/list/list-payroll-employee-leave-types.tool.js +1 -1
  47. package/dist/tools/list/list-payroll-employee-leave.tool.js +1 -1
  48. package/dist/tools/list/list-payroll-leave-periods.tool.js +1 -1
  49. package/dist/tools/list/list-prepayments.tool.js +1 -1
  50. package/dist/tools/list/list-profit-and-loss.tool.js +1 -1
  51. package/dist/tools/list/list-quotes.tool.js +1 -1
  52. package/dist/tools/list/list-report-balance-sheet.tool.js +1 -1
  53. package/dist/tools/list/list-report-bank-summary.tool.js +1 -1
  54. package/dist/tools/list/list-tracking-categories.tool.js +1 -1
  55. package/dist/tools/list/list-trial-balance.tool.js +1 -1
  56. package/dist/tools/list/lookup-invoice.tool.js +1 -1
  57. package/dist/tools/list/search-transactions.tool.js +1 -1
  58. package/dist/tools/update/approve-payroll-timesheet.tool.js +1 -1
  59. package/dist/tools/update/authorise-invoice.tool.js +1 -1
  60. package/dist/tools/update/revert-payroll-timesheet.tool.js +1 -1
  61. package/dist/tools/update/update-bank-transaction.tool.js +5 -5
  62. package/dist/tools/update/update-contact.tool.js +4 -4
  63. package/dist/tools/update/update-credit-note.tool.js +7 -7
  64. package/dist/tools/update/update-invoice.tool.js +12 -12
  65. package/dist/tools/update/update-item.tool.js +1 -1
  66. package/dist/tools/update/update-manual-journal-tool.js +2 -2
  67. package/dist/tools/update/update-payroll-timesheet-add-line.tool.js +1 -1
  68. package/dist/tools/update/update-payroll-timesheet-update-line.tool.js +1 -1
  69. package/dist/tools/update/update-quote.tool.js +7 -7
  70. package/dist/tools/update/update-tracking-category.tool.js +1 -1
  71. package/dist/tools/update/update-tracking-options.tool.js +3 -2
  72. package/dist/tools/update/void-invoice.tool.js +1 -1
  73. package/package.json +44 -39
package/.env.example ADDED
@@ -0,0 +1,36 @@
1
+ # Sanitised template: no live credentials or identities.
2
+ # See README.md for requirements, defaults and .env loading behaviour.
3
+ # Replace required/alternative placeholders privately; uncomment optional settings only when needed.
4
+
5
+ # Output date setting: local or an IANA timezone; shared by SSLStore and Xero.
6
+ # DATETIMEFORMAT=local
7
+ # Existing access token; use instead of a client ID/secret pair. Renew externally when expired.
8
+ # XERO_CLIENT_BEARER_TOKEN=<set-privately>
9
+ # Custom Connection client ID; must be set together with XERO_CLIENT_SECRET.
10
+ XERO_CLIENT_ID=<set-privately>
11
+ # Custom Connection client secret; must be set together with XERO_CLIENT_ID.
12
+ XERO_CLIENT_SECRET=<set-privately>
13
+ # Download destination; choose a private directory outside source control.
14
+ # XERO_DOWNLOAD_PATH=<set-privately>
15
+ # Literal true registers payroll tools; requires appropriate scopes.
16
+ # XERO_ENABLE_PAYROLL=false
17
+ # Compatibility alias for XERO_READWRITE; canonical variable wins.
18
+ # XERO_ENABLE_READWRITE=<set-privately>
19
+ # Reports are enabled unless set to literal false.
20
+ # XERO_ENABLE_REPORTS=true
21
+ # Comma-separated Host allowlist required for non-loopback HTTP; use the public hostnames accepted by the listener.
22
+ # XERO_HTTP_ALLOWED_HOSTS=<set-privately>
23
+ # Comma-separated browser Origin allowlist; configure when browser clients need access.
24
+ # XERO_HTTP_ALLOWED_ORIGINS=<set-privately>
25
+ # Private bearer secret required for non-loopback HTTP; clients send Authorization: Bearer <secret>.
26
+ # XERO_HTTP_BEARER_TOKEN=<set-privately>
27
+ # Listener bind address. Non-loopback binding requires a bearer token and explicit allowed hosts.
28
+ # XERO_HTTP_HOST=127.0.0.1
29
+ # Maximum HTTP request body; integer 1–16777216 bytes.
30
+ # XERO_HTTP_MAX_BODY_BYTES=1048576
31
+ # HTTP listener port; integer 1–65535.
32
+ # XERO_HTTP_PORT=3000
33
+ # Only true enables mutation tools; read-only is the default. Review each operation before use.
34
+ # XERO_READWRITE=false
35
+ # stdio or http; HTTP serves /mcp and GET /health.
36
+ # XERO_TRANSPORT=stdio
package/README.md CHANGED
@@ -320,7 +320,7 @@ are returned as decimal strings with their currency code.
320
320
 
321
321
  For TEAMlink purchase bills, live API verification confirmed that the convention
322
322
  `<supplier-invoice-number> / <TEAMlink-orderId>` is stored in Xero's
323
- `InvoiceNumber` field (for example `4462570 / 121058`), while `Reference` is empty.
323
+ `InvoiceNumber` field (for example `SYNTHETIC-BILL / TEST-REFERENCE`), while `Reference` is empty.
324
324
  Exact and batch searches therefore use Xero's native `InvoiceNumbers` filter. The
325
325
  separate `reference` search remains available for records that use that field.
326
326
 
@@ -353,7 +353,7 @@ In your `claude_desktop_config.json`, point directly at the built file:
353
353
  "mcpServers": {
354
354
  "xero": {
355
355
  "command": "node",
356
- "args": ["C:\\Users\\you\\Development\\Xero-MCP\\dist\\index.js"],
356
+ "args": ["C:/path/to\\Xero-MCP\\dist\\index.js"],
357
357
  "env": {
358
358
  "XERO_CLIENT_ID": "your_client_id_here",
359
359
  "XERO_CLIENT_SECRET": "your_client_secret_here",
@@ -383,3 +383,50 @@ MIT
383
383
  ## Security
384
384
 
385
385
  Do not commit your `.env` file or any credentials to version control. The `.gitignore` excludes `.env` by default.
386
+
387
+ <!-- BEGIN MCP configuration reference -->
388
+ ## Environment variable reference
389
+
390
+ The server automatically loads `.env` from its working directory; environment variables already set by the client take precedence.
391
+
392
+ 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.
393
+
394
+ | Variable | Required | Default | Purpose and accepted values |
395
+ |---|---|---|---|
396
+ | `DATETIMEFORMAT` | No | `local` | Output date setting: local or an IANA timezone; shared by SSLStore and Xero. |
397
+ | `XERO_CLIENT_BEARER_TOKEN` | Alternative | `unset` | Existing access token; use instead of a client ID/secret pair. Renew externally when expired. |
398
+ | `XERO_CLIENT_ID` | Alternative | `unset` | Custom Connection client ID; must be set together with XERO_CLIENT_SECRET. |
399
+ | `XERO_CLIENT_SECRET` | Alternative | `unset` | Custom Connection client secret; must be set together with XERO_CLIENT_ID. |
400
+ | `XERO_DOWNLOAD_PATH` | No | `user Downloads directory` | Download destination; choose a private directory outside source control. |
401
+ | `XERO_ENABLE_PAYROLL` | No | `false` | Literal true registers payroll tools; requires appropriate scopes. |
402
+ | `XERO_ENABLE_READWRITE` | Deprecated | `unset` | Compatibility alias for XERO_READWRITE; canonical variable wins. |
403
+ | `XERO_ENABLE_REPORTS` | No | `true` | Reports are enabled unless set to literal false. |
404
+ | `XERO_HTTP_ALLOWED_HOSTS` | Conditional | `unset` | Comma-separated Host allowlist required for non-loopback HTTP; use the public hostnames accepted by the listener. |
405
+ | `XERO_HTTP_ALLOWED_ORIGINS` | No | `unset` | Comma-separated browser Origin allowlist; configure when browser clients need access. |
406
+ | `XERO_HTTP_BEARER_TOKEN` | Conditional | `unset` | Private bearer secret required for non-loopback HTTP; clients send Authorization: Bearer <secret>. |
407
+ | `XERO_HTTP_HOST` | No | `127.0.0.1` | Listener bind address. Non-loopback binding requires a bearer token and explicit allowed hosts. |
408
+ | `XERO_HTTP_MAX_BODY_BYTES` | No | `1048576` | Maximum HTTP request body; integer 1–16777216 bytes. |
409
+ | `XERO_HTTP_PORT` | No | `3000` | HTTP listener port; integer 1–65535. |
410
+ | `XERO_READWRITE` | No | `false` | Only true enables mutation tools; read-only is the default. Review each operation before use. |
411
+ | `XERO_TRANSPORT` | No | `stdio` | stdio or http; HTTP serves /mcp and GET /health. |
412
+
413
+ 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.
414
+
415
+ ### Agent first-use workflow
416
+
417
+ 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.
418
+
419
+ 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.
420
+
421
+ ### Repository and package privacy
422
+
423
+ 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.
424
+ <!-- END MCP configuration reference -->
425
+
426
+ 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.
427
+
428
+ ### Development and diagnostics
429
+
430
+ 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.
431
+
432
+ 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.
@@ -0,0 +1,25 @@
1
+ import { z } from "zod/v3";
2
+ /** Reject an existing array maximum before parsing children; retain the inner JSON Schema.
3
+ * Deliberately accepts only a direct array schema, not wrappers or transforms.
4
+ * Defaults/transforms on its elements still run normally for valid-size inputs.
5
+ */
6
+ export function rejectOversizedArray(schema) {
7
+ const bound = schema._def.maxLength;
8
+ if (!bound)
9
+ throw new Error("An existing array maximum is required");
10
+ return z.preprocess((input, ctx) => {
11
+ if (Array.isArray(input) && input.length > bound.value) {
12
+ ctx.addIssue({
13
+ code: z.ZodIssueCode.too_big,
14
+ type: "array",
15
+ maximum: bound.value,
16
+ inclusive: true,
17
+ exact: false,
18
+ message: bound.message,
19
+ fatal: true,
20
+ });
21
+ return z.NEVER;
22
+ }
23
+ return input;
24
+ }, schema);
25
+ }
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import { z } from 'zod/v3';
2
2
  export const XeroCredentialSchema = z.object({
3
3
  clientId: z.string().min(1).optional(),
4
4
  clientSecret: z.string().min(1).optional(),
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  function isSchema(value) {
3
3
  return typeof value === "object" && value !== null && "_def" in value;
4
4
  }
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { convertXeroQuoteToInvoice } from "../../handlers/convert-xero-quote-to-invoice.handler.js";
3
3
  import { DeepLinkType, getDeepLink } from "../../helpers/get-deeplink.js";
4
4
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
3
3
  import { createXeroBankTransaction } from "../../handlers/create-xero-bank-transaction.handler.js";
4
4
  import { bankTransactionDeepLink } from "../../consts/deeplinks.js";
@@ -9,9 +9,9 @@ const lineItemSchema = z.object({
9
9
  accountCode: z.string(),
10
10
  taxType: z.string(),
11
11
  });
12
- const CreateBankTransactionTool = CreateXeroTool("create-bank-transaction", `Create a bank transaction in Xero.
13
- When a bank transaction is created, a deep link to the bank transaction in Xero is returned.
14
- This deep link can be used to view the bank transaction in Xero directly.
12
+ const CreateBankTransactionTool = CreateXeroTool("create-bank-transaction", `Create a bank transaction in Xero.
13
+ When a bank transaction is created, a deep link to the bank transaction in Xero is returned.
14
+ This deep link can be used to view the bank transaction in Xero directly.
15
15
  This link should be displayed to the user.`, {
16
16
  type: z.enum(["RECEIVE", "SPEND"]),
17
17
  bankAccountId: z.string(),
@@ -1,11 +1,11 @@
1
1
  import { createXeroContact } from "../../handlers/create-xero-contact.handler.js";
2
- import { z } from "zod";
2
+ import { z } from "zod/v3";
3
3
  import { DeepLinkType, getDeepLink } from "../../helpers/get-deeplink.js";
4
4
  import { ensureError } from "../../helpers/ensure-error.js";
5
5
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
6
- const CreateContactTool = CreateXeroTool("create-contact", "Create a contact in Xero.\
7
- When a contact is created, a deep link to the contact in Xero is returned. \
8
- This deep link can be used to view the contact in Xero directly. \
6
+ const CreateContactTool = CreateXeroTool("create-contact", "Create a contact in Xero.\
7
+ When a contact is created, a deep link to the contact in Xero is returned. \
8
+ This deep link can be used to view the contact in Xero directly. \
9
9
  This link should be displayed to the user.", {
10
10
  name: z.string(),
11
11
  email: z.string().email().optional(),
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { createXeroCreditNote } from "../../handlers/create-xero-credit-note.handler.js";
3
3
  import { DeepLinkType, getDeepLink } from "../../helpers/get-deeplink.js";
4
4
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
@@ -9,9 +9,9 @@ const lineItemSchema = z.object({
9
9
  accountCode: z.string(),
10
10
  taxType: z.string(),
11
11
  });
12
- const CreateCreditNoteTool = CreateXeroTool("create-credit-note", "Create a credit note in Xero.\
13
- When a credit note is created, a deep link to the credit note in Xero is returned. \
14
- This deep link can be used to view the credit note in Xero directly. \
12
+ const CreateCreditNoteTool = CreateXeroTool("create-credit-note", "Create a credit note in Xero.\
13
+ When a credit note is created, a deep link to the credit note in Xero is returned. \
14
+ This deep link can be used to view the credit note in Xero directly. \
15
15
  This link should be displayed to the user.", {
16
16
  contactId: z.string(),
17
17
  lineItems: z.array(lineItemSchema),
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { createXeroInvoice } from "../../handlers/create-xero-invoice.handler.js";
3
3
  import { DeepLinkType, getDeepLink } from "../../helpers/get-deeplink.js";
4
4
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
@@ -19,22 +19,22 @@ const lineItemSchema = z.object({
19
19
  unitAmount: z.number().describe("The price per unit of the line item"),
20
20
  accountCode: z.string().describe("The account code of the line item - can be obtained from the list-accounts tool"),
21
21
  taxType: z.string().describe("The tax type of the line item - can be obtained from the list-tax-rates tool"),
22
- itemCode: z.string().describe("The item code of the line item - can be obtained from the list-items tool \
22
+ itemCode: z.string().describe("The item code of the line item - can be obtained from the list-items tool \
23
23
  If the item is not listed, add without an item code and ask the user if they would like to add an item code.").optional(),
24
- tracking: z.array(trackingSchema).describe("Up to 2 tracking categories and options can be added to the line item. \
25
- Can be obtained from the list-tracking-categories tool. \
24
+ tracking: z.array(trackingSchema).describe("Up to 2 tracking categories and options can be added to the line item. \
25
+ Can be obtained from the list-tracking-categories tool. \
26
26
  Only use if prompted by the user.").optional(),
27
27
  });
28
- const CreateInvoiceTool = CreateXeroTool("create-invoice", "Create an invoice in Xero.\
29
- When an invoice is created, a deep link to the invoice in Xero is returned. \
30
- This deep link can be used to view the invoice in Xero directly. \
28
+ const CreateInvoiceTool = CreateXeroTool("create-invoice", "Create an invoice in Xero.\
29
+ When an invoice is created, a deep link to the invoice in Xero is returned. \
30
+ This deep link can be used to view the invoice in Xero directly. \
31
31
  This link should be displayed to the user.", {
32
- contactId: z.string().describe("The ID of the contact to create the invoice for. \
32
+ contactId: z.string().describe("The ID of the contact to create the invoice for. \
33
33
  Can be obtained from the list-contacts tool."),
34
34
  lineItems: z.array(lineItemSchema),
35
- type: z.enum(["ACCREC", "ACCPAY"]).describe("The type of invoice to create. \
36
- ACCREC is for sales invoices, Accounts Receivable, or customer invoices. \
37
- ACCPAY is for purchase invoices, Accounts Payable invoices, supplier invoices, or bills. \
35
+ type: z.enum(["ACCREC", "ACCPAY"]).describe("The type of invoice to create. \
36
+ ACCREC is for sales invoices, Accounts Receivable, or customer invoices. \
37
+ ACCPAY is for purchase invoices, Accounts Payable invoices, supplier invoices, or bills. \
38
38
  If the type is not specified, the default is ACCREC."),
39
39
  reference: z.string().describe("A reference number for the invoice.").optional(),
40
40
  date: z.string().describe("The date the invoice was created (YYYY-MM-DD format).").optional(),
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { createXeroItem } from "../../handlers/create-xero-item.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  const purchaseDetailsSchema = z.object({
@@ -1,13 +1,13 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
3
3
  import { createXeroManualJournal } from "../../handlers/create-xero-manual-journal.handler.js";
4
4
  import { DeepLinkType, getDeepLink } from "../../helpers/get-deeplink.js";
5
5
  import { ensureError } from "../../helpers/ensure-error.js";
6
6
  import { formatXeroDate } from "../../helpers/datetime.js";
7
- const CreateManualJournalTool = CreateXeroTool("create-manual-journal", "Create a manual journal in Xero.\
8
- Retrieve a list of account codes in Xero to use for the journal lines.\
9
- Journal lines must contain at least two individual journal lines with account codes, \
10
- use basic accounting account types pairing when not specified, \
7
+ const CreateManualJournalTool = CreateXeroTool("create-manual-journal", "Create a manual journal in Xero.\
8
+ Retrieve a list of account codes in Xero to use for the journal lines.\
9
+ Journal lines must contain at least two individual journal lines with account codes, \
10
+ use basic accounting account types pairing when not specified, \
11
11
  and make sure journal line pairs have credit and debit balanced.", {
12
12
  narration: z
13
13
  .string()
@@ -1,15 +1,15 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { createXeroPayment } from "../../handlers/create-xero-payment.handler.js";
3
3
  import { DeepLinkType, getDeepLink } from "../../helpers/get-deeplink.js";
4
4
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
5
- const CreatePaymentTool = CreateXeroTool("create-payment", "Create a payment against an invoice in Xero.\
6
- This tool records a payment transaction against an invoice. \
7
- You'll need to provide the invoice ID, account ID to make the payment from, and the amount. \
8
- The amount must be positive and should not exceed the remaining amount due on the invoice. \
9
- A payment can only be created for an invoice that is status AUTHORIZED \
10
- A payment can only be created for an invoice that is not fully paid \
11
- When a payment is created, a deep link to the payment in Xero is returned. \
12
- This deep link can be used to view the payment in Xero directly. \
5
+ const CreatePaymentTool = CreateXeroTool("create-payment", "Create a payment against an invoice in Xero.\
6
+ This tool records a payment transaction against an invoice. \
7
+ You'll need to provide the invoice ID, account ID to make the payment from, and the amount. \
8
+ The amount must be positive and should not exceed the remaining amount due on the invoice. \
9
+ A payment can only be created for an invoice that is status AUTHORIZED \
10
+ A payment can only be created for an invoice that is not fully paid \
11
+ When a payment is created, a deep link to the payment in Xero is returned. \
12
+ This deep link can be used to view the payment in Xero directly. \
13
13
  This link should be displayed to the user.", {
14
14
  invoiceId: z.string().describe("The ID of the invoice to pay"),
15
15
  accountId: z
@@ -1,7 +1,7 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { createXeroPayrollTimesheet, } from "../../handlers/create-xero-payroll-timesheet.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
- const CreatePayrollTimesheetTool = CreateXeroTool("create-timesheet", `Create a new payroll timesheet in Xero.
4
+ const CreatePayrollTimesheetTool = CreateXeroTool("create-timesheet", `Create a new payroll timesheet in Xero.
5
5
  This allows you to specify details such as the employee ID, payroll calendar ID, start and end dates, and timesheet lines.`, {
6
6
  payrollCalendarID: z.string().describe("The ID of the payroll calendar."),
7
7
  employeeID: z.string().describe("The ID of the employee."),
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { createXeroQuote } from "../../handlers/create-xero-quote.handler.js";
3
3
  import { DeepLinkType, getDeepLink } from "../../helpers/get-deeplink.js";
4
4
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
@@ -9,9 +9,9 @@ const lineItemSchema = z.object({
9
9
  accountCode: z.string(),
10
10
  taxType: z.string(),
11
11
  });
12
- const CreateQuoteTool = CreateXeroTool("create-quote", "Create a quote in Xero.\
13
- When a quote is created, a deep link to the quote in Xero is returned. \
14
- This deep link can be used to view the quote in Xero directly. \
12
+ const CreateQuoteTool = CreateXeroTool("create-quote", "Create a quote in Xero.\
13
+ When a quote is created, a deep link to the quote in Xero is returned. \
14
+ This deep link can be used to view the quote in Xero directly. \
15
15
  This link should be displayed to the user.", {
16
16
  contactId: z.string(),
17
17
  lineItems: z.array(lineItemSchema),
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
3
3
  import { createXeroTrackingCategory } from "../../handlers/create-xero-tracking-category.handler.js";
4
4
  const CreateTrackingCategoryTool = CreateXeroTool("create-tracking-category", `Create a tracking category in Xero.`, {
@@ -1,10 +1,11 @@
1
- import { z } from "zod";
1
+ import { rejectOversizedArray } from "../../helpers/reject-oversized-array.js";
2
+ import { z } from "zod/v3";
2
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
3
4
  import { formatTrackingOption } from "../../helpers/format-tracking-option.js";
4
5
  import { createXeroTrackingOptions } from "../../handlers/create-xero-tracking-option.handler.js";
5
6
  const CreateTrackingOptionsTool = CreateXeroTool("create-tracking-options", `Create tracking options for a tracking category in Xero.`, {
6
7
  trackingCategoryId: z.string(),
7
- optionNames: z.array(z.string()).max(10)
8
+ optionNames: rejectOversizedArray(z.array(z.string()).max(10))
8
9
  }, async ({ trackingCategoryId, optionNames }) => {
9
10
  const response = await createXeroTrackingOptions(trackingCategoryId, optionNames);
10
11
  if (response.isError) {
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { uploadXeroInvoiceAttachment } from "../../handlers/upload-xero-invoice-attachment.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  const UploadInvoiceAttachmentTool = CreateXeroTool("upload-invoice-attachment", "Upload a local file as an attachment to a Xero invoice (debtor or creditor). \
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { archiveXeroContact } from "../../handlers/archive-xero-contact.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  const ArchiveContactTool = CreateXeroTool("archive-contact", "Archive a contact in Xero. Xero does not support permanently deleting contacts. \
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { deleteXeroInvoiceAttachment } from "../../handlers/delete-xero-invoice-attachment.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  const DeleteInvoiceAttachmentTool = CreateXeroTool("delete-invoice-attachment", "Delete a file attachment from a Xero invoice by its attachment ID. \
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { deleteXeroPayrollTimesheet, } from "../../handlers/delete-xero-payroll-timesheet.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  const DeletePayrollTimesheetTool = CreateXeroTool("delete-timesheet", `Delete an existing payroll timesheet in Xero by its ID.`, {
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { downloadXeroInvoiceAttachment } from "../../handlers/download-xero-invoice-attachment.handler.js";
3
3
  import { listXeroInvoiceAttachments } from "../../handlers/list-xero-invoice-attachments.handler.js";
4
4
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { getXeroBillSettlement } from "../../handlers/get-xero-bill-settlement.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { jsonToolResponse } from "../../types/lookup-result.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { downloadXeroInvoiceAttachment } from "../../handlers/download-xero-invoice-attachment.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  const GetInvoiceAttachmentTool = CreateXeroTool("get-invoice-attachment", "Download a specific attachment from a Xero invoice and save it to the local download directory. \
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { getXeroInvoiceHistory } from "../../handlers/get-xero-invoice-history.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { jsonToolResponse } from "../../types/lookup-result.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { downloadXeroInvoicePdf } from "../../handlers/download-xero-invoice-pdf.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  const GetInvoicePdfTool = CreateXeroTool("get-invoice-pdf", "Download the Xero-generated PDF for an invoice and save it to the local download directory. \
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { getXeroInvoice } from "../../handlers/get-xero-invoice.handler.js";
3
3
  import { DeepLinkType, getDeepLink } from "../../helpers/get-deeplink.js";
4
4
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
@@ -1,8 +1,8 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { getXeroPayrollTimesheet, } from "../../handlers/get-xero-payroll-timesheet.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { formatUtcDatetime, formatXeroDate } from "../../helpers/datetime.js";
5
- const GetPayrollTimesheetTool = CreateXeroTool("get-timesheet", `Retrieve a single payroll timesheet from Xero by its ID.
5
+ const GetPayrollTimesheetTool = CreateXeroTool("get-timesheet", `Retrieve a single payroll timesheet from Xero by its ID.
6
6
  This provides details such as the timesheet ID, employee ID, start and end dates, total hours, and the last updated date.`, {
7
7
  timesheetID: z.string().describe("The ID of the timesheet to retrieve."),
8
8
  }, async (params) => {
@@ -1,9 +1,10 @@
1
- import { z } from "zod";
1
+ import { rejectOversizedArray } from "../../helpers/reject-oversized-array.js";
2
+ import { z } from "zod/v3";
2
3
  import { batchXeroInvoiceLookup } from "../../handlers/batch-xero-invoice-lookup.handler.js";
3
4
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
5
  import { jsonToolResponse } from "../../types/lookup-result.js";
5
6
  const BatchInvoiceLookupTool = CreateXeroTool("xero_batch_invoice_lookup", "Look up multiple exact Xero InvoiceNumber values in one batch request. Accepts an array of strings, preserves numeric-looking invoice numbers as strings, and reports exact matches, duplicates, and unmatched values for each input.", {
6
- invoiceNumbers: z.array(z.string().min(1)).min(1).max(100),
7
+ invoiceNumbers: rejectOversizedArray(z.array(z.string().min(1)).min(1).max(100)),
7
8
  type: z.enum(["ACCREC", "ACCPAY"]).optional().describe("ACCREC = AR sales/customer invoices; ACCPAY = AP purchase/supplier bills. Omit to search both."),
8
9
  }, async ({ invoiceNumbers, type }) => jsonToolResponse(await batchXeroInvoiceLookup(invoiceNumbers, type)));
9
10
  export default BatchInvoiceLookupTool;
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { findXeroContact } from "../../handlers/find-xero-contact.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { failedLookup, jsonToolResponse } from "../../types/lookup-result.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
3
3
  import { formatAgedReportFilter } from "../../helpers/format-aged-report-filter.js";
4
4
  import { listXeroAgedPayablesByContact } from "../../handlers/list-aged-payables-by-contact.handler.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroAgedReceivablesByContact } from "../../handlers/list-aged-receivables-by-contact.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { formatAgedReportFilter } from "../../helpers/format-aged-report-filter.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
3
3
  import { PAGE_NUMBER_GUIDANCE, PAGE_SIZE_GUIDANCE } from "../../helpers/pagination-guidance.js";
4
4
  import { listXeroBankTransactions } from "../../handlers/list-xero-bank-transactions.handler.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroInvoiceAttachments } from "../../handlers/list-xero-invoice-attachments.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { failedLookup, jsonToolResponse } from "../../types/lookup-result.js";
@@ -1,7 +1,7 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroContactGroups } from "../../handlers/list-xero-contact-groups.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
- const ListContactGroupsTool = CreateXeroTool("list-contact-groups", `List all contact groups in Xero.
4
+ const ListContactGroupsTool = CreateXeroTool("list-contact-groups", `List all contact groups in Xero.
5
5
  You can optionally specify a contact group ID to retrieve details for that specific group, including its contacts.`, {
6
6
  contactGroupId: z
7
7
  .string()
@@ -1,7 +1,7 @@
1
1
  import { listXeroContacts } from "../../handlers/list-xero-contacts.handler.js";
2
2
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
3
3
  import { PAGE_NUMBER_GUIDANCE, PAGE_SIZE_GUIDANCE } from "../../helpers/pagination-guidance.js";
4
- import { z } from "zod";
4
+ import { z } from "zod/v3";
5
5
  import { formatUtcDatetime } from "../../helpers/datetime.js";
6
6
  const ListContactsTool = CreateXeroTool("list-contacts", "List contacts from Xero. " +
7
7
  "Use searchTerm for name/email lookup — do NOT list all contacts and scan them. " +
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroCreditNotes } from "../../handlers/list-xero-credit-notes.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { PAGE_NUMBER_GUIDANCE, PAGE_SIZE_GUIDANCE } from "../../helpers/pagination-guidance.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroInvoiceAttachments } from "../../handlers/list-xero-invoice-attachments.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  const ListInvoiceAttachmentsTool = CreateXeroTool("list-invoice-attachments", "List all file attachments on a Xero invoice (debtor or creditor). \
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroInvoices } from "../../handlers/list-xero-invoices.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { formatLineItem } from "../../helpers/format-line-item.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroItems } from "../../handlers/list-xero-items.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { formatUtcDatetime } from "../../helpers/datetime.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroJournals } from "../../handlers/list-xero-journals.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { formatXeroDate } from "../../helpers/datetime.js";
@@ -1,13 +1,13 @@
1
1
  import { listXeroManualJournals } from "../../handlers/list-xero-manual-journals.handler.js";
2
2
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
3
3
  import { PAGE_NUMBER_GUIDANCE, PAGE_SIZE_GUIDANCE } from "../../helpers/pagination-guidance.js";
4
- import { z } from "zod";
4
+ import { z } from "zod/v3";
5
5
  import { formatUtcDatetime, formatXeroDate } from "../../helpers/datetime.js";
6
- const ListManualJournalsTool = CreateXeroTool("list-manual-journals", `List all manual journals from Xero.
7
- Ask the user if they want to see a specific manual journal or all manual journals before running.
8
- Can optionally pass in manual journal ID to retrieve a specific journal, or a date to filter journals modified after that date.
9
- The response presents a complete overview of all manual journals currently registered in your Xero account, with their details.
10
- Ask the user if they want the next page of manual journals after running this tool if 10 manual journals are returned.
6
+ const ListManualJournalsTool = CreateXeroTool("list-manual-journals", `List all manual journals from Xero.
7
+ Ask the user if they want to see a specific manual journal or all manual journals before running.
8
+ Can optionally pass in manual journal ID to retrieve a specific journal, or a date to filter journals modified after that date.
9
+ The response presents a complete overview of all manual journals currently registered in your Xero account, with their details.
10
+ Ask the user if they want the next page of manual journals after running this tool if 10 manual journals are returned.
11
11
  If they want the next page, call this tool again with the next page number, modified date, and the manual journal ID if one was provided in the previous call.`, {
12
12
  manualJournalId: z
13
13
  .string()
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroOverpayments } from "../../handlers/list-xero-overpayments.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { PAGE_NUMBER_GUIDANCE, PAGE_SIZE_GUIDANCE } from "../../helpers/pagination-guidance.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroPayments } from "../../handlers/list-xero-payments.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { PAGE_NUMBER_GUIDANCE, PAGE_SIZE_GUIDANCE } from "../../helpers/pagination-guidance.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroPayrollEmployeeLeaveBalances } from "../../handlers/list-xero-payroll-employee-leave-balances.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  const ListPayrollEmployeeLeaveBalancesTool = CreateXeroTool("list-payroll-employee-leave-balances", "List all leave balances for a specific employee in Xero. This shows current leave balances for all leave types available to the employee, including annual, sick, and other leave types.", {
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroPayrollEmployeeLeaveTypes } from "../../handlers/list-xero-payroll-employee-leave-types.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { formatXeroDate } from "../../helpers/datetime.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroPayrollEmployeeLeave } from "../../handlers/list-xero-payroll-employee-leave.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { formatUtcDatetime, formatXeroDate } from "../../helpers/datetime.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroPayrollLeavePeriods } from "../../handlers/list-xero-payroll-leave-periods.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { formatXeroDate } from "../../helpers/datetime.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroPrepayments } from "../../handlers/list-xero-prepayments.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { PAGE_NUMBER_GUIDANCE, PAGE_SIZE_GUIDANCE } from "../../helpers/pagination-guidance.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { buildComparisonColumnMetadata, listXeroProfitAndLoss } from "../../handlers/list-xero-profit-and-loss.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { formatUtcDatetime } from "../../helpers/datetime.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroQuotes } from "../../handlers/list-xero-quotes.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { formatUtcDatetime, formatXeroDate } from "../../helpers/datetime.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroReportBalanceSheet } from "../../handlers/list-xero-report-balance-sheet.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  const ListReportBalanceSheetTool = CreateXeroTool("list-report-balance-sheet", "List the Balance Sheet report from Xero.", {
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroReportBankSummary } from "../../handlers/list-xero-report-bank-summary.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { formatUtcDatetime } from "../../helpers/datetime.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
3
3
  import { listXeroTrackingCategories } from "../../handlers/list-xero-tracking-categories.handler.js";
4
4
  import { formatTrackingOption } from "../../helpers/format-tracking-option.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { listXeroTrialBalance } from "../../handlers/list-xero-trial-balance.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { formatUtcDatetime } from "../../helpers/datetime.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { batchXeroInvoiceLookup } from "../../handlers/batch-xero-invoice-lookup.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { jsonToolResponse } from "../../types/lookup-result.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { searchXeroTransactions } from "../../handlers/search-xero-transactions.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { jsonToolResponse } from "../../types/lookup-result.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { approveXeroPayrollTimesheet, } from "../../handlers/approve-xero-payroll-timesheet.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  const ApprovePayrollTimesheetTool = CreateXeroTool("approve-timesheet", `Approve a payroll timesheet in Xero by its ID.`, {
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { authoriseXeroInvoice } from "../../handlers/authorise-xero-invoice.handler.js";
3
3
  import { DeepLinkType, getDeepLink } from "../../helpers/get-deeplink.js";
4
4
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { revertXeroPayrollTimesheet, } from "../../handlers/revert-xero-payroll-timesheet.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  const RevertPayrollTimesheetTool = CreateXeroTool("revert-timesheet", `Revert a payroll timesheet to draft in Xero by its ID.`, {
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
3
3
  import { updateXeroBankTransaction } from "../../handlers/update-xero-bank-transaction.handler.js";
4
4
  import { bankTransactionDeepLink } from "../../consts/deeplinks.js";
@@ -9,14 +9,14 @@ const lineItemSchema = z.object({
9
9
  accountCode: z.string(),
10
10
  taxType: z.string(),
11
11
  });
12
- const UpdateBankTransactionTool = CreateXeroTool("update-bank-transaction", `Update a bank transaction in Xero.
13
- When a bank transaction is updated, a deep link to the bank transaction in Xero is returned.
14
- This deep link can be used to view the bank transaction in Xero directly.
12
+ const UpdateBankTransactionTool = CreateXeroTool("update-bank-transaction", `Update a bank transaction in Xero.
13
+ When a bank transaction is updated, a deep link to the bank transaction in Xero is returned.
14
+ This deep link can be used to view the bank transaction in Xero directly.
15
15
  This link should be displayed to the user.`, {
16
16
  bankTransactionId: z.string(),
17
17
  type: z.enum(["RECEIVE", "SPEND"]).optional(),
18
18
  contactId: z.string().optional(),
19
- lineItems: z.array(lineItemSchema).optional().describe("All line items must be provided. Any line items not provided will be removed. Including existing line items. \
19
+ lineItems: z.array(lineItemSchema).optional().describe("All line items must be provided. Any line items not provided will be removed. Including existing line items. \
20
20
  Do not modify line items that have not been specified by the user"),
21
21
  reference: z.string().optional(),
22
22
  date: z.string().optional()
@@ -1,11 +1,11 @@
1
1
  import { updateXeroContact } from "../../handlers/update-xero-contact.handler.js";
2
- import { z } from "zod";
2
+ import { z } from "zod/v3";
3
3
  import { DeepLinkType, getDeepLink } from "../../helpers/get-deeplink.js";
4
4
  import { ensureError } from "../../helpers/ensure-error.js";
5
5
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
6
- const UpdateContactTool = CreateXeroTool("update-contact", "Update a contact in Xero.\
7
- When a contact is updated, a deep link to the contact in Xero is returned. \
8
- This deep link can be used to view the contact in Xero directly. \
6
+ const UpdateContactTool = CreateXeroTool("update-contact", "Update a contact in Xero.\
7
+ When a contact is updated, a deep link to the contact in Xero is returned. \
8
+ This deep link can be used to view the contact in Xero directly. \
9
9
  This link should be displayed to the user.", {
10
10
  contactId: z.string(),
11
11
  name: z.string(),
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { updateXeroCreditNote } from "../../handlers/update-xero-credit-note.handler.js";
3
3
  import { DeepLinkType, getDeepLink } from "../../helpers/get-deeplink.js";
4
4
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
@@ -9,14 +9,14 @@ const lineItemSchema = z.object({
9
9
  accountCode: z.string(),
10
10
  taxType: z.string(),
11
11
  });
12
- const UpdateCreditNoteTool = CreateXeroTool("update-credit-note", "Update a credit note in Xero. Only works on draft credit notes.\
13
- All line items must be provided. Any line items not provided will be removed. Including existing line items.\
14
- Do not modify line items that have not been specified by the user.\
15
- When a credit note is updated, a deep link to the credit note in Xero is returned.\
16
- This deep link can be used to view the credit note in Xero directly.\
12
+ const UpdateCreditNoteTool = CreateXeroTool("update-credit-note", "Update a credit note in Xero. Only works on draft credit notes.\
13
+ All line items must be provided. Any line items not provided will be removed. Including existing line items.\
14
+ Do not modify line items that have not been specified by the user.\
15
+ When a credit note is updated, a deep link to the credit note in Xero is returned.\
16
+ This deep link can be used to view the credit note in Xero directly.\
17
17
  This link should be displayed to the user.", {
18
18
  creditNoteId: z.string(),
19
- lineItems: z.array(lineItemSchema).optional().describe("All line items must be provided. Any line items not provided will be removed. Including existing line items.\
19
+ lineItems: z.array(lineItemSchema).optional().describe("All line items must be provided. Any line items not provided will be removed. Including existing line items.\
20
20
  Do not modify line items that have not been specified by the user"),
21
21
  reference: z.string().optional(),
22
22
  date: z.string().optional(),
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { updateXeroInvoice } from "../../handlers/update-xero-invoice.handler.js";
3
3
  import { DeepLinkType, getDeepLink } from "../../helpers/get-deeplink.js";
4
4
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
@@ -19,26 +19,26 @@ const lineItemSchema = z.object({
19
19
  unitAmount: z.number().describe("The price per unit of the line item"),
20
20
  accountCode: z.string().describe("The account code of the line item - can be obtained from the list-accounts tool"),
21
21
  taxType: z.string().describe("The tax type of the line item - can be obtained from the list-tax-rates tool"),
22
- itemCode: z.string().describe("The item code of the line item - can be obtained from the list-items tool \
23
- If the item was not populated in the original invoice, \
22
+ itemCode: z.string().describe("The item code of the line item - can be obtained from the list-items tool \
23
+ If the item was not populated in the original invoice, \
24
24
  add without an item code unless the user has told you to add an item code.").optional(),
25
- tracking: z.array(trackingSchema).describe("Up to 2 tracking categories and options can be added to the line item. \
26
- Can be obtained from the list-tracking-categories tool. \
25
+ tracking: z.array(trackingSchema).describe("Up to 2 tracking categories and options can be added to the line item. \
26
+ Can be obtained from the list-tracking-categories tool. \
27
27
  Only use if prompted by the user.").optional(),
28
28
  });
29
- const UpdateInvoiceTool = CreateXeroTool("update-invoice", "Update an invoice in Xero. Only works on draft invoices.\
30
- All line items must be provided. Any line items not provided will be removed. Including existing line items.\
31
- Do not modify line items that have not been specified by the user.\
32
- When an invoice is updated, a deep link to the invoice in Xero is returned. \
33
- This deep link can be used to view the contact in Xero directly. \
29
+ const UpdateInvoiceTool = CreateXeroTool("update-invoice", "Update an invoice in Xero. Only works on draft invoices.\
30
+ All line items must be provided. Any line items not provided will be removed. Including existing line items.\
31
+ Do not modify line items that have not been specified by the user.\
32
+ When an invoice is updated, a deep link to the invoice in Xero is returned. \
33
+ This deep link can be used to view the contact in Xero directly. \
34
34
  This link should be displayed to the user.", {
35
35
  invoiceId: z.string().describe("The ID of the invoice to update."),
36
- lineItems: z.array(lineItemSchema).optional().describe("All line items must be provided. Any line items not provided will be removed. Including existing line items. \
36
+ lineItems: z.array(lineItemSchema).optional().describe("All line items must be provided. Any line items not provided will be removed. Including existing line items. \
37
37
  Do not modify line items that have not been specified by the user"),
38
38
  reference: z.string().optional().describe("A reference number for the invoice."),
39
39
  dueDate: z.string().optional().describe("The due date of the invoice."),
40
40
  date: z.string().optional().describe("The date of the invoice."),
41
- contactId: z.string().optional().describe("The ID of the contact to update the invoice for. \
41
+ contactId: z.string().optional().describe("The ID of the contact to update the invoice for. \
42
42
  Can be obtained from the list-contacts tool."),
43
43
  }, async ({ invoiceId, lineItems, reference, dueDate, date, contactId }) => {
44
44
  const result = await updateXeroInvoice(invoiceId, lineItems, reference, dueDate, date, contactId);
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { updateXeroItem } from "../../handlers/update-xero-item.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  const purchaseDetailsSchema = z.object({
@@ -1,9 +1,9 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
3
3
  import { DeepLinkType, getDeepLink } from "../../helpers/get-deeplink.js";
4
4
  import { ensureError } from "../../helpers/ensure-error.js";
5
5
  import { updateXeroManualJournal } from "../../handlers/update-xero-manual-journal.handler.js";
6
- const UpdateManualJournalTool = CreateXeroTool("update-manual-journal", "Update a manual journal in Xero. Only works on draft manual journals.\
6
+ const UpdateManualJournalTool = CreateXeroTool("update-manual-journal", "Update a manual journal in Xero. Only works on draft manual journals.\
7
7
  Do not modify line items or parameters that have not been specified by the user.", {
8
8
  narration: z
9
9
  .string()
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { updateXeroPayrollTimesheetAddLine, } from "../../handlers/update-xero-payroll-timesheet-add-line.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  const AddTimesheetLineTool = CreateXeroTool("add-timesheet-line", `Add a new timesheet line to an existing payroll timesheet in Xero.`, {
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { updateXeroPayrollTimesheetUpdateLine, } from "../../handlers/update-xero-payroll-timesheet-update-line.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  const UpdatePayrollTimesheetLineTool = CreateXeroTool("update-timesheet-line", `Update an existing timesheet line in a payroll timesheet in Xero.`, {
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { updateXeroQuote } from "../../handlers/update-xero-quote.handler.js";
3
3
  import { DeepLinkType, getDeepLink } from "../../helpers/get-deeplink.js";
4
4
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
@@ -9,14 +9,14 @@ const lineItemSchema = z.object({
9
9
  accountCode: z.string(),
10
10
  taxType: z.string(),
11
11
  });
12
- const UpdateQuoteTool = CreateXeroTool("update-quote", "Update a quote in Xero. Only works on draft quotes.\
13
- All line items must be provided. Any line items not provided will be removed. Including existing line items.\
14
- Do not modify line items that have not been specified by the user. \
15
- When a quote is updated, a deep link to the quote in Xero is returned. \
16
- This deep link can be used to view the quote in Xero directly. \
12
+ const UpdateQuoteTool = CreateXeroTool("update-quote", "Update a quote in Xero. Only works on draft quotes.\
13
+ All line items must be provided. Any line items not provided will be removed. Including existing line items.\
14
+ Do not modify line items that have not been specified by the user. \
15
+ When a quote is updated, a deep link to the quote in Xero is returned. \
16
+ This deep link can be used to view the quote in Xero directly. \
17
17
  This link should be displayed to the user.", {
18
18
  quoteId: z.string(),
19
- lineItems: z.array(lineItemSchema).optional().describe("All line items must be provided. Any line items not provided will be removed. Including existing line items. \
19
+ lineItems: z.array(lineItemSchema).optional().describe("All line items must be provided. Any line items not provided will be removed. Including existing line items. \
20
20
  Do not modify line items that have not been specified by the user"),
21
21
  reference: z.string().optional(),
22
22
  terms: z.string().optional(),
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
3
3
  import { updateXeroTrackingCategory } from "../../handlers/update-xero-tracking-category.handler.js";
4
4
  const UpdateTrackingCategoryTool = CreateXeroTool("update-tracking-category", `Updates an existing tracking category in Xero.`, {
@@ -1,4 +1,5 @@
1
- import { z } from "zod";
1
+ import { rejectOversizedArray } from "../../helpers/reject-oversized-array.js";
2
+ import { z } from "zod/v3";
2
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
3
4
  import { formatTrackingOption } from "../../helpers/format-tracking-option.js";
4
5
  import { updateXeroTrackingOption } from "../../handlers/update-xero-tracking-options.handler.js";
@@ -9,7 +10,7 @@ const trackingOptionSchema = z.object({
9
10
  });
10
11
  const UpdateTrackingOptionsTool = CreateXeroTool("update-tracking-options", `Updates tracking options for a tracking category in Xero.`, {
11
12
  trackingCategoryId: z.string(),
12
- options: z.array(trackingOptionSchema).max(10)
13
+ options: rejectOversizedArray(z.array(trackingOptionSchema).max(10))
13
14
  }, async ({ trackingCategoryId, options }) => {
14
15
  const response = await updateXeroTrackingOption(trackingCategoryId, options);
15
16
  if (response.isError) {
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { voidXeroInvoice } from "../../handlers/void-xero-invoice.handler.js";
3
3
  import { CreateXeroTool } from "../../helpers/create-xero-tool.js";
4
4
  import { Invoice } from "xero-node";
package/package.json CHANGED
@@ -1,39 +1,44 @@
1
- {
2
- "name": "@teamnetwork-nz/xero-mcp-server",
3
- "version": "1.15.2",
4
- "description": "MCP server implementation for Xero integration - TEAMnetwork",
5
- "license": "MIT",
6
- "main": "dist/index.js",
7
- "author": "Daryl Petersen - TEAMnetwork (https://teamnetwork.co.nz)",
8
- "type": "module",
9
- "bin": "./dist/index.js",
10
- "files": [
11
- "dist"
12
- ],
13
- "scripts": {
14
- "build": "tsc && shx chmod +x dist/*.js",
15
- "test": "npm run build && node --test test/*.test.js",
16
- "prepare": "npm run build",
17
- "watch": "tsc --watch",
18
- "lint:fix": "eslint --fix",
19
- "lint": "eslint ."
20
- },
21
- "dependencies": {
22
- "@modelcontextprotocol/sdk": "^1.29.0",
23
- "dotenv": "^16.4.7",
24
- "openid-client": "^6.8.1",
25
- "xero-node": "^13.3.0",
26
- "zod": "^3.25.0"
27
- },
28
- "devDependencies": {
29
- "@eslint/js": "^9.39.1",
30
- "@types/node": "^22.13.10",
31
- "eslint": "^9.39.1",
32
- "eslint-config-prettier": "^10.1.8",
33
- "globals": "^16.5.0",
34
- "prettier": "3.7.4",
35
- "shx": "^0.3.4",
36
- "typescript": "^5.9.3",
37
- "typescript-eslint": "^8.48.1"
38
- }
39
- }
1
+ {
2
+ "name": "@teamnetwork-nz/xero-mcp-server",
3
+ "version": "1.15.4",
4
+ "description": "MCP server implementation for Xero integration - TEAMnetwork",
5
+ "license": "MIT",
6
+ "main": "dist/index.js",
7
+ "author": "Daryl Petersen - TEAMnetwork (https://teamnetwork.co.nz)",
8
+ "type": "module",
9
+ "bin": "./dist/index.js",
10
+ "files": [
11
+ "dist/**/*.js",
12
+ "dist/**/*.d.ts",
13
+ "README.md",
14
+ ".env.example"
15
+ ],
16
+ "scripts": {
17
+ "build": "tsc && shx chmod +x dist/*.js",
18
+ "test": "npm run build && node --test debug/tests/*.test.js",
19
+ "prepare": "npm run build",
20
+ "watch": "tsc --watch",
21
+ "lint:fix": "eslint --fix",
22
+ "lint": "eslint .",
23
+ "audit:package": "node scripts/check-package-privacy.mjs",
24
+ "prepublishOnly": "npm run build && npm run audit:package"
25
+ },
26
+ "dependencies": {
27
+ "@modelcontextprotocol/sdk": "^1.32.2",
28
+ "dotenv": "^16.4.7",
29
+ "openid-client": "^6.8.1",
30
+ "xero-node": "^13.3.0",
31
+ "zod": "^4.6.7"
32
+ },
33
+ "devDependencies": {
34
+ "@eslint/js": "^9.39.1",
35
+ "@types/node": "^22.13.10",
36
+ "eslint": "^9.39.1",
37
+ "eslint-config-prettier": "^10.1.8",
38
+ "globals": "^16.5.0",
39
+ "prettier": "3.7.4",
40
+ "shx": "^0.3.4",
41
+ "typescript": "^5.9.3",
42
+ "typescript-eslint": "^8.48.1"
43
+ }
44
+ }