@velaro/mcp-server 2.0.22 → 2.0.24
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velaro/mcp-server",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.24",
|
|
4
4
|
"description": "Velaro MCP server — connect Claude and other AI agents directly to your Velaro account: KB, workflows, bots, conversations, contacts, routing, and more.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -1,18 +1,42 @@
|
|
|
1
|
-
// velaro part-finder: the per-site Part Finder
|
|
2
|
-
// Parity module (CLI group `part-finder` -> MCP tools). Needs the
|
|
1
|
+
// velaro part-finder (alias smart-match): Smart Match, the per-site ordered lookup (internal name Part Finder, tool names are live contracts). Site scope comes from the credential only, never from arguments.
|
|
2
|
+
// Parity module (CLI group `part-finder` -> MCP tools). Needs the Smart Match package (EnablePartFinder).
|
|
3
3
|
|
|
4
4
|
const need = (a, ...ks) => { for (const k of ks) if (a[k] === undefined || a[k] === null || a[k] === '') throw new Error(k + ' is required'); };
|
|
5
|
+
/** Body for POST /PartFinder/Sources. Pure so it is unit tested: shareUrl required and https, upload refused, no fileName sent. */
|
|
6
|
+
function buildSourceBody(a) {
|
|
7
|
+
need(a, 'shareUrl');
|
|
8
|
+
const shareUrl = String(a.shareUrl).trim();
|
|
9
|
+
if (!/^https:\/\//i.test(shareUrl)) throw new Error('shareUrl must be an https link to the file in SharePoint or OneDrive');
|
|
10
|
+
const type = a.type === undefined || a.type === '' ? 'sharepoint' : String(a.type).toLowerCase();
|
|
11
|
+
if (type !== 'sharepoint' && type !== 'onedrive') throw new Error('type must be sharepoint or onedrive');
|
|
12
|
+
const body = { type, shareUrl, loadMode: a.loadMode ? String(a.loadMode) : 'preload', enabled: a.enabled !== false };
|
|
13
|
+
if (a.syncIntervalHours !== undefined) {
|
|
14
|
+
const h = Number(a.syncIntervalHours);
|
|
15
|
+
if (!Number.isFinite(h) || h <= 0) throw new Error('syncIntervalHours must be a positive number');
|
|
16
|
+
body.syncIntervalHours = h;
|
|
17
|
+
}
|
|
18
|
+
if (typeof a.autoApproveRows === 'boolean') body.autoApproveRows = a.autoApproveRows;
|
|
19
|
+
return body;
|
|
20
|
+
}
|
|
21
|
+
/** itemNoun rule shared with messaging: trimmed, letters digits space hyphen, max 40; empty means the default (item). */
|
|
22
|
+
function validItemNoun(v) {
|
|
23
|
+
const t = String(v ?? '').trim();
|
|
24
|
+
if (t === '') return 'item';
|
|
25
|
+
if (t.length > 40) throw new Error('itemNoun must be 40 characters or fewer');
|
|
26
|
+
if (!/^[\p{L}\p{N} -]+$/u.test(t)) throw new Error('itemNoun can use letters, digits, spaces and hyphens only');
|
|
27
|
+
return t;
|
|
28
|
+
}
|
|
5
29
|
const pid = (v, n = 'id') => { const x = Number(v); if (!Number.isInteger(x) || x <= 0) throw new Error(n + ' must be a positive integer'); return x; };
|
|
6
30
|
|
|
7
31
|
export const tools = [
|
|
8
32
|
{
|
|
9
33
|
name: 'part_finder_find',
|
|
10
|
-
description: 'Run the
|
|
34
|
+
description: 'Run the Smart Match lookup the bot uses for anything a customer names (a part number, product, service, plan, competitor name or description): approved matrix, connected business system, own catalog, then labelled possible matches. Returns status (confirmed, candidates, no_result), source, recommendations, candidates, handoff and the per-step trace. Calls POST /PartFinder/Find.',
|
|
11
35
|
inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'The part number, model or description as the customer wrote it' } }, required: ['query'] },
|
|
12
36
|
},
|
|
13
37
|
{
|
|
14
38
|
name: 'part_finder_config',
|
|
15
|
-
description: 'Read the
|
|
39
|
+
description: 'Read the Smart Match settings, or change them when any field is given: enabled, steps (ordered list of {id: matrix|erp|catalog_exact|spec_search, enabled, timeoutMs}), minConfidence (0 to 1), noResultAction (handoff|categories|handoff_and_categories|capture_lead), itemNoun (what the business calls the things customers look for, default item; letters, digits, spaces and hyphens, max 40). Matrix and catalog_exact cannot both be off. Calls GET or PUT /PartFinder/Config.',
|
|
16
40
|
inputSchema: {
|
|
17
41
|
type: 'object',
|
|
18
42
|
properties: {
|
|
@@ -20,18 +44,30 @@ export const tools = [
|
|
|
20
44
|
steps: { type: 'array', items: { type: 'object', properties: { id: { type: 'string' }, enabled: { type: 'boolean' }, timeoutMs: { type: 'number' } }, required: ['id'] } },
|
|
21
45
|
minConfidence: { type: 'number' },
|
|
22
46
|
noResultAction: { type: 'string' },
|
|
47
|
+
itemNoun: { type: 'string', description: 'What the business calls the things customers look for: part, product, service, plan, policy, course. Default item. Letters, digits, spaces and hyphens, max 40.' },
|
|
23
48
|
},
|
|
24
49
|
},
|
|
25
50
|
},
|
|
26
51
|
{
|
|
27
52
|
name: 'part_finder_sources',
|
|
28
|
-
description: 'List the matrix sources (SharePoint, OneDrive
|
|
53
|
+
description: 'List the Smart Match matrix sources (SharePoint, OneDrive) with load mode and last sync status. Calls GET /PartFinder/Sources.',
|
|
29
54
|
inputSchema: { type: 'object', properties: {} },
|
|
30
55
|
},
|
|
31
56
|
{
|
|
32
57
|
name: 'part_finder_source_add',
|
|
33
|
-
description: 'Add a matrix source.
|
|
34
|
-
inputSchema: {
|
|
58
|
+
description: 'Add a matrix source from a share link. shareUrl is the Share link of an Excel (.xlsx) or CSV file in SharePoint or OneDrive (not a folder); the server resolves it to the file. type is sharepoint (default) or onedrive, loadMode is preload (default) or live, syncIntervalHours and autoApproveRows are optional. New rows are not approved unless autoApproveRows is true or the file says so. Calls POST /PartFinder/Sources.',
|
|
59
|
+
inputSchema: {
|
|
60
|
+
type: 'object',
|
|
61
|
+
properties: {
|
|
62
|
+
shareUrl: { type: 'string', description: 'The Share link (https) to the .xlsx or .csv file in SharePoint or OneDrive' },
|
|
63
|
+
type: { type: 'string', enum: ['sharepoint', 'onedrive'] },
|
|
64
|
+
loadMode: { type: 'string', enum: ['preload', 'live'] },
|
|
65
|
+
syncIntervalHours: { type: 'number' },
|
|
66
|
+
autoApproveRows: { type: 'boolean' },
|
|
67
|
+
enabled: { type: 'boolean' },
|
|
68
|
+
},
|
|
69
|
+
required: ['shareUrl'],
|
|
70
|
+
},
|
|
35
71
|
},
|
|
36
72
|
{
|
|
37
73
|
name: 'part_finder_source_preview',
|
|
@@ -85,13 +121,13 @@ export const handlers = {
|
|
|
85
121
|
patch.minConfidence = v;
|
|
86
122
|
}
|
|
87
123
|
if (a.noResultAction !== undefined) patch.noResultAction = String(a.noResultAction);
|
|
124
|
+
if (a.itemNoun !== undefined) patch.itemNoun = validItemNoun(a.itemNoun);
|
|
88
125
|
if (Object.keys(patch).length === 0) return ctx.messagingGet('/PartFinder/Config');
|
|
89
126
|
return ctx.messagingPut('/PartFinder/Config', patch);
|
|
90
127
|
},
|
|
91
128
|
part_finder_sources: async (_a, ctx) => ctx.messagingGet('/PartFinder/Sources'),
|
|
92
129
|
part_finder_source_add: async (a, ctx) => {
|
|
93
|
-
|
|
94
|
-
return ctx.messagingPost('/PartFinder/Sources', { type: String(a.type), fileName: String(a.fileName), loadMode: a.loadMode ? String(a.loadMode) : 'preload', enabled: true });
|
|
130
|
+
return ctx.messagingPost('/PartFinder/Sources', buildSourceBody(a));
|
|
95
131
|
},
|
|
96
132
|
part_finder_source_preview: async (a, ctx) => ctx.messagingGet('/PartFinder/Sources/' + pid(a.id) + '/Preview'),
|
|
97
133
|
part_finder_source_sync: async (a, ctx) => ctx.messagingPost('/PartFinder/Sources/' + pid(a.id) + '/SyncNow', {}),
|