@unboundcx/sdk 4.13.156 → 4.13.157
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 +1 -0
- package/lib/mcpConnectSnippets.js +185 -0
- package/package.json +1 -1
- package/services/workflowTools.js +19 -0
- package/services/workflows.js +2 -0
package/index.js
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "4.13.157",
|
|
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",
|
|
@@ -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 {
|
package/services/workflows.js
CHANGED
|
@@ -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,
|