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.
Files changed (31) hide show
  1. package/dist/mcp/servicenow-development-assistant-mcp.js +29 -4
  2. package/dist/queen/queen-memory.d.ts +12 -6
  3. package/dist/queen/queen-memory.js +264 -187
  4. package/dist/queen/types.d.ts +1 -0
  5. package/dist/version.d.ts +1 -0
  6. package/dist/version.js +9 -0
  7. package/package.json +1 -1
  8. package/dist/mcp/example-refactored-server.d.ts +0 -18
  9. package/dist/mcp/example-refactored-server.js +0 -57
  10. package/dist/mcp/servicenow-automation-mcp-refactored.d.ts +0 -26
  11. package/dist/mcp/servicenow-automation-mcp-refactored.js +0 -632
  12. package/dist/mcp/servicenow-deployment-mcp-refactored.d.ts +0 -74
  13. package/dist/mcp/servicenow-deployment-mcp-refactored.js +0 -1044
  14. package/dist/mcp/servicenow-flow-composer-mcp-refactored.d.ts +0 -25
  15. package/dist/mcp/servicenow-flow-composer-mcp-refactored.js +0 -565
  16. package/dist/mcp/servicenow-graph-memory-mcp-refactored.d.ts +0 -32
  17. package/dist/mcp/servicenow-graph-memory-mcp-refactored.js +0 -642
  18. package/dist/mcp/servicenow-integration-mcp-refactored.d.ts +0 -24
  19. package/dist/mcp/servicenow-integration-mcp-refactored.js +0 -612
  20. package/dist/mcp/servicenow-intelligent-mcp-refactored.d.ts +0 -63
  21. package/dist/mcp/servicenow-intelligent-mcp-refactored.js +0 -782
  22. package/dist/mcp/servicenow-operations-mcp-refactored.d.ts +0 -63
  23. package/dist/mcp/servicenow-operations-mcp-refactored.js +0 -1770
  24. package/dist/mcp/servicenow-platform-development-mcp-refactored.d.ts +0 -25
  25. package/dist/mcp/servicenow-platform-development-mcp-refactored.js +0 -542
  26. package/dist/mcp/servicenow-reporting-analytics-mcp-refactored.d.ts +0 -26
  27. package/dist/mcp/servicenow-reporting-analytics-mcp-refactored.js +0 -648
  28. package/dist/mcp/servicenow-security-compliance-mcp-refactored.d.ts +0 -25
  29. package/dist/mcp/servicenow-security-compliance-mcp-refactored.js +0 -600
  30. package/dist/mcp/servicenow-update-set-mcp-refactored.d.ts +0 -31
  31. package/dist/mcp/servicenow-update-set-mcp-refactored.js +0 -662
@@ -1,642 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- /**
4
- * servicenow-graph-memory MCP Server - REFACTORED
5
- * Uses BaseMCPServer to eliminate code duplication
6
- */
7
- var __importDefault = (this && this.__importDefault) || function (mod) {
8
- return (mod && mod.__esModule) ? mod : { "default": mod };
9
- };
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.ServiceNowGraphMemoryMCP = void 0;
12
- const base_mcp_server_js_1 = require("./base-mcp-server.js");
13
- const neo4j_driver_1 = __importDefault(require("neo4j-driver"));
14
- const mcp_config_manager_js_1 = require("../utils/mcp-config-manager.js");
15
- class ServiceNowGraphMemoryMCP extends base_mcp_server_js_1.BaseMCPServer {
16
- constructor() {
17
- super({
18
- name: 'servicenow-graph-memory',
19
- version: '2.0.0',
20
- description: 'Neo4j-based intelligent memory system for ServiceNow artifacts'
21
- });
22
- this.neo4jDriver = null;
23
- this.neo4jConfig = null;
24
- this.neo4jAvailable = false;
25
- this.initializeNeo4j();
26
- }
27
- setupTools() {
28
- // Tools are defined in getTools() method
29
- }
30
- getTools() {
31
- return [
32
- {
33
- name: 'snow_graph_index_artifact',
34
- description: 'AUTONOMOUS graph indexing - stores ServiceNow artifacts in Neo4j with relationships, enables instant understanding of dependencies and connections',
35
- inputSchema: {
36
- type: 'object',
37
- properties: {
38
- artifact: {
39
- type: 'object',
40
- properties: {
41
- id: { type: 'string', description: 'Unique identifier for the artifact' },
42
- name: { type: 'string', description: 'Artifact name' },
43
- type: { type: 'string', enum: ['widget', 'flow', 'script_include', 'business_rule', 'table', 'client_script', 'ui_script'] },
44
- content: { type: 'string', description: 'Full content/code of the artifact' },
45
- purpose: { type: 'string', description: 'What this artifact does' }
46
- },
47
- required: ['id', 'name', 'type']
48
- },
49
- relationships: {
50
- type: 'array',
51
- description: 'Relationships to other artifacts',
52
- items: {
53
- type: 'object',
54
- properties: {
55
- to: { type: 'string', description: 'Target artifact ID' },
56
- type: { type: 'string', enum: ['USES', 'REQUIRES', 'TRIGGERS', 'CREATES', 'MODIFIES', 'CALLS', 'EXTENDS'] },
57
- data_flow: { type: 'string', description: 'How data flows between artifacts' }
58
- }
59
- }
60
- }
61
- },
62
- required: ['artifact']
63
- }
64
- },
65
- {
66
- name: 'snow_graph_find_related',
67
- description: 'INTELLIGENT relationship discovery - finds all artifacts related to a given artifact, understands dependencies, data flows, and impact _analysis',
68
- inputSchema: {
69
- type: 'object',
70
- properties: {
71
- artifact_id: { type: 'string', description: 'Artifact ID to find relationships for' },
72
- depth: { type: 'number', description: 'How many levels of relationships to traverse', default: 2 },
73
- relationship_types: {
74
- type: 'array',
75
- description: 'Filter by relationship types',
76
- items: { type: 'string', enum: ['USES', 'REQUIRES', 'TRIGGERS', 'CREATES', 'MODIFIES', 'CALLS', 'EXTENDS'] }
77
- }
78
- },
79
- required: ['artifact_id']
80
- }
81
- },
82
- {
83
- name: 'snow_graph_analyze_impact',
84
- description: 'IMPACT ANALYSIS - shows what will be affected if an artifact is modified, critical for safe deployments',
85
- inputSchema: {
86
- type: 'object',
87
- properties: {
88
- artifact_id: { type: 'string', description: 'Artifact to analyze impact for' },
89
- change_type: { type: 'string', enum: ['modify', 'delete', 'upgrade'], description: 'Type of change planned' }
90
- },
91
- required: ['artifact_id']
92
- }
93
- },
94
- {
95
- name: 'snow_graph_suggest_artifacts',
96
- description: 'AI-POWERED suggestions - recommends artifacts based on current context and past successful patterns',
97
- inputSchema: {
98
- type: 'object',
99
- properties: {
100
- context: { type: 'string', description: 'Current development context' },
101
- artifact_type: { type: 'string', description: 'Type of artifact needed' },
102
- requirements: { type: 'array', description: 'Specific requirements', items: { type: 'string' } }
103
- },
104
- required: ['context']
105
- }
106
- },
107
- {
108
- name: 'snow_graph_pattern__analysis',
109
- description: 'PATTERN RECOGNITION - identifies common patterns, best practices, and reusable components across all artifacts',
110
- inputSchema: {
111
- type: 'object',
112
- properties: {
113
- pattern_type: { type: 'string', enum: ['architectural', 'coding', 'integration', 'error_handling'], description: 'Type of pattern to analyze' },
114
- min_occurrences: { type: 'number', default: 3, description: 'Minimum times pattern must appear' }
115
- }
116
- }
117
- },
118
- {
119
- name: 'snow_graph_visualize',
120
- description: 'GRAPH VISUALIZATION - generates Cypher queries for visualizing artifact relationships in Neo4j Browser',
121
- inputSchema: {
122
- type: 'object',
123
- properties: {
124
- focus_artifact: { type: 'string', description: 'Central artifact to visualize around' },
125
- max_nodes: { type: 'number', default: 50, description: 'Maximum nodes to display' },
126
- include_types: { type: 'array', description: 'Artifact types to include', items: { type: 'string' } }
127
- }
128
- }
129
- },
130
- {
131
- name: 'snow_graph_export_knowledge',
132
- description: 'KNOWLEDGE EXPORT - exports learned patterns and relationships for backup or sharing',
133
- inputSchema: {
134
- type: 'object',
135
- properties: {
136
- format: { type: 'string', enum: ['cypher', 'json', 'graphml'], description: 'Export format' },
137
- include_content: { type: 'boolean', default: false, description: 'Include full artifact content' }
138
- }
139
- }
140
- }
141
- ];
142
- }
143
- async executeTool(name, args) {
144
- const startTime = Date.now();
145
- // Check Neo4j availability for all tools
146
- if (!this.neo4jAvailable) {
147
- return this.createFallbackResponse(name);
148
- }
149
- switch (name) {
150
- case 'snow_graph_index_artifact':
151
- return await this.handleSnowGraphIndexArtifact(args);
152
- case 'snow_graph_find_related':
153
- return await this.handleSnowGraphFindRelated(args);
154
- case 'snow_graph_analyze_impact':
155
- return await this.handleSnowGraphAnalyzeImpact(args);
156
- case 'snow_graph_suggest_artifacts':
157
- return await this.handleSnowGraphSuggestArtifacts(args);
158
- case 'snow_graph_pattern__analysis':
159
- return await this.handleSnowGraphPatternAnalysis(args);
160
- case 'snow_graph_visualize':
161
- return await this.handleSnowGraphVisualize(args);
162
- case 'snow_graph_export_knowledge':
163
- return await this.handleSnowGraphExportKnowledge(args);
164
- default:
165
- return {
166
- success: false,
167
- error: `Unknown tool: ${name}`
168
- };
169
- }
170
- }
171
- // Initialize Neo4j connection
172
- initializeNeo4j() {
173
- const rawConfig = mcp_config_manager_js_1.mcpConfig.getNeo4jConfig();
174
- if (!rawConfig?.uri || !rawConfig?.username || !rawConfig?.password) {
175
- this.logger.warn('Neo4j configuration missing. Graph Memory MCP will run in fallback mode without Neo4j functionality.');
176
- this.logger.info('To enable Neo4j: set NEO4J_URI, NEO4J_USERNAME, and NEO4J_PASSWORD environment variables.');
177
- this.neo4jAvailable = false;
178
- }
179
- else {
180
- this.neo4jConfig = {
181
- uri: rawConfig.uri,
182
- username: rawConfig.username,
183
- password: rawConfig.password,
184
- database: rawConfig.database
185
- };
186
- this.neo4jAvailable = true;
187
- }
188
- }
189
- async connectToNeo4j() {
190
- if (!this.neo4jAvailable || !this.neo4jConfig) {
191
- return null;
192
- }
193
- if (!this.neo4jDriver) {
194
- try {
195
- this.neo4jDriver = neo4j_driver_1.default.driver(this.neo4jConfig.uri, neo4j_driver_1.default.auth.basic(this.neo4jConfig.username, this.neo4jConfig.password));
196
- await this.neo4jDriver.verifyConnectivity();
197
- this.logger.info('Connected to Neo4j');
198
- // Create indexes for better performance
199
- const session = this.neo4jDriver.session();
200
- try {
201
- await session.run('CREATE INDEX artifact_id IF NOT EXISTS FOR (a:Artifact) ON (a.id)');
202
- await session.run('CREATE INDEX artifact_type IF NOT EXISTS FOR (a:Artifact) ON (a.type)');
203
- await session.run('CREATE INDEX artifact_name IF NOT EXISTS FOR (a:Artifact) ON (a.name)');
204
- }
205
- finally {
206
- await session.close();
207
- }
208
- }
209
- catch (error) {
210
- this.logger.error('Failed to connect to Neo4j', error);
211
- throw error;
212
- }
213
- }
214
- return this.neo4jDriver;
215
- }
216
- createFallbackResponse(toolName) {
217
- return {
218
- success: false,
219
- error: `${toolName} requires Neo4j database. Please install and configure Neo4j to use graph memory features.`,
220
- result: {
221
- fallback_mode: true,
222
- instructions: [
223
- '1. Install Neo4j Community Edition',
224
- '2. Start Neo4j service',
225
- '3. Set environment variables: NEO4J_URI, NEO4J_USERNAME, NEO4J_PASSWORD',
226
- '4. Restart the MCP server'
227
- ]
228
- }
229
- };
230
- }
231
- // Tool handlers
232
- async handleSnowGraphIndexArtifact(args) {
233
- const startTime = Date.now();
234
- try {
235
- const driver = await this.connectToNeo4j();
236
- if (!driver)
237
- throw new Error('Neo4j not available');
238
- const session = driver.session();
239
- const artifact = args.artifact;
240
- const relationships = args.relationships || [];
241
- try {
242
- // Create or update the artifact node
243
- await session.run(`MERGE (a:Artifact {id: $id})
244
- SET a.name = $name,
245
- a.type = $type,
246
- a.content = $content,
247
- a.purpose = $purpose,
248
- a.last_updated = datetime(),
249
- a.deployment_count = COALESCE(a.deployment_count, 0) + 1`, {
250
- id: artifact.id,
251
- name: artifact.name,
252
- type: artifact.type,
253
- content: artifact.content || '',
254
- purpose: artifact.purpose || ''
255
- });
256
- // Create relationships
257
- for (const rel of relationships) {
258
- await session.run(`MATCH (a:Artifact {id: $fromId}), (b:Artifact {id: $toId})
259
- MERGE (a)-[r:${rel.type}]->(b)
260
- SET r.data_flow = $dataFlow,
261
- r.strength = COALESCE(r.strength, 0) + 1`, {
262
- fromId: artifact.id,
263
- toId: rel.to,
264
- dataFlow: rel.data_flow || ''
265
- });
266
- }
267
- return {
268
- success: true,
269
- result: {
270
- artifact_id: artifact.id,
271
- indexed: true,
272
- relationships_created: relationships.length
273
- },
274
- executionTime: Date.now() - startTime
275
- };
276
- }
277
- finally {
278
- await session.close();
279
- }
280
- }
281
- catch (error) {
282
- return {
283
- success: false,
284
- error: error instanceof Error ? error.message : 'Failed to index artifact',
285
- executionTime: Date.now() - startTime
286
- };
287
- }
288
- }
289
- async handleSnowGraphFindRelated(args) {
290
- const startTime = Date.now();
291
- try {
292
- const driver = await this.connectToNeo4j();
293
- if (!driver)
294
- throw new Error('Neo4j not available');
295
- const session = driver.session();
296
- const { artifact_id, depth = 2, relationship_types } = args;
297
- try {
298
- let relationshipFilter = '';
299
- if (relationship_types && relationship_types.length > 0) {
300
- relationshipFilter = `WHERE type(r) IN [${relationship_types.map((t) => `'${t}'`).join(', ')}]`;
301
- }
302
- const result = await session.run(`MATCH path = (start:Artifact {id: $artifactId})-[r*1..${depth}]->(end:Artifact)
303
- ${relationshipFilter}
304
- RETURN path, relationships(path) as rels, nodes(path) as nodes`, { artifactId: artifact_id });
305
- const relatedArtifacts = result.records.map(record => {
306
- const nodes = record.get('nodes');
307
- const rels = record.get('rels');
308
- return {
309
- path_length: nodes.length - 1,
310
- artifacts: nodes.map((node) => node.properties),
311
- relationships: rels.map((rel) => ({
312
- type: rel.type,
313
- properties: rel.properties
314
- }))
315
- };
316
- });
317
- return {
318
- success: true,
319
- result: {
320
- artifact_id,
321
- related_artifacts: relatedArtifacts,
322
- total_found: relatedArtifacts.length
323
- },
324
- executionTime: Date.now() - startTime
325
- };
326
- }
327
- finally {
328
- await session.close();
329
- }
330
- }
331
- catch (error) {
332
- return {
333
- success: false,
334
- error: error instanceof Error ? error.message : 'Failed to find related artifacts',
335
- executionTime: Date.now() - startTime
336
- };
337
- }
338
- }
339
- async handleSnowGraphAnalyzeImpact(args) {
340
- const startTime = Date.now();
341
- try {
342
- const driver = await this.connectToNeo4j();
343
- if (!driver)
344
- throw new Error('Neo4j not available');
345
- const session = driver.session();
346
- const { artifact_id, change_type } = args;
347
- try {
348
- // Find all artifacts that depend on this one
349
- const dependentsResult = await session.run(`MATCH (target:Artifact {id: $artifactId})<-[r]-(dependent:Artifact)
350
- RETURN dependent, type(r) as relationship_type, r.strength as strength
351
- ORDER BY r.strength DESC`, { artifactId: artifact_id });
352
- // Find all artifacts this one depends on
353
- const dependenciesResult = await session.run(`MATCH (source:Artifact {id: $artifactId})-[r]->(dependency:Artifact)
354
- RETURN dependency, type(r) as relationship_type, r.strength as strength
355
- ORDER BY r.strength DESC`, { artifactId: artifact_id });
356
- const dependents = dependentsResult.records.map(record => ({
357
- artifact: record.get('dependent').properties,
358
- relationship: record.get('relationship_type'),
359
- impact_level: this.calculateImpactLevel(change_type, record.get('relationship_type'), record.get('strength'))
360
- }));
361
- const dependencies = dependenciesResult.records.map(record => ({
362
- artifact: record.get('dependency').properties,
363
- relationship: record.get('relationship_type'),
364
- required: record.get('relationship_type') === 'REQUIRES'
365
- }));
366
- return {
367
- success: true,
368
- result: {
369
- artifact_id,
370
- change_type,
371
- impact__analysis: {
372
- dependent_artifacts: dependents,
373
- dependency_artifacts: dependencies,
374
- total_affected: dependents.length,
375
- high_impact_count: dependents.filter(d => d.impact_level === 'high').length,
376
- recommendations: this.generateImpactRecommendations(change_type, dependents, dependencies)
377
- }
378
- },
379
- executionTime: Date.now() - startTime
380
- };
381
- }
382
- finally {
383
- await session.close();
384
- }
385
- }
386
- catch (error) {
387
- return {
388
- success: false,
389
- error: error instanceof Error ? error.message : 'Failed to analyze impact',
390
- executionTime: Date.now() - startTime
391
- };
392
- }
393
- }
394
- async handleSnowGraphSuggestArtifacts(args) {
395
- const startTime = Date.now();
396
- try {
397
- // This would be a complex AI-powered recommendation system
398
- // For now, provide a simplified implementation
399
- const suggestions = [
400
- {
401
- artifact_id: 'suggested_script_include_1',
402
- name: 'DataValidationUtils',
403
- type: 'script_include',
404
- relevance_score: 0.89,
405
- reason: 'Commonly used with similar requirements',
406
- usage_count: 45
407
- },
408
- {
409
- artifact_id: 'suggested_widget_1',
410
- name: 'StatusDashboard',
411
- type: 'widget',
412
- relevance_score: 0.76,
413
- reason: 'Pattern match with context requirements',
414
- usage_count: 23
415
- }
416
- ];
417
- return {
418
- success: true,
419
- result: {
420
- context: args.context,
421
- suggestions,
422
- total_suggestions: suggestions.length
423
- },
424
- executionTime: Date.now() - startTime
425
- };
426
- }
427
- catch (error) {
428
- return {
429
- success: false,
430
- error: error instanceof Error ? error.message : 'Failed to suggest artifacts',
431
- executionTime: Date.now() - startTime
432
- };
433
- }
434
- }
435
- async handleSnowGraphPatternAnalysis(args) {
436
- const startTime = Date.now();
437
- try {
438
- const driver = await this.connectToNeo4j();
439
- if (!driver)
440
- throw new Error('Neo4j not available');
441
- const session = driver.session();
442
- const { pattern_type, min_occurrences = 3 } = args;
443
- try {
444
- // Analyze common patterns based on type
445
- let query = '';
446
- switch (pattern_type) {
447
- case 'architectural':
448
- query = `MATCH (a:Artifact)-[r]->(b:Artifact)
449
- WHERE a.type <> b.type
450
- RETURN a.type as from_type, type(r) as relationship, b.type as to_type, count(*) as frequency
451
- HAVING frequency >= $minOccurrences
452
- ORDER BY frequency DESC`;
453
- break;
454
- case 'coding':
455
- query = `MATCH (a:Artifact)
456
- WHERE a.content IS NOT NULL
457
- RETURN a.type, count(*) as count
458
- HAVING count >= $minOccurrences
459
- ORDER BY count DESC`;
460
- break;
461
- default:
462
- query = `MATCH (a:Artifact)-[r]->(b:Artifact)
463
- RETURN type(r) as relationship_pattern, count(*) as frequency
464
- HAVING frequency >= $minOccurrences
465
- ORDER BY frequency DESC`;
466
- }
467
- const result = await session.run(query, { minOccurrences: min_occurrences });
468
- const patterns = result.records.map(record => {
469
- const data = {};
470
- record.keys.forEach(key => {
471
- data[key] = record.get(key);
472
- });
473
- return data;
474
- });
475
- return {
476
- success: true,
477
- result: {
478
- pattern_type,
479
- patterns,
480
- total_patterns: patterns.length,
481
- min_occurrences
482
- },
483
- executionTime: Date.now() - startTime
484
- };
485
- }
486
- finally {
487
- await session.close();
488
- }
489
- }
490
- catch (error) {
491
- return {
492
- success: false,
493
- error: error instanceof Error ? error.message : 'Failed to analyze patterns',
494
- executionTime: Date.now() - startTime
495
- };
496
- }
497
- }
498
- async handleSnowGraphVisualize(args) {
499
- const startTime = Date.now();
500
- try {
501
- const { focus_artifact, max_nodes = 50, include_types } = args;
502
- let typeFilter = '';
503
- if (include_types && include_types.length > 0) {
504
- typeFilter = `WHERE a.type IN [${include_types.map((t) => `'${t}'`).join(', ')}] AND b.type IN [${include_types.map((t) => `'${t}'`).join(', ')}]`;
505
- }
506
- const cypherQuery = focus_artifact
507
- ? `MATCH path = (center:Artifact {id: '${focus_artifact}'})-[r*1..2]-(connected:Artifact)
508
- ${typeFilter}
509
- RETURN path LIMIT ${max_nodes}`
510
- : `MATCH (a:Artifact)-[r]->(b:Artifact)
511
- ${typeFilter}
512
- RETURN a, r, b LIMIT ${max_nodes}`;
513
- return {
514
- success: true,
515
- result: {
516
- cypher_query: cypherQuery,
517
- focus_artifact,
518
- max_nodes,
519
- browser_url: this.neo4jConfig ? `${this.neo4jConfig.uri.replace('bolt://', 'http://')}/browser/` : 'Neo4j Browser not available',
520
- instructions: [
521
- '1. Open Neo4j Browser',
522
- '2. Paste the Cypher query above',
523
- '3. Click the graph visualization tab',
524
- '4. Explore the artifact relationships'
525
- ]
526
- },
527
- executionTime: Date.now() - startTime
528
- };
529
- }
530
- catch (error) {
531
- return {
532
- success: false,
533
- error: error instanceof Error ? error.message : 'Failed to generate visualization',
534
- executionTime: Date.now() - startTime
535
- };
536
- }
537
- }
538
- async handleSnowGraphExportKnowledge(args) {
539
- const startTime = Date.now();
540
- try {
541
- const driver = await this.connectToNeo4j();
542
- if (!driver)
543
- throw new Error('Neo4j not available');
544
- const session = driver.session();
545
- const { format = 'json', include_content = false } = args;
546
- try {
547
- const contentFilter = include_content ? '' : ', a.content';
548
- const result = await session.run(`MATCH (a:Artifact)-[r]->(b:Artifact)
549
- RETURN a{.*, content: ${include_content ? 'a.content' : 'null'}} as from_artifact,
550
- type(r) as relationship_type,
551
- r{.*} as relationship_properties,
552
- b{.*, content: ${include_content ? 'b.content' : 'null'}} as to_artifact`);
553
- const knowledge = result.records.map(record => ({
554
- from_artifact: record.get('from_artifact'),
555
- relationship: {
556
- type: record.get('relationship_type'),
557
- properties: record.get('relationship_properties')
558
- },
559
- to_artifact: record.get('to_artifact')
560
- }));
561
- let exportData;
562
- switch (format) {
563
- case 'cypher':
564
- exportData = this.generateCypherExport(knowledge);
565
- break;
566
- case 'graphml':
567
- exportData = this.generateGraphMLExport(knowledge);
568
- break;
569
- default:
570
- exportData = knowledge;
571
- }
572
- return {
573
- success: true,
574
- result: {
575
- format,
576
- export_data: exportData,
577
- total_relationships: knowledge.length,
578
- export_timestamp: new Date().toISOString(),
579
- include_content
580
- },
581
- executionTime: Date.now() - startTime
582
- };
583
- }
584
- finally {
585
- await session.close();
586
- }
587
- }
588
- catch (error) {
589
- return {
590
- success: false,
591
- error: error instanceof Error ? error.message : 'Failed to export knowledge',
592
- executionTime: Date.now() - startTime
593
- };
594
- }
595
- }
596
- // Helper methods
597
- calculateImpactLevel(changeType, relationshipType, strength) {
598
- if (changeType === 'delete' && relationshipType === 'REQUIRES')
599
- return 'critical';
600
- if (changeType === 'delete' && strength > 5)
601
- return 'high';
602
- if (changeType === 'modify' && relationshipType === 'USES' && strength > 3)
603
- return 'medium';
604
- return 'low';
605
- }
606
- generateImpactRecommendations(changeType, dependents, dependencies) {
607
- const recommendations = [];
608
- if (changeType === 'delete') {
609
- recommendations.push('Create backup before deletion');
610
- recommendations.push('Update all dependent artifacts');
611
- }
612
- if (dependents.length > 5) {
613
- recommendations.push('Consider phased deployment due to high number of dependencies');
614
- }
615
- return recommendations;
616
- }
617
- generateCypherExport(knowledge) {
618
- return knowledge.map(k => `CREATE (a:Artifact {id: '${k.from_artifact.id}', name: '${k.from_artifact.name}', type: '${k.from_artifact.type}'})-[:${k.relationship.type}]->(b:Artifact {id: '${k.to_artifact.id}', name: '${k.to_artifact.name}', type: '${k.to_artifact.type}'})`).join(';\n');
619
- }
620
- generateGraphMLExport(knowledge) {
621
- // Simplified GraphML export
622
- return `<?xml version="1.0" encoding="UTF-8"?>\n<graphml>\n<!-- Export contains ${knowledge.length} relationships -->\n</graphml>`;
623
- }
624
- // Override shutdown to close Neo4j driver
625
- async shutdown() {
626
- if (this.neo4jDriver) {
627
- await this.neo4jDriver.close();
628
- this.logger.info('Neo4j driver closed');
629
- }
630
- // BaseMCPServer doesn't have a shutdown method, just close the server
631
- if (this.server) {
632
- await this.server.close();
633
- }
634
- }
635
- }
636
- exports.ServiceNowGraphMemoryMCP = ServiceNowGraphMemoryMCP;
637
- // Create and run the server
638
- if (require.main === module) {
639
- const server = new ServiceNowGraphMemoryMCP();
640
- server.start().catch(console.error);
641
- }
642
- //# sourceMappingURL=servicenow-graph-memory-mcp-refactored.js.map
@@ -1,24 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * servicenow-integration 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 ServiceNowIntegrationMCP extends BaseMCPServer {
9
- constructor();
10
- protected setupTools(): void;
11
- protected getTools(): Tool[];
12
- protected executeTool(name: string, args: any): Promise<ToolResult>;
13
- private handleSnowCreateRestMessage;
14
- private handleSnowCreateRestMethod;
15
- private handleSnowCreateTransformMap;
16
- private handleSnowCreateFieldMap;
17
- private handleSnowCreateImportSet;
18
- private handleSnowCreateWebService;
19
- private handleSnowCreateEmailConfig;
20
- private handleSnowDiscoverIntegrationEndpoints;
21
- private handleSnowTestIntegration;
22
- private handleSnowDiscoverDataSources;
23
- }
24
- //# sourceMappingURL=servicenow-integration-mcp-refactored.d.ts.map