@mindstone/mcp-server-xero 0.0.15 → 0.0.16
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
|
@@ -47,7 +47,7 @@ It is also the recommended approach if you are integrating this into 3rd party M
|
|
|
47
47
|
|
|
48
48
|
Set up a Custom Connection following these instructions: https://developer.xero.com/documentation/guides/oauth2/custom-connections/
|
|
49
49
|
|
|
50
|
-
Currently the following scopes are required for
|
|
50
|
+
Currently the following scopes are required for Custom Connection sessions: [scopes](src/clients/xero-scopes.ts)
|
|
51
51
|
|
|
52
52
|
##### Integrating the MCP server with Claude Desktop
|
|
53
53
|
|
|
@@ -3,6 +3,7 @@ import dotenv from "dotenv";
|
|
|
3
3
|
import { XeroClient, } from "xero-node";
|
|
4
4
|
import { ensureError } from "../helpers/ensure-error.js";
|
|
5
5
|
import { formatTokenRequestError } from "../helpers/format-token-error.js";
|
|
6
|
+
import { XERO_CUSTOM_CONNECTION_SCOPE } from "./xero-scopes.js";
|
|
6
7
|
dotenv.config();
|
|
7
8
|
const client_id = process.env.XERO_CLIENT_ID;
|
|
8
9
|
const client_secret = process.env.XERO_CLIENT_SECRET;
|
|
@@ -68,10 +69,9 @@ class CustomConnectionsXeroClient extends MCPXeroClient {
|
|
|
68
69
|
return elapsed < this.tokenExpiresInMs - CustomConnectionsXeroClient.REFRESH_BUFFER_MS;
|
|
69
70
|
}
|
|
70
71
|
async getClientCredentialsToken() {
|
|
71
|
-
const scope = "accounting.transactions accounting.contacts accounting.settings accounting.reports.read accounting.attachments.read payroll.settings payroll.employees payroll.timesheets";
|
|
72
72
|
const credentials = Buffer.from(`${this.clientId}:${this.clientSecret}`).toString("base64");
|
|
73
73
|
try {
|
|
74
|
-
const response = await axios.post("https://identity.xero.com/connect/token", `grant_type=client_credentials&scope=${encodeURIComponent(
|
|
74
|
+
const response = await axios.post("https://identity.xero.com/connect/token", `grant_type=client_credentials&scope=${encodeURIComponent(XERO_CUSTOM_CONNECTION_SCOPE)}`, {
|
|
75
75
|
headers: {
|
|
76
76
|
Authorization: `Basic ${credentials}`,
|
|
77
77
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const XERO_CUSTOM_CONNECTION_SCOPES = [
|
|
2
|
+
"accounting.attachments.read",
|
|
3
|
+
"accounting.banktransactions",
|
|
4
|
+
"accounting.contacts",
|
|
5
|
+
"accounting.invoices",
|
|
6
|
+
"accounting.manualjournals",
|
|
7
|
+
"accounting.payments",
|
|
8
|
+
"accounting.reports.aged.read",
|
|
9
|
+
"accounting.reports.balancesheet.read",
|
|
10
|
+
"accounting.reports.banksummary.read",
|
|
11
|
+
"accounting.reports.budgetsummary.read",
|
|
12
|
+
"accounting.reports.executivesummary.read",
|
|
13
|
+
"accounting.reports.profitandloss.read",
|
|
14
|
+
"accounting.reports.taxreports.read",
|
|
15
|
+
"accounting.reports.tenninetynine.read",
|
|
16
|
+
"accounting.reports.trialbalance.read",
|
|
17
|
+
"accounting.settings",
|
|
18
|
+
"payroll.employees",
|
|
19
|
+
"payroll.settings",
|
|
20
|
+
"payroll.timesheets",
|
|
21
|
+
];
|
|
22
|
+
export const XERO_CUSTOM_CONNECTION_SCOPE = XERO_CUSTOM_CONNECTION_SCOPES.join(" ");
|
|
23
|
+
export const XERO_CUSTOM_CONNECTION_SCOPE_MESSAGE = XERO_CUSTOM_CONNECTION_SCOPES.join(", ");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
+
import { XERO_CUSTOM_CONNECTION_SCOPE_MESSAGE } from "../clients/xero-scopes.js";
|
|
2
3
|
const REQUIRED_SCOPE_MESSAGE = "Xero authentication failed: your Custom Connection is missing required scopes. " +
|
|
3
4
|
"Go to https://developer.xero.com/app/manage, select your app, and ensure these scopes are enabled: " +
|
|
4
|
-
|
|
5
|
-
"accounting.attachments.read, payroll.settings, payroll.employees, payroll.timesheets";
|
|
5
|
+
XERO_CUSTOM_CONNECTION_SCOPE_MESSAGE;
|
|
6
6
|
function isRecord(value) {
|
|
7
7
|
return typeof value === "object" && value !== null;
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindstone/mcp-server-xero",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"mcpName": "io.github.mindstone/mcp-server-xero",
|
|
5
5
|
"description": "Xero MCP server for invoices, contacts, payments, quotes, and financial reports",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/mindstone/mcp-servers.git",
|
|
10
|
+
"url": "git+https://github.com/mindstone/mcp-servers.git",
|
|
11
11
|
"directory": "connectors/xero"
|
|
12
12
|
},
|
|
13
13
|
"homepage": "https://github.com/mindstone/mcp-servers/tree/main/connectors/xero",
|