@codespar/mcp-andreani 0.1.0 → 0.2.0-alpha.2
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 +18 -5
- package/dist/index.d.ts +11 -1
- package/dist/index.js +246 -3
- package/package.json +13 -4
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# MCP Andreani
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
> **Alpha release** — published under the `alpha` npm dist-tag. Endpoint paths follow public docs and BACEN/provider conventions but have not been fully live-validated. Pin exact versions during `0.x.x-alpha`. Install with `npm install <pkg>@alpha`.
|
|
5
|
+
|
|
3
6
|
MCP server for **Andreani** — the largest Argentine courier and logistics company, providing domestic and international shipping services.
|
|
4
7
|
|
|
5
8
|
## Quick Start
|
|
@@ -27,18 +30,28 @@ npx tsx packages/argentina/andreani/src/index.ts --http
|
|
|
27
30
|
| `MCP_HTTP` | No | Set to `"true"` to enable HTTP transport |
|
|
28
31
|
| `MCP_PORT` | No | HTTP port (default: 3000) |
|
|
29
32
|
|
|
30
|
-
## Tools
|
|
33
|
+
## Tools (18)
|
|
31
34
|
|
|
32
|
-
| Tool |
|
|
33
|
-
|
|
35
|
+
| Tool | Purpose |
|
|
36
|
+
|---|---|
|
|
34
37
|
| `create_shipment` | Create a new shipment |
|
|
35
38
|
| `get_shipment` | Get shipment details by ID |
|
|
36
39
|
| `track_shipment` | Track a shipment by tracking number |
|
|
37
40
|
| `get_rates` | Get shipping rates/quotes |
|
|
38
41
|
| `list_branches` | List Andreani branches/sucursales |
|
|
39
|
-
| `create_label` | Generate a shipping label |
|
|
40
|
-
| `get_tracking_history` | Get full tracking history |
|
|
42
|
+
| `create_label` | Generate a shipping label for a shipment |
|
|
43
|
+
| `get_tracking_history` | Get full tracking history for a shipment |
|
|
41
44
|
| `cancel_shipment` | Cancel a shipment |
|
|
45
|
+
| `get_label_pdf` | Download a shipping label as PDF (base64-encoded) |
|
|
46
|
+
| `list_tracking_by_date` | List tracking events for a contract within a date range |
|
|
47
|
+
| `validate_postal_code` | Validate CP coverage and list available services for a postal code |
|
|
48
|
+
| `create_pickup` | Create a pickup/collection request (retiro) |
|
|
49
|
+
| `list_pickups` | List pickup/collection requests |
|
|
50
|
+
| `cancel_pickup` | Cancel a pickup/collection request |
|
|
51
|
+
| `create_return` | Create a reverse logistics shipment (logística inversa / devolución) |
|
|
52
|
+
| `list_returns` | List reverse logistics shipments (returns) |
|
|
53
|
+
| `list_products` | List contracted products/services available on the account |
|
|
54
|
+
| `get_invoice` | Get billing/invoice details |
|
|
42
55
|
|
|
43
56
|
## Auth
|
|
44
57
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,15 +2,25 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* MCP Server for Andreani — largest Argentine courier/logistics provider.
|
|
4
4
|
*
|
|
5
|
-
* Tools:
|
|
5
|
+
* Tools (18):
|
|
6
6
|
* - create_shipment: Create a new shipment
|
|
7
7
|
* - get_shipment: Get shipment details by ID
|
|
8
8
|
* - track_shipment: Track a shipment by tracking number
|
|
9
9
|
* - get_rates: Get shipping rates/quotes
|
|
10
10
|
* - list_branches: List Andreani branches/sucursales
|
|
11
11
|
* - create_label: Generate a shipping label
|
|
12
|
+
* - get_label_pdf: Download label as PDF (base64)
|
|
12
13
|
* - get_tracking_history: Get full tracking history
|
|
14
|
+
* - list_tracking_by_date: List tracking events for a date range
|
|
13
15
|
* - cancel_shipment: Cancel a shipment
|
|
16
|
+
* - validate_postal_code: Validate CP coverage and list available services
|
|
17
|
+
* - create_pickup: Create a pickup/collection request
|
|
18
|
+
* - list_pickups: List pickup requests
|
|
19
|
+
* - cancel_pickup: Cancel a pickup request
|
|
20
|
+
* - create_return: Create a reverse logistics shipment (return)
|
|
21
|
+
* - list_returns: List return shipments
|
|
22
|
+
* - list_products: List contracted products/services
|
|
23
|
+
* - get_invoice: Get billing/invoice details
|
|
14
24
|
*
|
|
15
25
|
* Environment:
|
|
16
26
|
* ANDREANI_API_KEY — API key
|
package/dist/index.js
CHANGED
|
@@ -2,15 +2,25 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* MCP Server for Andreani — largest Argentine courier/logistics provider.
|
|
4
4
|
*
|
|
5
|
-
* Tools:
|
|
5
|
+
* Tools (18):
|
|
6
6
|
* - create_shipment: Create a new shipment
|
|
7
7
|
* - get_shipment: Get shipment details by ID
|
|
8
8
|
* - track_shipment: Track a shipment by tracking number
|
|
9
9
|
* - get_rates: Get shipping rates/quotes
|
|
10
10
|
* - list_branches: List Andreani branches/sucursales
|
|
11
11
|
* - create_label: Generate a shipping label
|
|
12
|
+
* - get_label_pdf: Download label as PDF (base64)
|
|
12
13
|
* - get_tracking_history: Get full tracking history
|
|
14
|
+
* - list_tracking_by_date: List tracking events for a date range
|
|
13
15
|
* - cancel_shipment: Cancel a shipment
|
|
16
|
+
* - validate_postal_code: Validate CP coverage and list available services
|
|
17
|
+
* - create_pickup: Create a pickup/collection request
|
|
18
|
+
* - list_pickups: List pickup requests
|
|
19
|
+
* - cancel_pickup: Cancel a pickup request
|
|
20
|
+
* - create_return: Create a reverse logistics shipment (return)
|
|
21
|
+
* - list_returns: List return shipments
|
|
22
|
+
* - list_products: List contracted products/services
|
|
23
|
+
* - get_invoice: Get billing/invoice details
|
|
14
24
|
*
|
|
15
25
|
* Environment:
|
|
16
26
|
* ANDREANI_API_KEY — API key
|
|
@@ -62,7 +72,7 @@ async function andreaniRequest(method, path, body) {
|
|
|
62
72
|
}
|
|
63
73
|
return res.json();
|
|
64
74
|
}
|
|
65
|
-
const server = new Server({ name: "mcp-andreani", version: "0.
|
|
75
|
+
const server = new Server({ name: "mcp-andreani", version: "0.2.0-alpha.2" }, { capabilities: { tools: {} } });
|
|
66
76
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
67
77
|
tools: [
|
|
68
78
|
{
|
|
@@ -188,6 +198,176 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
188
198
|
required: ["shipmentId"],
|
|
189
199
|
},
|
|
190
200
|
},
|
|
201
|
+
{
|
|
202
|
+
name: "get_label_pdf",
|
|
203
|
+
description: "Download a shipping label as PDF (base64-encoded)",
|
|
204
|
+
inputSchema: {
|
|
205
|
+
type: "object",
|
|
206
|
+
properties: { shipmentId: { type: "string", description: "Shipment ID" } },
|
|
207
|
+
required: ["shipmentId"],
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: "list_tracking_by_date",
|
|
212
|
+
description: "List tracking events for a contract within a date range",
|
|
213
|
+
inputSchema: {
|
|
214
|
+
type: "object",
|
|
215
|
+
properties: {
|
|
216
|
+
contract: { type: "string", description: "Contract/account number" },
|
|
217
|
+
from_date: { type: "string", description: "Start date (YYYY-MM-DD)" },
|
|
218
|
+
to_date: { type: "string", description: "End date (YYYY-MM-DD)" },
|
|
219
|
+
},
|
|
220
|
+
required: ["contract", "from_date", "to_date"],
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: "validate_postal_code",
|
|
225
|
+
description: "Validate CP coverage and list available services for a postal code",
|
|
226
|
+
inputSchema: {
|
|
227
|
+
type: "object",
|
|
228
|
+
properties: {
|
|
229
|
+
postal_code: { type: "string", description: "Argentine postal code" },
|
|
230
|
+
},
|
|
231
|
+
required: ["postal_code"],
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: "create_pickup",
|
|
236
|
+
description: "Create a pickup/collection request (retiro)",
|
|
237
|
+
inputSchema: {
|
|
238
|
+
type: "object",
|
|
239
|
+
properties: {
|
|
240
|
+
contract: { type: "string", description: "Contract number" },
|
|
241
|
+
pickup_date: { type: "string", description: "Pickup date (YYYY-MM-DD)" },
|
|
242
|
+
address: {
|
|
243
|
+
type: "object",
|
|
244
|
+
description: "Pickup address",
|
|
245
|
+
properties: {
|
|
246
|
+
postal_code: { type: "string" },
|
|
247
|
+
street: { type: "string" },
|
|
248
|
+
number: { type: "string" },
|
|
249
|
+
city: { type: "string" },
|
|
250
|
+
province: { type: "string" },
|
|
251
|
+
contact_name: { type: "string" },
|
|
252
|
+
contact_phone: { type: "string" },
|
|
253
|
+
},
|
|
254
|
+
required: ["postal_code", "contact_name"],
|
|
255
|
+
},
|
|
256
|
+
packages_count: { type: "number", description: "Number of packages to pick up" },
|
|
257
|
+
notes: { type: "string", description: "Additional notes" },
|
|
258
|
+
},
|
|
259
|
+
required: ["contract", "pickup_date", "address", "packages_count"],
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
name: "list_pickups",
|
|
264
|
+
description: "List pickup/collection requests",
|
|
265
|
+
inputSchema: {
|
|
266
|
+
type: "object",
|
|
267
|
+
properties: {
|
|
268
|
+
contract: { type: "string", description: "Filter by contract" },
|
|
269
|
+
from_date: { type: "string", description: "Filter from date (YYYY-MM-DD)" },
|
|
270
|
+
to_date: { type: "string", description: "Filter to date (YYYY-MM-DD)" },
|
|
271
|
+
status: { type: "string", description: "Filter by status" },
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
name: "cancel_pickup",
|
|
277
|
+
description: "Cancel a pickup/collection request",
|
|
278
|
+
inputSchema: {
|
|
279
|
+
type: "object",
|
|
280
|
+
properties: { pickupId: { type: "string", description: "Pickup request ID" } },
|
|
281
|
+
required: ["pickupId"],
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
name: "create_return",
|
|
286
|
+
description: "Create a reverse logistics shipment (logística inversa / devolución)",
|
|
287
|
+
inputSchema: {
|
|
288
|
+
type: "object",
|
|
289
|
+
properties: {
|
|
290
|
+
contract: { type: "string", description: "Contract number" },
|
|
291
|
+
original_shipment_id: { type: "string", description: "Original shipment ID being returned" },
|
|
292
|
+
origin: {
|
|
293
|
+
type: "object",
|
|
294
|
+
description: "Pickup address (where to collect from)",
|
|
295
|
+
properties: {
|
|
296
|
+
postal_code: { type: "string" },
|
|
297
|
+
street: { type: "string" },
|
|
298
|
+
number: { type: "string" },
|
|
299
|
+
city: { type: "string" },
|
|
300
|
+
province: { type: "string" },
|
|
301
|
+
contact_name: { type: "string" },
|
|
302
|
+
contact_phone: { type: "string" },
|
|
303
|
+
},
|
|
304
|
+
required: ["postal_code", "contact_name"],
|
|
305
|
+
},
|
|
306
|
+
destination: {
|
|
307
|
+
type: "object",
|
|
308
|
+
description: "Return destination address",
|
|
309
|
+
properties: {
|
|
310
|
+
postal_code: { type: "string" },
|
|
311
|
+
street: { type: "string" },
|
|
312
|
+
number: { type: "string" },
|
|
313
|
+
city: { type: "string" },
|
|
314
|
+
province: { type: "string" },
|
|
315
|
+
},
|
|
316
|
+
required: ["postal_code"],
|
|
317
|
+
},
|
|
318
|
+
packages: {
|
|
319
|
+
type: "array",
|
|
320
|
+
description: "Packages to return",
|
|
321
|
+
items: {
|
|
322
|
+
type: "object",
|
|
323
|
+
properties: {
|
|
324
|
+
weight: { type: "number" },
|
|
325
|
+
height: { type: "number" },
|
|
326
|
+
width: { type: "number" },
|
|
327
|
+
length: { type: "number" },
|
|
328
|
+
},
|
|
329
|
+
required: ["weight"],
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
reason: { type: "string", description: "Return reason" },
|
|
333
|
+
},
|
|
334
|
+
required: ["contract", "origin", "destination", "packages"],
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
name: "list_returns",
|
|
339
|
+
description: "List reverse logistics shipments (returns)",
|
|
340
|
+
inputSchema: {
|
|
341
|
+
type: "object",
|
|
342
|
+
properties: {
|
|
343
|
+
contract: { type: "string", description: "Filter by contract" },
|
|
344
|
+
from_date: { type: "string", description: "Filter from date (YYYY-MM-DD)" },
|
|
345
|
+
to_date: { type: "string", description: "Filter to date (YYYY-MM-DD)" },
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
name: "list_products",
|
|
351
|
+
description: "List contracted products/services available on the account",
|
|
352
|
+
inputSchema: {
|
|
353
|
+
type: "object",
|
|
354
|
+
properties: {
|
|
355
|
+
contract: { type: "string", description: "Contract/account number" },
|
|
356
|
+
},
|
|
357
|
+
required: ["contract"],
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
name: "get_invoice",
|
|
362
|
+
description: "Get billing/invoice details",
|
|
363
|
+
inputSchema: {
|
|
364
|
+
type: "object",
|
|
365
|
+
properties: {
|
|
366
|
+
invoice_id: { type: "string", description: "Invoice/factura ID or number" },
|
|
367
|
+
},
|
|
368
|
+
required: ["invoice_id"],
|
|
369
|
+
},
|
|
370
|
+
},
|
|
191
371
|
],
|
|
192
372
|
}));
|
|
193
373
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
@@ -234,6 +414,69 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
234
414
|
return { content: [{ type: "text", text: JSON.stringify(await andreaniRequest("GET", `/envios/${args?.shipmentId}/trazas`), null, 2) }] };
|
|
235
415
|
case "cancel_shipment":
|
|
236
416
|
return { content: [{ type: "text", text: JSON.stringify(await andreaniRequest("DELETE", `/envios/${args?.shipmentId}`), null, 2) }] };
|
|
417
|
+
case "get_label_pdf":
|
|
418
|
+
return { content: [{ type: "text", text: JSON.stringify(await andreaniRequest("GET", `/envios/${args?.shipmentId}/etiquetas?formato=pdf`), null, 2) }] };
|
|
419
|
+
case "list_tracking_by_date": {
|
|
420
|
+
const params = new URLSearchParams({
|
|
421
|
+
contrato: args?.contract,
|
|
422
|
+
fechaDesde: args?.from_date,
|
|
423
|
+
fechaHasta: args?.to_date,
|
|
424
|
+
});
|
|
425
|
+
return { content: [{ type: "text", text: JSON.stringify(await andreaniRequest("GET", `/trazas?${params}`), null, 2) }] };
|
|
426
|
+
}
|
|
427
|
+
case "validate_postal_code":
|
|
428
|
+
return { content: [{ type: "text", text: JSON.stringify(await andreaniRequest("GET", `/cobertura/${args?.postal_code}`), null, 2) }] };
|
|
429
|
+
case "create_pickup": {
|
|
430
|
+
const payload = {
|
|
431
|
+
contrato: args?.contract,
|
|
432
|
+
fechaRetiro: args?.pickup_date,
|
|
433
|
+
direccion: args?.address,
|
|
434
|
+
cantidadBultos: args?.packages_count,
|
|
435
|
+
observaciones: args?.notes,
|
|
436
|
+
};
|
|
437
|
+
return { content: [{ type: "text", text: JSON.stringify(await andreaniRequest("POST", "/retiros", payload), null, 2) }] };
|
|
438
|
+
}
|
|
439
|
+
case "list_pickups": {
|
|
440
|
+
const params = new URLSearchParams();
|
|
441
|
+
if (args?.contract)
|
|
442
|
+
params.set("contrato", args.contract);
|
|
443
|
+
if (args?.from_date)
|
|
444
|
+
params.set("fechaDesde", args.from_date);
|
|
445
|
+
if (args?.to_date)
|
|
446
|
+
params.set("fechaHasta", args.to_date);
|
|
447
|
+
if (args?.status)
|
|
448
|
+
params.set("estado", args.status);
|
|
449
|
+
return { content: [{ type: "text", text: JSON.stringify(await andreaniRequest("GET", `/retiros?${params}`), null, 2) }] };
|
|
450
|
+
}
|
|
451
|
+
case "cancel_pickup":
|
|
452
|
+
return { content: [{ type: "text", text: JSON.stringify(await andreaniRequest("DELETE", `/retiros/${args?.pickupId}`), null, 2) }] };
|
|
453
|
+
case "create_return": {
|
|
454
|
+
const payload = {
|
|
455
|
+
contrato: args?.contract,
|
|
456
|
+
envioOriginal: args?.original_shipment_id,
|
|
457
|
+
origen: args?.origin,
|
|
458
|
+
destino: args?.destination,
|
|
459
|
+
bultos: args?.packages,
|
|
460
|
+
motivo: args?.reason,
|
|
461
|
+
};
|
|
462
|
+
return { content: [{ type: "text", text: JSON.stringify(await andreaniRequest("POST", "/logistica-inversa", payload), null, 2) }] };
|
|
463
|
+
}
|
|
464
|
+
case "list_returns": {
|
|
465
|
+
const params = new URLSearchParams();
|
|
466
|
+
if (args?.contract)
|
|
467
|
+
params.set("contrato", args.contract);
|
|
468
|
+
if (args?.from_date)
|
|
469
|
+
params.set("fechaDesde", args.from_date);
|
|
470
|
+
if (args?.to_date)
|
|
471
|
+
params.set("fechaHasta", args.to_date);
|
|
472
|
+
return { content: [{ type: "text", text: JSON.stringify(await andreaniRequest("GET", `/logistica-inversa?${params}`), null, 2) }] };
|
|
473
|
+
}
|
|
474
|
+
case "list_products": {
|
|
475
|
+
const params = new URLSearchParams({ contrato: args?.contract });
|
|
476
|
+
return { content: [{ type: "text", text: JSON.stringify(await andreaniRequest("GET", `/productos?${params}`), null, 2) }] };
|
|
477
|
+
}
|
|
478
|
+
case "get_invoice":
|
|
479
|
+
return { content: [{ type: "text", text: JSON.stringify(await andreaniRequest("GET", `/facturas/${args?.invoice_id}`), null, 2) }] };
|
|
237
480
|
default:
|
|
238
481
|
return { content: [{ type: "text", text: `Unknown tool: ${name}` }], isError: true };
|
|
239
482
|
}
|
|
@@ -260,7 +503,7 @@ async function main() {
|
|
|
260
503
|
const t = new StreamableHTTPServerTransport({ sessionIdGenerator: () => randomUUID(), onsessioninitialized: (id) => { transports.set(id, t); } });
|
|
261
504
|
t.onclose = () => { if (t.sessionId)
|
|
262
505
|
transports.delete(t.sessionId); };
|
|
263
|
-
const s = new Server({ name: "mcp-andreani", version: "0.
|
|
506
|
+
const s = new Server({ name: "mcp-andreani", version: "0.2.0-alpha.2" }, { capabilities: { tools: {} } });
|
|
264
507
|
server._requestHandlers.forEach((v, k) => s._requestHandlers.set(k, v));
|
|
265
508
|
server._notificationHandlers?.forEach((v, k) => s._notificationHandlers.set(k, v));
|
|
266
509
|
await s.connect(t);
|
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codespar/mcp-andreani",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "MCP server for Andreani
|
|
3
|
+
"version": "0.2.0-alpha.2",
|
|
4
|
+
"description": "MCP server for Andreani \u2014 Argentine courier and logistics",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"mcp-andreani": "dist/index.js"
|
|
9
9
|
},
|
|
10
|
-
"files": [
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
11
13
|
"scripts": {
|
|
12
14
|
"build": "tsc",
|
|
13
15
|
"start": "node dist/index.js"
|
|
@@ -20,6 +22,13 @@
|
|
|
20
22
|
"typescript": "^5.8.0"
|
|
21
23
|
},
|
|
22
24
|
"license": "MIT",
|
|
23
|
-
"keywords": [
|
|
25
|
+
"keywords": [
|
|
26
|
+
"andreani",
|
|
27
|
+
"courier",
|
|
28
|
+
"logistics",
|
|
29
|
+
"argentina",
|
|
30
|
+
"shipping",
|
|
31
|
+
"mcp"
|
|
32
|
+
],
|
|
24
33
|
"mcpName": "io.github.codespar/mcp-andreani"
|
|
25
34
|
}
|