@codespar/mcp-siigo 0.1.0 → 0.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/dist/index.d.ts CHANGED
@@ -6,11 +6,23 @@
6
6
  * - create_invoice: Create an invoice (DIAN electronic invoice)
7
7
  * - get_invoice: Get invoice by ID
8
8
  * - list_invoices: List invoices
9
+ * - get_invoice_pdf: Get the PDF for an invoice
9
10
  * - create_credit_note: Create a credit note
11
+ * - get_credit_note: Get credit note by ID
12
+ * - list_credit_notes: List credit notes
10
13
  * - list_customers: List customers
11
14
  * - create_customer: Create a customer
15
+ * - update_customer: Update an existing customer
16
+ * - delete_customer: Delete a customer
12
17
  * - list_products: List products
13
18
  * - create_product: Create a product
19
+ * - update_product: Update an existing product
20
+ * - delete_product: Delete a product
21
+ * - create_purchase: Create a purchase document
22
+ * - list_purchases: List purchase documents
23
+ * - list_document_types: List document types (by document type)
24
+ * - list_users: List Siigo users
25
+ * - list_warehouses: List warehouses (bodegas)
14
26
  * - list_taxes: List available tax types
15
27
  * - list_payment_methods: List payment methods
16
28
  *
package/dist/index.js CHANGED
@@ -6,11 +6,23 @@
6
6
  * - create_invoice: Create an invoice (DIAN electronic invoice)
7
7
  * - get_invoice: Get invoice by ID
8
8
  * - list_invoices: List invoices
9
+ * - get_invoice_pdf: Get the PDF for an invoice
9
10
  * - create_credit_note: Create a credit note
11
+ * - get_credit_note: Get credit note by ID
12
+ * - list_credit_notes: List credit notes
10
13
  * - list_customers: List customers
11
14
  * - create_customer: Create a customer
15
+ * - update_customer: Update an existing customer
16
+ * - delete_customer: Delete a customer
12
17
  * - list_products: List products
13
18
  * - create_product: Create a product
19
+ * - update_product: Update an existing product
20
+ * - delete_product: Delete a product
21
+ * - create_purchase: Create a purchase document
22
+ * - list_purchases: List purchase documents
23
+ * - list_document_types: List document types (by document type)
24
+ * - list_users: List Siigo users
25
+ * - list_warehouses: List warehouses (bodegas)
14
26
  * - list_taxes: List available tax types
15
27
  * - list_payment_methods: List payment methods
16
28
  *
@@ -42,7 +54,7 @@ async function siigoRequest(method, path, body) {
42
54
  }
43
55
  return res.json();
44
56
  }
45
- const server = new Server({ name: "mcp-siigo", version: "0.1.0" }, { capabilities: { tools: {} } });
57
+ const server = new Server({ name: "mcp-siigo", version: "0.2.0" }, { capabilities: { tools: {} } });
46
58
  server.setRequestHandler(ListToolsRequestSchema, async () => ({
47
59
  tools: [
48
60
  {
@@ -267,6 +279,226 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
267
279
  required: ["code", "name"],
268
280
  },
269
281
  },
282
+ {
283
+ name: "get_invoice_pdf",
284
+ description: "Get the PDF document for an invoice",
285
+ inputSchema: {
286
+ type: "object",
287
+ properties: { invoiceId: { type: "string", description: "Invoice ID" } },
288
+ required: ["invoiceId"],
289
+ },
290
+ },
291
+ {
292
+ name: "get_credit_note",
293
+ description: "Get a credit note by ID",
294
+ inputSchema: {
295
+ type: "object",
296
+ properties: { creditNoteId: { type: "string", description: "Credit note ID" } },
297
+ required: ["creditNoteId"],
298
+ },
299
+ },
300
+ {
301
+ name: "list_credit_notes",
302
+ description: "List credit notes",
303
+ inputSchema: {
304
+ type: "object",
305
+ properties: {
306
+ page: { type: "number", description: "Page number" },
307
+ page_size: { type: "number", description: "Page size (max 100)" },
308
+ date_start: { type: "string", description: "Start date (YYYY-MM-DD)" },
309
+ date_end: { type: "string", description: "End date (YYYY-MM-DD)" },
310
+ },
311
+ },
312
+ },
313
+ {
314
+ name: "update_customer",
315
+ description: "Update an existing customer",
316
+ inputSchema: {
317
+ type: "object",
318
+ properties: {
319
+ customerId: { type: "string", description: "Customer ID" },
320
+ commercial_name: { type: "string", description: "Commercial/business name" },
321
+ name: { type: "array", description: "Name array [first_name, last_name]", items: { type: "string" } },
322
+ contacts: {
323
+ type: "array",
324
+ description: "Contact info",
325
+ items: {
326
+ type: "object",
327
+ properties: {
328
+ first_name: { type: "string", description: "First name" },
329
+ last_name: { type: "string", description: "Last name" },
330
+ email: { type: "string", description: "Email" },
331
+ phone: { type: "string", description: "Phone" },
332
+ },
333
+ },
334
+ },
335
+ address: {
336
+ type: "object",
337
+ description: "Address",
338
+ properties: {
339
+ address: { type: "string", description: "Street address" },
340
+ city: { type: "object", properties: { country_code: { type: "string" }, state_code: { type: "string" }, city_code: { type: "string" } } },
341
+ },
342
+ },
343
+ },
344
+ required: ["customerId"],
345
+ },
346
+ },
347
+ {
348
+ name: "delete_customer",
349
+ description: "Delete a customer",
350
+ inputSchema: {
351
+ type: "object",
352
+ properties: { customerId: { type: "string", description: "Customer ID" } },
353
+ required: ["customerId"],
354
+ },
355
+ },
356
+ {
357
+ name: "update_product",
358
+ description: "Update an existing product",
359
+ inputSchema: {
360
+ type: "object",
361
+ properties: {
362
+ productId: { type: "string", description: "Product ID" },
363
+ code: { type: "string", description: "Product code" },
364
+ name: { type: "string", description: "Product name" },
365
+ account_group: { type: "number", description: "Account group ID" },
366
+ type: { type: "string", description: "Product type (Product, Service)" },
367
+ stock_control: { type: "boolean", description: "Enable stock control" },
368
+ unit: { type: "string", description: "Unit of measure" },
369
+ taxes: {
370
+ type: "array",
371
+ description: "Tax configuration",
372
+ items: { type: "object", properties: { id: { type: "number", description: "Tax ID" } } },
373
+ },
374
+ prices: {
375
+ type: "array",
376
+ description: "Price list",
377
+ items: {
378
+ type: "object",
379
+ properties: {
380
+ currency_code: { type: "string", description: "Currency (COP)" },
381
+ price_list: { type: "array", items: { type: "object", properties: { position: { type: "number" }, value: { type: "number" } } } },
382
+ },
383
+ },
384
+ },
385
+ },
386
+ required: ["productId"],
387
+ },
388
+ },
389
+ {
390
+ name: "delete_product",
391
+ description: "Delete a product",
392
+ inputSchema: {
393
+ type: "object",
394
+ properties: { productId: { type: "string", description: "Product ID" } },
395
+ required: ["productId"],
396
+ },
397
+ },
398
+ {
399
+ name: "create_purchase",
400
+ description: "Create a purchase document",
401
+ inputSchema: {
402
+ type: "object",
403
+ properties: {
404
+ document: {
405
+ type: "object",
406
+ description: "Document type",
407
+ properties: { id: { type: "number", description: "Document type ID for purchases" } },
408
+ required: ["id"],
409
+ },
410
+ date: { type: "string", description: "Purchase date (YYYY-MM-DD)" },
411
+ supplier: {
412
+ type: "object",
413
+ description: "Supplier reference",
414
+ properties: { identification: { type: "string", description: "Supplier NIT or CC" } },
415
+ required: ["identification"],
416
+ },
417
+ cost_center: { type: "number", description: "Cost center ID" },
418
+ provider_invoice: {
419
+ type: "object",
420
+ description: "Provider invoice info",
421
+ properties: {
422
+ prefix: { type: "string", description: "Invoice prefix" },
423
+ number: { type: "string", description: "Invoice number" },
424
+ },
425
+ },
426
+ items: {
427
+ type: "array",
428
+ description: "Purchase items",
429
+ items: {
430
+ type: "object",
431
+ properties: {
432
+ code: { type: "string", description: "Product code" },
433
+ description: { type: "string", description: "Description" },
434
+ quantity: { type: "number", description: "Quantity" },
435
+ price: { type: "number", description: "Unit price" },
436
+ taxes: {
437
+ type: "array",
438
+ items: {
439
+ type: "object",
440
+ properties: { id: { type: "number" }, name: { type: "string" }, percentage: { type: "number" } },
441
+ },
442
+ },
443
+ },
444
+ required: ["code", "quantity", "price"],
445
+ },
446
+ },
447
+ payments: {
448
+ type: "array",
449
+ description: "Payment methods",
450
+ items: {
451
+ type: "object",
452
+ properties: {
453
+ id: { type: "number", description: "Payment method ID" },
454
+ value: { type: "number", description: "Payment amount" },
455
+ },
456
+ required: ["id", "value"],
457
+ },
458
+ },
459
+ },
460
+ required: ["document", "date", "supplier", "items", "payments"],
461
+ },
462
+ },
463
+ {
464
+ name: "list_purchases",
465
+ description: "List purchase documents",
466
+ inputSchema: {
467
+ type: "object",
468
+ properties: {
469
+ page: { type: "number", description: "Page number" },
470
+ page_size: { type: "number", description: "Page size (max 100)" },
471
+ date_start: { type: "string", description: "Start date (YYYY-MM-DD)" },
472
+ date_end: { type: "string", description: "End date (YYYY-MM-DD)" },
473
+ },
474
+ },
475
+ },
476
+ {
477
+ name: "list_document_types",
478
+ description: "List document types (e.g., FV for invoice, NC for credit note, FC for purchase)",
479
+ inputSchema: {
480
+ type: "object",
481
+ properties: {
482
+ type: { type: "string", description: "Document type code: FV (invoice), NC (credit note), FC (purchase), RC (receipt), etc." },
483
+ },
484
+ },
485
+ },
486
+ {
487
+ name: "list_users",
488
+ description: "List Siigo users (sellers)",
489
+ inputSchema: {
490
+ type: "object",
491
+ properties: {
492
+ page: { type: "number", description: "Page number" },
493
+ page_size: { type: "number", description: "Page size" },
494
+ },
495
+ },
496
+ },
497
+ {
498
+ name: "list_warehouses",
499
+ description: "List warehouses (bodegas)",
500
+ inputSchema: { type: "object", properties: {} },
501
+ },
270
502
  {
271
503
  name: "list_taxes",
272
504
  description: "List available tax types",
@@ -355,6 +587,84 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
355
587
  taxes: args?.taxes,
356
588
  prices: args?.prices,
357
589
  }), null, 2) }] };
590
+ case "get_invoice_pdf":
591
+ return { content: [{ type: "text", text: JSON.stringify(await siigoRequest("GET", `/invoices/${args?.invoiceId}/pdf`), null, 2) }] };
592
+ case "get_credit_note":
593
+ return { content: [{ type: "text", text: JSON.stringify(await siigoRequest("GET", `/credit-notes/${args?.creditNoteId}`), null, 2) }] };
594
+ case "list_credit_notes": {
595
+ const params = new URLSearchParams();
596
+ if (args?.page)
597
+ params.set("page", String(args.page));
598
+ if (args?.page_size)
599
+ params.set("page_size", String(args.page_size));
600
+ if (args?.date_start)
601
+ params.set("date_start", args.date_start);
602
+ if (args?.date_end)
603
+ params.set("date_end", args.date_end);
604
+ return { content: [{ type: "text", text: JSON.stringify(await siigoRequest("GET", `/credit-notes?${params}`), null, 2) }] };
605
+ }
606
+ case "update_customer":
607
+ return { content: [{ type: "text", text: JSON.stringify(await siigoRequest("PUT", `/customers/${args?.customerId}`, {
608
+ commercial_name: args?.commercial_name,
609
+ name: args?.name,
610
+ contacts: args?.contacts,
611
+ address: args?.address,
612
+ }), null, 2) }] };
613
+ case "delete_customer":
614
+ return { content: [{ type: "text", text: JSON.stringify(await siigoRequest("DELETE", `/customers/${args?.customerId}`), null, 2) }] };
615
+ case "update_product":
616
+ return { content: [{ type: "text", text: JSON.stringify(await siigoRequest("PUT", `/products/${args?.productId}`, {
617
+ code: args?.code,
618
+ name: args?.name,
619
+ account_group: args?.account_group,
620
+ type: args?.type,
621
+ stock_control: args?.stock_control,
622
+ unit: args?.unit,
623
+ taxes: args?.taxes,
624
+ prices: args?.prices,
625
+ }), null, 2) }] };
626
+ case "delete_product":
627
+ return { content: [{ type: "text", text: JSON.stringify(await siigoRequest("DELETE", `/products/${args?.productId}`), null, 2) }] };
628
+ case "create_purchase":
629
+ return { content: [{ type: "text", text: JSON.stringify(await siigoRequest("POST", "/purchases", {
630
+ document: args?.document,
631
+ date: args?.date,
632
+ supplier: args?.supplier,
633
+ cost_center: args?.cost_center,
634
+ provider_invoice: args?.provider_invoice,
635
+ items: args?.items,
636
+ payments: args?.payments,
637
+ }), null, 2) }] };
638
+ case "list_purchases": {
639
+ const params = new URLSearchParams();
640
+ if (args?.page)
641
+ params.set("page", String(args.page));
642
+ if (args?.page_size)
643
+ params.set("page_size", String(args.page_size));
644
+ if (args?.date_start)
645
+ params.set("date_start", args.date_start);
646
+ if (args?.date_end)
647
+ params.set("date_end", args.date_end);
648
+ return { content: [{ type: "text", text: JSON.stringify(await siigoRequest("GET", `/purchases?${params}`), null, 2) }] };
649
+ }
650
+ case "list_document_types": {
651
+ const params = new URLSearchParams();
652
+ if (args?.type)
653
+ params.set("type", args.type);
654
+ const qs = params.toString();
655
+ return { content: [{ type: "text", text: JSON.stringify(await siigoRequest("GET", qs ? `/document-types?${qs}` : "/document-types"), null, 2) }] };
656
+ }
657
+ case "list_users": {
658
+ const params = new URLSearchParams();
659
+ if (args?.page)
660
+ params.set("page", String(args.page));
661
+ if (args?.page_size)
662
+ params.set("page_size", String(args.page_size));
663
+ const qs = params.toString();
664
+ return { content: [{ type: "text", text: JSON.stringify(await siigoRequest("GET", qs ? `/users?${qs}` : "/users"), null, 2) }] };
665
+ }
666
+ case "list_warehouses":
667
+ return { content: [{ type: "text", text: JSON.stringify(await siigoRequest("GET", "/warehouses"), null, 2) }] };
358
668
  case "list_taxes":
359
669
  return { content: [{ type: "text", text: JSON.stringify(await siigoRequest("GET", "/taxes"), null, 2) }] };
360
670
  case "list_payment_methods":
@@ -385,7 +695,7 @@ async function main() {
385
695
  const t = new StreamableHTTPServerTransport({ sessionIdGenerator: () => randomUUID(), onsessioninitialized: (id) => { transports.set(id, t); } });
386
696
  t.onclose = () => { if (t.sessionId)
387
697
  transports.delete(t.sessionId); };
388
- const s = new Server({ name: "mcp-siigo", version: "0.1.0" }, { capabilities: { tools: {} } });
698
+ const s = new Server({ name: "mcp-siigo", version: "0.2.0" }, { capabilities: { tools: {} } });
389
699
  server._requestHandlers.forEach((v, k) => s._requestHandlers.set(k, v));
390
700
  server._notificationHandlers?.forEach((v, k) => s._notificationHandlers.set(k, v));
391
701
  await s.connect(t);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codespar/mcp-siigo",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "MCP server for Siigo — Colombian accounting + DIAN e-invoicing",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",