@velaro/mcp-server 2.0.74 → 2.0.76

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 CHANGED
@@ -148,6 +148,7 @@ This works with any MCP client that supports HTTP/SSE transport — including Cl
148
148
  | `routing_team_update_config` | Partial update of team-level routing config; unknown fields pass through |
149
149
  | `routing_get_policy` | Site auto-routing policy including reassignment mode and the agent inactivity chain |
150
150
  | `routing_update_policy` | Update the policy, reassignment mode and inactivity chain (mode is always sent back) |
151
+ | `escalation_get_settings` / `escalation_update_settings` | Read or change SLA warning/breach percent and unanswered-chat escalation, account default or per team (reads then merges; null returns a setting to the default) |
151
152
  | `routing_simulate_inactivity` | DRY RUN of the inactivity chain for a mocked scenario, nothing is sent |
152
153
  | `routing_explain_precedence` | Which routing rule wins when an agent goes silent, plus conflict warnings |
153
154
  | `routing_inactivity_transfers` | Count agent inactivity transfers: total, per agent, per day |
@@ -0,0 +1,45 @@
1
+ // Unanswered-chat escalation + SLA threshold helpers (REST: messaging GET/PUT /EscalationSettings and
2
+ // /EscalationSettings/team/{id}). The PUT replaces all seven stored overrides, so a save reads the current
3
+ // overrides, merges only the passed fields, and sends the full set. null = "use the default".
4
+
5
+ export const FIELDS = {
6
+ slaWarningPercent: { min: 1, max: 100 },
7
+ slaBreachPercent: { min: 1, max: 100 },
8
+ abandonedEscalationEnabled: { bool: true },
9
+ unassignedEscalationMinutes: { min: 1, max: 1440 },
10
+ fallbackTeamId: { min: 1, max: 2147483647 },
11
+ assignedButUntouchedMinutes: { min: 1, max: 10080 },
12
+ transferBouncebackEnabled: { bool: true },
13
+ };
14
+
15
+ export function escalationPath(teamId) {
16
+ if (teamId === undefined || teamId === null || teamId === '') return '/EscalationSettings';
17
+ const n = Number(teamId);
18
+ if (!Number.isInteger(n) || n <= 0) throw new Error('teamId must be a positive integer.');
19
+ return `/EscalationSettings/team/${n}`;
20
+ }
21
+
22
+ // patch: { field: value | null } where null clears the field back to the default.
23
+ export function validatePatch(patch = {}) {
24
+ const keys = Object.keys(patch).filter((k) => patch[k] !== undefined);
25
+ if (!keys.length) throw new Error('No settings to change were provided.');
26
+ for (const k of keys) {
27
+ const d = FIELDS[k];
28
+ if (!d) throw new Error(`Unknown setting ${k}. Allowed: ${Object.keys(FIELDS).join(', ')}.`);
29
+ const v = patch[k];
30
+ if (v === null) continue;
31
+ if (d.bool) { if (typeof v !== 'boolean') throw new Error(`${k} must be true or false.`); continue; }
32
+ if (!Number.isInteger(v) || v < d.min || v > d.max) throw new Error(`${k} must be a whole number between ${d.min} and ${d.max}.`);
33
+ }
34
+ return keys;
35
+ }
36
+
37
+ export function buildPutBody(currentOverrides = {}, patch = {}) {
38
+ validatePatch(patch);
39
+ const body = {};
40
+ for (const k of Object.keys(FIELDS)) body[k] = currentOverrides?.[k] ?? null;
41
+ for (const [k, v] of Object.entries(patch)) if (v !== undefined) body[k] = v;
42
+ const w = body.slaWarningPercent, b = body.slaBreachPercent;
43
+ if (w != null && b != null && w > b) throw new Error('The SLA warning percent cannot be higher than the SLA breach percent.');
44
+ return body;
45
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velaro/mcp-server",
3
- "version": "2.0.74",
3
+ "version": "2.0.76",
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": {
@@ -46,6 +46,7 @@
46
46
  "fetch-retry.js",
47
47
  "messaging-base.js",
48
48
  "survey-email.js",
49
+ "escalation-settings.js",
49
50
  "parity/loader.js",
50
51
  "parity/*.customer.js",
51
52
  "workflow-schedule.js",
package/server.js CHANGED
@@ -41,6 +41,7 @@
41
41
  */
42
42
 
43
43
  import { fetchRetry429 } from './fetch-retry.js';
44
+ import { escalationPath, buildPutBody as buildEscalationBody, FIELDS as ESCALATION_FIELDS } from './escalation-settings.js';
44
45
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
45
46
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
46
47
  import {
@@ -1915,6 +1916,29 @@ For multiSelect dynamic options: the variable named in dynamicOptionsVariable mu
1915
1916
  description: 'Reset the Smart Routing circuit breaker. The breaker opens automatically when the modern engine fails repeatedly (>5 errors in 5 min) and auto-reverts to legacy. Call this after fixing the root cause to re-enable smart routing.',
1916
1917
  inputSchema: { type: 'object', properties: {}, required: [] },
1917
1918
  },
1919
+ {
1920
+ name: 'escalation_get_settings',
1921
+ description: 'Get SLA warning/breach percent and unanswered-chat escalation settings for the account default or one team (teamId). The SLA warning alert fires when a waiting chat reaches the warning percent (default 75) of its queue timeout. Set under Routing & Escalation > 2 \u00b7 Unanswered chats, not Ticket Settings.',
1922
+ inputSchema: { type: 'object', properties: { teamId: { type: 'number', description: 'Team (group) id; omit for the account default' } }, required: [] },
1923
+ },
1924
+ {
1925
+ name: 'escalation_update_settings',
1926
+ description: 'Change SLA warning/breach percent or escalation settings (account default or one team). Only passed settings change; set a setting to null to return it to the default. Warning percent cannot exceed breach percent.',
1927
+ inputSchema: {
1928
+ type: 'object',
1929
+ properties: {
1930
+ teamId: { type: 'number' },
1931
+ slaWarningPercent: { type: ['number', 'null'], description: '1-100' },
1932
+ slaBreachPercent: { type: ['number', 'null'], description: '1-100' },
1933
+ abandonedEscalationEnabled: { type: ['boolean', 'null'] },
1934
+ unassignedEscalationMinutes: { type: ['number', 'null'] },
1935
+ fallbackTeamId: { type: ['number', 'null'] },
1936
+ assignedButUntouchedMinutes: { type: ['number', 'null'] },
1937
+ transferBouncebackEnabled: { type: ['boolean', 'null'] },
1938
+ },
1939
+ required: [],
1940
+ },
1941
+ },
1918
1942
  {
1919
1943
  name: 'routing_get_policy',
1920
1944
  description: 'Get the site-wide auto-routing policy: initial response timeout, idle timers, max reroutes, bounceback setting, terminal action, and other escalation parameters.',
@@ -4886,6 +4910,15 @@ For multiSelect dynamic options: the variable named in dynamicOptionsVariable mu
4886
4910
  // /BookableResources, /BookableServices, /ResourceAvailabilityRules. SiteId always
4887
4911
  // derives server-side from the caller's auth context, never a tool argument (IDOR).
4888
4912
  // See velaro-admin memory project_2026_09_06_generic_booking_engine_schema_plan.md.
4913
+ {
4914
+ name: 'booking_list_upcoming',
4915
+ description: 'List upcoming appointments (default next 7 days, at most 62 days). Optional scope me|team|group and teamId.',
4916
+ inputSchema: { type: 'object', properties: {
4917
+ scope: { type: 'string', description: 'me, team or group' },
4918
+ teamId: { type: 'number' },
4919
+ fromUtc: { type: 'string', description: 'ISO 8601 UTC start' },
4920
+ toUtc: { type: 'string', description: 'ISO 8601 UTC end' } }, required: [] },
4921
+ },
4889
4922
  {
4890
4923
  name: 'booking_list_resources',
4891
4924
  description: 'List bookable resources (staff / room / equipment / virtual) for this site.',
@@ -6516,6 +6549,20 @@ reply: ${r?.reply}`;
6516
6549
  ].join('\n');
6517
6550
  }
6518
6551
 
6552
+ case 'escalation_get_settings': {
6553
+ return JSON.stringify(await messagingGet(escalationPath(args.teamId)), null, 2);
6554
+ }
6555
+
6556
+ case 'escalation_update_settings': {
6557
+ const patch = {};
6558
+ for (const k of Object.keys(ESCALATION_FIELDS)) if (args[k] !== undefined) patch[k] = args[k];
6559
+ const path = escalationPath(args.teamId);
6560
+ const cur = await messagingGet(path);
6561
+ const body = buildEscalationBody(cur?.overrides || {}, patch);
6562
+ await messagingPut(path, body);
6563
+ return JSON.stringify({ saved: true, teamId: args.teamId ?? null, settings: body }, null, 2);
6564
+ }
6565
+
6519
6566
  case 'routing_update_policy': {
6520
6567
  // Load current, merge provided fields
6521
6568
  const current = await messagingGet('/AutoRoutingPolicy');
@@ -9410,6 +9457,16 @@ ${JSON.stringify(result, null, 2)}`;
9410
9457
  }
9411
9458
 
9412
9459
  // -- Generic Booking Engine (Phase 1b) --
9460
+ case 'booking_list_upcoming': {
9461
+ const q = new URLSearchParams();
9462
+ if (args.scope) q.set('scope', String(args.scope));
9463
+ if (args.teamId != null) q.set('teamId', String(args.teamId));
9464
+ if (args.fromUtc) q.set('fromUtc', String(args.fromUtc));
9465
+ if (args.toUtc) q.set('toUtc', String(args.toUtc));
9466
+ const result = await messagingGet(`/Appointments${q.toString() ? '?' + q : ''}`);
9467
+ return JSON.stringify(result, null, 2);
9468
+ }
9469
+
9413
9470
  case 'booking_list_resources': {
9414
9471
  const result = await messagingGet('/BookableResources');
9415
9472
  return JSON.stringify(result, null, 2);