siigo-mcp-server 1.0.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/dist/index.js ADDED
@@ -0,0 +1,1094 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
38
+ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
39
+ const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
40
+ const siigo_client_js_1 = require("./siigo-client.js");
41
+ const dotenv = __importStar(require("dotenv"));
42
+ dotenv.config();
43
+ class SiigoMCPServer {
44
+ constructor() {
45
+ this.server = new index_js_1.Server({
46
+ name: 'siigo-mcp-server',
47
+ version: '1.0.0',
48
+ }, {
49
+ capabilities: {
50
+ tools: {},
51
+ },
52
+ });
53
+ const config = {
54
+ username: process.env.SIIGO_USERNAME || '',
55
+ accessKey: process.env.SIIGO_ACCESS_KEY || '',
56
+ baseUrl: process.env.SIIGO_BASE_URL || 'https://api.siigo.com',
57
+ partnerId: process.env.SIIGO_PARTNER_ID || 'siigo-mcp-server',
58
+ };
59
+ if (!config.username || !config.accessKey) {
60
+ throw new Error('SIIGO_USERNAME and SIIGO_ACCESS_KEY environment variables are required');
61
+ }
62
+ this.siigoClient = new siigo_client_js_1.SiigoClient(config);
63
+ this.setupHandlers();
64
+ }
65
+ setupHandlers() {
66
+ this.server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
67
+ return {
68
+ tools: this.getTools(),
69
+ };
70
+ });
71
+ this.server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
72
+ const { name, arguments: args } = request.params;
73
+ try {
74
+ switch (name) {
75
+ // Products
76
+ case 'siigo_get_products':
77
+ return await this.handleGetProducts(args);
78
+ case 'siigo_get_product':
79
+ return await this.handleGetProduct(args);
80
+ case 'siigo_create_product':
81
+ return await this.handleCreateProduct(args);
82
+ case 'siigo_update_product':
83
+ return await this.handleUpdateProduct(args);
84
+ case 'siigo_delete_product':
85
+ return await this.handleDeleteProduct(args);
86
+ // Customers
87
+ case 'siigo_get_customers':
88
+ return await this.handleGetCustomers(args);
89
+ case 'siigo_get_customer':
90
+ return await this.handleGetCustomer(args);
91
+ case 'siigo_create_customer':
92
+ return await this.handleCreateCustomer(args);
93
+ case 'siigo_update_customer':
94
+ return await this.handleUpdateCustomer(args);
95
+ // Invoices
96
+ case 'siigo_get_invoices':
97
+ return await this.handleGetInvoices(args);
98
+ case 'siigo_get_invoice':
99
+ return await this.handleGetInvoice(args);
100
+ case 'siigo_create_invoice':
101
+ return await this.handleCreateInvoice(args);
102
+ case 'siigo_update_invoice':
103
+ return await this.handleUpdateInvoice(args);
104
+ case 'siigo_delete_invoice':
105
+ return await this.handleDeleteInvoice(args);
106
+ case 'siigo_get_invoice_pdf':
107
+ return await this.handleGetInvoicePdf(args);
108
+ case 'siigo_send_invoice_email':
109
+ return await this.handleSendInvoiceEmail(args);
110
+ // Credit Notes
111
+ case 'siigo_get_credit_notes':
112
+ return await this.handleGetCreditNotes(args);
113
+ case 'siigo_get_credit_note':
114
+ return await this.handleGetCreditNote(args);
115
+ case 'siigo_create_credit_note':
116
+ return await this.handleCreateCreditNote(args);
117
+ // Vouchers
118
+ case 'siigo_get_vouchers':
119
+ return await this.handleGetVouchers(args);
120
+ case 'siigo_get_voucher':
121
+ return await this.handleGetVoucher(args);
122
+ case 'siigo_create_voucher':
123
+ return await this.handleCreateVoucher(args);
124
+ // Purchases
125
+ case 'siigo_get_purchases':
126
+ return await this.handleGetPurchases(args);
127
+ case 'siigo_get_purchase':
128
+ return await this.handleGetPurchase(args);
129
+ case 'siigo_create_purchase':
130
+ return await this.handleCreatePurchase(args);
131
+ case 'siigo_update_purchase':
132
+ return await this.handleUpdatePurchase(args);
133
+ case 'siigo_delete_purchase':
134
+ return await this.handleDeletePurchase(args);
135
+ // Payment Receipts
136
+ case 'siigo_get_payment_receipts':
137
+ return await this.handleGetPaymentReceipts(args);
138
+ case 'siigo_get_payment_receipt':
139
+ return await this.handleGetPaymentReceipt(args);
140
+ case 'siigo_create_payment_receipt':
141
+ return await this.handleCreatePaymentReceipt(args);
142
+ case 'siigo_update_payment_receipt':
143
+ return await this.handleUpdatePaymentReceipt(args);
144
+ case 'siigo_delete_payment_receipt':
145
+ return await this.handleDeletePaymentReceipt(args);
146
+ // Journals
147
+ case 'siigo_get_journals':
148
+ return await this.handleGetJournals(args);
149
+ case 'siigo_get_journal':
150
+ return await this.handleGetJournal(args);
151
+ case 'siigo_create_journal':
152
+ return await this.handleCreateJournal(args);
153
+ // Catalogs
154
+ case 'siigo_get_document_types':
155
+ return await this.handleGetDocumentTypes(args);
156
+ case 'siigo_get_taxes':
157
+ return await this.handleGetTaxes(args);
158
+ case 'siigo_get_payment_types':
159
+ return await this.handleGetPaymentTypes(args);
160
+ case 'siigo_get_cost_centers':
161
+ return await this.handleGetCostCenters(args);
162
+ case 'siigo_get_users':
163
+ return await this.handleGetUsers(args);
164
+ case 'siigo_get_warehouses':
165
+ return await this.handleGetWarehouses(args);
166
+ case 'siigo_get_price_lists':
167
+ return await this.handleGetPriceLists(args);
168
+ case 'siigo_get_account_groups':
169
+ return await this.handleGetAccountGroups(args);
170
+ case 'siigo_get_cities':
171
+ return await this.handleGetCities(args);
172
+ case 'siigo_get_id_types':
173
+ return await this.handleGetIdTypes(args);
174
+ case 'siigo_get_fiscal_responsibilities':
175
+ return await this.handleGetFiscalResponsibilities(args);
176
+ // Reports
177
+ case 'siigo_get_trial_balance':
178
+ return await this.handleGetTrialBalance(args);
179
+ case 'siigo_get_trial_balance_by_third':
180
+ return await this.handleGetTrialBalanceByThird(args);
181
+ case 'siigo_get_accounts_payable':
182
+ return await this.handleGetAccountsPayable(args);
183
+ default:
184
+ throw new Error(`Unknown tool: ${name}`);
185
+ }
186
+ }
187
+ catch (error) {
188
+ return {
189
+ content: [
190
+ {
191
+ type: 'text',
192
+ text: `Error executing ${name}: ${error instanceof Error ? error.message : String(error)}`,
193
+ },
194
+ ],
195
+ isError: true,
196
+ };
197
+ }
198
+ });
199
+ }
200
+ getTools() {
201
+ return [
202
+ // Products
203
+ {
204
+ name: 'siigo_get_products',
205
+ description: 'Get list of products from Siigo',
206
+ inputSchema: {
207
+ type: 'object',
208
+ properties: {
209
+ page: { type: 'number', description: 'Page number' },
210
+ page_size: { type: 'number', description: 'Number of items per page' },
211
+ },
212
+ },
213
+ },
214
+ {
215
+ name: 'siigo_get_product',
216
+ description: 'Get a specific product by ID',
217
+ inputSchema: {
218
+ type: 'object',
219
+ properties: {
220
+ id: { type: 'string', description: 'Product ID' },
221
+ },
222
+ required: ['id'],
223
+ },
224
+ },
225
+ {
226
+ name: 'siigo_create_product',
227
+ description: 'Create a new product',
228
+ inputSchema: {
229
+ type: 'object',
230
+ properties: {
231
+ product: {
232
+ type: 'object',
233
+ description: 'Product data',
234
+ properties: {
235
+ code: { type: 'string', description: 'Product code' },
236
+ name: { type: 'string', description: 'Product name' },
237
+ account_group: { type: 'number', description: 'Account group ID' },
238
+ type: { type: 'string', enum: ['Product', 'Service', 'ConsumerGood'] },
239
+ stock_control: { type: 'boolean' },
240
+ active: { type: 'boolean' },
241
+ tax_classification: { type: 'string', enum: ['Taxed', 'Exempt', 'Excluded'] },
242
+ tax_included: { type: 'boolean' },
243
+ unit: { type: 'string' },
244
+ unit_label: { type: 'string' },
245
+ reference: { type: 'string' },
246
+ description: { type: 'string' },
247
+ },
248
+ required: ['code', 'name', 'account_group'],
249
+ },
250
+ },
251
+ required: ['product'],
252
+ },
253
+ },
254
+ {
255
+ name: 'siigo_update_product',
256
+ description: 'Update an existing product',
257
+ inputSchema: {
258
+ type: 'object',
259
+ properties: {
260
+ id: { type: 'string', description: 'Product ID' },
261
+ product: { type: 'object', description: 'Product data to update' },
262
+ },
263
+ required: ['id', 'product'],
264
+ },
265
+ },
266
+ {
267
+ name: 'siigo_delete_product',
268
+ description: 'Delete a product',
269
+ inputSchema: {
270
+ type: 'object',
271
+ properties: {
272
+ id: { type: 'string', description: 'Product ID' },
273
+ },
274
+ required: ['id'],
275
+ },
276
+ },
277
+ // Customers
278
+ {
279
+ name: 'siigo_get_customers',
280
+ description: 'Get list of customers from Siigo',
281
+ inputSchema: {
282
+ type: 'object',
283
+ properties: {
284
+ page: { type: 'number', description: 'Page number' },
285
+ page_size: { type: 'number', description: 'Number of items per page' },
286
+ type: { type: 'string', description: 'Customer type filter' },
287
+ },
288
+ },
289
+ },
290
+ {
291
+ name: 'siigo_get_customer',
292
+ description: 'Get a specific customer by ID',
293
+ inputSchema: {
294
+ type: 'object',
295
+ properties: {
296
+ id: { type: 'string', description: 'Customer ID' },
297
+ },
298
+ required: ['id'],
299
+ },
300
+ },
301
+ {
302
+ name: 'siigo_create_customer',
303
+ description: 'Create a new customer',
304
+ inputSchema: {
305
+ type: 'object',
306
+ properties: {
307
+ customer: {
308
+ type: 'object',
309
+ description: 'Customer data',
310
+ properties: {
311
+ person_type: { type: 'string', enum: ['Person', 'Company'] },
312
+ id_type: { type: 'string', description: 'ID type code' },
313
+ identification: { type: 'string', description: 'Customer identification' },
314
+ name: { type: 'array', items: { type: 'string' }, description: 'Customer names' },
315
+ address: {
316
+ type: 'object',
317
+ properties: {
318
+ address: { type: 'string' },
319
+ city: {
320
+ type: 'object',
321
+ properties: {
322
+ country_code: { type: 'string' },
323
+ state_code: { type: 'string' },
324
+ city_code: { type: 'string' },
325
+ },
326
+ required: ['country_code', 'state_code', 'city_code'],
327
+ },
328
+ },
329
+ required: ['address', 'city'],
330
+ },
331
+ phones: { type: 'array', items: { type: 'object' } },
332
+ contacts: { type: 'array', items: { type: 'object' } },
333
+ },
334
+ required: ['person_type', 'id_type', 'identification', 'name', 'address', 'phones', 'contacts'],
335
+ },
336
+ },
337
+ required: ['customer'],
338
+ },
339
+ },
340
+ {
341
+ name: 'siigo_update_customer',
342
+ description: 'Update an existing customer',
343
+ inputSchema: {
344
+ type: 'object',
345
+ properties: {
346
+ id: { type: 'string', description: 'Customer ID' },
347
+ customer: { type: 'object', description: 'Customer data to update' },
348
+ },
349
+ required: ['id', 'customer'],
350
+ },
351
+ },
352
+ // Invoices
353
+ {
354
+ name: 'siigo_get_invoices',
355
+ description: 'Get list of invoices from Siigo',
356
+ inputSchema: {
357
+ type: 'object',
358
+ properties: {
359
+ page: { type: 'number', description: 'Page number' },
360
+ page_size: { type: 'number', description: 'Number of items per page' },
361
+ created_start: { type: 'string', description: 'Start date filter (YYYY-MM-DD)' },
362
+ created_end: { type: 'string', description: 'End date filter (YYYY-MM-DD)' },
363
+ },
364
+ },
365
+ },
366
+ {
367
+ name: 'siigo_get_invoice',
368
+ description: 'Get a specific invoice by ID',
369
+ inputSchema: {
370
+ type: 'object',
371
+ properties: {
372
+ id: { type: 'string', description: 'Invoice ID' },
373
+ },
374
+ required: ['id'],
375
+ },
376
+ },
377
+ {
378
+ name: 'siigo_create_invoice',
379
+ description: 'Create a new invoice',
380
+ inputSchema: {
381
+ type: 'object',
382
+ properties: {
383
+ invoice: {
384
+ type: 'object',
385
+ description: 'Invoice data',
386
+ properties: {
387
+ document: { type: 'object', properties: { id: { type: 'number' } }, required: ['id'] },
388
+ date: { type: 'string', description: 'Invoice date (YYYY-MM-DD)' },
389
+ customer: { type: 'object', description: 'Customer information' },
390
+ seller: { type: 'number', description: 'Seller ID' },
391
+ items: { type: 'array', items: { type: 'object' }, description: 'Invoice items' },
392
+ payments: { type: 'array', items: { type: 'object' }, description: 'Payment methods' },
393
+ },
394
+ required: ['document', 'date', 'customer', 'seller', 'items', 'payments'],
395
+ },
396
+ },
397
+ required: ['invoice'],
398
+ },
399
+ },
400
+ {
401
+ name: 'siigo_update_invoice',
402
+ description: 'Update an existing invoice',
403
+ inputSchema: {
404
+ type: 'object',
405
+ properties: {
406
+ id: { type: 'string', description: 'Invoice ID' },
407
+ invoice: { type: 'object', description: 'Invoice data to update' },
408
+ },
409
+ required: ['id', 'invoice'],
410
+ },
411
+ },
412
+ {
413
+ name: 'siigo_delete_invoice',
414
+ description: 'Delete an invoice',
415
+ inputSchema: {
416
+ type: 'object',
417
+ properties: {
418
+ id: { type: 'string', description: 'Invoice ID' },
419
+ },
420
+ required: ['id'],
421
+ },
422
+ },
423
+ {
424
+ name: 'siigo_get_invoice_pdf',
425
+ description: 'Get invoice PDF',
426
+ inputSchema: {
427
+ type: 'object',
428
+ properties: {
429
+ id: { type: 'string', description: 'Invoice ID' },
430
+ },
431
+ required: ['id'],
432
+ },
433
+ },
434
+ {
435
+ name: 'siigo_send_invoice_email',
436
+ description: 'Send invoice by email',
437
+ inputSchema: {
438
+ type: 'object',
439
+ properties: {
440
+ id: { type: 'string', description: 'Invoice ID' },
441
+ mail_to: { type: 'string', description: 'Recipient email' },
442
+ copy_to: { type: 'string', description: 'CC emails (semicolon separated)' },
443
+ },
444
+ required: ['id', 'mail_to'],
445
+ },
446
+ },
447
+ // Credit Notes
448
+ {
449
+ name: 'siigo_get_credit_notes',
450
+ description: 'Get list of credit notes from Siigo',
451
+ inputSchema: {
452
+ type: 'object',
453
+ properties: {
454
+ page: { type: 'number', description: 'Page number' },
455
+ page_size: { type: 'number', description: 'Number of items per page' },
456
+ },
457
+ },
458
+ },
459
+ {
460
+ name: 'siigo_get_credit_note',
461
+ description: 'Get a specific credit note by ID',
462
+ inputSchema: {
463
+ type: 'object',
464
+ properties: {
465
+ id: { type: 'string', description: 'Credit note ID' },
466
+ },
467
+ required: ['id'],
468
+ },
469
+ },
470
+ {
471
+ name: 'siigo_create_credit_note',
472
+ description: 'Create a new credit note',
473
+ inputSchema: {
474
+ type: 'object',
475
+ properties: {
476
+ creditNote: { type: 'object', description: 'Credit note data' },
477
+ },
478
+ required: ['creditNote'],
479
+ },
480
+ },
481
+ // Vouchers
482
+ {
483
+ name: 'siigo_get_vouchers',
484
+ description: 'Get list of vouchers (cash receipts) from Siigo',
485
+ inputSchema: {
486
+ type: 'object',
487
+ properties: {
488
+ page: { type: 'number', description: 'Page number' },
489
+ page_size: { type: 'number', description: 'Number of items per page' },
490
+ },
491
+ },
492
+ },
493
+ {
494
+ name: 'siigo_get_voucher',
495
+ description: 'Get a specific voucher by ID',
496
+ inputSchema: {
497
+ type: 'object',
498
+ properties: {
499
+ id: { type: 'string', description: 'Voucher ID' },
500
+ },
501
+ required: ['id'],
502
+ },
503
+ },
504
+ {
505
+ name: 'siigo_create_voucher',
506
+ description: 'Create a new voucher',
507
+ inputSchema: {
508
+ type: 'object',
509
+ properties: {
510
+ voucher: { type: 'object', description: 'Voucher data' },
511
+ },
512
+ required: ['voucher'],
513
+ },
514
+ },
515
+ // Purchases
516
+ {
517
+ name: 'siigo_get_purchases',
518
+ description: 'Get list of purchases from Siigo',
519
+ inputSchema: {
520
+ type: 'object',
521
+ properties: {
522
+ page: { type: 'number', description: 'Page number' },
523
+ page_size: { type: 'number', description: 'Number of items per page' },
524
+ },
525
+ },
526
+ },
527
+ {
528
+ name: 'siigo_get_purchase',
529
+ description: 'Get a specific purchase by ID',
530
+ inputSchema: {
531
+ type: 'object',
532
+ properties: {
533
+ id: { type: 'string', description: 'Purchase ID' },
534
+ },
535
+ required: ['id'],
536
+ },
537
+ },
538
+ {
539
+ name: 'siigo_create_purchase',
540
+ description: 'Create a new purchase',
541
+ inputSchema: {
542
+ type: 'object',
543
+ properties: {
544
+ purchase: { type: 'object', description: 'Purchase data' },
545
+ },
546
+ required: ['purchase'],
547
+ },
548
+ },
549
+ {
550
+ name: 'siigo_update_purchase',
551
+ description: 'Update an existing purchase',
552
+ inputSchema: {
553
+ type: 'object',
554
+ properties: {
555
+ id: { type: 'string', description: 'Purchase ID' },
556
+ purchase: { type: 'object', description: 'Purchase data to update' },
557
+ },
558
+ required: ['id', 'purchase'],
559
+ },
560
+ },
561
+ {
562
+ name: 'siigo_delete_purchase',
563
+ description: 'Delete a purchase',
564
+ inputSchema: {
565
+ type: 'object',
566
+ properties: {
567
+ id: { type: 'string', description: 'Purchase ID' },
568
+ },
569
+ required: ['id'],
570
+ },
571
+ },
572
+ // Payment Receipts
573
+ {
574
+ name: 'siigo_get_payment_receipts',
575
+ description: 'Get list of payment receipts from Siigo',
576
+ inputSchema: {
577
+ type: 'object',
578
+ properties: {
579
+ page: { type: 'number', description: 'Page number' },
580
+ page_size: { type: 'number', description: 'Number of items per page' },
581
+ },
582
+ },
583
+ },
584
+ {
585
+ name: 'siigo_get_payment_receipt',
586
+ description: 'Get a specific payment receipt by ID',
587
+ inputSchema: {
588
+ type: 'object',
589
+ properties: {
590
+ id: { type: 'string', description: 'Payment receipt ID' },
591
+ },
592
+ required: ['id'],
593
+ },
594
+ },
595
+ {
596
+ name: 'siigo_create_payment_receipt',
597
+ description: 'Create a new payment receipt',
598
+ inputSchema: {
599
+ type: 'object',
600
+ properties: {
601
+ paymentReceipt: { type: 'object', description: 'Payment receipt data' },
602
+ },
603
+ required: ['paymentReceipt'],
604
+ },
605
+ },
606
+ {
607
+ name: 'siigo_update_payment_receipt',
608
+ description: 'Update an existing payment receipt',
609
+ inputSchema: {
610
+ type: 'object',
611
+ properties: {
612
+ id: { type: 'string', description: 'Payment receipt ID' },
613
+ paymentReceipt: { type: 'object', description: 'Payment receipt data to update' },
614
+ },
615
+ required: ['id', 'paymentReceipt'],
616
+ },
617
+ },
618
+ {
619
+ name: 'siigo_delete_payment_receipt',
620
+ description: 'Delete a payment receipt',
621
+ inputSchema: {
622
+ type: 'object',
623
+ properties: {
624
+ id: { type: 'string', description: 'Payment receipt ID' },
625
+ },
626
+ required: ['id'],
627
+ },
628
+ },
629
+ // Journals
630
+ {
631
+ name: 'siigo_get_journals',
632
+ description: 'Get list of accounting journals from Siigo',
633
+ inputSchema: {
634
+ type: 'object',
635
+ properties: {
636
+ page: { type: 'number', description: 'Page number' },
637
+ page_size: { type: 'number', description: 'Number of items per page' },
638
+ },
639
+ },
640
+ },
641
+ {
642
+ name: 'siigo_get_journal',
643
+ description: 'Get a specific journal by ID',
644
+ inputSchema: {
645
+ type: 'object',
646
+ properties: {
647
+ id: { type: 'string', description: 'Journal ID' },
648
+ },
649
+ required: ['id'],
650
+ },
651
+ },
652
+ {
653
+ name: 'siigo_create_journal',
654
+ description: 'Create a new accounting journal',
655
+ inputSchema: {
656
+ type: 'object',
657
+ properties: {
658
+ journal: { type: 'object', description: 'Journal data' },
659
+ },
660
+ required: ['journal'],
661
+ },
662
+ },
663
+ // Catalogs
664
+ {
665
+ name: 'siigo_get_document_types',
666
+ description: 'Get document types catalog',
667
+ inputSchema: {
668
+ type: 'object',
669
+ properties: {
670
+ type: { type: 'string', description: 'Document type filter (FV, RC, NC, FC, CC)' },
671
+ },
672
+ },
673
+ },
674
+ {
675
+ name: 'siigo_get_taxes',
676
+ description: 'Get taxes catalog',
677
+ inputSchema: { type: 'object', properties: {} },
678
+ },
679
+ {
680
+ name: 'siigo_get_payment_types',
681
+ description: 'Get payment types catalog',
682
+ inputSchema: {
683
+ type: 'object',
684
+ properties: {
685
+ document_type: { type: 'string', description: 'Document type filter' },
686
+ },
687
+ },
688
+ },
689
+ {
690
+ name: 'siigo_get_cost_centers',
691
+ description: 'Get cost centers catalog',
692
+ inputSchema: { type: 'object', properties: {} },
693
+ },
694
+ {
695
+ name: 'siigo_get_users',
696
+ description: 'Get users catalog',
697
+ inputSchema: { type: 'object', properties: {} },
698
+ },
699
+ {
700
+ name: 'siigo_get_warehouses',
701
+ description: 'Get warehouses catalog',
702
+ inputSchema: { type: 'object', properties: {} },
703
+ },
704
+ {
705
+ name: 'siigo_get_price_lists',
706
+ description: 'Get price lists catalog',
707
+ inputSchema: { type: 'object', properties: {} },
708
+ },
709
+ {
710
+ name: 'siigo_get_account_groups',
711
+ description: 'Get account groups catalog',
712
+ inputSchema: { type: 'object', properties: {} },
713
+ },
714
+ {
715
+ name: 'siigo_get_cities',
716
+ description: 'Get cities catalog',
717
+ inputSchema: { type: 'object', properties: {} },
718
+ },
719
+ {
720
+ name: 'siigo_get_id_types',
721
+ description: 'Get ID types catalog',
722
+ inputSchema: { type: 'object', properties: {} },
723
+ },
724
+ {
725
+ name: 'siigo_get_fiscal_responsibilities',
726
+ description: 'Get fiscal responsibilities catalog',
727
+ inputSchema: { type: 'object', properties: {} },
728
+ },
729
+ // Reports
730
+ {
731
+ name: 'siigo_get_trial_balance',
732
+ description: 'Get trial balance report',
733
+ inputSchema: {
734
+ type: 'object',
735
+ properties: {
736
+ account_start: { type: 'string', description: 'Starting account code' },
737
+ account_end: { type: 'string', description: 'Ending account code' },
738
+ year: { type: 'number', description: 'Year' },
739
+ month_start: { type: 'number', description: 'Starting month (1-13)' },
740
+ month_end: { type: 'number', description: 'Ending month (1-13)' },
741
+ includes_tax_difference: { type: 'boolean', description: 'Include tax differences' },
742
+ },
743
+ required: ['year', 'month_start', 'month_end', 'includes_tax_difference'],
744
+ },
745
+ },
746
+ {
747
+ name: 'siigo_get_trial_balance_by_third',
748
+ description: 'Get trial balance by third party report',
749
+ inputSchema: {
750
+ type: 'object',
751
+ properties: {
752
+ account_start: { type: 'string', description: 'Starting account code' },
753
+ account_end: { type: 'string', description: 'Ending account code' },
754
+ year: { type: 'number', description: 'Year' },
755
+ month_start: { type: 'number', description: 'Starting month (1-13)' },
756
+ month_end: { type: 'number', description: 'Ending month (1-13)' },
757
+ includes_tax_difference: { type: 'boolean', description: 'Include tax differences' },
758
+ customer: { type: 'object', description: 'Customer filter' },
759
+ },
760
+ required: ['year', 'month_start', 'month_end', 'includes_tax_difference'],
761
+ },
762
+ },
763
+ {
764
+ name: 'siigo_get_accounts_payable',
765
+ description: 'Get accounts payable report',
766
+ inputSchema: {
767
+ type: 'object',
768
+ properties: {
769
+ page: { type: 'number', description: 'Page number' },
770
+ page_size: { type: 'number', description: 'Number of items per page' },
771
+ },
772
+ },
773
+ },
774
+ ];
775
+ }
776
+ // Handler methods
777
+ async handleGetProducts(args) {
778
+ const result = await this.siigoClient.getProducts(args);
779
+ return {
780
+ content: [
781
+ {
782
+ type: 'text',
783
+ text: JSON.stringify(result, null, 2),
784
+ },
785
+ ],
786
+ };
787
+ }
788
+ async handleGetProduct(args) {
789
+ const result = await this.siigoClient.getProduct(args.id);
790
+ return {
791
+ content: [
792
+ {
793
+ type: 'text',
794
+ text: JSON.stringify(result, null, 2),
795
+ },
796
+ ],
797
+ };
798
+ }
799
+ async handleCreateProduct(args) {
800
+ const result = await this.siigoClient.createProduct(args.product);
801
+ return {
802
+ content: [
803
+ {
804
+ type: 'text',
805
+ text: JSON.stringify(result, null, 2),
806
+ },
807
+ ],
808
+ };
809
+ }
810
+ async handleUpdateProduct(args) {
811
+ const result = await this.siigoClient.updateProduct(args.id, args.product);
812
+ return {
813
+ content: [
814
+ {
815
+ type: 'text',
816
+ text: JSON.stringify(result, null, 2),
817
+ },
818
+ ],
819
+ };
820
+ }
821
+ async handleDeleteProduct(args) {
822
+ const result = await this.siigoClient.deleteProduct(args.id);
823
+ return {
824
+ content: [
825
+ {
826
+ type: 'text',
827
+ text: JSON.stringify(result, null, 2),
828
+ },
829
+ ],
830
+ };
831
+ }
832
+ async handleGetCustomers(args) {
833
+ const result = await this.siigoClient.getCustomers(args);
834
+ return {
835
+ content: [
836
+ {
837
+ type: 'text',
838
+ text: JSON.stringify(result, null, 2),
839
+ },
840
+ ],
841
+ };
842
+ }
843
+ async handleGetCustomer(args) {
844
+ const result = await this.siigoClient.getCustomer(args.id);
845
+ return {
846
+ content: [
847
+ {
848
+ type: 'text',
849
+ text: JSON.stringify(result, null, 2),
850
+ },
851
+ ],
852
+ };
853
+ }
854
+ async handleCreateCustomer(args) {
855
+ const result = await this.siigoClient.createCustomer(args.customer);
856
+ return {
857
+ content: [
858
+ {
859
+ type: 'text',
860
+ text: JSON.stringify(result, null, 2),
861
+ },
862
+ ],
863
+ };
864
+ }
865
+ async handleUpdateCustomer(args) {
866
+ const result = await this.siigoClient.updateCustomer(args.id, args.customer);
867
+ return {
868
+ content: [
869
+ {
870
+ type: 'text',
871
+ text: JSON.stringify(result, null, 2),
872
+ },
873
+ ],
874
+ };
875
+ }
876
+ async handleGetInvoices(args) {
877
+ const result = await this.siigoClient.getInvoices(args);
878
+ return {
879
+ content: [
880
+ {
881
+ type: 'text',
882
+ text: JSON.stringify(result, null, 2),
883
+ },
884
+ ],
885
+ };
886
+ }
887
+ async handleGetInvoice(args) {
888
+ const result = await this.siigoClient.getInvoice(args.id);
889
+ return {
890
+ content: [
891
+ {
892
+ type: 'text',
893
+ text: JSON.stringify(result, null, 2),
894
+ },
895
+ ],
896
+ };
897
+ }
898
+ async handleCreateInvoice(args) {
899
+ const result = await this.siigoClient.createInvoice(args.invoice);
900
+ return {
901
+ content: [
902
+ {
903
+ type: 'text',
904
+ text: JSON.stringify(result, null, 2),
905
+ },
906
+ ],
907
+ };
908
+ }
909
+ async handleUpdateInvoice(args) {
910
+ const result = await this.siigoClient.updateInvoice(args.id, args.invoice);
911
+ return {
912
+ content: [
913
+ {
914
+ type: 'text',
915
+ text: JSON.stringify(result, null, 2),
916
+ },
917
+ ],
918
+ };
919
+ }
920
+ async handleDeleteInvoice(args) {
921
+ const result = await this.siigoClient.deleteInvoice(args.id);
922
+ return {
923
+ content: [
924
+ {
925
+ type: 'text',
926
+ text: JSON.stringify(result, null, 2),
927
+ },
928
+ ],
929
+ };
930
+ }
931
+ async handleGetInvoicePdf(args) {
932
+ const result = await this.siigoClient.getInvoicePdf(args.id);
933
+ return {
934
+ content: [
935
+ {
936
+ type: 'text',
937
+ text: JSON.stringify(result, null, 2),
938
+ },
939
+ ],
940
+ };
941
+ }
942
+ async handleSendInvoiceEmail(args) {
943
+ const { id, mail_to, copy_to } = args;
944
+ const result = await this.siigoClient.sendInvoiceByEmail(id, { mail_to, copy_to });
945
+ return {
946
+ content: [
947
+ {
948
+ type: 'text',
949
+ text: JSON.stringify(result, null, 2),
950
+ },
951
+ ],
952
+ };
953
+ }
954
+ // Add similar handlers for all other endpoints...
955
+ async handleGetCreditNotes(args) {
956
+ const result = await this.siigoClient.getCreditNotes(args);
957
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
958
+ }
959
+ async handleGetCreditNote(args) {
960
+ const result = await this.siigoClient.getCreditNote(args.id);
961
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
962
+ }
963
+ async handleCreateCreditNote(args) {
964
+ const result = await this.siigoClient.createCreditNote(args.creditNote);
965
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
966
+ }
967
+ async handleGetVouchers(args) {
968
+ const result = await this.siigoClient.getVouchers(args);
969
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
970
+ }
971
+ async handleGetVoucher(args) {
972
+ const result = await this.siigoClient.getVoucher(args.id);
973
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
974
+ }
975
+ async handleCreateVoucher(args) {
976
+ const result = await this.siigoClient.createVoucher(args.voucher);
977
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
978
+ }
979
+ async handleGetPurchases(args) {
980
+ const result = await this.siigoClient.getPurchases(args);
981
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
982
+ }
983
+ async handleGetPurchase(args) {
984
+ const result = await this.siigoClient.getPurchase(args.id);
985
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
986
+ }
987
+ async handleCreatePurchase(args) {
988
+ const result = await this.siigoClient.createPurchase(args.purchase);
989
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
990
+ }
991
+ async handleUpdatePurchase(args) {
992
+ const result = await this.siigoClient.updatePurchase(args.id, args.purchase);
993
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
994
+ }
995
+ async handleDeletePurchase(args) {
996
+ const result = await this.siigoClient.deletePurchase(args.id);
997
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
998
+ }
999
+ async handleGetPaymentReceipts(args) {
1000
+ const result = await this.siigoClient.getPaymentReceipts(args);
1001
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1002
+ }
1003
+ async handleGetPaymentReceipt(args) {
1004
+ const result = await this.siigoClient.getPaymentReceipt(args.id);
1005
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1006
+ }
1007
+ async handleCreatePaymentReceipt(args) {
1008
+ const result = await this.siigoClient.createPaymentReceipt(args.paymentReceipt);
1009
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1010
+ }
1011
+ async handleUpdatePaymentReceipt(args) {
1012
+ const result = await this.siigoClient.updatePaymentReceipt(args.id, args.paymentReceipt);
1013
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1014
+ }
1015
+ async handleDeletePaymentReceipt(args) {
1016
+ const result = await this.siigoClient.deletePaymentReceipt(args.id);
1017
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1018
+ }
1019
+ async handleGetJournals(args) {
1020
+ const result = await this.siigoClient.getJournals(args);
1021
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1022
+ }
1023
+ async handleGetJournal(args) {
1024
+ const result = await this.siigoClient.getJournal(args.id);
1025
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1026
+ }
1027
+ async handleCreateJournal(args) {
1028
+ const result = await this.siigoClient.createJournal(args.journal);
1029
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1030
+ }
1031
+ async handleGetDocumentTypes(args) {
1032
+ const result = await this.siigoClient.getDocumentTypes(args.type);
1033
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1034
+ }
1035
+ async handleGetTaxes(args) {
1036
+ const result = await this.siigoClient.getTaxes();
1037
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1038
+ }
1039
+ async handleGetPaymentTypes(args) {
1040
+ const result = await this.siigoClient.getPaymentTypes(args.document_type);
1041
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1042
+ }
1043
+ async handleGetCostCenters(args) {
1044
+ const result = await this.siigoClient.getCostCenters();
1045
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1046
+ }
1047
+ async handleGetUsers(args) {
1048
+ const result = await this.siigoClient.getUsers();
1049
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1050
+ }
1051
+ async handleGetWarehouses(args) {
1052
+ const result = await this.siigoClient.getWarehouses();
1053
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1054
+ }
1055
+ async handleGetPriceLists(args) {
1056
+ const result = await this.siigoClient.getPriceLists();
1057
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1058
+ }
1059
+ async handleGetAccountGroups(args) {
1060
+ const result = await this.siigoClient.getAccountGroups();
1061
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1062
+ }
1063
+ async handleGetCities(args) {
1064
+ const result = await this.siigoClient.getCities();
1065
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1066
+ }
1067
+ async handleGetIdTypes(args) {
1068
+ const result = await this.siigoClient.getIdTypes();
1069
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1070
+ }
1071
+ async handleGetFiscalResponsibilities(args) {
1072
+ const result = await this.siigoClient.getFiscalResponsibilities();
1073
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1074
+ }
1075
+ async handleGetTrialBalance(args) {
1076
+ const result = await this.siigoClient.getTrialBalance(args);
1077
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1078
+ }
1079
+ async handleGetTrialBalanceByThird(args) {
1080
+ const result = await this.siigoClient.getTrialBalanceByThird(args);
1081
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1082
+ }
1083
+ async handleGetAccountsPayable(args) {
1084
+ const result = await this.siigoClient.getAccountsPayable(args);
1085
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
1086
+ }
1087
+ async run() {
1088
+ const transport = new stdio_js_1.StdioServerTransport();
1089
+ await this.server.connect(transport);
1090
+ }
1091
+ }
1092
+ const server = new SiigoMCPServer();
1093
+ server.run().catch(console.error);
1094
+ //# sourceMappingURL=index.js.map