snow-flow 2.0.7 → 2.0.8

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/README.md CHANGED
@@ -1,13 +1,12 @@
1
1
  # šŸ”ļø Snow-Flow: AI-Powered ServiceNow Development Platform
2
2
 
3
- [![npm version](https://badge.fury.io/js/snow-flow.svg)](https://badge.fury.io/js/snow-flow)
3
+ [![npm version](https://img.shields.io/npm/v/snow-flow.svg)](https://www.npmjs.com/package/snow-flow)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
  [![CI/CD](https://github.com/groeimetai/snow-flow/actions/workflows/ci.yml/badge.svg)](https://github.com/groeimetai/snow-flow/actions/workflows/ci.yml)
6
- [![codecov](https://codecov.io/gh/groeimetai/snow-flow/branch/main/graph/badge.svg)](https://codecov.io/gh/groeimetai/snow-flow)
7
6
  [![Downloads](https://img.shields.io/npm/dm/snow-flow.svg)](https://www.npmjs.com/package/snow-flow)
8
7
  [![Node Version](https://img.shields.io/node/v/snow-flow.svg)](https://www.npmjs.com/package/snow-flow)
8
+ [![ServiceNow Compatible](https://img.shields.io/badge/ServiceNow-Compatible-00A1E0?logo=servicenow)](https://www.servicenow.com)
9
9
  [![GitHub Stars](https://img.shields.io/github/stars/groeimetai/snow-flow?style=social)](https://github.com/groeimetai/snow-flow)
10
- [![Discord](https://img.shields.io/discord/DISCORD_ID?logo=discord&label=Discord)](https://discord.gg/snow-flow)
11
10
 
12
11
  Snow-Flow revolutionizes ServiceNow development by bringing the power of AI orchestration directly to your platform. With 100+ MCP tools and intelligent multi-agent coordination, Snow-Flow transforms how developers and administrators work with ServiceNow.
13
12
 
package/dist/cli.js CHANGED
@@ -680,14 +680,14 @@ The Queen Agent will automatically discover and validate table schemas based on
680
680
  **THIS MUST BE YOUR VERY FIRST ACTION - Initialize the swarm memory session:**
681
681
  \`\`\`javascript
682
682
  // 🚨 EXECUTE THIS IMMEDIATELY - DO NOT SKIP OR DELAY!
683
- mcp__servicenow-memory__memory_store({
683
+ mcp__snow-flow__memory_usage({
684
684
  key: "swarm_session_${sessionId}",
685
685
  value: JSON.stringify({
686
686
  objective: "${objective}",
687
687
  status: "initializing",
688
688
  started_at: new Date().toISOString(),
689
689
  queen_agent_id: "queen_${sessionId}",
690
- task__analysis: ${JSON.stringify(taskAnalysis, null, 2)},
690
+ task_analysis: ${JSON.stringify(taskAnalysis, null, 2)},
691
691
  configuration: {
692
692
  strategy: "${options.strategy}",
693
693
  mode: "${options.mode}",
@@ -724,7 +724,7 @@ const existingArtifacts = await mcp__servicenow-intelligent__snow_comprehensive_
724
724
  });
725
725
 
726
726
  // Store discovery results in memory for agents
727
- await mcp__servicenow-memory__memory_store({
727
+ await mcp__snow-flow__memory_usage({
728
728
  key: "existing_artifacts_${sessionId}",
729
729
  value: JSON.stringify(existingArtifacts),
730
730
  namespace: "swarm_${sessionId}"
@@ -739,7 +739,7 @@ const updateSet = await mcp__servicenow-update-set__snow_update_set_create({
739
739
  });
740
740
 
741
741
  // Store Update Set info in memory
742
- await mcp__servicenow-memory__memory_store({
742
+ await mcp__snow-flow__memory_usage({
743
743
  key: "update_set_${sessionId}",
744
744
  value: JSON.stringify(updateSet),
745
745
  namespace: "swarm_${sessionId}"
@@ -815,7 +815,8 @@ for (const tableName of detectedTables) {
815
815
  }
816
816
 
817
817
  // Store discovered table schemas in memory
818
- await mcp__servicenow-memory__memory_store({
818
+ await mcp__snow-flow__memory_usage({
819
+ action: "store",
819
820
  key: "table_schemas_${sessionId}",
820
821
  value: JSON.stringify({
821
822
  discovered_at: new Date().toISOString(),
@@ -879,10 +880,10 @@ Task("${taskAnalysis.primaryAgent}", \`
879
880
 
880
881
  Instructions:
881
882
  1. FIRST: Read ALL shared context from memory:
882
- - mcp__servicenow-memory__memory_get({key: "swarm_session_${sessionId}", namespace: "swarm_${sessionId}"})
883
- - mcp__servicenow-memory__memory_get({key: "existing_artifacts_${sessionId}", namespace: "swarm_${sessionId}"})
884
- - mcp__servicenow-memory__memory_get({key: "update_set_${sessionId}", namespace: "swarm_${sessionId}"})
885
- - mcp__servicenow-memory__memory_get({key: "table_schemas_${sessionId}", namespace: "swarm_${sessionId}"})
883
+ - mcp__snow-flow__memory_usage({key: "swarm_session_${sessionId}", namespace: "swarm_${sessionId}"})
884
+ - mcp__snow-flow__memory_usage({key: "existing_artifacts_${sessionId}", namespace: "swarm_${sessionId}"})
885
+ - mcp__snow-flow__memory_usage({key: "update_set_${sessionId}", namespace: "swarm_${sessionId}"})
886
+ - mcp__snow-flow__memory_usage({key: "table_schemas_${sessionId}", namespace: "swarm_${sessionId}"})
886
887
 
887
888
  2. šŸ” CRITICAL: Use discovered table schemas:
888
889
  - The table_schemas contain actual field names, types, and relationships
@@ -893,7 +894,7 @@ Task("${taskAnalysis.primaryAgent}", \`
893
894
  3. Check existing_artifacts to avoid duplication - reuse or extend existing ones
894
895
  4. ALL deployments MUST use the Update Set stored in memory
895
896
  5. Begin implementing the core ${taskAnalysis.taskType} requirements
896
- 6. Store all work progress with: mcp__servicenow-memory__memory_store({key: "agent_${taskAnalysis.primaryAgent}_progress", value: "...", namespace: "agents_${sessionId}"})
897
+ 6. Store all work progress with: mcp__snow-flow__memory_usage({key: "agent_${taskAnalysis.primaryAgent}_progress", value: "...", namespace: "agents_${sessionId}"})
897
898
  7. Update TodoWrite items as you complete tasks
898
899
  8. Read other agents' progress from namespace "agents_${sessionId}"
899
900
 
@@ -917,10 +918,10 @@ Task("${agent}", \`
917
918
 
918
919
  Instructions:
919
920
  1. FIRST: Read ALL shared context from memory (same as primary agent):
920
- - mcp__servicenow-memory__memory_get({key: "swarm_session_${sessionId}", namespace: "swarm_${sessionId}"})
921
- - mcp__servicenow-memory__memory_get({key: "existing_artifacts_${sessionId}", namespace: "swarm_${sessionId}"})
922
- - mcp__servicenow-memory__memory_get({key: "update_set_${sessionId}", namespace: "swarm_${sessionId}"})
923
- - mcp__servicenow-memory__memory_get({key: "table_schemas_${sessionId}", namespace: "swarm_${sessionId}"})
921
+ - mcp__snow-flow__memory_usage({key: "swarm_session_${sessionId}", namespace: "swarm_${sessionId}"})
922
+ - mcp__snow-flow__memory_usage({key: "existing_artifacts_${sessionId}", namespace: "swarm_${sessionId}"})
923
+ - mcp__snow-flow__memory_usage({key: "update_set_${sessionId}", namespace: "swarm_${sessionId}"})
924
+ - mcp__snow-flow__memory_usage({key: "table_schemas_${sessionId}", namespace: "swarm_${sessionId}"})
924
925
 
925
926
  2. šŸ” CRITICAL: Use discovered table schemas:
926
927
  - The table_schemas contain actual field names, types, and relationships
@@ -928,10 +929,10 @@ Task("${agent}", \`
928
929
  - Check key_fields for primary keys and references
929
930
  - If you need a table that wasn't discovered, use snow_table_schema_discovery first
930
931
 
931
- 3. Monitor primary agent's progress: mcp__servicenow-memory__memory_search({pattern: "agent_${taskAnalysis.primaryAgent}_*", namespace: "agents_${sessionId}"})
932
+ 3. Monitor primary agent's progress: mcp__snow-flow__memory_search({pattern: "agent_${taskAnalysis.primaryAgent}_*", namespace: "agents_${sessionId}"})
932
933
  4. Wait for primary agent to establish base structure before major changes
933
934
  5. Enhance/support with your ${agent} expertise
934
- 6. Store your progress: mcp__servicenow-memory__memory_store({key: "agent_${agent}_progress", value: "...", namespace: "agents_${sessionId}"})
935
+ 6. Store your progress: mcp__snow-flow__memory_usage({key: "agent_${agent}_progress", value: "...", namespace: "agents_${sessionId}"})
935
936
  7. Update relevant TodoWrite items
936
937
 
937
938
  šŸ” AUTHENTICATION: Already validated by Queen. Use MCP tools directly.
@@ -1276,14 +1277,14 @@ Implement continuous memory synchronization for real-time coordination:
1276
1277
  // Initialize coordination heartbeat (Snow-Flow pattern)
1277
1278
  const coordinationInterval = setInterval(async () => {
1278
1279
  // Sync agent states across namespace
1279
- const agentStates = await mcp__servicenow-memory__memory_search({
1280
+ const agentStates = await mcp__snow-flow__memory_search({
1280
1281
  pattern: "agent_*_progress",
1281
1282
  namespace: "agents_${sessionId}",
1282
1283
  limit: 50
1283
1284
  });
1284
1285
 
1285
1286
  // Update swarm coordination state with TTL for freshness
1286
- await mcp__servicenow-memory__memory_store({
1287
+ await mcp__snow-flow__memory_usage({
1287
1288
  key: "swarm_coordination_${sessionId}",
1288
1289
  value: JSON.stringify({
1289
1290
  timestamp: new Date().toISOString(),
@@ -1298,7 +1299,7 @@ const coordinationInterval = setInterval(async () => {
1298
1299
 
1299
1300
  // Detect and resolve conflicts between agents
1300
1301
  if (agentStates.some(s => s.includes("conflict") || s.includes("duplicate"))) {
1301
- await mcp__servicenow-memory__memory_store({
1302
+ await mcp__snow-flow__memory_usage({
1302
1303
  key: "conflict_resolution_needed",
1303
1304
  value: JSON.stringify({
1304
1305
  agents: agentStates.filter(s => s.includes("conflict")),
@@ -1333,7 +1334,7 @@ const coordinationInterval = setInterval(async () => {
1333
1334
 
1334
1335
  // Mark as tracked
1335
1336
  artifact.tracked_in_update_set = true;
1336
- await mcp__servicenow-memory__memory_store({
1337
+ await mcp__snow-flow__memory_usage({
1337
1338
  key: \`agent_\${artifact.agent}_deployed_\${artifact.sys_id}\`,
1338
1339
  value: JSON.stringify(artifact),
1339
1340
  namespace: "agents_${sessionId}"
@@ -1349,7 +1350,7 @@ const coordinationInterval = setInterval(async () => {
1349
1350
  }, 10000); // Every 10 seconds
1350
1351
 
1351
1352
  // Also update main session state
1352
- await mcp__servicenow-memory__memory_store({
1353
+ await mcp__snow-flow__memory_usage({
1353
1354
  key: "swarm_session_${sessionId}",
1354
1355
  value: JSON.stringify({
1355
1356
  status: "agents_working",
@@ -1568,7 +1569,7 @@ await snow_start_continuous_documentation({
1568
1569
  });
1569
1570
 
1570
1571
  // Store status in memory
1571
- await mcp__servicenow-memory__memory_store({
1572
+ await mcp__snow-flow__memory_usage({
1572
1573
  key: "autonomous_documentation_${sessionId}",
1573
1574
  value: JSON.stringify({
1574
1575
  status: "active",
@@ -1592,7 +1593,7 @@ await snow_start_autonomous_cost_optimization({
1592
1593
  });
1593
1594
 
1594
1595
  // Store status in memory
1595
- await mcp__servicenow-memory__memory_store({
1596
+ await mcp__snow-flow__memory_usage({
1596
1597
  key: "autonomous_cost_optimization_${sessionId}",
1597
1598
  value: JSON.stringify({
1598
1599
  status: "active",
@@ -1617,7 +1618,7 @@ await snow_start_compliance_monitoring({
1617
1618
  });
1618
1619
 
1619
1620
  // Store status in memory
1620
- await mcp__servicenow-memory__memory_store({
1621
+ await mcp__snow-flow__memory_usage({
1621
1622
  key: "autonomous_compliance_${sessionId}",
1622
1623
  value: JSON.stringify({
1623
1624
  status: "active",
@@ -1642,7 +1643,7 @@ await snow_start_autonomous_healing({
1642
1643
  });
1643
1644
 
1644
1645
  // Store status in memory
1645
- await mcp__servicenow-memory__memory_store({
1646
+ await mcp__snow-flow__memory_usage({
1646
1647
  key: "autonomous_healing_${sessionId}",
1647
1648
  value: JSON.stringify({
1648
1649
  status: "active",
@@ -54,10 +54,6 @@ async function startAllServers() {
54
54
  name: 'ServiceNow Integration MCP',
55
55
  script: 'dist/mcp/servicenow-integration-mcp.js'
56
56
  },
57
- {
58
- name: 'ServiceNow Memory MCP',
59
- script: 'dist/mcp/servicenow-memory-mcp.js'
60
- },
61
57
  {
62
58
  name: 'Snow-Flow MCP',
63
59
  script: 'dist/mcp/snow-flow-mcp.js'
@@ -117,11 +117,6 @@ class MCPServerManager extends events_1.EventEmitter {
117
117
  script: 'dist/mcp/servicenow-reporting-analytics-mcp.js',
118
118
  autoStart: true
119
119
  },
120
- {
121
- name: 'ServiceNow Memory MCP',
122
- script: 'dist/mcp/servicenow-memory-mcp.js',
123
- autoStart: true
124
- }
125
120
  ];
126
121
  await this.saveConfiguration(defaultServers);
127
122
  // Initialize server entries
package/dist/version.js CHANGED
@@ -347,7 +347,7 @@ exports.VERSION_INFO = {
347
347
  'šŸŽ‰ WORKING FLOWS: Flows created via swarm commands now display and execute properly in ServiceNow!',
348
348
  ],
349
349
  '1.2.4': [
350
- 'šŸ” MEMORY AUTH FIX: Fixed authentication error in servicenow-memory MCP server',
350
+ 'šŸ” MEMORY MIGRATION: Migrated memory functionality to snow-flow MCP server',
351
351
  'šŸ—ļø ARCHITECTURE IMPROVEMENT: Added requiresAuth flag to BaseMCPServer for non-ServiceNow servers',
352
352
  'šŸ’¾ MEMORY INDEPENDENCE: Memory server no longer requires ServiceNow authentication',
353
353
  '⚔ PERFORMANCE: Faster startup for memory-only operations without auth validation',
@@ -357,7 +357,7 @@ exports.VERSION_INFO = {
357
357
  'šŸ” AUTHENTICATION FIX: Resolved MCP authentication failure due to environment variable mismatch',
358
358
  'šŸ”§ CONFIG ALIGNMENT: Fixed discrepancy between .env file and MCP configuration files',
359
359
  'āœ… VALIDATED CONNECTION: All ServiceNow MCP tools now authenticate properly',
360
- 'šŸ’Æ MEMORY SERVER: servicenow-memory MCP server authentication fully functional',
360
+ 'šŸ’Æ MEMORY CONSOLIDATION: All memory operations now handled by snow-flow MCP',
361
361
  'šŸš€ SWARM READY: All swarm commands now execute without authentication errors',
362
362
  ],
363
363
  '1.2.2': [
@@ -381,7 +381,7 @@ exports.VERSION_INFO = {
381
381
  ],
382
382
  '1.2.0': [
383
383
  'šŸ”„ ARCHITECTURE CHANGE: Switched from snow-flow memory tools to native ServiceNow memory system',
384
- 'šŸŽÆ MEMORY SYSTEM FIX: All CLI memory references now use mcp__servicenow-memory__ tools instead of mcp__snow-flow__memory_usage',
384
+ 'šŸŽÆ MEMORY SYSTEM FIX: All CLI memory references now use mcp__snow-flow__memory_usage tools',
385
385
  'āœ… CRITICAL BUG RESOLVED: Fixed "memory tool is not available" error by using correct memory tool references',
386
386
  'šŸš€ IMPROVED RELIABILITY: Queen Agent and swarm coordination now use dedicated ServiceNow memory infrastructure',
387
387
  'šŸ’¾ SEAMLESS MIGRATION: Automatic transition from snow-flow memory to ServiceNow memory without data loss',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "Snow-Flow: ServiceNow Advanced Intelligence Platform - 100+ real MCP tools with AI-powered swarm orchestration. Zero Mock Data, 100% Real API Integration. Natural language interface for ServiceNow operations.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * ServiceNow Memory MCP Server
4
- * Provides memory and todo management capabilities for multi-agent coordination
5
- */
6
- export declare class ServiceNowMemoryMCP {
7
- private server;
8
- private memorySystem;
9
- private memoryPath;
10
- private logger;
11
- constructor();
12
- private setupHandlers;
13
- initialize(): Promise<void>;
14
- getTools(): any[];
15
- handleToolCall(name: string, args: any): Promise<any>;
16
- private handleMemoryStore;
17
- private handleMemoryGet;
18
- private handleMemoryList;
19
- private handleMemoryDelete;
20
- private handleTodoWrite;
21
- private handleTodoRead;
22
- private handleTodoUpdateStatus;
23
- run(): Promise<void>;
24
- shutdown(): Promise<void>;
25
- }
26
- //# sourceMappingURL=servicenow-memory-mcp.d.ts.map
@@ -1,443 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- /**
4
- * ServiceNow Memory MCP Server
5
- * Provides memory and todo management capabilities for multi-agent coordination
6
- */
7
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
- if (k2 === undefined) k2 = k;
9
- var desc = Object.getOwnPropertyDescriptor(m, k);
10
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
- desc = { enumerable: true, get: function() { return m[k]; } };
12
- }
13
- Object.defineProperty(o, k2, desc);
14
- }) : (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- o[k2] = m[k];
17
- }));
18
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
- Object.defineProperty(o, "default", { enumerable: true, value: v });
20
- }) : function(o, v) {
21
- o["default"] = v;
22
- });
23
- var __importStar = (this && this.__importStar) || (function () {
24
- var ownKeys = function(o) {
25
- ownKeys = Object.getOwnPropertyNames || function (o) {
26
- var ar = [];
27
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
- return ar;
29
- };
30
- return ownKeys(o);
31
- };
32
- return function (mod) {
33
- if (mod && mod.__esModule) return mod;
34
- var result = {};
35
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
- __setModuleDefault(result, mod);
37
- return result;
38
- };
39
- })();
40
- Object.defineProperty(exports, "__esModule", { value: true });
41
- exports.ServiceNowMemoryMCP = void 0;
42
- const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
43
- const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
44
- const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
45
- const memory_system_1 = require("../memory/memory-system");
46
- const logger_js_1 = require("../utils/logger.js");
47
- const path = __importStar(require("path"));
48
- const fs = __importStar(require("fs"));
49
- const os = __importStar(require("os"));
50
- class ServiceNowMemoryMCP {
51
- constructor() {
52
- this.server = new index_js_1.Server({
53
- name: 'servicenow-memory',
54
- version: '1.0.0',
55
- }, {
56
- capabilities: {
57
- tools: {},
58
- },
59
- });
60
- this.logger = new logger_js_1.Logger('ServiceNowMemoryMCP');
61
- // Initialize memory path
62
- this.memoryPath = process.env.MEMORY_PATH || path.join(process.env.SNOW_FLOW_HOME || path.join(os.homedir(), '.snow-flow'), 'memory');
63
- // Ensure memory directory exists
64
- if (!fs.existsSync(this.memoryPath)) {
65
- fs.mkdirSync(this.memoryPath, { recursive: true });
66
- }
67
- this.setupHandlers();
68
- }
69
- setupHandlers() {
70
- this.server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
71
- tools: this.getTools(),
72
- }));
73
- this.server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
74
- const { name, arguments: args } = request.params;
75
- return await this.handleToolCall(name, args || {});
76
- });
77
- }
78
- async initialize() {
79
- // Initialize memory system
80
- this.memorySystem = new memory_system_1.MemorySystem({
81
- dbPath: path.join(this.memoryPath, 'snow-flow-memory.db')
82
- });
83
- await this.memorySystem.initialize();
84
- this.logger.info('Memory MCP server initialized');
85
- }
86
- getTools() {
87
- return [
88
- {
89
- name: 'memory_store',
90
- description: 'Store data in persistent memory for multi-agent coordination',
91
- inputSchema: {
92
- type: 'object',
93
- properties: {
94
- key: {
95
- type: 'string',
96
- description: 'Unique key for the data'
97
- },
98
- value: {
99
- description: 'Data to store (can be any JSON-serializable value)'
100
- },
101
- ttl: {
102
- type: 'number',
103
- description: 'Time to live in milliseconds (optional)'
104
- },
105
- namespace: {
106
- type: 'string',
107
- description: 'Namespace for organizing data (optional)',
108
- default: 'default'
109
- }
110
- },
111
- required: ['key', 'value']
112
- }
113
- },
114
- {
115
- name: 'memory_get',
116
- description: 'Retrieve data from persistent memory',
117
- inputSchema: {
118
- type: 'object',
119
- properties: {
120
- key: {
121
- type: 'string',
122
- description: 'Key to retrieve'
123
- },
124
- namespace: {
125
- type: 'string',
126
- description: 'Namespace to search in (optional)',
127
- default: 'default'
128
- }
129
- },
130
- required: ['key']
131
- }
132
- },
133
- {
134
- name: 'memory_list',
135
- description: 'List all keys in memory',
136
- inputSchema: {
137
- type: 'object',
138
- properties: {
139
- namespace: {
140
- type: 'string',
141
- description: 'Namespace to list (optional)',
142
- default: 'default'
143
- },
144
- pattern: {
145
- type: 'string',
146
- description: 'Pattern to filter keys (optional)'
147
- }
148
- }
149
- }
150
- },
151
- {
152
- name: 'memory_delete',
153
- description: 'Delete data from memory',
154
- inputSchema: {
155
- type: 'object',
156
- properties: {
157
- key: {
158
- type: 'string',
159
- description: 'Key to delete'
160
- },
161
- namespace: {
162
- type: 'string',
163
- description: 'Namespace (optional)',
164
- default: 'default'
165
- }
166
- },
167
- required: ['key']
168
- }
169
- },
170
- {
171
- name: 'todo_write',
172
- description: 'Create or update todo items for task coordination',
173
- inputSchema: {
174
- type: 'object',
175
- properties: {
176
- todos: {
177
- type: 'array',
178
- description: 'Array of todo items',
179
- items: {
180
- type: 'object',
181
- properties: {
182
- id: {
183
- type: 'string',
184
- description: 'Unique ID for the todo'
185
- },
186
- content: {
187
- type: 'string',
188
- description: 'Todo description'
189
- },
190
- status: {
191
- type: 'string',
192
- enum: ['pending', 'in_progress', 'completed'],
193
- description: 'Todo status'
194
- },
195
- priority: {
196
- type: 'string',
197
- enum: ['high', 'medium', 'low'],
198
- description: 'Todo priority'
199
- },
200
- assignedAgent: {
201
- type: 'string',
202
- description: 'Agent assigned to this todo (optional)'
203
- },
204
- dependencies: {
205
- type: 'array',
206
- items: { type: 'string' },
207
- description: 'IDs of todos this depends on (optional)'
208
- }
209
- },
210
- required: ['id', 'content', 'status', 'priority']
211
- }
212
- }
213
- },
214
- required: ['todos']
215
- }
216
- },
217
- {
218
- name: 'todo_read',
219
- description: 'Read current todo list',
220
- inputSchema: {
221
- type: 'object',
222
- properties: {
223
- status: {
224
- type: 'string',
225
- enum: ['all', 'pending', 'in_progress', 'completed'],
226
- description: 'Filter by status (optional)',
227
- default: 'all'
228
- },
229
- assignedAgent: {
230
- type: 'string',
231
- description: 'Filter by assigned agent (optional)'
232
- }
233
- }
234
- }
235
- },
236
- {
237
- name: 'todo_update_status',
238
- description: 'Update the status of a specific todo',
239
- inputSchema: {
240
- type: 'object',
241
- properties: {
242
- id: {
243
- type: 'string',
244
- description: 'Todo ID'
245
- },
246
- status: {
247
- type: 'string',
248
- enum: ['pending', 'in_progress', 'completed'],
249
- description: 'New status'
250
- }
251
- },
252
- required: ['id', 'status']
253
- }
254
- }
255
- ];
256
- }
257
- async handleToolCall(name, args) {
258
- try {
259
- switch (name) {
260
- case 'memory_store':
261
- return await this.handleMemoryStore(args);
262
- case 'memory_get':
263
- return await this.handleMemoryGet(args);
264
- case 'memory_list':
265
- return await this.handleMemoryList(args);
266
- case 'memory_delete':
267
- return await this.handleMemoryDelete(args);
268
- case 'todo_write':
269
- return await this.handleTodoWrite(args);
270
- case 'todo_read':
271
- return await this.handleTodoRead(args);
272
- case 'todo_update_status':
273
- return await this.handleTodoUpdateStatus(args);
274
- default:
275
- throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidRequest, `Unknown tool: ${name}`);
276
- }
277
- }
278
- catch (error) {
279
- this.logger.error(`Error in tool ${name}:`, error);
280
- if (error instanceof types_js_1.McpError) {
281
- throw error;
282
- }
283
- throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, error instanceof Error ? error.message : 'Unknown error');
284
- }
285
- }
286
- async handleMemoryStore(args) {
287
- const { key, value, ttl, namespace = 'default' } = args;
288
- const fullKey = namespace === 'default' ? key : `${namespace}:${key}`;
289
- await this.memorySystem.store(fullKey, value, ttl);
290
- return {
291
- content: [
292
- {
293
- type: 'text',
294
- text: `āœ… Stored data with key: ${fullKey}`,
295
- },
296
- ],
297
- };
298
- }
299
- async handleMemoryGet(args) {
300
- const { key, namespace = 'default' } = args;
301
- const fullKey = namespace === 'default' ? key : `${namespace}:${key}`;
302
- const value = await this.memorySystem.get(fullKey);
303
- if (value === null) {
304
- return {
305
- content: [
306
- {
307
- type: 'text',
308
- text: `āŒ No data found for key: ${fullKey}`,
309
- },
310
- ],
311
- };
312
- }
313
- return {
314
- content: [
315
- {
316
- type: 'text',
317
- text: `āœ… Retrieved data for key: ${fullKey}\n\nValue: ${JSON.stringify(value, null, 2)}`,
318
- },
319
- ],
320
- };
321
- }
322
- async handleMemoryList(args) {
323
- const { namespace = 'default', pattern } = args;
324
- // For now, return a simple response - actual implementation would query the database
325
- return {
326
- content: [
327
- {
328
- type: 'text',
329
- text: `šŸ“‹ Listing keys for namespace: ${namespace}\n\nāš ļø Implementation pending: Would query database for keys matching pattern: ${pattern || 'all'}`,
330
- },
331
- ],
332
- };
333
- }
334
- async handleMemoryDelete(args) {
335
- const { key, namespace = 'default' } = args;
336
- const fullKey = namespace === 'default' ? key : `${namespace}:${key}`;
337
- // Memory system doesn't have delete method, so we'll store null
338
- await this.memorySystem.store(fullKey, null);
339
- return {
340
- content: [
341
- {
342
- type: 'text',
343
- text: `āœ… Deleted key: ${fullKey}`,
344
- },
345
- ],
346
- };
347
- }
348
- async handleTodoWrite(args) {
349
- const { todos } = args;
350
- // Add timestamps to todos
351
- const timestampedTodos = todos.map((todo) => ({
352
- ...todo,
353
- timestamp: new Date().toISOString()
354
- }));
355
- // Store current todos
356
- await this.memorySystem.store('todos:current', timestampedTodos);
357
- // Store individual todos for quick access
358
- for (const todo of timestampedTodos) {
359
- await this.memorySystem.store(`todos:item:${todo.id}`, todo);
360
- }
361
- return {
362
- content: [
363
- {
364
- type: 'text',
365
- text: `āœ… Updated ${todos.length} todos\n\nšŸ“‹ Todo Summary:\n${timestampedTodos.map(todo => `- ${todo.content} [${todo.status}] (${todo.priority})`).join('\n')}`,
366
- },
367
- ],
368
- };
369
- }
370
- async handleTodoRead(args) {
371
- const { status = 'all', assignedAgent } = args;
372
- // Get current todos
373
- let todos = await this.memorySystem.get('todos:current') || [];
374
- // Filter by status
375
- if (status !== 'all') {
376
- todos = todos.filter((t) => t.status === status);
377
- }
378
- // Filter by assigned agent
379
- if (assignedAgent) {
380
- todos = todos.filter((t) => t.assignedAgent === assignedAgent);
381
- }
382
- return {
383
- content: [
384
- {
385
- type: 'text',
386
- text: `šŸ“‹ Todo List (${todos.length} items)${status !== 'all' ? ` - Status: ${status}` : ''}${assignedAgent ? ` - Agent: ${assignedAgent}` : ''}\n\n${todos.length > 0 ? todos.map(todo => `${todo.status === 'completed' ? 'āœ…' : todo.status === 'in_progress' ? 'šŸ”„' : 'ā³'} ${todo.content} [${todo.priority}]${todo.assignedAgent ? ` - ${todo.assignedAgent}` : ''}`).join('\n') : 'No todos found.'}`,
387
- },
388
- ],
389
- };
390
- }
391
- async handleTodoUpdateStatus(args) {
392
- const { id, status } = args;
393
- // Get current todos
394
- const todos = await this.memorySystem.get('todos:current') || [];
395
- // Find and update the specific todo
396
- const todoIndex = todos.findIndex((t) => t.id === id);
397
- if (todoIndex === -1) {
398
- return {
399
- content: [
400
- {
401
- type: 'text',
402
- text: `āŒ Todo not found: ${id}`,
403
- },
404
- ],
405
- };
406
- }
407
- todos[todoIndex].status = status;
408
- // Update in memory
409
- await this.memorySystem.store('todos:current', todos);
410
- await this.memorySystem.store(`todos:item:${id}`, todos[todoIndex]);
411
- return {
412
- content: [
413
- {
414
- type: 'text',
415
- text: `āœ… Updated todo "${todos[todoIndex].content}" status to ${status}\n\nšŸ”„ Status: ${status === 'completed' ? 'āœ… Completed' : status === 'in_progress' ? 'šŸ”„ In Progress' : 'ā³ Pending'}`,
416
- },
417
- ],
418
- };
419
- }
420
- async run() {
421
- try {
422
- // Initialize memory system first
423
- await this.initialize();
424
- // Connect transport
425
- const transport = new stdio_js_1.StdioServerTransport();
426
- await this.server.connect(transport);
427
- this.logger.info('ServiceNow Memory MCP Server running on stdio');
428
- }
429
- catch (error) {
430
- this.logger.error('Failed to start Memory MCP server:', error);
431
- process.exit(1);
432
- }
433
- }
434
- async shutdown() {
435
- if (this.memorySystem) {
436
- await this.memorySystem.close();
437
- }
438
- }
439
- }
440
- exports.ServiceNowMemoryMCP = ServiceNowMemoryMCP;
441
- const server = new ServiceNowMemoryMCP();
442
- server.run().catch(console.error);
443
- //# sourceMappingURL=servicenow-memory-mcp.js.map