@velaro/mcp-server 2.0.22 → 2.0.23

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.22",
3
+ "version": "2.0.23",
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": {
@@ -2,6 +2,22 @@
2
2
  // Parity module (CLI group `part-finder` -> MCP tools). Needs the Part Finder 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
+ }
5
21
  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
22
 
7
23
  export const tools = [
@@ -25,13 +41,24 @@ export const tools = [
25
41
  },
26
42
  {
27
43
  name: 'part_finder_sources',
28
- description: 'List the matrix sources (SharePoint, OneDrive, upload) with load mode and last sync status. Calls GET /PartFinder/Sources.',
44
+ description: 'List the matrix sources (SharePoint, OneDrive) with load mode and last sync status. Calls GET /PartFinder/Sources.',
29
45
  inputSchema: { type: 'object', properties: {} },
30
46
  },
31
47
  {
32
48
  name: 'part_finder_source_add',
33
- description: 'Add a matrix source. type is sharepoint or onedrive, fileName is the file name or link, loadMode is preload (default) or live. New rows are not approved unless the file says so. Calls POST /PartFinder/Sources.',
34
- inputSchema: { type: 'object', properties: { type: { type: 'string' }, fileName: { type: 'string' }, loadMode: { type: 'string' } }, required: ['type', 'fileName'] },
49
+ 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.',
50
+ inputSchema: {
51
+ type: 'object',
52
+ properties: {
53
+ shareUrl: { type: 'string', description: 'The Share link (https) to the .xlsx or .csv file in SharePoint or OneDrive' },
54
+ type: { type: 'string', enum: ['sharepoint', 'onedrive'] },
55
+ loadMode: { type: 'string', enum: ['preload', 'live'] },
56
+ syncIntervalHours: { type: 'number' },
57
+ autoApproveRows: { type: 'boolean' },
58
+ enabled: { type: 'boolean' },
59
+ },
60
+ required: ['shareUrl'],
61
+ },
35
62
  },
36
63
  {
37
64
  name: 'part_finder_source_preview',
@@ -90,8 +117,7 @@ export const handlers = {
90
117
  },
91
118
  part_finder_sources: async (_a, ctx) => ctx.messagingGet('/PartFinder/Sources'),
92
119
  part_finder_source_add: async (a, ctx) => {
93
- need(a, 'type', 'fileName');
94
- return ctx.messagingPost('/PartFinder/Sources', { type: String(a.type), fileName: String(a.fileName), loadMode: a.loadMode ? String(a.loadMode) : 'preload', enabled: true });
120
+ return ctx.messagingPost('/PartFinder/Sources', buildSourceBody(a));
95
121
  },
96
122
  part_finder_source_preview: async (a, ctx) => ctx.messagingGet('/PartFinder/Sources/' + pid(a.id) + '/Preview'),
97
123
  part_finder_source_sync: async (a, ctx) => ctx.messagingPost('/PartFinder/Sources/' + pid(a.id) + '/SyncNow', {}),