xero-mcp 1.1.2 → 1.2.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
@@ -1,89 +1,109 @@
1
1
  # Xero MCP Server
2
2
 
3
+ ![](https://badge.mcpx.dev?type=server "MCP Server")
4
+ [![smithery badge](https://smithery.ai/badge/xero-mcp)](https://smithery.ai/server/@john-zhang-dev/xero-mcp)
5
+
3
6
  This MCP server allows Clients to interact with [Xero Accounting Software](https://www.xero.com).
4
7
 
5
8
  ## Get Started
6
9
 
7
10
  1. Make sure [node](https://nodejs.org) and [Claude Desktop](https://claude.ai/download) are installed.
8
11
 
9
- 2. Create an OAuth 2.0 app in Xero to get a *CLIENT_ID* and *CLIENT_SECRET*.
12
+ 2. Create an OAuth 2.0 app in Xero to get a _CLIENT_ID_ and _CLIENT_SECRET_.
10
13
 
11
- * Create a free Xero user account (if you don't have one)
12
- * Login to Xero Developer center https://developer.xero.com/app/manage/
13
- * Click New app
14
- * Enter a name for your app
15
- * Select Web app
16
- * Provide a valid URL (can be anything valid eg. https://www.myapp.com)
17
- * Enter redirect URI: `http://localhost:5000/callback`
18
- * Tick to Accept the Terms & Conditions and click Create app
19
- * On the left-hand side of the screen select Configuration
20
- * Click Generate a secret
14
+ - Create a free Xero user account (if you don't have one)
15
+ - Login to Xero Developer center https://developer.xero.com/app/manage/
16
+ - Click New app
17
+ - Enter a name for your app
18
+ - Select Web app
19
+ - Provide a valid URL (can be anything valid eg. https://www.myapp.com)
20
+ - Enter redirect URI: `http://localhost:5000/callback`
21
+ - Tick to Accept the Terms & Conditions and click Create app
22
+ - On the left-hand side of the screen select Configuration
23
+ - Click Generate a secret
21
24
 
22
25
  3. Modify `claude_desktop_config.json` file
23
26
 
24
- ```json
25
- {
26
- "mcpServers": {
27
- "xero-mcp": {
28
- "command": "npx",
29
- "args": ["-y", "xero-mcp"],
30
- "env": {
31
- "XERO_CLIENT_ID": "YOUR_CLIENT_ID",
32
- "XERO_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
33
- "XERO_REDIRECT_URI": "http://localhost:5000/callback"
34
- }
35
- }
36
- }
37
- }
38
- ```
27
+ ```json
28
+ {
29
+ "mcpServers": {
30
+ "xero-mcp": {
31
+ "command": "npx",
32
+ "args": ["-y", "xero-mcp@latest"],
33
+ "env": {
34
+ "XERO_CLIENT_ID": "YOUR_CLIENT_ID",
35
+ "XERO_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
36
+ "XERO_REDIRECT_URI": "http://localhost:5000/callback"
37
+ }
38
+ }
39
+ }
40
+ }
41
+ ```
39
42
 
40
43
  4. Restart Claude Desktop
41
44
 
45
+ 5. When the Client decides to access a Xero tool for the first time, a Xero login page will pop up to ask your consent. Complete the auth flow and manually close the web page (as the Xero page will not auto close in this version)
46
+
47
+ **Privacy alert: after completing the Xero OAuth2 flow, your Xero data may go through the LLM that you use. If you are doing testing you should authorize to your [Xero Demo Company](https://central.xero.com/s/article/Use-the-demo-company).**
48
+
42
49
  ## Tools
43
50
 
44
- - authenticate
51
+ - `authenticate`
52
+
53
+ Authenticate with Xero using OAuth2
54
+
55
+ - `get_balance_sheet`
56
+
57
+ Retrieves report for balancesheet
58
+
59
+ - `list_accounts`
60
+
61
+ Retrieves the full chart of accounts
62
+
63
+ - `list_bank_transactions`
64
+
65
+ Retrieves any spent or received money transactions
45
66
 
46
- Authenticate with Xero using OAuth2
67
+ - `list_contacts`
47
68
 
48
- - list_accounts
69
+ Retrieves all contacts in a Xero organisation
49
70
 
50
- List all accounts
71
+ - `list_invoices`
51
72
 
52
- - list_bank_transactions
73
+ Retrieves sales invoices or purchase bills
53
74
 
54
- List all bank transactions
75
+ - `list_journals`
55
76
 
56
- - list_contacts
77
+ Retrieves journals
57
78
 
58
- List all contacts
79
+ - `list_organisations`
59
80
 
60
- - list_invoices
81
+ Retrieves Xero organisation details
61
82
 
62
- List all invoices
83
+ - `list_payments`
63
84
 
64
- - list_journals
85
+ Retrieves payments for invoices and credit notes
65
86
 
66
- List all journals
87
+ - `list_quotes`
67
88
 
68
- - list_organisations
89
+ Retrieves sales quotes
69
90
 
70
- List all organisations
91
+ ## Examples
71
92
 
72
- - list_payments
93
+ - "Visualize my financial position over the last month"
73
94
 
74
- List all payments
95
+ <img src="https://github.com/john-zhang-dev/assets/blob/main/xero-mcp/demo1.jpg?raw=true" width=50% height=50%>
75
96
 
76
- - list_quotes
97
+ - "Track my spendings over last week"
77
98
 
78
- List all quotes
99
+ <img src="https://github.com/john-zhang-dev/assets/blob/main/xero-mcp/demo2.jpg?raw=true" width=50% height=50%>
79
100
 
80
101
  ## WIP Features
81
102
 
82
103
  - Tools that allow new transactions to be added to Xero
83
- - Docker support
84
104
 
85
105
  If you have additional requirements, please open an issue on this github repository.
86
106
 
87
107
  ## License
88
108
 
89
- MIT
109
+ MIT
@@ -1,9 +1,9 @@
1
- import { XeroClientSession } from "../XeroApiClient.js";
1
+ import { XeroClientSession } from "../../XeroApiClient.js";
2
2
  import { z } from "zod";
3
3
  export const ListAccountsTool = {
4
4
  requestSchema: {
5
5
  name: "list_accounts",
6
- description: "List all accounts",
6
+ description: "Retrieves the full chart of accounts",
7
7
  inputSchema: { type: "object", properties: {} },
8
8
  output: { content: [{ type: "text", text: z.string() }] },
9
9
  },
@@ -1,9 +1,9 @@
1
1
  import { z } from "zod";
2
- import { XeroClientSession } from "../XeroApiClient.js";
2
+ import { XeroClientSession } from "../../XeroApiClient.js";
3
3
  export const ListBankTransactionsTool = {
4
4
  requestSchema: {
5
5
  name: "list_bank_transactions",
6
- description: "List all bank transactions",
6
+ description: "Retrieves any spent or received money transactions",
7
7
  inputSchema: { type: "object", properties: {} },
8
8
  output: { content: [{ type: "text", text: z.string() }] },
9
9
  },
@@ -1,9 +1,9 @@
1
- import { XeroClientSession } from "../XeroApiClient.js";
1
+ import { XeroClientSession } from "../../XeroApiClient.js";
2
2
  import { z } from "zod";
3
3
  export const ListContactsTool = {
4
4
  requestSchema: {
5
5
  name: "list_contacts",
6
- description: "List all contacts",
6
+ description: "Retrieves all contacts in a Xero organisation",
7
7
  inputSchema: { type: "object", properties: {} },
8
8
  output: { content: [{ type: "text", text: z.string() }] },
9
9
  },
@@ -1,9 +1,9 @@
1
- import { XeroClientSession } from "../XeroApiClient.js";
1
+ import { XeroClientSession } from "../../XeroApiClient.js";
2
2
  import { z } from "zod";
3
3
  export const ListInvoicesTool = {
4
4
  requestSchema: {
5
5
  name: "list_invoices",
6
- description: "List all invoices",
6
+ description: "Retrieves sales invoices or purchase bills",
7
7
  inputSchema: { type: "object", properties: {} },
8
8
  output: { content: [{ type: "text", text: z.string() }] },
9
9
  },
@@ -1,9 +1,9 @@
1
- import { XeroClientSession } from "../XeroApiClient.js";
1
+ import { XeroClientSession } from "../../XeroApiClient.js";
2
2
  import { z } from "zod";
3
3
  export const ListJournalsTool = {
4
4
  requestSchema: {
5
5
  name: "list_journals",
6
- description: "List all journals",
6
+ description: "Retrieves journals",
7
7
  inputSchema: { type: "object", properties: {} },
8
8
  output: { content: [{ type: "text", text: z.string() }] },
9
9
  },
@@ -1,9 +1,9 @@
1
1
  import { z } from "zod";
2
- import { XeroClientSession } from "../XeroApiClient.js";
2
+ import { XeroClientSession } from "../../XeroApiClient.js";
3
3
  export const ListOrganisationsTool = {
4
4
  requestSchema: {
5
5
  name: "list_organisations",
6
- description: "List all organisations",
6
+ description: "Retrieves Xero organisation details",
7
7
  inputSchema: { type: "object", properties: {} },
8
8
  output: { content: [{ type: "text", text: z.string() }] },
9
9
  },
@@ -1,9 +1,9 @@
1
- import { XeroClientSession } from "../XeroApiClient.js";
1
+ import { XeroClientSession } from "../../XeroApiClient.js";
2
2
  import { z } from "zod";
3
3
  export const ListPaymentsTool = {
4
4
  requestSchema: {
5
5
  name: "list_payments",
6
- description: "List all payments",
6
+ description: "Retrieves payments for invoices and credit notes",
7
7
  inputSchema: { type: "object", properties: {} },
8
8
  output: { content: [{ type: "text", text: z.string() }] },
9
9
  },
@@ -1,9 +1,9 @@
1
- import { XeroClientSession } from "../XeroApiClient.js";
1
+ import { XeroClientSession } from "../../XeroApiClient.js";
2
2
  import { z } from "zod";
3
3
  export const ListQuotesTool = {
4
4
  requestSchema: {
5
5
  name: "list_quotes",
6
- description: "List all quotes",
6
+ description: "Retrieves sales quotes",
7
7
  inputSchema: { type: "object", properties: {} },
8
8
  output: { content: [{ type: "text", text: z.string() }] },
9
9
  },
@@ -1,15 +1,17 @@
1
- import { ListAccountsTool } from "./Accounts.js";
1
+ import { ListAccountsTool } from "./Accounting/Accounts.js";
2
2
  import { AuthenticateTool } from "./Authenticate.js";
3
- import { ListBankTransactionsTool } from "./BankTransactions.js";
4
- import { ListContactsTool } from "./Contacts.js";
5
- import { ListInvoicesTool } from "./Invoices.js";
6
- import { ListJournalsTool } from "./Journals.js";
7
- import { ListOrganisationsTool } from "./Organisations.js";
8
- import { ListPaymentsTool } from "./Payments.js";
9
- import { ListQuotesTool } from "./Quotes.js";
3
+ import { ListBankTransactionsTool } from "./Accounting/BankTransactions.js";
4
+ import { ListContactsTool } from "./Accounting/Contacts.js";
5
+ import { ListInvoicesTool } from "./Accounting/Invoices.js";
6
+ import { ListJournalsTool } from "./Accounting/Journals.js";
7
+ import { ListOrganisationsTool } from "./Accounting/Organisations.js";
8
+ import { ListPaymentsTool } from "./Accounting/Payments.js";
9
+ import { ListQuotesTool } from "./Accounting/Quotes.js";
10
+ import { GetBalanceSheetTool } from "./Reports/BalanceSheet.js";
10
11
  export const McpToolsFactory = (function () {
11
12
  const tools = [
12
13
  AuthenticateTool,
14
+ GetBalanceSheetTool,
13
15
  ListAccountsTool,
14
16
  ListBankTransactionsTool,
15
17
  ListContactsTool,
@@ -0,0 +1,22 @@
1
+ import { XeroClientSession } from "../../XeroApiClient.js";
2
+ import { z } from "zod";
3
+ export const GetBalanceSheetTool = {
4
+ requestSchema: {
5
+ name: "get_balance_sheet",
6
+ description: "Returns a balance sheet for the end of the month of the specified date. It also returns the value at the end of the same month for the previous year.",
7
+ inputSchema: { type: "object", properties: {} },
8
+ output: { content: [{ type: "text", text: z.string() }] },
9
+ },
10
+ requestHandler: async () => {
11
+ const response = await XeroClientSession.xeroClient.accountingApi.getReportBalanceSheet(XeroClientSession.activeTenantId());
12
+ const reports = response.body.reports || [];
13
+ return {
14
+ content: [
15
+ {
16
+ type: "text",
17
+ text: JSON.stringify(reports),
18
+ },
19
+ ],
20
+ };
21
+ },
22
+ };
@@ -3,7 +3,7 @@ import "dotenv/config";
3
3
  const client_id = process.env.XERO_CLIENT_ID;
4
4
  const client_secret = process.env.XERO_CLIENT_SECRET;
5
5
  const redirectUrl = process.env.XERO_REDIRECT_URI;
6
- const scopes = "offline_access openid profile accounting.transactions accounting.contacts.read accounting.journals.read";
6
+ const scopes = "offline_access openid profile accounting.transactions.read accounting.contacts.read accounting.journals.read accounting.reports.read";
7
7
  if (!client_id || !client_secret || !redirectUrl) {
8
8
  throw Error("Environment Variables not all set - please check your .env file in the project root or create one!");
9
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xero-mcp",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "A Model Context Protocol server allows Clients to interact with Xero",
5
5
  "author": "Jianyang Zhang",
6
6
  "type": "module",