snow-flow 8.39.2 → 8.39.3
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/dist/mcp/servicenow-mcp-unified/tools/automation/index.d.ts +6 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/index.d.ts.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/index.js +19 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/index.js.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_email_logs.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_email_logs.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_email_logs.js +185 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_email_logs.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_flow_execution_logs.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_flow_execution_logs.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_flow_execution_logs.js +280 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_flow_execution_logs.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_inbound_http_logs.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_inbound_http_logs.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_inbound_http_logs.js +233 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_inbound_http_logs.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_outbound_http_logs.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_outbound_http_logs.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_outbound_http_logs.js +218 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_outbound_http_logs.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_scheduled_job_logs.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_scheduled_job_logs.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_scheduled_job_logs.js +276 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_scheduled_job_logs.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_slow_queries.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_slow_queries.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_slow_queries.js +340 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_slow_queries.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/index.d.ts +10 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/index.d.ts.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/integration/index.js +34 -1
- package/dist/mcp/servicenow-mcp-unified/tools/integration/index.js.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_configure_mid_server.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_configure_mid_server.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_configure_mid_server.js +397 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_configure_mid_server.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_connection_alias.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_connection_alias.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_connection_alias.js +234 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_connection_alias.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_credential_alias.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_credential_alias.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_credential_alias.js +280 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_credential_alias.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_flow_action.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_flow_action.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_flow_action.js +358 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_flow_action.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_oauth_profile.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_oauth_profile.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_oauth_profile.js +237 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_oauth_profile.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_install_spoke.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_install_spoke.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_install_spoke.js +326 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_install_spoke.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_mid_capabilities.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_mid_capabilities.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_mid_capabilities.js +442 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_mid_capabilities.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_oauth_tokens.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_oauth_tokens.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_oauth_tokens.js +348 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_oauth_tokens.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_spoke_connection.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_spoke_connection.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_spoke_connection.js +427 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_spoke_connection.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_test_mid_connectivity.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_test_mid_connectivity.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_test_mid_connectivity.js +432 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_test_mid_connectivity.js.map +1 -0
- package/dist/templates/agents-md-template.d.ts +2 -2
- package/dist/templates/agents-md-template.d.ts.map +1 -1
- package/dist/templates/agents-md-template.js +57 -2
- package/dist/templates/agents-md-template.js.map +1 -1
- package/dist/templates/claude-md-template.d.ts +2 -2
- package/dist/templates/claude-md-template.d.ts.map +1 -1
- package/dist/templates/claude-md-template.js +17 -1
- package/dist/templates/claude-md-template.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* snow_create_connection_alias - Create Connection & Credential Aliases
|
|
4
|
+
*
|
|
5
|
+
* Create connection aliases for IntegrationHub and Flow Designer
|
|
6
|
+
* to securely reference external system credentials.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.author = exports.version = exports.toolDefinition = void 0;
|
|
10
|
+
exports.execute = execute;
|
|
11
|
+
const auth_js_1 = require("../../shared/auth.js");
|
|
12
|
+
const error_handler_js_1 = require("../../shared/error-handler.js");
|
|
13
|
+
exports.toolDefinition = {
|
|
14
|
+
name: 'snow_create_connection_alias',
|
|
15
|
+
description: 'Create connection alias for IntegrationHub/Flow Designer to reference external credentials',
|
|
16
|
+
category: 'integration',
|
|
17
|
+
subcategory: 'credentials',
|
|
18
|
+
use_cases: ['integration-hub', 'flow-designer', 'credentials', 'connections'],
|
|
19
|
+
complexity: 'intermediate',
|
|
20
|
+
frequency: 'medium',
|
|
21
|
+
permission: 'write',
|
|
22
|
+
allowedRoles: ['developer', 'admin'],
|
|
23
|
+
inputSchema: {
|
|
24
|
+
type: 'object',
|
|
25
|
+
properties: {
|
|
26
|
+
name: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
description: 'Connection alias name (e.g., "Jira Production", "Azure DevOps")'
|
|
29
|
+
},
|
|
30
|
+
connection_type: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
enum: ['http', 'jdbc', 'ldap', 'ssh', 'custom'],
|
|
33
|
+
description: 'Type of connection',
|
|
34
|
+
default: 'http'
|
|
35
|
+
},
|
|
36
|
+
configuration_template: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
description: 'sys_id of the connection configuration template (e.g., for specific Spoke)'
|
|
39
|
+
},
|
|
40
|
+
credential_alias: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'sys_id of credential alias to use (if already exists)'
|
|
43
|
+
},
|
|
44
|
+
active: {
|
|
45
|
+
type: 'boolean',
|
|
46
|
+
description: 'Whether the alias is active',
|
|
47
|
+
default: true
|
|
48
|
+
},
|
|
49
|
+
http_connection: {
|
|
50
|
+
type: 'object',
|
|
51
|
+
description: 'HTTP connection details (for http type)',
|
|
52
|
+
properties: {
|
|
53
|
+
base_url: {
|
|
54
|
+
type: 'string',
|
|
55
|
+
description: 'Base URL of the external system'
|
|
56
|
+
},
|
|
57
|
+
default_headers: {
|
|
58
|
+
type: 'object',
|
|
59
|
+
description: 'Default headers to send'
|
|
60
|
+
},
|
|
61
|
+
use_mutual_auth: {
|
|
62
|
+
type: 'boolean',
|
|
63
|
+
description: 'Enable mutual TLS authentication'
|
|
64
|
+
},
|
|
65
|
+
mid_server: {
|
|
66
|
+
type: 'string',
|
|
67
|
+
description: 'MID Server to use for connection'
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
retry_policy: {
|
|
72
|
+
type: 'object',
|
|
73
|
+
description: 'Retry policy for failed connections',
|
|
74
|
+
properties: {
|
|
75
|
+
max_retries: {
|
|
76
|
+
type: 'number',
|
|
77
|
+
description: 'Maximum number of retries',
|
|
78
|
+
default: 3
|
|
79
|
+
},
|
|
80
|
+
retry_interval_seconds: {
|
|
81
|
+
type: 'number',
|
|
82
|
+
description: 'Seconds between retries',
|
|
83
|
+
default: 5
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
required: ['name']
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
async function execute(args, context) {
|
|
92
|
+
var name = args.name;
|
|
93
|
+
var connection_type = args.connection_type || 'http';
|
|
94
|
+
var configuration_template = args.configuration_template || '';
|
|
95
|
+
var credential_alias = args.credential_alias || '';
|
|
96
|
+
var active = args.active !== false;
|
|
97
|
+
var http_connection = args.http_connection || {};
|
|
98
|
+
var retry_policy = args.retry_policy || {};
|
|
99
|
+
try {
|
|
100
|
+
var client = await (0, auth_js_1.getAuthenticatedClient)(context);
|
|
101
|
+
var usedBackgroundScript = false;
|
|
102
|
+
// Create the connection alias record
|
|
103
|
+
var aliasData = {
|
|
104
|
+
name: name,
|
|
105
|
+
type: connection_type,
|
|
106
|
+
active: active
|
|
107
|
+
};
|
|
108
|
+
if (configuration_template) {
|
|
109
|
+
aliasData.configuration_template = configuration_template;
|
|
110
|
+
}
|
|
111
|
+
if (credential_alias) {
|
|
112
|
+
aliasData.credential = credential_alias;
|
|
113
|
+
}
|
|
114
|
+
var aliasResponse;
|
|
115
|
+
try {
|
|
116
|
+
aliasResponse = await client.post('/api/now/table/sys_alias', aliasData);
|
|
117
|
+
}
|
|
118
|
+
catch (tableError) {
|
|
119
|
+
if (tableError.response?.status === 403) {
|
|
120
|
+
usedBackgroundScript = true;
|
|
121
|
+
var script = `
|
|
122
|
+
var gr = new GlideRecord('sys_alias');
|
|
123
|
+
gr.initialize();
|
|
124
|
+
gr.name = ${JSON.stringify(name)};
|
|
125
|
+
gr.type = ${JSON.stringify(connection_type)};
|
|
126
|
+
gr.active = ${active};
|
|
127
|
+
${configuration_template ? `gr.configuration_template = ${JSON.stringify(configuration_template)};` : ''}
|
|
128
|
+
${credential_alias ? `gr.credential = ${JSON.stringify(credential_alias)};` : ''}
|
|
129
|
+
var sysId = gr.insert();
|
|
130
|
+
|
|
131
|
+
if (sysId) {
|
|
132
|
+
gs.print(JSON.stringify({
|
|
133
|
+
sys_id: sysId,
|
|
134
|
+
name: gr.name.toString(),
|
|
135
|
+
type: gr.type.toString()
|
|
136
|
+
}));
|
|
137
|
+
} else {
|
|
138
|
+
gs.error('Failed to create connection alias');
|
|
139
|
+
}
|
|
140
|
+
`;
|
|
141
|
+
var scriptResponse = await client.post('/api/now/table/sys_script_execution', {
|
|
142
|
+
script: script,
|
|
143
|
+
description: 'Create connection alias: ' + name
|
|
144
|
+
});
|
|
145
|
+
var output = scriptResponse.data.result?.output || '';
|
|
146
|
+
var match = output.match(/\{[^}]+\}/);
|
|
147
|
+
if (match) {
|
|
148
|
+
aliasResponse = { data: { result: JSON.parse(match[0]) } };
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
throw new Error('Failed to create connection alias via background script');
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
throw tableError;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
var alias = aliasResponse.data.result;
|
|
159
|
+
// If HTTP connection details provided, create HTTP connection record
|
|
160
|
+
var httpConnectionRecord = null;
|
|
161
|
+
if (connection_type === 'http' && http_connection.base_url) {
|
|
162
|
+
var httpData = {
|
|
163
|
+
connection_alias: alias.sys_id,
|
|
164
|
+
connection_url: http_connection.base_url,
|
|
165
|
+
use_mutual_auth: http_connection.use_mutual_auth || false
|
|
166
|
+
};
|
|
167
|
+
if (http_connection.mid_server) {
|
|
168
|
+
httpData.mid_server = http_connection.mid_server;
|
|
169
|
+
}
|
|
170
|
+
try {
|
|
171
|
+
var httpResponse = await client.post('/api/now/table/sys_connection', httpData);
|
|
172
|
+
httpConnectionRecord = httpResponse.data.result;
|
|
173
|
+
}
|
|
174
|
+
catch (httpError) {
|
|
175
|
+
if (httpError.response?.status === 403) {
|
|
176
|
+
var httpScript = `
|
|
177
|
+
var gr = new GlideRecord('sys_connection');
|
|
178
|
+
gr.initialize();
|
|
179
|
+
gr.connection_alias = ${JSON.stringify(alias.sys_id)};
|
|
180
|
+
gr.connection_url = ${JSON.stringify(http_connection.base_url)};
|
|
181
|
+
gr.use_mutual_auth = ${http_connection.use_mutual_auth || false};
|
|
182
|
+
${http_connection.mid_server ? `gr.mid_server = ${JSON.stringify(http_connection.mid_server)};` : ''}
|
|
183
|
+
var sysId = gr.insert();
|
|
184
|
+
|
|
185
|
+
if (sysId) {
|
|
186
|
+
gs.print(JSON.stringify({
|
|
187
|
+
sys_id: sysId,
|
|
188
|
+
connection_url: gr.connection_url.toString()
|
|
189
|
+
}));
|
|
190
|
+
}
|
|
191
|
+
`;
|
|
192
|
+
var httpScriptResponse = await client.post('/api/now/table/sys_script_execution', {
|
|
193
|
+
script: httpScript,
|
|
194
|
+
description: 'Create HTTP connection for alias: ' + name
|
|
195
|
+
});
|
|
196
|
+
var httpOutput = httpScriptResponse.data.result?.output || '';
|
|
197
|
+
var httpMatch = httpOutput.match(/\{[^}]+\}/);
|
|
198
|
+
if (httpMatch) {
|
|
199
|
+
httpConnectionRecord = JSON.parse(httpMatch[0]);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return (0, error_handler_js_1.createSuccessResult)({
|
|
205
|
+
created: true,
|
|
206
|
+
method: usedBackgroundScript ? 'background_script' : 'table_api',
|
|
207
|
+
connection_alias: {
|
|
208
|
+
sys_id: alias.sys_id,
|
|
209
|
+
name: alias.name || name,
|
|
210
|
+
type: connection_type,
|
|
211
|
+
active: active
|
|
212
|
+
},
|
|
213
|
+
http_connection: httpConnectionRecord ? {
|
|
214
|
+
sys_id: httpConnectionRecord.sys_id,
|
|
215
|
+
base_url: http_connection.base_url
|
|
216
|
+
} : null,
|
|
217
|
+
usage_instructions: [
|
|
218
|
+
'Use this alias in Flow Designer actions',
|
|
219
|
+
'Reference in REST steps: alias=' + name,
|
|
220
|
+
'Configure credentials via snow_create_credential_alias if needed'
|
|
221
|
+
]
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
if (error.response?.status === 403) {
|
|
226
|
+
return (0, error_handler_js_1.createErrorResult)('Permission denied (403): Your ServiceNow user lacks permissions to create connection aliases. ' +
|
|
227
|
+
'Required roles: "connection_admin" or "admin". Please contact your ServiceNow administrator.');
|
|
228
|
+
}
|
|
229
|
+
return (0, error_handler_js_1.createErrorResult)(error.message);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
exports.version = '1.0.0';
|
|
233
|
+
exports.author = 'Snow-Flow Team';
|
|
234
|
+
//# sourceMappingURL=snow_create_connection_alias.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snow_create_connection_alias.js","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/integration/snow_create_connection_alias.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAsFH,0BAwJC;AA3OD,kDAA8D;AAC9D,oEAAuF;AAE1E,QAAA,cAAc,GAAsB;IAC/C,IAAI,EAAE,8BAA8B;IACp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QAAA,OAAO,GAAG,OAAO,CAAC;AAClB,QAAA,MAAM,GAAG,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* snow_create_credential_alias - Create Credential Aliases for secure authentication
|
|
3
|
+
*
|
|
4
|
+
* Create credential aliases to securely store and reference authentication
|
|
5
|
+
* credentials for external integrations (API keys, Basic Auth, OAuth).
|
|
6
|
+
*/
|
|
7
|
+
import { MCPToolDefinition, ServiceNowContext, ToolResult } from '../../shared/types.js';
|
|
8
|
+
export declare const toolDefinition: MCPToolDefinition;
|
|
9
|
+
export declare function execute(args: any, context: ServiceNowContext): Promise<ToolResult>;
|
|
10
|
+
export declare const version = "1.0.0";
|
|
11
|
+
export declare const author = "Snow-Flow Team";
|
|
12
|
+
//# sourceMappingURL=snow_create_credential_alias.d.ts.map
|
package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_credential_alias.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snow_create_credential_alias.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/integration/snow_create_credential_alias.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAIzF,eAAO,MAAM,cAAc,EAAE,iBA+E5B,CAAC;AAEF,wBAAsB,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CAoMxF;AAED,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* snow_create_credential_alias - Create Credential Aliases for secure authentication
|
|
4
|
+
*
|
|
5
|
+
* Create credential aliases to securely store and reference authentication
|
|
6
|
+
* credentials for external integrations (API keys, Basic Auth, OAuth).
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.author = exports.version = exports.toolDefinition = void 0;
|
|
10
|
+
exports.execute = execute;
|
|
11
|
+
const auth_js_1 = require("../../shared/auth.js");
|
|
12
|
+
const error_handler_js_1 = require("../../shared/error-handler.js");
|
|
13
|
+
exports.toolDefinition = {
|
|
14
|
+
name: 'snow_create_credential_alias',
|
|
15
|
+
description: 'Create credential alias for secure storage of API keys, passwords, and OAuth tokens',
|
|
16
|
+
category: 'integration',
|
|
17
|
+
subcategory: 'credentials',
|
|
18
|
+
use_cases: ['credentials', 'security', 'authentication', 'api-keys'],
|
|
19
|
+
complexity: 'intermediate',
|
|
20
|
+
frequency: 'medium',
|
|
21
|
+
permission: 'write',
|
|
22
|
+
allowedRoles: ['developer', 'admin'],
|
|
23
|
+
inputSchema: {
|
|
24
|
+
type: 'object',
|
|
25
|
+
properties: {
|
|
26
|
+
name: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
description: 'Credential alias name (e.g., "Jira API Credentials", "AWS Access Keys")'
|
|
29
|
+
},
|
|
30
|
+
type: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
enum: ['basic', 'api_key', 'oauth2', 'ssh', 'certificate', 'custom'],
|
|
33
|
+
description: 'Type of credential',
|
|
34
|
+
default: 'basic'
|
|
35
|
+
},
|
|
36
|
+
basic_auth: {
|
|
37
|
+
type: 'object',
|
|
38
|
+
description: 'Basic authentication credentials',
|
|
39
|
+
properties: {
|
|
40
|
+
username: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'Username'
|
|
43
|
+
},
|
|
44
|
+
password: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
description: 'Password (stored encrypted)'
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
api_key: {
|
|
51
|
+
type: 'object',
|
|
52
|
+
description: 'API key credentials',
|
|
53
|
+
properties: {
|
|
54
|
+
key: {
|
|
55
|
+
type: 'string',
|
|
56
|
+
description: 'API key value (stored encrypted)'
|
|
57
|
+
},
|
|
58
|
+
header_name: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
description: 'Header name for API key (e.g., "X-API-Key", "Authorization")',
|
|
61
|
+
default: 'X-API-Key'
|
|
62
|
+
},
|
|
63
|
+
prefix: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
description: 'Prefix for the key value (e.g., "Bearer ", "Api-Key ")'
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
oauth2: {
|
|
70
|
+
type: 'object',
|
|
71
|
+
description: 'OAuth 2.0 credential reference',
|
|
72
|
+
properties: {
|
|
73
|
+
oauth_profile_id: {
|
|
74
|
+
type: 'string',
|
|
75
|
+
description: 'sys_id of the OAuth profile to use'
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
active: {
|
|
80
|
+
type: 'boolean',
|
|
81
|
+
description: 'Whether the credential is active',
|
|
82
|
+
default: true
|
|
83
|
+
},
|
|
84
|
+
tag: {
|
|
85
|
+
type: 'string',
|
|
86
|
+
description: 'Tag for organizing credentials'
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
required: ['name', 'type']
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
async function execute(args, context) {
|
|
93
|
+
var name = args.name;
|
|
94
|
+
var type = args.type || 'basic';
|
|
95
|
+
var basic_auth = args.basic_auth || {};
|
|
96
|
+
var api_key = args.api_key || {};
|
|
97
|
+
var oauth2 = args.oauth2 || {};
|
|
98
|
+
var active = args.active !== false;
|
|
99
|
+
var tag = args.tag || '';
|
|
100
|
+
try {
|
|
101
|
+
var client = await (0, auth_js_1.getAuthenticatedClient)(context);
|
|
102
|
+
var usedBackgroundScript = false;
|
|
103
|
+
// First create the credential alias record
|
|
104
|
+
var aliasData = {
|
|
105
|
+
name: name,
|
|
106
|
+
type: type,
|
|
107
|
+
active: active
|
|
108
|
+
};
|
|
109
|
+
if (tag) {
|
|
110
|
+
aliasData.tag = tag;
|
|
111
|
+
}
|
|
112
|
+
var aliasResponse;
|
|
113
|
+
try {
|
|
114
|
+
aliasResponse = await client.post('/api/now/table/sys_alias', aliasData);
|
|
115
|
+
}
|
|
116
|
+
catch (tableError) {
|
|
117
|
+
if (tableError.response?.status === 403) {
|
|
118
|
+
usedBackgroundScript = true;
|
|
119
|
+
var script = `
|
|
120
|
+
var gr = new GlideRecord('sys_alias');
|
|
121
|
+
gr.initialize();
|
|
122
|
+
gr.name = ${JSON.stringify(name)};
|
|
123
|
+
gr.type = 'credential';
|
|
124
|
+
gr.active = ${active};
|
|
125
|
+
${tag ? `gr.tag = ${JSON.stringify(tag)};` : ''}
|
|
126
|
+
var sysId = gr.insert();
|
|
127
|
+
|
|
128
|
+
if (sysId) {
|
|
129
|
+
gs.print(JSON.stringify({
|
|
130
|
+
sys_id: sysId,
|
|
131
|
+
name: gr.name.toString()
|
|
132
|
+
}));
|
|
133
|
+
} else {
|
|
134
|
+
gs.error('Failed to create credential alias');
|
|
135
|
+
}
|
|
136
|
+
`;
|
|
137
|
+
var scriptResponse = await client.post('/api/now/table/sys_script_execution', {
|
|
138
|
+
script: script,
|
|
139
|
+
description: 'Create credential alias: ' + name
|
|
140
|
+
});
|
|
141
|
+
var output = scriptResponse.data.result?.output || '';
|
|
142
|
+
var match = output.match(/\{[^}]+\}/);
|
|
143
|
+
if (match) {
|
|
144
|
+
aliasResponse = { data: { result: JSON.parse(match[0]) } };
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
throw new Error('Failed to create credential alias via background script');
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
throw tableError;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
var alias = aliasResponse.data.result;
|
|
155
|
+
var credentialRecord = null;
|
|
156
|
+
// Create the actual credential record based on type
|
|
157
|
+
if (type === 'basic' && basic_auth.username) {
|
|
158
|
+
var basicData = {
|
|
159
|
+
name: name + ' - Basic Auth',
|
|
160
|
+
user_name: basic_auth.username,
|
|
161
|
+
password: basic_auth.password || ''
|
|
162
|
+
};
|
|
163
|
+
try {
|
|
164
|
+
var basicResponse = await client.post('/api/now/table/basic_auth_credentials', basicData);
|
|
165
|
+
credentialRecord = basicResponse.data.result;
|
|
166
|
+
}
|
|
167
|
+
catch (basicError) {
|
|
168
|
+
if (basicError.response?.status === 403) {
|
|
169
|
+
var basicScript = `
|
|
170
|
+
var gr = new GlideRecord('basic_auth_credentials');
|
|
171
|
+
gr.initialize();
|
|
172
|
+
gr.name = ${JSON.stringify(name + ' - Basic Auth')};
|
|
173
|
+
gr.user_name = ${JSON.stringify(basic_auth.username)};
|
|
174
|
+
gr.password = ${JSON.stringify(basic_auth.password || '')};
|
|
175
|
+
var sysId = gr.insert();
|
|
176
|
+
|
|
177
|
+
if (sysId) {
|
|
178
|
+
gs.print(JSON.stringify({
|
|
179
|
+
sys_id: sysId,
|
|
180
|
+
name: gr.name.toString(),
|
|
181
|
+
user_name: gr.user_name.toString()
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
`;
|
|
185
|
+
var basicScriptResponse = await client.post('/api/now/table/sys_script_execution', {
|
|
186
|
+
script: basicScript,
|
|
187
|
+
description: 'Create basic auth credential: ' + name
|
|
188
|
+
});
|
|
189
|
+
var basicOutput = basicScriptResponse.data.result?.output || '';
|
|
190
|
+
var basicMatch = basicOutput.match(/\{[^}]+\}/);
|
|
191
|
+
if (basicMatch) {
|
|
192
|
+
credentialRecord = JSON.parse(basicMatch[0]);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
else if (type === 'api_key' && api_key.key) {
|
|
198
|
+
var apiKeyData = {
|
|
199
|
+
name: name + ' - API Key',
|
|
200
|
+
api_key: api_key.key,
|
|
201
|
+
api_key_header: api_key.header_name || 'X-API-Key'
|
|
202
|
+
};
|
|
203
|
+
try {
|
|
204
|
+
var apiKeyResponse = await client.post('/api/now/table/api_key_credentials', apiKeyData);
|
|
205
|
+
credentialRecord = apiKeyResponse.data.result;
|
|
206
|
+
}
|
|
207
|
+
catch (apiKeyError) {
|
|
208
|
+
if (apiKeyError.response?.status === 403) {
|
|
209
|
+
var apiKeyScript = `
|
|
210
|
+
var gr = new GlideRecord('api_key_credentials');
|
|
211
|
+
gr.initialize();
|
|
212
|
+
gr.name = ${JSON.stringify(name + ' - API Key')};
|
|
213
|
+
gr.api_key = ${JSON.stringify(api_key.key)};
|
|
214
|
+
gr.api_key_header = ${JSON.stringify(api_key.header_name || 'X-API-Key')};
|
|
215
|
+
var sysId = gr.insert();
|
|
216
|
+
|
|
217
|
+
if (sysId) {
|
|
218
|
+
gs.print(JSON.stringify({
|
|
219
|
+
sys_id: sysId,
|
|
220
|
+
name: gr.name.toString(),
|
|
221
|
+
header: gr.api_key_header.toString()
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
`;
|
|
225
|
+
var apiKeyScriptResponse = await client.post('/api/now/table/sys_script_execution', {
|
|
226
|
+
script: apiKeyScript,
|
|
227
|
+
description: 'Create API key credential: ' + name
|
|
228
|
+
});
|
|
229
|
+
var apiKeyOutput = apiKeyScriptResponse.data.result?.output || '';
|
|
230
|
+
var apiKeyMatch = apiKeyOutput.match(/\{[^}]+\}/);
|
|
231
|
+
if (apiKeyMatch) {
|
|
232
|
+
credentialRecord = JSON.parse(apiKeyMatch[0]);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
// Link credential to alias if we created one
|
|
238
|
+
if (credentialRecord && alias.sys_id) {
|
|
239
|
+
try {
|
|
240
|
+
await client.patch('/api/now/table/sys_alias/' + alias.sys_id, {
|
|
241
|
+
credential: credentialRecord.sys_id
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
catch (linkError) {
|
|
245
|
+
// Non-critical, alias still works
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return (0, error_handler_js_1.createSuccessResult)({
|
|
249
|
+
created: true,
|
|
250
|
+
method: usedBackgroundScript ? 'background_script' : 'table_api',
|
|
251
|
+
credential_alias: {
|
|
252
|
+
sys_id: alias.sys_id,
|
|
253
|
+
name: alias.name || name,
|
|
254
|
+
type: type,
|
|
255
|
+
active: active
|
|
256
|
+
},
|
|
257
|
+
credential: credentialRecord ? {
|
|
258
|
+
sys_id: credentialRecord.sys_id,
|
|
259
|
+
name: credentialRecord.name,
|
|
260
|
+
type: type
|
|
261
|
+
} : null,
|
|
262
|
+
security_note: 'Credentials are stored encrypted in ServiceNow. Never expose credentials in logs or outputs.',
|
|
263
|
+
usage: [
|
|
264
|
+
'Reference this alias in connection configurations',
|
|
265
|
+
'Use in Flow Designer REST actions',
|
|
266
|
+
'Reference in snow_create_connection_alias for full connection setup'
|
|
267
|
+
]
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
271
|
+
if (error.response?.status === 403) {
|
|
272
|
+
return (0, error_handler_js_1.createErrorResult)('Permission denied (403): Your ServiceNow user lacks permissions to create credentials. ' +
|
|
273
|
+
'Required roles: "credentials_admin" or "admin". Please contact your ServiceNow administrator.');
|
|
274
|
+
}
|
|
275
|
+
return (0, error_handler_js_1.createErrorResult)(error.message);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
exports.version = '1.0.0';
|
|
279
|
+
exports.author = 'Snow-Flow Team';
|
|
280
|
+
//# sourceMappingURL=snow_create_credential_alias.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snow_create_credential_alias.js","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/integration/snow_create_credential_alias.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAuFH,0BAoMC;AAxRD,kDAA8D;AAC9D,oEAAuF;AAE1E,QAAA,cAAc,GAAsB;IAC/C,IAAI,EAAE,8BAA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- Create custom IntegrationHub actions
|
|
3
|
+
*
|
|
4
|
+
* Create custom Flow Designer actions for IntegrationHub to extend
|
|
5
|
+
* spoke capabilities or create new integrations.
|
|
6
|
+
*/
|
|
7
|
+
import { MCPToolDefinition, ServiceNowContext, ToolResult } from '../../shared/types.js';
|
|
8
|
+
export declare const toolDefinition: MCPToolDefinition;
|
|
9
|
+
export declare function execute(args: any, context: ServiceNowContext): Promise<ToolResult>;
|
|
10
|
+
export declare const version = "1.0.0";
|
|
11
|
+
export declare const author = "Snow-Flow Team";
|
|
12
|
+
//# sourceMappingURL=snow_create_flow_action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snow_create_flow_action.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/integration/snow_create_flow_action.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAIzF,eAAO,MAAM,cAAc,EAAE,iBA6F5B,CAAC;AAEF,wBAAsB,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CAuQxF;AAED,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,MAAM,mBAAmB,CAAC"}
|