File tree Expand file tree Collapse file tree 6 files changed +116
-1
lines changed Expand file tree Collapse file tree 6 files changed +116
-1
lines changed Original file line number Diff line number Diff line change
1
+ import { XeroClientSession } from "../XeroApiClient.js" ;
2
+ import { IMcpServerTool } from "./IMcpServerTool.js" ;
3
+ import { z } from "zod" ;
4
+
5
+ export const ListInvoicesTool : IMcpServerTool = {
6
+ requestSchema : {
7
+ name : "list_invoices" ,
8
+ description : "List all invoices" ,
9
+ inputSchema : { type : "object" , properties : { } } ,
10
+ output : { content : [ { type : "text" , text : z . string ( ) } ] } ,
11
+ } ,
12
+ requestHandler : async ( ) => {
13
+ const response =
14
+ await XeroClientSession . xeroClient . accountingApi . getInvoices (
15
+ XeroClientSession . activeTenantId ( ) ! !
16
+ ) ;
17
+ const invoices = response . body . invoices || [ ] ;
18
+ return {
19
+ content : [
20
+ {
21
+ type : "text" ,
22
+ text : JSON . stringify ( invoices ) ,
23
+ } ,
24
+ ] ,
25
+ } ;
26
+ } ,
27
+ } ;
Original file line number Diff line number Diff line change
1
+ import { XeroClientSession } from "../XeroApiClient.js" ;
2
+ import { IMcpServerTool } from "./IMcpServerTool.js" ;
3
+ import { z } from "zod" ;
4
+
5
+ export const ListJournalsTool : IMcpServerTool = {
6
+ requestSchema : {
7
+ name : "list_journals" ,
8
+ description : "List all journals" ,
9
+ inputSchema : { type : "object" , properties : { } } ,
10
+ output : { content : [ { type : "text" , text : z . string ( ) } ] } ,
11
+ } ,
12
+ requestHandler : async ( ) => {
13
+ const response =
14
+ await XeroClientSession . xeroClient . accountingApi . getJournals (
15
+ XeroClientSession . activeTenantId ( ) ! !
16
+ ) ;
17
+ const journals = response . body . journals || [ ] ;
18
+ return {
19
+ content : [
20
+ {
21
+ type : "text" ,
22
+ text : JSON . stringify ( journals ) ,
23
+ } ,
24
+ ] ,
25
+ } ;
26
+ } ,
27
+ } ;
Original file line number Diff line number Diff line change @@ -3,15 +3,23 @@ import { AuthenticateTool } from "./Authenticate.js";
3
3
import { ListBankTransactionsTool } from "./BankTransactions.js" ;
4
4
import { ListContactsTool } from "./Contacts.js" ;
5
5
import { IMcpServerTool } from "./IMcpServerTool.js" ;
6
+ import { ListInvoicesTool } from "./Invoices.js" ;
7
+ import { ListJournalsTool } from "./Journals.js" ;
6
8
import { ListOrganisationsTool } from "./Organisations.js" ;
9
+ import { ListPaymentsTool } from "./Payments.js" ;
10
+ import { ListQuotesTool } from "./Quotes.js" ;
7
11
8
12
export const McpToolsFactory = ( function ( ) {
9
13
const tools : IMcpServerTool [ ] = [
10
14
AuthenticateTool ,
11
15
ListAccountsTool ,
12
16
ListBankTransactionsTool ,
13
17
ListContactsTool ,
18
+ ListInvoicesTool ,
19
+ ListJournalsTool ,
14
20
ListOrganisationsTool ,
21
+ ListPaymentsTool ,
22
+ ListQuotesTool ,
15
23
// register new tools here alphabetically
16
24
] ;
17
25
Original file line number Diff line number Diff line change
1
+ import { XeroClientSession } from "../XeroApiClient.js" ;
2
+ import { IMcpServerTool } from "./IMcpServerTool.js" ;
3
+ import { z } from "zod" ;
4
+
5
+ export const ListPaymentsTool : IMcpServerTool = {
6
+ requestSchema : {
7
+ name : "list_payments" ,
8
+ description : "List all payments" ,
9
+ inputSchema : { type : "object" , properties : { } } ,
10
+ output : { content : [ { type : "text" , text : z . string ( ) } ] } ,
11
+ } ,
12
+ requestHandler : async ( ) => {
13
+ const response =
14
+ await XeroClientSession . xeroClient . accountingApi . getPayments (
15
+ XeroClientSession . activeTenantId ( ) ! !
16
+ ) ;
17
+ const payments = response . body . payments || [ ] ;
18
+ return {
19
+ content : [
20
+ {
21
+ type : "text" ,
22
+ text : JSON . stringify ( payments ) ,
23
+ } ,
24
+ ] ,
25
+ } ;
26
+ } ,
27
+ } ;
Original file line number Diff line number Diff line change
1
+ import { XeroClientSession } from "../XeroApiClient.js" ;
2
+ import { IMcpServerTool } from "./IMcpServerTool.js" ;
3
+ import { z } from "zod" ;
4
+
5
+ export const ListQuotesTool : IMcpServerTool = {
6
+ requestSchema : {
7
+ name : "list_quotes" ,
8
+ description : "List all quotes" ,
9
+ inputSchema : { type : "object" , properties : { } } ,
10
+ output : { content : [ { type : "text" , text : z . string ( ) } ] } ,
11
+ } ,
12
+ requestHandler : async ( ) => {
13
+ const response = await XeroClientSession . xeroClient . accountingApi . getQuotes (
14
+ XeroClientSession . activeTenantId ( ) ! !
15
+ ) ;
16
+ const quotes = response . body . quotes || [ ] ;
17
+ return {
18
+ content : [
19
+ {
20
+ type : "text" ,
21
+ text : JSON . stringify ( quotes ) ,
22
+ } ,
23
+ ] ,
24
+ } ;
25
+ } ,
26
+ } ;
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ const client_id = process.env.XERO_CLIENT_ID;
5
5
const client_secret = process . env . XERO_CLIENT_SECRET ;
6
6
const redirectUrl = process . env . XERO_REDIRECT_URI ;
7
7
const scopes =
8
- "offline_access openid profile email accounting.transactions accounting.budgets.read accounting.reports.read accounting.journals.read accounting.settings accounting.settings.read accounting. contacts accounting.contacts. read accounting.attachments accounting.attachments.read files files.read assets assets.read projects projects .read" ;
8
+ "offline_access openid profile accounting.transactions accounting.contacts. read accounting.journals .read" ;
9
9
10
10
if ( ! client_id || ! client_secret || ! redirectUrl ) {
11
11
throw Error (
You can’t perform that action at this time.
0 commit comments