@velaro/mcp-server 2.0.131 → 2.0.132

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.
@@ -0,0 +1,12 @@
1
+ // Customer MCP keys (vel_live_*) are default-denied by the admin REST API's DefaultPolicy (ApiKeyAuthPolicies.cs),
2
+ // so the REST routes behind the KB tools answer 403 for them. The hosted gateway (POST /mcp, policy mcp:tools)
3
+ // serves the same tools in-process and scopes them to the key's site, so key-authenticated calls go there.
4
+ // A signed-in JWT keeps the direct REST path.
5
+ export const GATEWAY_KB_TOOLS = new Set([
6
+ 'kb_list_topics', 'kb_search_articles', 'kb_get_article',
7
+ 'kb_create_article', 'kb_update_article', 'kb_delete_article',
8
+ ]);
9
+
10
+ export function shouldUseGateway(toolName, hasMcpKey) {
11
+ return Boolean(hasMcpKey) && GATEWAY_KB_TOOLS.has(toolName);
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velaro/mcp-server",
3
- "version": "2.0.131",
3
+ "version": "2.0.132",
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": {
@@ -47,6 +47,7 @@
47
47
  "tool-annotations.js",
48
48
  "fetch-retry.js",
49
49
  "messaging-base.js",
50
+ "gateway-routing.js",
50
51
  "survey-email.js",
51
52
  "escalation-settings.js",
52
53
  "parity/loader.js",
package/server.js CHANGED
@@ -57,6 +57,7 @@ import { resolveMessagingApi } from './messaging-base.js';
57
57
  import { normalizeMultiTabMode, buildMultiTabUpdateFields, normalizeEmailTranscript, buildEmailTranscriptUpdateFields } from './chat-window-style.js';
58
58
  import { buildResolvePath, buildTimelinePath, buildOverrideBody, buildValidateBody, buildBannerPath, buildOverrideListPath, tolerant, VALIDATE_PATH, OVERRIDE_PATH } from './workflow-schedule.js';
59
59
  import { applyEmailSubmissionsTo } from './survey-email.js';
60
+ import { shouldUseGateway } from './gateway-routing.js';
60
61
 
61
62
  // Production admin API by default; set VELARO_ADMIN_API to target staging.
62
63
  const API_BASE = process.env.VELARO_ADMIN_API || 'https://api-admin-us-east.velaro.com';
@@ -5771,6 +5772,7 @@ const CHAIN_FIELDS = [
5771
5772
  ];
5772
5773
 
5773
5774
  async function handleTool(name, args) {
5775
+ if (shouldUseGateway(name, Boolean(MCP_KEY))) return rpc(name, args);
5774
5776
  switch (name) {
5775
5777
  case 'case_list_types': {
5776
5778
  return JSON.stringify(await messagingGet('/CaseTypes'), null, 2);
@@ -5921,7 +5923,7 @@ async function handleTool(name, args) {
5921
5923
  const articles = data?.articles ?? [];
5922
5924
  if (!articles.length) return 'No articles found.';
5923
5925
  return articles.map(a =>
5924
- `[${a.id}] ${a.isPublished ? 'published' : 'draft'} | "${a.title}" | ${a.hitCount ?? 0} views | ${a.url ?? 'not public'}`
5926
+ `[${a.id}] ${a.isPublished ? 'published' : 'draft'} ${a.title}\n slug: ${a.slug ?? ''}\n ${a.hitCount ?? 0} views | ${a.url ?? 'not public'}`
5925
5927
  ).join('\n');
5926
5928
  }
5927
5929