snow-flow 2.6.4 → 2.6.6
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-development-assistant-mcp.js +29 -4
- package/dist/queen/queen-memory.d.ts +12 -6
- package/dist/queen/queen-memory.js +264 -187
- package/dist/queen/types.d.ts +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +9 -0
- package/package.json +1 -1
- package/dist/mcp/example-refactored-server.d.ts +0 -18
- package/dist/mcp/example-refactored-server.js +0 -57
- package/dist/mcp/servicenow-automation-mcp-refactored.d.ts +0 -26
- package/dist/mcp/servicenow-automation-mcp-refactored.js +0 -632
- package/dist/mcp/servicenow-deployment-mcp-refactored.d.ts +0 -74
- package/dist/mcp/servicenow-deployment-mcp-refactored.js +0 -1044
- package/dist/mcp/servicenow-flow-composer-mcp-refactored.d.ts +0 -25
- package/dist/mcp/servicenow-flow-composer-mcp-refactored.js +0 -565
- package/dist/mcp/servicenow-graph-memory-mcp-refactored.d.ts +0 -32
- package/dist/mcp/servicenow-graph-memory-mcp-refactored.js +0 -642
- package/dist/mcp/servicenow-integration-mcp-refactored.d.ts +0 -24
- package/dist/mcp/servicenow-integration-mcp-refactored.js +0 -612
- package/dist/mcp/servicenow-intelligent-mcp-refactored.d.ts +0 -63
- package/dist/mcp/servicenow-intelligent-mcp-refactored.js +0 -782
- package/dist/mcp/servicenow-operations-mcp-refactored.d.ts +0 -63
- package/dist/mcp/servicenow-operations-mcp-refactored.js +0 -1770
- package/dist/mcp/servicenow-platform-development-mcp-refactored.d.ts +0 -25
- package/dist/mcp/servicenow-platform-development-mcp-refactored.js +0 -542
- package/dist/mcp/servicenow-reporting-analytics-mcp-refactored.d.ts +0 -26
- package/dist/mcp/servicenow-reporting-analytics-mcp-refactored.js +0 -648
- package/dist/mcp/servicenow-security-compliance-mcp-refactored.d.ts +0 -25
- package/dist/mcp/servicenow-security-compliance-mcp-refactored.js +0 -600
- package/dist/mcp/servicenow-update-set-mcp-refactored.d.ts +0 -31
- package/dist/mcp/servicenow-update-set-mcp-refactored.js +0 -662
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* servicenow-flow-composer MCP Server - REFACTORED
|
|
4
|
-
* Uses BaseMCPServer to eliminate code duplication
|
|
5
|
-
*/
|
|
6
|
-
import { BaseMCPServer, ToolResult } from './base-mcp-server.js';
|
|
7
|
-
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
8
|
-
export declare class ServiceNowFlowComposerMCP extends BaseMCPServer {
|
|
9
|
-
private flowClient;
|
|
10
|
-
private flowOAuth;
|
|
11
|
-
constructor();
|
|
12
|
-
protected setupTools(): void;
|
|
13
|
-
protected getTools(): Tool[];
|
|
14
|
-
protected executeTool(name: string, args: any): Promise<ToolResult>;
|
|
15
|
-
private handleSnowCreateFlow;
|
|
16
|
-
private handleSnowAnalyzeFlowInstruction;
|
|
17
|
-
private handleSnowDiscoverFlowArtifacts;
|
|
18
|
-
private handleSnowPreviewFlowStructure;
|
|
19
|
-
private handleSnowDeployComposedFlow;
|
|
20
|
-
private handleSnowIntelligentFlowAnalysis;
|
|
21
|
-
private handleSnowScopeOptimization;
|
|
22
|
-
private handleSnowTemplateMatching;
|
|
23
|
-
private extractFlowName;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=servicenow-flow-composer-mcp-refactored.d.ts.map
|
|
@@ -1,565 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
/**
|
|
4
|
-
* servicenow-flow-composer MCP Server - REFACTORED
|
|
5
|
-
* Uses BaseMCPServer to eliminate code duplication
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.ServiceNowFlowComposerMCP = void 0;
|
|
9
|
-
const base_mcp_server_js_1 = require("./base-mcp-server.js");
|
|
10
|
-
const servicenow_client_js_1 = require("../utils/servicenow-client.js");
|
|
11
|
-
const snow_oauth_js_1 = require("../utils/snow-oauth.js");
|
|
12
|
-
class ServiceNowFlowComposerMCP extends base_mcp_server_js_1.BaseMCPServer {
|
|
13
|
-
constructor() {
|
|
14
|
-
super({
|
|
15
|
-
name: 'servicenow-flow-composer',
|
|
16
|
-
version: '2.0.0',
|
|
17
|
-
description: 'Natural language flow creation with multi-artifact orchestration'
|
|
18
|
-
});
|
|
19
|
-
// Initialize flow-specific clients
|
|
20
|
-
this.flowClient = new servicenow_client_js_1.ServiceNowClient();
|
|
21
|
-
this.flowOAuth = new snow_oauth_js_1.ServiceNowOAuth();
|
|
22
|
-
}
|
|
23
|
-
setupTools() {
|
|
24
|
-
// Tools are defined in getTools() method
|
|
25
|
-
}
|
|
26
|
-
getTools() {
|
|
27
|
-
return [
|
|
28
|
-
{
|
|
29
|
-
name: 'snow_create_flow',
|
|
30
|
-
description: 'FULLY AUTONOMOUS flow creation - parses natural language, discovers artifacts, creates missing components, links everything, deploys automatically. ZERO MANUAL WORK!',
|
|
31
|
-
inputSchema: {
|
|
32
|
-
type: 'object',
|
|
33
|
-
properties: {
|
|
34
|
-
instruction: {
|
|
35
|
-
type: 'string',
|
|
36
|
-
description: 'Natural language instruction for the flow'
|
|
37
|
-
},
|
|
38
|
-
deploy_immediately: {
|
|
39
|
-
type: 'boolean',
|
|
40
|
-
description: '⚠️ DEPLOYMENT MODE - true: Deploy REAL flow to ServiceNow immediately | false: Planning mode only',
|
|
41
|
-
default: true
|
|
42
|
-
},
|
|
43
|
-
create_missing_artifacts: {
|
|
44
|
-
type: 'boolean',
|
|
45
|
-
description: 'Create missing artifacts as fallbacks',
|
|
46
|
-
default: true
|
|
47
|
-
},
|
|
48
|
-
scope_preference: {
|
|
49
|
-
type: 'string',
|
|
50
|
-
enum: ['global', 'application', 'auto'],
|
|
51
|
-
description: 'Preferred deployment scope',
|
|
52
|
-
default: 'auto'
|
|
53
|
-
},
|
|
54
|
-
enable_intelligent_analysis: {
|
|
55
|
-
type: 'boolean',
|
|
56
|
-
description: 'Enable intelligent flow vs subflow analysis',
|
|
57
|
-
default: true
|
|
58
|
-
},
|
|
59
|
-
validation_level: {
|
|
60
|
-
type: 'string',
|
|
61
|
-
enum: ['basic', 'standard', 'comprehensive'],
|
|
62
|
-
description: 'Level of validation to perform',
|
|
63
|
-
default: 'standard'
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
required: ['instruction']
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: 'snow_analyze_flow_instruction',
|
|
71
|
-
description: 'AUTONOMOUS analysis - understands complex requirements, identifies all needed artifacts, plans optimal flow structure. SELF-LEARNING from patterns.',
|
|
72
|
-
inputSchema: {
|
|
73
|
-
type: 'object',
|
|
74
|
-
properties: {
|
|
75
|
-
instruction: {
|
|
76
|
-
type: 'string',
|
|
77
|
-
description: 'Natural language instruction to analyze'
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
required: ['instruction']
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: 'snow_discover_flow_artifacts',
|
|
85
|
-
description: 'AUTONOMOUS discovery - finds all required artifacts, creates missing ones, ensures compatibility. INTELLIGENT DEPENDENCY RESOLUTION!',
|
|
86
|
-
inputSchema: {
|
|
87
|
-
type: 'object',
|
|
88
|
-
properties: {
|
|
89
|
-
instruction: {
|
|
90
|
-
type: 'string',
|
|
91
|
-
description: 'Natural language instruction'
|
|
92
|
-
},
|
|
93
|
-
artifact_types: {
|
|
94
|
-
type: 'array',
|
|
95
|
-
items: {
|
|
96
|
-
type: 'string',
|
|
97
|
-
enum: ['script_include', 'business_rule', 'table', 'widget', 'ui_script']
|
|
98
|
-
},
|
|
99
|
-
description: 'Specific artifact types to search for'
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
required: ['instruction']
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
name: 'snow_preview_flow_structure',
|
|
107
|
-
description: 'Preview the flow structure before deployment',
|
|
108
|
-
inputSchema: {
|
|
109
|
-
type: 'object',
|
|
110
|
-
properties: {
|
|
111
|
-
instruction: {
|
|
112
|
-
type: 'string',
|
|
113
|
-
description: 'Natural language instruction'
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
required: ['instruction']
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
name: 'snow_deploy_composed_flow',
|
|
121
|
-
description: 'Deploy a previously composed flow with all its artifacts',
|
|
122
|
-
inputSchema: {
|
|
123
|
-
type: 'object',
|
|
124
|
-
properties: {
|
|
125
|
-
flow_instruction: {
|
|
126
|
-
type: 'object',
|
|
127
|
-
description: 'Previously composed flow instruction object'
|
|
128
|
-
},
|
|
129
|
-
validation_required: {
|
|
130
|
-
type: 'boolean',
|
|
131
|
-
description: 'Validate all artifacts before deployment',
|
|
132
|
-
default: true
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
required: ['flow_instruction']
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
name: 'snow_intelligent_flow_analysis',
|
|
140
|
-
description: 'INTELLIGENT ANALYSIS - Performs comprehensive flow vs subflow analysis with decision rationale and recommendations',
|
|
141
|
-
inputSchema: {
|
|
142
|
-
type: 'object',
|
|
143
|
-
properties: {
|
|
144
|
-
instruction: {
|
|
145
|
-
type: 'string',
|
|
146
|
-
description: 'Natural language instruction to analyze'
|
|
147
|
-
},
|
|
148
|
-
include_templates: {
|
|
149
|
-
type: 'boolean',
|
|
150
|
-
description: 'Include template matching analysis',
|
|
151
|
-
default: true
|
|
152
|
-
},
|
|
153
|
-
include_validation: {
|
|
154
|
-
type: 'boolean',
|
|
155
|
-
description: 'Include validation analysis',
|
|
156
|
-
default: true
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
required: ['instruction']
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
name: 'snow_scope_optimization',
|
|
164
|
-
description: 'SCOPE OPTIMIZATION - Analyzes and recommends optimal deployment scope with fallback strategies',
|
|
165
|
-
inputSchema: {
|
|
166
|
-
type: 'object',
|
|
167
|
-
properties: {
|
|
168
|
-
artifact_type: {
|
|
169
|
-
type: 'string',
|
|
170
|
-
description: 'Type of artifact to analyze'
|
|
171
|
-
},
|
|
172
|
-
artifact_data: {
|
|
173
|
-
type: 'object',
|
|
174
|
-
description: 'Artifact data for analysis'
|
|
175
|
-
},
|
|
176
|
-
environment_type: {
|
|
177
|
-
type: 'string',
|
|
178
|
-
enum: ['development', 'testing', 'production'],
|
|
179
|
-
description: 'Target environment type',
|
|
180
|
-
default: 'development'
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
required: ['artifact_type', 'artifact_data']
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
name: 'snow_template_matching',
|
|
188
|
-
description: 'TEMPLATE MATCHING - Finds and applies best matching flow templates for common patterns',
|
|
189
|
-
inputSchema: {
|
|
190
|
-
type: 'object',
|
|
191
|
-
properties: {
|
|
192
|
-
instruction: {
|
|
193
|
-
type: 'string',
|
|
194
|
-
description: 'Natural language instruction'
|
|
195
|
-
},
|
|
196
|
-
template_categories: {
|
|
197
|
-
type: 'array',
|
|
198
|
-
items: {
|
|
199
|
-
type: 'string',
|
|
200
|
-
enum: ['approval', 'fulfillment', 'notification', 'integration', 'utility']
|
|
201
|
-
},
|
|
202
|
-
description: 'Template categories to search'
|
|
203
|
-
},
|
|
204
|
-
minimum_confidence: {
|
|
205
|
-
type: 'number',
|
|
206
|
-
description: 'Minimum confidence threshold for template matching',
|
|
207
|
-
default: 0.6
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
required: ['instruction']
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
];
|
|
214
|
-
}
|
|
215
|
-
async executeTool(name, args) {
|
|
216
|
-
const startTime = Date.now();
|
|
217
|
-
switch (name) {
|
|
218
|
-
case 'snow_create_flow':
|
|
219
|
-
return await this.handleSnowCreateFlow(args);
|
|
220
|
-
case 'snow_analyze_flow_instruction':
|
|
221
|
-
return await this.handleSnowAnalyzeFlowInstruction(args);
|
|
222
|
-
case 'snow_discover_flow_artifacts':
|
|
223
|
-
return await this.handleSnowDiscoverFlowArtifacts(args);
|
|
224
|
-
case 'snow_preview_flow_structure':
|
|
225
|
-
return await this.handleSnowPreviewFlowStructure(args);
|
|
226
|
-
case 'snow_deploy_composed_flow':
|
|
227
|
-
return await this.handleSnowDeployComposedFlow(args);
|
|
228
|
-
case 'snow_intelligent_flow_analysis':
|
|
229
|
-
return await this.handleSnowIntelligentFlowAnalysis(args);
|
|
230
|
-
case 'snow_scope_optimization':
|
|
231
|
-
return await this.handleSnowScopeOptimization(args);
|
|
232
|
-
case 'snow_template_matching':
|
|
233
|
-
return await this.handleSnowTemplateMatching(args);
|
|
234
|
-
default:
|
|
235
|
-
return {
|
|
236
|
-
success: false,
|
|
237
|
-
error: `Unknown tool: ${name}`
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
// Tool handlers
|
|
242
|
-
async handleSnowCreateFlow(args) {
|
|
243
|
-
const startTime = Date.now();
|
|
244
|
-
try {
|
|
245
|
-
// Input validation
|
|
246
|
-
if (!args.instruction || typeof args.instruction !== 'string' || args.instruction.trim().length === 0) {
|
|
247
|
-
return {
|
|
248
|
-
success: false,
|
|
249
|
-
error: 'Invalid Input: Instruction is required and must be a non-empty string.'
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
if (args.instruction.length > 2000) {
|
|
253
|
-
return {
|
|
254
|
-
success: false,
|
|
255
|
-
error: 'Invalid Input: Instruction is too long (maximum 2000 characters).'
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
this.logger.info('Creating flow using direct ServiceNowClient', { instruction: args.instruction });
|
|
259
|
-
// Parse natural language instruction
|
|
260
|
-
const flowName = this.extractFlowName(args.instruction);
|
|
261
|
-
const flowDescription = args.instruction;
|
|
262
|
-
// Create basic flow structure
|
|
263
|
-
const flowData = {
|
|
264
|
-
name: flowName,
|
|
265
|
-
description: flowDescription,
|
|
266
|
-
trigger_type: 'manual',
|
|
267
|
-
activities: [
|
|
268
|
-
{
|
|
269
|
-
name: 'Send Notification',
|
|
270
|
-
type: 'notification',
|
|
271
|
-
inputs: {
|
|
272
|
-
recipient: 'admin@test.nl',
|
|
273
|
-
subject: 'Flow Notification',
|
|
274
|
-
message: `Flow created: ${flowName}`
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
]
|
|
278
|
-
};
|
|
279
|
-
// Deploy if requested
|
|
280
|
-
let deploymentResult = null;
|
|
281
|
-
if (args.deploy_immediately !== false) {
|
|
282
|
-
console.log('🔧 DEPLOYING via direct ServiceNowClient.createFlow');
|
|
283
|
-
deploymentResult = await this.flowClient.createFlow(flowData);
|
|
284
|
-
console.log('🔧 Direct deployment result:', deploymentResult);
|
|
285
|
-
}
|
|
286
|
-
const credentials = await this.flowOAuth.loadCredentials();
|
|
287
|
-
const flowUrl = `https://${credentials?.instance}/flow-designer/flow/${flowName}`;
|
|
288
|
-
return {
|
|
289
|
-
success: true,
|
|
290
|
-
result: {
|
|
291
|
-
flowName,
|
|
292
|
-
flowDescription,
|
|
293
|
-
deploymentResult,
|
|
294
|
-
flowUrl,
|
|
295
|
-
deployed: args.deploy_immediately !== false && deploymentResult?.success
|
|
296
|
-
},
|
|
297
|
-
executionTime: Date.now() - startTime
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
catch (error) {
|
|
301
|
-
return {
|
|
302
|
-
success: false,
|
|
303
|
-
error: error instanceof Error ? error.message : 'Flow creation failed',
|
|
304
|
-
executionTime: Date.now() - startTime
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
async handleSnowAnalyzeFlowInstruction(args) {
|
|
309
|
-
const startTime = Date.now();
|
|
310
|
-
try {
|
|
311
|
-
this.logger.info('Analyzing flow instruction', { instruction: args.instruction });
|
|
312
|
-
// Simplified analysis for refactored version
|
|
313
|
-
const flowName = this.extractFlowName(args.instruction);
|
|
314
|
-
const analysis = {
|
|
315
|
-
parsedIntent: {
|
|
316
|
-
flowName,
|
|
317
|
-
table: 'task',
|
|
318
|
-
trigger: { type: 'manual', condition: 'None' },
|
|
319
|
-
intents: ['create_flow'],
|
|
320
|
-
dataFlow: ['input', 'process', 'output']
|
|
321
|
-
},
|
|
322
|
-
requiredArtifacts: [],
|
|
323
|
-
flowStructure: {
|
|
324
|
-
name: flowName,
|
|
325
|
-
activities: 1,
|
|
326
|
-
variables: 0,
|
|
327
|
-
error_handling: 0
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
return {
|
|
331
|
-
success: true,
|
|
332
|
-
result: analysis,
|
|
333
|
-
executionTime: Date.now() - Date.now()
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
catch (error) {
|
|
337
|
-
return {
|
|
338
|
-
success: false,
|
|
339
|
-
error: error instanceof Error ? error.message : 'Flow instruction analysis failed'
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
async handleSnowDiscoverFlowArtifacts(args) {
|
|
344
|
-
try {
|
|
345
|
-
this.logger.info('Discovering flow artifacts', { instruction: args.instruction });
|
|
346
|
-
// Simplified artifact discovery
|
|
347
|
-
const artifacts = [
|
|
348
|
-
{
|
|
349
|
-
type: 'script_include',
|
|
350
|
-
purpose: 'Core flow logic',
|
|
351
|
-
searchQuery: args.instruction,
|
|
352
|
-
required: true,
|
|
353
|
-
fallbackAction: 'Create new'
|
|
354
|
-
}
|
|
355
|
-
];
|
|
356
|
-
// Filter by requested types if specified
|
|
357
|
-
const filteredArtifacts = args.artifact_types && args.artifact_types.length > 0
|
|
358
|
-
? artifacts.filter(a => args.artifact_types.includes(a.type))
|
|
359
|
-
: artifacts;
|
|
360
|
-
return {
|
|
361
|
-
success: true,
|
|
362
|
-
result: { artifacts: filteredArtifacts },
|
|
363
|
-
executionTime: Date.now() - Date.now()
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
catch (error) {
|
|
367
|
-
return {
|
|
368
|
-
success: false,
|
|
369
|
-
error: error instanceof Error ? error.message : 'Artifact discovery failed'
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
async handleSnowPreviewFlowStructure(args) {
|
|
374
|
-
try {
|
|
375
|
-
this.logger.info('Previewing flow structure', { instruction: args.instruction });
|
|
376
|
-
const flowName = this.extractFlowName(args.instruction);
|
|
377
|
-
const flowStructure = {
|
|
378
|
-
name: flowName,
|
|
379
|
-
description: `Flow for: ${args.instruction}`,
|
|
380
|
-
trigger: { type: 'manual', table: 'task', condition: '' },
|
|
381
|
-
variables: [],
|
|
382
|
-
activities: [
|
|
383
|
-
{
|
|
384
|
-
id: 'activity_1',
|
|
385
|
-
name: 'Process Step',
|
|
386
|
-
type: 'custom',
|
|
387
|
-
inputs: { data: 'input' },
|
|
388
|
-
outputs: { result: 'processed' }
|
|
389
|
-
}
|
|
390
|
-
],
|
|
391
|
-
error_handling: []
|
|
392
|
-
};
|
|
393
|
-
return {
|
|
394
|
-
success: true,
|
|
395
|
-
result: { flowStructure },
|
|
396
|
-
executionTime: Date.now() - Date.now()
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
catch (error) {
|
|
400
|
-
return {
|
|
401
|
-
success: false,
|
|
402
|
-
error: error instanceof Error ? error.message : 'Flow structure preview failed'
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
async handleSnowDeployComposedFlow(args) {
|
|
407
|
-
try {
|
|
408
|
-
this.logger.info('Deploying composed flow', { flow: args.flow_instruction });
|
|
409
|
-
// Simulate deployment
|
|
410
|
-
const deploymentResult = {
|
|
411
|
-
success: true,
|
|
412
|
-
message: 'Flow deployed successfully',
|
|
413
|
-
flowName: args.flow_instruction?.flowStructure?.name || 'Unknown'
|
|
414
|
-
};
|
|
415
|
-
return {
|
|
416
|
-
success: true,
|
|
417
|
-
result: deploymentResult,
|
|
418
|
-
executionTime: Date.now() - Date.now()
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
catch (error) {
|
|
422
|
-
return {
|
|
423
|
-
success: false,
|
|
424
|
-
error: error instanceof Error ? error.message : 'Flow deployment failed'
|
|
425
|
-
};
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
async handleSnowIntelligentFlowAnalysis(args) {
|
|
429
|
-
try {
|
|
430
|
-
this.logger.info('Performing intelligent flow analysis', { instruction: args.instruction });
|
|
431
|
-
const analysisResult = {
|
|
432
|
-
decision: {
|
|
433
|
-
recommendedType: 'flow',
|
|
434
|
-
confidence: 0.85,
|
|
435
|
-
rationale: 'Standard flow pattern detected'
|
|
436
|
-
},
|
|
437
|
-
complexity: 'medium',
|
|
438
|
-
reusability: 'high',
|
|
439
|
-
context: 'business_process',
|
|
440
|
-
validation: {
|
|
441
|
-
isValid: true,
|
|
442
|
-
score: 8,
|
|
443
|
-
maxScore: 10
|
|
444
|
-
},
|
|
445
|
-
templates: {
|
|
446
|
-
matchCount: 2,
|
|
447
|
-
bestMatch: 'standard_approval_flow',
|
|
448
|
-
confidence: 0.75
|
|
449
|
-
},
|
|
450
|
-
subflowCandidates: 1,
|
|
451
|
-
alternatives: []
|
|
452
|
-
};
|
|
453
|
-
return {
|
|
454
|
-
success: true,
|
|
455
|
-
result: analysisResult,
|
|
456
|
-
executionTime: Date.now() - Date.now()
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
catch (error) {
|
|
460
|
-
return {
|
|
461
|
-
success: false,
|
|
462
|
-
error: error instanceof Error ? error.message : 'Intelligent flow analysis failed'
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
async handleSnowScopeOptimization(args) {
|
|
467
|
-
try {
|
|
468
|
-
this.logger.info('Performing scope optimization analysis', {
|
|
469
|
-
artifactType: args.artifact_type,
|
|
470
|
-
environmentType: args.environment_type
|
|
471
|
-
});
|
|
472
|
-
const scopeAnalysis = {
|
|
473
|
-
selectedScope: 'global',
|
|
474
|
-
confidence: 0.9,
|
|
475
|
-
rationale: 'Global scope provides maximum flexibility and reusability',
|
|
476
|
-
fallbackScope: 'application',
|
|
477
|
-
validationResult: {
|
|
478
|
-
permissions: 'Valid',
|
|
479
|
-
compliance: 'Compliant',
|
|
480
|
-
dependencies: 'Resolved'
|
|
481
|
-
},
|
|
482
|
-
recommendations: [
|
|
483
|
-
'Deploy to global scope for maximum reusability',
|
|
484
|
-
'Ensure proper naming conventions',
|
|
485
|
-
'Document scope decision for future reference'
|
|
486
|
-
]
|
|
487
|
-
};
|
|
488
|
-
return {
|
|
489
|
-
success: true,
|
|
490
|
-
result: scopeAnalysis,
|
|
491
|
-
executionTime: Date.now() - Date.now()
|
|
492
|
-
};
|
|
493
|
-
}
|
|
494
|
-
catch (error) {
|
|
495
|
-
return {
|
|
496
|
-
success: false,
|
|
497
|
-
error: error instanceof Error ? error.message : 'Scope optimization failed'
|
|
498
|
-
};
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
async handleSnowTemplateMatching(args) {
|
|
502
|
-
try {
|
|
503
|
-
this.logger.info('Performing template matching', {
|
|
504
|
-
instruction: args.instruction,
|
|
505
|
-
minimumConfidence: args.minimum_confidence || 0.6
|
|
506
|
-
});
|
|
507
|
-
const matchingResults = [
|
|
508
|
-
{
|
|
509
|
-
template: {
|
|
510
|
-
name: 'Standard Approval Flow',
|
|
511
|
-
category: 'approval',
|
|
512
|
-
description: 'Basic approval workflow template',
|
|
513
|
-
triggers: ['request_created'],
|
|
514
|
-
activities: 3,
|
|
515
|
-
variables: 2,
|
|
516
|
-
customizable: true
|
|
517
|
-
},
|
|
518
|
-
confidence: 0.8,
|
|
519
|
-
matchingReasons: ['Keyword match: approval', 'Pattern similarity'],
|
|
520
|
-
scores: {
|
|
521
|
-
keywords: 0.9,
|
|
522
|
-
intent: 0.8,
|
|
523
|
-
structure: 0.7,
|
|
524
|
-
context: 0.8
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
];
|
|
528
|
-
// Filter by confidence and categories
|
|
529
|
-
const filteredResults = matchingResults.filter(result => result.confidence >= (args.minimum_confidence || 0.6) &&
|
|
530
|
-
(!args.template_categories || args.template_categories.includes(result.template.category)));
|
|
531
|
-
return {
|
|
532
|
-
success: true,
|
|
533
|
-
result: { templates: filteredResults },
|
|
534
|
-
executionTime: Date.now() - Date.now()
|
|
535
|
-
};
|
|
536
|
-
}
|
|
537
|
-
catch (error) {
|
|
538
|
-
return {
|
|
539
|
-
success: false,
|
|
540
|
-
error: error instanceof Error ? error.message : 'Template matching failed'
|
|
541
|
-
};
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
// Helper methods
|
|
545
|
-
extractFlowName(instruction) {
|
|
546
|
-
const words = instruction.toLowerCase().split(' ');
|
|
547
|
-
if (words.includes('incident'))
|
|
548
|
-
return 'Incident Flow';
|
|
549
|
-
if (words.includes('user') || words.includes('gebruiker'))
|
|
550
|
-
return 'User Flow';
|
|
551
|
-
if (words.includes('request') || words.includes('aanvraag'))
|
|
552
|
-
return 'Request Flow';
|
|
553
|
-
if (words.includes('notification'))
|
|
554
|
-
return 'Notification Flow';
|
|
555
|
-
if (words.includes('approval'))
|
|
556
|
-
return 'Approval Flow';
|
|
557
|
-
return 'Custom Flow';
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
exports.ServiceNowFlowComposerMCP = ServiceNowFlowComposerMCP;
|
|
561
|
-
// Create and run the server
|
|
562
|
-
if (require.main === module) {
|
|
563
|
-
const server = new ServiceNowFlowComposerMCP();
|
|
564
|
-
server.start().catch(console.error);
|
|
565
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* servicenow-graph-memory MCP Server - REFACTORED
|
|
4
|
-
* Uses BaseMCPServer to eliminate code duplication
|
|
5
|
-
*/
|
|
6
|
-
import { BaseMCPServer, ToolResult } from './base-mcp-server.js';
|
|
7
|
-
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
8
|
-
export declare class ServiceNowGraphMemoryMCP extends BaseMCPServer {
|
|
9
|
-
private neo4jDriver;
|
|
10
|
-
private neo4jConfig;
|
|
11
|
-
private neo4jAvailable;
|
|
12
|
-
constructor();
|
|
13
|
-
protected setupTools(): void;
|
|
14
|
-
protected getTools(): Tool[];
|
|
15
|
-
protected executeTool(name: string, args: any): Promise<ToolResult>;
|
|
16
|
-
private initializeNeo4j;
|
|
17
|
-
private connectToNeo4j;
|
|
18
|
-
private createFallbackResponse;
|
|
19
|
-
private handleSnowGraphIndexArtifact;
|
|
20
|
-
private handleSnowGraphFindRelated;
|
|
21
|
-
private handleSnowGraphAnalyzeImpact;
|
|
22
|
-
private handleSnowGraphSuggestArtifacts;
|
|
23
|
-
private handleSnowGraphPatternAnalysis;
|
|
24
|
-
private handleSnowGraphVisualize;
|
|
25
|
-
private handleSnowGraphExportKnowledge;
|
|
26
|
-
private calculateImpactLevel;
|
|
27
|
-
private generateImpactRecommendations;
|
|
28
|
-
private generateCypherExport;
|
|
29
|
-
private generateGraphMLExport;
|
|
30
|
-
shutdown(): Promise<void>;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=servicenow-graph-memory-mcp-refactored.d.ts.map
|