@codespar/mcp-colppy 0.1.0 → 0.2.0-alpha.1
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 +10 -8
- package/dist/index.js +288 -10
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,14 +3,16 @@
|
|
|
3
3
|
* MCP Server for Colppy — Argentine cloud accounting + AFIP invoicing.
|
|
4
4
|
*
|
|
5
5
|
* Tools:
|
|
6
|
-
* - list_customers
|
|
7
|
-
* -
|
|
8
|
-
* - list_products
|
|
9
|
-
* -
|
|
10
|
-
* - list_invoices
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
6
|
+
* - list_customers / create_customer / update_customer / delete_customer / get_customer_balance
|
|
7
|
+
* - list_suppliers / create_supplier
|
|
8
|
+
* - list_products / update_product / get_stock
|
|
9
|
+
* - list_warehouses
|
|
10
|
+
* - create_invoice / list_invoices / cancel_invoice / get_invoice_pdf
|
|
11
|
+
* - create_receipt / list_receipts
|
|
12
|
+
* - create_payment
|
|
13
|
+
* - get_balance / list_accounts
|
|
14
|
+
* - list_companies
|
|
15
|
+
* - sales_report / expenses_report
|
|
14
16
|
*
|
|
15
17
|
* Environment:
|
|
16
18
|
* COLPPY_API_KEY — API key
|
package/dist/index.js
CHANGED
|
@@ -3,14 +3,16 @@
|
|
|
3
3
|
* MCP Server for Colppy — Argentine cloud accounting + AFIP invoicing.
|
|
4
4
|
*
|
|
5
5
|
* Tools:
|
|
6
|
-
* - list_customers
|
|
7
|
-
* -
|
|
8
|
-
* - list_products
|
|
9
|
-
* -
|
|
10
|
-
* - list_invoices
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
6
|
+
* - list_customers / create_customer / update_customer / delete_customer / get_customer_balance
|
|
7
|
+
* - list_suppliers / create_supplier
|
|
8
|
+
* - list_products / update_product / get_stock
|
|
9
|
+
* - list_warehouses
|
|
10
|
+
* - create_invoice / list_invoices / cancel_invoice / get_invoice_pdf
|
|
11
|
+
* - create_receipt / list_receipts
|
|
12
|
+
* - create_payment
|
|
13
|
+
* - get_balance / list_accounts
|
|
14
|
+
* - list_companies
|
|
15
|
+
* - sales_report / expenses_report
|
|
14
16
|
*
|
|
15
17
|
* Environment:
|
|
16
18
|
* COLPPY_API_KEY — API key
|
|
@@ -45,7 +47,7 @@ async function colppyRequest(service, operation, params) {
|
|
|
45
47
|
}
|
|
46
48
|
return res.json();
|
|
47
49
|
}
|
|
48
|
-
const server = new Server({ name: "mcp-colppy", version: "0.
|
|
50
|
+
const server = new Server({ name: "mcp-colppy", version: "0.2.0-alpha.1" }, { capabilities: { tools: {} } });
|
|
49
51
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
50
52
|
tools: [
|
|
51
53
|
{
|
|
@@ -168,6 +170,184 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
168
170
|
required: ["invoice_id", "amount", "payment_method"],
|
|
169
171
|
},
|
|
170
172
|
},
|
|
173
|
+
{
|
|
174
|
+
name: "update_customer",
|
|
175
|
+
description: "Update an existing customer's data",
|
|
176
|
+
inputSchema: {
|
|
177
|
+
type: "object",
|
|
178
|
+
properties: {
|
|
179
|
+
customer_id: { type: "string", description: "Customer ID" },
|
|
180
|
+
name: { type: "string", description: "Customer name or business name" },
|
|
181
|
+
email: { type: "string", description: "Email address" },
|
|
182
|
+
phone: { type: "string", description: "Phone number" },
|
|
183
|
+
address: { type: "string", description: "Street address" },
|
|
184
|
+
tax_category: { type: "string", description: "Tax category (RI, Monotributo, Exento, ConsumidorFinal)" },
|
|
185
|
+
},
|
|
186
|
+
required: ["customer_id"],
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: "delete_customer",
|
|
191
|
+
description: "Delete a customer",
|
|
192
|
+
inputSchema: {
|
|
193
|
+
type: "object",
|
|
194
|
+
properties: {
|
|
195
|
+
customer_id: { type: "string", description: "Customer ID" },
|
|
196
|
+
},
|
|
197
|
+
required: ["customer_id"],
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: "get_customer_balance",
|
|
202
|
+
description: "Get the current account balance (cuenta corriente) for a customer",
|
|
203
|
+
inputSchema: {
|
|
204
|
+
type: "object",
|
|
205
|
+
properties: {
|
|
206
|
+
customer_id: { type: "string", description: "Customer ID" },
|
|
207
|
+
date: { type: "string", description: "As-of date (YYYY-MM-DD)" },
|
|
208
|
+
},
|
|
209
|
+
required: ["customer_id"],
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: "list_suppliers",
|
|
214
|
+
description: "List suppliers (proveedores)",
|
|
215
|
+
inputSchema: {
|
|
216
|
+
type: "object",
|
|
217
|
+
properties: {
|
|
218
|
+
filter: { type: "string", description: "Search filter (name or tax ID)" },
|
|
219
|
+
offset: { type: "number", description: "Pagination offset" },
|
|
220
|
+
limit: { type: "number", description: "Results limit" },
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: "create_supplier",
|
|
226
|
+
description: "Create a supplier (proveedor)",
|
|
227
|
+
inputSchema: {
|
|
228
|
+
type: "object",
|
|
229
|
+
properties: {
|
|
230
|
+
name: { type: "string", description: "Supplier name or business name" },
|
|
231
|
+
tax_id: { type: "string", description: "CUIT number" },
|
|
232
|
+
tax_category: { type: "string", description: "Tax category (RI, Monotributo, Exento)" },
|
|
233
|
+
email: { type: "string", description: "Email address" },
|
|
234
|
+
phone: { type: "string", description: "Phone number" },
|
|
235
|
+
address: { type: "string", description: "Street address" },
|
|
236
|
+
},
|
|
237
|
+
required: ["name", "tax_id"],
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
name: "cancel_invoice",
|
|
242
|
+
description: "Cancel/void an invoice (anular comprobante)",
|
|
243
|
+
inputSchema: {
|
|
244
|
+
type: "object",
|
|
245
|
+
properties: {
|
|
246
|
+
invoice_id: { type: "string", description: "Invoice ID" },
|
|
247
|
+
reason: { type: "string", description: "Cancellation reason" },
|
|
248
|
+
},
|
|
249
|
+
required: ["invoice_id"],
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
name: "get_invoice_pdf",
|
|
254
|
+
description: "Get the PDF representation of an invoice (returns URL or base64)",
|
|
255
|
+
inputSchema: {
|
|
256
|
+
type: "object",
|
|
257
|
+
properties: {
|
|
258
|
+
invoice_id: { type: "string", description: "Invoice ID" },
|
|
259
|
+
},
|
|
260
|
+
required: ["invoice_id"],
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
name: "create_receipt",
|
|
265
|
+
description: "Create a receipt (recibo) — record cash/transfer received against one or more invoices",
|
|
266
|
+
inputSchema: {
|
|
267
|
+
type: "object",
|
|
268
|
+
properties: {
|
|
269
|
+
customer_id: { type: "string", description: "Customer ID" },
|
|
270
|
+
date: { type: "string", description: "Receipt date (YYYY-MM-DD)" },
|
|
271
|
+
amount: { type: "number", description: "Total receipt amount" },
|
|
272
|
+
payment_method: { type: "string", description: "Payment method (cash, bank_transfer, check, card)" },
|
|
273
|
+
invoice_ids: {
|
|
274
|
+
type: "array",
|
|
275
|
+
description: "Invoice IDs being paid",
|
|
276
|
+
items: { type: "string" },
|
|
277
|
+
},
|
|
278
|
+
reference: { type: "string", description: "Receipt reference" },
|
|
279
|
+
},
|
|
280
|
+
required: ["customer_id", "amount", "payment_method"],
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
name: "list_receipts",
|
|
285
|
+
description: "List receipts (recibos)",
|
|
286
|
+
inputSchema: {
|
|
287
|
+
type: "object",
|
|
288
|
+
properties: {
|
|
289
|
+
date_from: { type: "string", description: "Start date (YYYY-MM-DD)" },
|
|
290
|
+
date_to: { type: "string", description: "End date (YYYY-MM-DD)" },
|
|
291
|
+
customer_id: { type: "string", description: "Filter by customer" },
|
|
292
|
+
offset: { type: "number", description: "Pagination offset" },
|
|
293
|
+
limit: { type: "number", description: "Results limit" },
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
name: "get_stock",
|
|
299
|
+
description: "Get current stock for a product across warehouses",
|
|
300
|
+
inputSchema: {
|
|
301
|
+
type: "object",
|
|
302
|
+
properties: {
|
|
303
|
+
product_id: { type: "string", description: "Product ID" },
|
|
304
|
+
warehouse_id: { type: "string", description: "Optional warehouse (depósito) ID filter" },
|
|
305
|
+
},
|
|
306
|
+
required: ["product_id"],
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
name: "list_warehouses",
|
|
311
|
+
description: "List warehouses (depósitos)",
|
|
312
|
+
inputSchema: {
|
|
313
|
+
type: "object",
|
|
314
|
+
properties: {},
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
name: "list_companies",
|
|
319
|
+
description: "List companies (empresas) accessible to the current API user",
|
|
320
|
+
inputSchema: {
|
|
321
|
+
type: "object",
|
|
322
|
+
properties: {},
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
name: "sales_report",
|
|
327
|
+
description: "Sales report by date range",
|
|
328
|
+
inputSchema: {
|
|
329
|
+
type: "object",
|
|
330
|
+
properties: {
|
|
331
|
+
date_from: { type: "string", description: "Start date (YYYY-MM-DD)" },
|
|
332
|
+
date_to: { type: "string", description: "End date (YYYY-MM-DD)" },
|
|
333
|
+
customer_id: { type: "string", description: "Optional customer filter" },
|
|
334
|
+
},
|
|
335
|
+
required: ["date_from", "date_to"],
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
name: "expenses_report",
|
|
340
|
+
description: "Expenses/purchases report by date range",
|
|
341
|
+
inputSchema: {
|
|
342
|
+
type: "object",
|
|
343
|
+
properties: {
|
|
344
|
+
date_from: { type: "string", description: "Start date (YYYY-MM-DD)" },
|
|
345
|
+
date_to: { type: "string", description: "End date (YYYY-MM-DD)" },
|
|
346
|
+
supplier_id: { type: "string", description: "Optional supplier filter" },
|
|
347
|
+
},
|
|
348
|
+
required: ["date_from", "date_to"],
|
|
349
|
+
},
|
|
350
|
+
},
|
|
171
351
|
],
|
|
172
352
|
}));
|
|
173
353
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
@@ -248,6 +428,104 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
248
428
|
fecha: args?.date,
|
|
249
429
|
referencia: args?.reference,
|
|
250
430
|
}), null, 2) }] };
|
|
431
|
+
case "update_customer":
|
|
432
|
+
return { content: [{ type: "text", text: JSON.stringify(await colppyRequest("cliente", "modificar", {
|
|
433
|
+
idCliente: args?.customer_id,
|
|
434
|
+
razonSocial: args?.name,
|
|
435
|
+
email: args?.email,
|
|
436
|
+
telefono: args?.phone,
|
|
437
|
+
direccion: args?.address,
|
|
438
|
+
categoriaFiscal: args?.tax_category,
|
|
439
|
+
}), null, 2) }] };
|
|
440
|
+
case "delete_customer":
|
|
441
|
+
return { content: [{ type: "text", text: JSON.stringify(await colppyRequest("cliente", "eliminar", {
|
|
442
|
+
idCliente: args?.customer_id,
|
|
443
|
+
}), null, 2) }] };
|
|
444
|
+
case "get_customer_balance": {
|
|
445
|
+
const params = { idCliente: args?.customer_id };
|
|
446
|
+
if (args?.date)
|
|
447
|
+
params.fecha = args.date;
|
|
448
|
+
return { content: [{ type: "text", text: JSON.stringify(await colppyRequest("cliente", "saldo", params), null, 2) }] };
|
|
449
|
+
}
|
|
450
|
+
case "list_suppliers": {
|
|
451
|
+
const params = {};
|
|
452
|
+
if (args?.filter)
|
|
453
|
+
params.filter = args.filter;
|
|
454
|
+
if (args?.offset)
|
|
455
|
+
params.offset = args.offset;
|
|
456
|
+
if (args?.limit)
|
|
457
|
+
params.limit = args.limit;
|
|
458
|
+
return { content: [{ type: "text", text: JSON.stringify(await colppyRequest("proveedor", "listar", params), null, 2) }] };
|
|
459
|
+
}
|
|
460
|
+
case "create_supplier":
|
|
461
|
+
return { content: [{ type: "text", text: JSON.stringify(await colppyRequest("proveedor", "crear", {
|
|
462
|
+
razonSocial: args?.name,
|
|
463
|
+
cuit: args?.tax_id,
|
|
464
|
+
categoriaFiscal: args?.tax_category,
|
|
465
|
+
email: args?.email,
|
|
466
|
+
telefono: args?.phone,
|
|
467
|
+
direccion: args?.address,
|
|
468
|
+
}), null, 2) }] };
|
|
469
|
+
case "cancel_invoice":
|
|
470
|
+
return { content: [{ type: "text", text: JSON.stringify(await colppyRequest("factura", "anular", {
|
|
471
|
+
idFactura: args?.invoice_id,
|
|
472
|
+
motivo: args?.reason,
|
|
473
|
+
}), null, 2) }] };
|
|
474
|
+
case "get_invoice_pdf":
|
|
475
|
+
return { content: [{ type: "text", text: JSON.stringify(await colppyRequest("factura", "obtenerPDF", {
|
|
476
|
+
idFactura: args?.invoice_id,
|
|
477
|
+
}), null, 2) }] };
|
|
478
|
+
case "create_receipt":
|
|
479
|
+
return { content: [{ type: "text", text: JSON.stringify(await colppyRequest("recibo", "crear", {
|
|
480
|
+
idCliente: args?.customer_id,
|
|
481
|
+
fecha: args?.date,
|
|
482
|
+
monto: args?.amount,
|
|
483
|
+
metodoPago: args?.payment_method,
|
|
484
|
+
idsFactura: args?.invoice_ids,
|
|
485
|
+
referencia: args?.reference,
|
|
486
|
+
}), null, 2) }] };
|
|
487
|
+
case "list_receipts": {
|
|
488
|
+
const params = {};
|
|
489
|
+
if (args?.date_from)
|
|
490
|
+
params.fechaDesde = args.date_from;
|
|
491
|
+
if (args?.date_to)
|
|
492
|
+
params.fechaHasta = args.date_to;
|
|
493
|
+
if (args?.customer_id)
|
|
494
|
+
params.idCliente = args.customer_id;
|
|
495
|
+
if (args?.offset)
|
|
496
|
+
params.offset = args.offset;
|
|
497
|
+
if (args?.limit)
|
|
498
|
+
params.limit = args.limit;
|
|
499
|
+
return { content: [{ type: "text", text: JSON.stringify(await colppyRequest("recibo", "listar", params), null, 2) }] };
|
|
500
|
+
}
|
|
501
|
+
case "get_stock": {
|
|
502
|
+
const params = { idProducto: args?.product_id };
|
|
503
|
+
if (args?.warehouse_id)
|
|
504
|
+
params.idDeposito = args.warehouse_id;
|
|
505
|
+
return { content: [{ type: "text", text: JSON.stringify(await colppyRequest("inventario", "stock", params), null, 2) }] };
|
|
506
|
+
}
|
|
507
|
+
case "list_warehouses":
|
|
508
|
+
return { content: [{ type: "text", text: JSON.stringify(await colppyRequest("deposito", "listar", {}), null, 2) }] };
|
|
509
|
+
case "list_companies":
|
|
510
|
+
return { content: [{ type: "text", text: JSON.stringify(await colppyRequest("empresa", "listar", {}), null, 2) }] };
|
|
511
|
+
case "sales_report": {
|
|
512
|
+
const params = {
|
|
513
|
+
fechaDesde: args?.date_from,
|
|
514
|
+
fechaHasta: args?.date_to,
|
|
515
|
+
};
|
|
516
|
+
if (args?.customer_id)
|
|
517
|
+
params.idCliente = args.customer_id;
|
|
518
|
+
return { content: [{ type: "text", text: JSON.stringify(await colppyRequest("reporte", "ventas", params), null, 2) }] };
|
|
519
|
+
}
|
|
520
|
+
case "expenses_report": {
|
|
521
|
+
const params = {
|
|
522
|
+
fechaDesde: args?.date_from,
|
|
523
|
+
fechaHasta: args?.date_to,
|
|
524
|
+
};
|
|
525
|
+
if (args?.supplier_id)
|
|
526
|
+
params.idProveedor = args.supplier_id;
|
|
527
|
+
return { content: [{ type: "text", text: JSON.stringify(await colppyRequest("reporte", "compras", params), null, 2) }] };
|
|
528
|
+
}
|
|
251
529
|
default:
|
|
252
530
|
return { content: [{ type: "text", text: `Unknown tool: ${name}` }], isError: true };
|
|
253
531
|
}
|
|
@@ -274,7 +552,7 @@ async function main() {
|
|
|
274
552
|
const t = new StreamableHTTPServerTransport({ sessionIdGenerator: () => randomUUID(), onsessioninitialized: (id) => { transports.set(id, t); } });
|
|
275
553
|
t.onclose = () => { if (t.sessionId)
|
|
276
554
|
transports.delete(t.sessionId); };
|
|
277
|
-
const s = new Server({ name: "mcp-colppy", version: "0.
|
|
555
|
+
const s = new Server({ name: "mcp-colppy", version: "0.2.0-alpha.1" }, { capabilities: { tools: {} } });
|
|
278
556
|
server._requestHandlers.forEach((v, k) => s._requestHandlers.set(k, v));
|
|
279
557
|
server._notificationHandlers?.forEach((v, k) => s._notificationHandlers.set(k, v));
|
|
280
558
|
await s.connect(t);
|