@unboundcx/sdk 4.13.156 → 4.13.158

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/index.js CHANGED
@@ -419,3 +419,4 @@ export {
419
419
  isSimEmail,
420
420
  simModeKey,
421
421
  } from './lib/simRules.js';
422
+ export { buildMcpConnectSnippets } from './lib/mcpConnectSnippets.js';
@@ -0,0 +1,185 @@
1
+ // Shared MCP "Connect" snippet builder (mcp-tools-plan.md §5, D8). Pure, no
2
+ // network -- consumed by app1-client's Setup → MCP tools page and the
3
+ // app1-developer portal's Tools & Connect page so the two surfaces never
4
+ // drift on client wiring quirks (Cursor/VS Code/Windsurf header shape,
5
+ // Claude Desktop's env-var workaround, Grok's required server_label).
6
+ //
7
+ // `namespace` is the account subdomain (e.g. "masterc"); `apiHost` is the
8
+ // base domain the client already resolves for API calls (e.g.
9
+ // "dev-d01.app1svc.com", the same value other pages use as
10
+ // `$page.data.env.baseUrl`) -- this helper prepends `${namespace}.api.`
11
+ // itself, matching the existing `https://${namespace}.api.${envBaseUrl}/...`
12
+ // convention. `token` is the raw MCP bearer JWT shown once right after
13
+ // mint; pass null before a token exists and every snippet falls back to
14
+ // the literal placeholder `<your mcp token>`.
15
+
16
+ const PLACEHOLDER_TOKEN = '<your mcp token>';
17
+
18
+ function serverUrl(namespace, apiHost) {
19
+ return `https://${namespace}.api.${apiHost}/mcp`;
20
+ }
21
+
22
+ function bearer(token) {
23
+ return `Bearer ${token || PLACEHOLDER_TOKEN}`;
24
+ }
25
+
26
+ /**
27
+ * @param {{namespace: string, apiHost: string, token: string|null}} args
28
+ * @returns {Array<{id: string, client: string, mechanism: string, note: string, language: string, snippet: string, disabled?: boolean}>}
29
+ */
30
+ export function buildMcpConnectSnippets({ namespace, apiHost, token } = {}) {
31
+ const ns = namespace || '<namespace>';
32
+ const host = apiHost || '<host>';
33
+ const url = serverUrl(ns, host);
34
+ const auth = bearer(token);
35
+ const label = `unbound-${ns}`;
36
+
37
+ return [
38
+ {
39
+ id: 'claude-code',
40
+ client: 'Claude Code',
41
+ mechanism: 'streamable HTTP + header',
42
+ note: '',
43
+ language: 'bash',
44
+ snippet: `claude mcp add --transport http ${label} ${url} --header "Authorization: ${auth}"`,
45
+ },
46
+ {
47
+ id: 'cursor',
48
+ client: 'Cursor',
49
+ mechanism: 'mcpServers + url + headers.Authorization',
50
+ note: '',
51
+ language: 'json',
52
+ snippet: JSON.stringify(
53
+ {
54
+ mcpServers: {
55
+ [label]: {
56
+ url,
57
+ headers: { Authorization: auth },
58
+ },
59
+ },
60
+ },
61
+ null,
62
+ 2,
63
+ ),
64
+ },
65
+ {
66
+ id: 'vscode',
67
+ client: 'VS Code',
68
+ mechanism: 'servers + type:http + headers',
69
+ note: '',
70
+ language: 'json',
71
+ snippet: JSON.stringify(
72
+ {
73
+ servers: {
74
+ [label]: {
75
+ type: 'http',
76
+ url,
77
+ headers: { Authorization: auth },
78
+ },
79
+ },
80
+ },
81
+ null,
82
+ 2,
83
+ ),
84
+ },
85
+ {
86
+ id: 'windsurf',
87
+ client: 'Windsurf',
88
+ mechanism: 'serverUrl + headers',
89
+ note: '',
90
+ language: 'json',
91
+ snippet: JSON.stringify(
92
+ {
93
+ mcpServers: {
94
+ [label]: {
95
+ serverUrl: url,
96
+ headers: { Authorization: auth },
97
+ },
98
+ },
99
+ },
100
+ null,
101
+ 2,
102
+ ),
103
+ },
104
+ {
105
+ id: 'claude-desktop',
106
+ client: 'Claude Desktop',
107
+ mechanism: 'npx -y mcp-remote',
108
+ note: 'Desktop splits args on spaces, so the Authorization header is passed via an env var instead of inline.',
109
+ language: 'json',
110
+ snippet: JSON.stringify(
111
+ {
112
+ mcpServers: {
113
+ [label]: {
114
+ command: 'npx',
115
+ args: [
116
+ '-y',
117
+ 'mcp-remote@latest',
118
+ url,
119
+ '--header',
120
+ 'Authorization:${AUTH_HEADER}',
121
+ ],
122
+ env: { AUTH_HEADER: auth },
123
+ },
124
+ },
125
+ },
126
+ null,
127
+ 2,
128
+ ),
129
+ },
130
+ {
131
+ id: 'claude-connector',
132
+ client: 'Claude.ai custom connector',
133
+ mechanism: 'static Authorization header',
134
+ note: 'org Owner, beta; OAuth later',
135
+ language: 'text',
136
+ snippet: `URL: ${url}\nAuthorization: ${auth}`,
137
+ },
138
+ {
139
+ id: 'chatgpt',
140
+ client: 'ChatGPT connectors',
141
+ mechanism: 'OAuth only',
142
+ note: 'after OAuth',
143
+ language: 'text',
144
+ snippet: '',
145
+ disabled: true,
146
+ },
147
+ {
148
+ id: 'grok',
149
+ client: 'Grok (xAI Responses API)',
150
+ mechanism: 'tools:[{type:"mcp", ...}]',
151
+ note: '',
152
+ language: 'bash',
153
+ snippet: `curl https://api.x.ai/v1/responses \\
154
+ -H "Authorization: Bearer $XAI_API_KEY" \\
155
+ -H "Content-Type: application/json" \\
156
+ -d '${JSON.stringify(
157
+ {
158
+ model: 'grok-4',
159
+ input: 'List the tools available to you.',
160
+ tools: [
161
+ {
162
+ type: 'mcp',
163
+ server_url: url,
164
+ server_label: label,
165
+ authorization: auth,
166
+ },
167
+ ],
168
+ },
169
+ )}'`,
170
+ },
171
+ {
172
+ id: 'generic-rest',
173
+ client: 'Generic REST',
174
+ mechanism: 'REST twin',
175
+ note: '',
176
+ language: 'bash',
177
+ snippet: `curl -X POST https://${ns}.api.${host}/workflows/tools/<slug>/call \\
178
+ -H "Authorization: ${auth}" \\
179
+ -H "Content-Type: application/json" \\
180
+ -d '{"input": {}}'`,
181
+ },
182
+ ];
183
+ }
184
+
185
+ export default buildMcpConnectSnippets;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk",
3
- "version": "4.13.156",
3
+ "version": "4.13.158",
4
4
  "description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -204,6 +204,7 @@ export class PlaybooksService {
204
204
  * @param {boolean} [options.requiredForPass=false] - Whether required for pass
205
205
  * @param {string} [options.visibility] - 'live' or 'reviewOnly'
206
206
  * @param {string} [options.recordTypeId] - Record type ID
207
+ * @param {string} [options.criteriaMode] - How multiple criteria combine: 'all' or 'any'
207
208
  * @returns {Promise<Object>} Created goal with id
208
209
  *
209
210
  * @example
@@ -212,7 +213,8 @@ export class PlaybooksService {
212
213
  * goal: 'Identify customer pain points',
213
214
  * description: 'Agent should discover at least 2 pain points',
214
215
  * scoreType: 'scale',
215
- * weight: 25
216
+ * weight: 25,
217
+ * criteriaMode: 'any'
216
218
  * });
217
219
  */
218
220
  async createPlaybookGoal({
@@ -231,6 +233,7 @@ export class PlaybooksService {
231
233
  windowTurns,
232
234
  visibility,
233
235
  recordTypeId,
236
+ criteriaMode,
234
237
  }) {
235
238
  this.sdk.validateParams(
236
239
  {
@@ -246,6 +249,7 @@ export class PlaybooksService {
246
249
  role,
247
250
  signal,
248
251
  recordTypeId,
252
+ criteriaMode,
249
253
  },
250
254
  {
251
255
  playbookId: { type: "string", required: true },
@@ -263,6 +267,7 @@ export class PlaybooksService {
263
267
  windowTurns: { type: "number", required: false },
264
268
  visibility: { type: "string", required: false },
265
269
  recordTypeId: { type: "string", required: false },
270
+ criteriaMode: { type: "string", required: false },
266
271
  },
267
272
  );
268
273
 
@@ -282,6 +287,7 @@ export class PlaybooksService {
282
287
  windowTurns,
283
288
  visibility,
284
289
  recordTypeId,
290
+ ...(criteriaMode !== undefined ? { criteriaMode } : {}),
285
291
  },
286
292
  };
287
293
 
@@ -366,13 +372,15 @@ export class PlaybooksService {
366
372
  * @param {boolean} [options.requiredForPass] - Whether required for pass
367
373
  * @param {string} [options.visibility] - 'live' or 'reviewOnly'
368
374
  * @param {string} [options.recordTypeId] - Record type ID
375
+ * @param {string} [options.criteriaMode] - How multiple criteria combine: 'all' or 'any'
369
376
  * @returns {Promise<Object>} Updated goal object
370
377
  *
371
378
  * @example
372
379
  * const updated = await sdk.ai.playbooks.updatePlaybookGoal({
373
380
  * goalId: 'goal_789',
374
381
  * weight: 30,
375
- * description: 'Updated description'
382
+ * description: 'Updated description',
383
+ * criteriaMode: 'all'
376
384
  * });
377
385
  */
378
386
  async updatePlaybookGoal({
@@ -390,6 +398,7 @@ export class PlaybooksService {
390
398
  windowTurns,
391
399
  visibility,
392
400
  recordTypeId,
401
+ criteriaMode,
393
402
  }) {
394
403
  this.sdk.validateParams(
395
404
  {
@@ -404,6 +413,7 @@ export class PlaybooksService {
404
413
  role,
405
414
  signal,
406
415
  recordTypeId,
416
+ criteriaMode,
407
417
  },
408
418
  {
409
419
  goalId: { type: "string", required: true },
@@ -420,6 +430,7 @@ export class PlaybooksService {
420
430
  windowTurns: { type: "number", required: false },
421
431
  visibility: { type: "string", required: false },
422
432
  recordTypeId: { type: "string", required: false },
433
+ criteriaMode: { type: "string", required: false },
423
434
  },
424
435
  );
425
436
 
@@ -438,6 +449,7 @@ export class PlaybooksService {
438
449
  windowTurns,
439
450
  visibility,
440
451
  recordTypeId,
452
+ ...(criteriaMode !== undefined ? { criteriaMode } : {}),
441
453
  },
442
454
  };
443
455
 
@@ -31,6 +31,25 @@ export class WorkflowToolsService {
31
31
  );
32
32
  return result;
33
33
  }
34
+
35
+ // P1 D8/§4 "Export routes" (Download tool JSON):
36
+ // no slug -> GET /workflows/tools/export?format= (the whole catalog)
37
+ // slug -> GET /workflows/tools/:slug/export?format= (one tool)
38
+ // format is one of 'mcp' | 'anthropic' | 'openai'.
39
+ async export({ slug, format } = {}) {
40
+ this.sdk.validateParams(
41
+ { format },
42
+ { format: { type: 'string', required: true } },
43
+ );
44
+
45
+ const path = slug
46
+ ? `/workflows/tools/${slug}/export`
47
+ : '/workflows/tools/export';
48
+ const result = await internalRequest(this.sdk, path, 'GET', {
49
+ query: { format },
50
+ });
51
+ return result;
52
+ }
34
53
  }
35
54
 
36
55
  export class WorkflowMcpTokensService {
@@ -600,6 +600,7 @@ export class WorkflowSessionsService {
600
600
  limit,
601
601
  before,
602
602
  activeOnly,
603
+ source,
603
604
  } = {}) {
604
605
  this.sdk.validateParams(
605
606
  { workflowId, workflowVersionId },
@@ -624,6 +625,7 @@ export class WorkflowSessionsService {
624
625
  if (limit) query.limit = limit;
625
626
  if (before) query.before = before;
626
627
  if (activeOnly) query.activeOnly = true;
628
+ if (source) query.source = source;
627
629
 
628
630
  const result = await internalRequest(this.sdk, '/workflows/sessions/list', 'GET', {
629
631
  query,