@velaro/mcp-server 0.6.52 → 0.6.53

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.js +37 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velaro/mcp-server",
3
- "version": "0.6.52",
3
+ "version": "0.6.53",
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": {
package/server.js CHANGED
@@ -128,6 +128,17 @@ async function messagingApi(path) {
128
128
  return res.json();
129
129
  }
130
130
 
131
+ // FIXED 2026-09-24: velaro-messaging's /superadmin/logs/search used to return a bare JSON array
132
+ // for some queries and {entries, nextCursor} for others, depending on which internal code path
133
+ // served the request (see that repo's LogsController.cs ENVELOPE SHAPE comment). It now always
134
+ // returns {entries, nextCursor} -- this helper also accepts a bare array so callers degrade
135
+ // gracefully rather than throwing if ever pointed at an older deploy.
136
+ function extractLogEntries(response) {
137
+ if (Array.isArray(response)) return response;
138
+ if (response && Array.isArray(response.entries)) return response.entries;
139
+ return [];
140
+ }
141
+
131
142
  async function messagingRequest(method, path, body) {
132
143
  if (!MESSAGING_API) throw new Error(
133
144
  'VELARO_MESSAGING_API is not configured. Add "VELARO_MESSAGING_API": "https://velaro-messaging-api-staging.azurewebsites.net" to your MCP env config.'
@@ -1944,13 +1955,18 @@ For multiSelect dynamic options: the variable named in dynamicOptionsVariable mu
1944
1955
  inputSchema: {
1945
1956
  type: 'object',
1946
1957
  properties: {
1947
- q: { type: 'string', description: 'Text to search for in log messages (plain or regex)' },
1948
- level: { type: 'string', enum: ['ERROR', 'WARN', 'INFO', 'DEBUG'], description: 'Filter by log level' },
1949
- integration: { type: 'string', description: 'Integration tag filter (HubSpot, [Skill], NetSuite, etc.)' },
1950
- siteId: { type: 'number', description: 'Filter by site ID' },
1951
- last: { type: 'string', description: 'Time window: 30m, 2h, 1d (default: 2h)' },
1952
- take: { type: 'number', description: 'Max results (default: 50, max: 500)' },
1953
- regex: { type: 'boolean', description: 'Treat q as a regex pattern (default: false)' },
1958
+ q: { type: 'string', description: 'Text to search for in log messages (plain or regex)' },
1959
+ level: { type: 'string', enum: ['ERROR', 'WARN', 'INFO', 'DEBUG'], description: 'Filter by log level' },
1960
+ logger: { type: 'string', description: 'Logger name filter (substring match, or regex when regex=true)' },
1961
+ integration: { type: 'string', description: 'Integration tag filter (HubSpot, [Skill], NetSuite, etc.)' },
1962
+ siteId: { type: 'number', description: 'Filter by site ID' },
1963
+ source: { type: 'string', description: 'Source/app-tag filter, e.g. velaro-messaging-Staging' },
1964
+ platform: { type: 'string', enum: ['v10', 'v20', 'admin'], description: 'Filter by platform' },
1965
+ environment: { type: 'string', enum: ['Production', 'Staging', 'Development'] },
1966
+ correlationId: { type: 'string', description: 'Exact correlation/trace ID filter' },
1967
+ last: { type: 'string', description: 'Time window: 30m, 2h, 1d (default: 2h)' },
1968
+ take: { type: 'number', description: 'Max results (default: 50, max: 500)' },
1969
+ regex: { type: 'boolean', description: 'Treat q/logger as a regex pattern (default: false)' },
1954
1970
  },
1955
1971
  },
1956
1972
  },
@@ -5469,7 +5485,8 @@ async function handleTool(name, args) {
5469
5485
  const velaroLoggerP = safeJson(async () => {
5470
5486
  if (!MESSAGING_API) return { _error: 'VELARO_MESSAGING_API not set — add it to MCP env config' };
5471
5487
  const q = encodeURIComponent('ERROR|WF-AI-ROUTE|PERF-SLOW');
5472
- return messagingApi(`/superadmin/logs/search?q=${q}&from=${encodeURIComponent(from1h)}&take=30&regex=true`);
5488
+ const res = await messagingApi(`/superadmin/logs/search?q=${q}&from=${encodeURIComponent(from1h)}&take=30&regex=true`);
5489
+ return extractLogEntries(res);
5473
5490
  });
5474
5491
 
5475
5492
  // ── Layer 4b: Loggly ERROR + SLOW + AI-routing logs (last 1h) — SECONDARY (migrating away)
@@ -6321,13 +6338,18 @@ async function handleTool(name, args) {
6321
6338
  case 'velaro_logs_search': {
6322
6339
  const from = new Date(Date.now() - parseDuration(args.last));
6323
6340
  const params = new URLSearchParams({ from: from.toISOString(), take: String(args.take ?? 50) });
6324
- if (args.q) params.set('q', args.q);
6325
- if (args.level) params.set('level', args.level.toUpperCase());
6326
- if (args.integration) params.set('integration', args.integration);
6327
- if (args.siteId) params.set('siteId', String(args.siteId));
6328
- if (args.regex) params.set('regex', 'true');
6329
- const entries = await messagingApi(`/superadmin/logs/search?${params}`);
6330
- if (!Array.isArray(entries) || !entries.length) return 'No results.';
6341
+ if (args.q) params.set('q', args.q);
6342
+ if (args.level) params.set('level', args.level.toUpperCase());
6343
+ if (args.logger) params.set('logger', args.logger);
6344
+ if (args.integration) params.set('integration', args.integration);
6345
+ if (args.siteId) params.set('siteId', String(args.siteId));
6346
+ if (args.source) params.set('source', args.source);
6347
+ if (args.platform) params.set('platform', args.platform);
6348
+ if (args.environment) params.set('environment', args.environment);
6349
+ if (args.correlationId) params.set('correlationId', args.correlationId);
6350
+ if (args.regex) params.set('regex', 'true');
6351
+ const entries = extractLogEntries(await messagingApi(`/superadmin/logs/search?${params}`));
6352
+ if (!entries.length) return 'No results.';
6331
6353
  const lines = [`${entries.length} result(s) from ${from.toISOString().slice(0, 16)} UTC\n`];
6332
6354
  for (const e of entries) {
6333
6355
  const ts = new Date(e.timestamp ?? e.LogTimestamp).toISOString().replace('T', ' ').slice(0, 19);