snow-flow 2.0.2 → 2.0.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/{.claude/mcp-config.json → .mcp.json} +13 -12
- package/.releaserc.json +47 -0
- package/README.md +6 -0
- package/package.json +1 -1
- package/.claude/claude-settings.json +0 -15
- package/.claude/commands/analysis/README.md +0 -9
- package/.claude/commands/automation/README.md +0 -9
- package/.claude/commands/github/README.md +0 -11
- package/.claude/commands/helpers/standard-checkpoint-hooks.sh +0 -179
- package/.claude/commands/hooks/README.md +0 -11
- package/.claude/commands/monitoring/README.md +0 -9
- package/.claude/commands/optimization/README.md +0 -9
- package/.claude/commands/training/README.md +0 -9
- package/.claude/commands/workflows/README.md +0 -9
- package/.claude/config.json +0 -36
- package/.claude/helpers/github-setup.sh +0 -28
- package/.claude/helpers/quick-start.sh +0 -19
- package/.claude/helpers/setup-mcp.sh +0 -18
- package/.claude/settings.json +0 -114
- package/.claude/settings.local.json +0 -33
- package/.claude-flow/metrics/agent-metrics.json +0 -1
- package/.claude-flow/metrics/performance.json +0 -9
- package/.claude-flow/metrics/system-metrics.json +0 -15986
- package/.claude-flow/metrics/task-metrics.json +0 -10
- package/.roo/README.md +0 -402
- package/.roo/mcp-list.txt +0 -257
- package/.roo/mcp.json +0 -32
- package/.roo/workflows/basic-tdd.json +0 -32
- package/.roomodes +0 -201
- package/CLAUDE.md +0 -393
- package/bin/snow-flow.js +0 -3
- package/dist/cli.js.bak +0 -2052
- package/dist/config/snow-flow-config.d.ts +0 -1492
- package/dist/config/snow-flow-config.js +0 -938
- package/scripts/create-env.js +0 -91
- package/scripts/postinstall.js +0 -30
- package/scripts/register-mcp-servers.js +0 -210
- package/scripts/reset-mcp-servers.js +0 -246
- package/scripts/setup-mcp.js +0 -106
- package/scripts/update-version.js +0 -31
- package/src/agents/README.md +0 -192
- package/src/agents/base-agent.ts +0 -251
- package/src/agents/coordinator.ts +0 -971
- package/src/agents/index.ts +0 -18
- package/src/agents/queen-403-handler.ts +0 -230
- package/src/agents/queen-agent.ts +0 -1399
- package/src/agents/script-writer-agent.ts +0 -769
- package/src/agents/security-agent.ts +0 -726
- package/src/agents/widget-creator-agent.ts +0 -568
- package/src/api/error-handling.ts +0 -1758
- package/src/api/natural-language-mapper.ts +0 -630
- package/src/api/performance-optimizer.ts +0 -891
- package/src/api/transaction-manager.ts +0 -754
- package/src/cli/deploy-artifact.ts +0 -304
- package/src/cli/snow-flow-cli-integration.ts +0 -434
- package/src/cli.ts +0 -4455
- package/src/cli.ts.bak +0 -5616
- package/src/compliance/advanced-compliance-system.ts +0 -1268
- package/src/compliance/index.ts +0 -19
- package/src/config/snow-flow-config.ts +0 -1019
- package/src/documentation/index.ts +0 -16
- package/src/documentation/self-documenting-system.ts +0 -1421
- package/src/dynamic-version.ts +0 -44
- package/src/healing/index.ts +0 -20
- package/src/healing/self-healing-system.ts +0 -1435
- package/src/health/README.md +0 -161
- package/src/health/system-health.ts +0 -995
- package/src/index.ts +0 -60
- package/src/intelligence/acl-analyzer.ts +0 -377
- package/src/intelligence/auto-resolution-engine.ts +0 -643
- package/src/intelligence/gap-analysis-engine.ts +0 -488
- package/src/intelligence/manual-instructions-generator.ts +0 -744
- package/src/intelligence/mcp-coverage-analyzer.ts +0 -708
- package/src/intelligence/multi-pass-requirements-analyzer.ts +0 -603
- package/src/intelligence/performance-recommendations-engine.ts +0 -1223
- package/src/intelligence/requirements-analyzer.ts +0 -1148
- package/src/intelligence/task-analyzer.ts +0 -628
- package/src/managers/scope-manager.ts +0 -555
- package/src/mcp/advanced/servicenow-advanced-features-mcp.ts +0 -16110
- package/src/mcp/base-mcp-server.ts +0 -660
- package/src/mcp/http-transport-wrapper.ts +0 -426
- package/src/mcp/service-discovery-client.ts +0 -312
- package/src/mcp/servicenow-automation-mcp-refactored.ts +0 -678
- package/src/mcp/servicenow-automation-mcp.ts +0 -838
- package/src/mcp/servicenow-deployment-mcp-refactored.ts +0 -1292
- package/src/mcp/servicenow-deployment-mcp.ts +0 -7244
- package/src/mcp/servicenow-graph-memory-mcp-refactored.ts +0 -721
- package/src/mcp/servicenow-graph-memory-mcp.ts +0 -832
- package/src/mcp/servicenow-integration-mcp-refactored.ts +0 -655
- package/src/mcp/servicenow-integration-mcp.ts +0 -819
- package/src/mcp/servicenow-intelligent-mcp-refactored.ts +0 -977
- package/src/mcp/servicenow-intelligent-mcp.ts +0 -4638
- package/src/mcp/servicenow-mcp-server.ts +0 -728
- package/src/mcp/servicenow-memory-mcp.ts +0 -474
- package/src/mcp/servicenow-operations-mcp-refactored.ts +0 -1995
- package/src/mcp/servicenow-operations-mcp.ts +0 -3384
- package/src/mcp/servicenow-platform-development-mcp-refactored.ts +0 -611
- package/src/mcp/servicenow-platform-development-mcp.ts +0 -970
- package/src/mcp/servicenow-progressive-indexer.ts +0 -370
- package/src/mcp/servicenow-reporting-analytics-mcp-refactored.ts +0 -695
- package/src/mcp/servicenow-reporting-analytics-mcp.ts +0 -1123
- package/src/mcp/servicenow-security-compliance-mcp-refactored.ts +0 -642
- package/src/mcp/servicenow-security-compliance-mcp.ts +0 -1157
- package/src/mcp/servicenow-update-set-mcp-refactored.ts +0 -751
- package/src/mcp/servicenow-update-set-mcp.ts +0 -811
- package/src/mcp/shared/agent-context-provider.ts +0 -365
- package/src/mcp/shared/base-mcp-server.ts +0 -2463
- package/src/mcp/shared/mcp-memory-manager.ts +0 -540
- package/src/mcp/shared/mcp-resource-manager.ts +0 -367
- package/src/mcp/snow-flow-mcp.ts +0 -911
- package/src/mcp/start-all-mcp-servers.ts +0 -102
- package/src/mcp/start-servicenow-mcp.ts +0 -67
- package/src/monitoring/enhanced-monitoring-system.ts +0 -1345
- package/src/monitoring/performance-tracker.ts +0 -777
- package/src/optimization/cost-optimization-engine.ts +0 -1125
- package/src/optimization/index.ts +0 -10
- package/src/queen/README.md +0 -403
- package/src/queen/agent-factory.ts +0 -574
- package/src/queen/index.ts +0 -94
- package/src/queen/mcp-execution-bridge.ts +0 -681
- package/src/queen/neural-learning.ts +0 -319
- package/src/queen/parallel-agent-engine.ts +0 -848
- package/src/queen/queen-memory-system.ts +0 -490
- package/src/queen/queen-memory.ts +0 -456
- package/src/queen/servicenow-queen.ts +0 -1029
- package/src/queen/types.ts +0 -87
- package/src/rollback/smart-rollback-system.ts +0 -866
- package/src/schemas/deployment.schema.json +0 -58
- package/src/schemas/flow.schema.json +0 -79
- package/src/schemas/widget.schema.json +0 -72
- package/src/snow-flow-system.ts +0 -541
- package/src/sparc/sparc-help.ts +0 -49
- package/src/sparc/team-sparc.ts +0 -88
- package/src/strategies/global-scope-strategy.ts +0 -736
- package/src/templates/base/application.template.json +0 -45
- package/src/templates/base/business_rule.template.json +0 -33
- package/src/templates/base/script_include.template.json +0 -18
- package/src/templates/base/table.template.json +0 -64
- package/src/templates/base/widget.template.json +0 -25
- package/src/templates/patterns/composite.incident-management.template.json +0 -140
- package/src/templates/patterns/widget.dashboard.template.json +0 -238
- package/src/templates/patterns/widget.datatable.template.json +0 -292
- package/src/testing/integration-test-suite.ts +0 -1276
- package/src/types/index.ts +0 -183
- package/src/types/neo4j-driver.d.ts +0 -23
- package/src/types/servicenow.types.ts +0 -307
- package/src/types/snow-flow.types.ts +0 -186
- package/src/types/todo.types.ts +0 -70
- package/src/utils/action-type-cache.ts +0 -286
- package/src/utils/agent-detector.ts +0 -573
- package/src/utils/artifact-tracker.ts +0 -379
- package/src/utils/dependency-detector.ts +0 -233
- package/src/utils/deployment-metadata-handler.ts +0 -518
- package/src/utils/error-recovery.ts +0 -680
- package/src/utils/logger.ts +0 -60
- package/src/utils/mcp-auth-middleware.ts +0 -262
- package/src/utils/mcp-config-manager.ts +0 -270
- package/src/utils/mcp-server-manager.ts +0 -446
- package/src/utils/mcp-tool-registry.ts +0 -298
- package/src/utils/migrate-snow-flow.ts +0 -98
- package/src/utils/oauth-html-templates.ts +0 -188
- package/src/utils/scope-utils.ts +0 -443
- package/src/utils/servicenow-client.ts +0 -3321
- package/src/utils/servicenow-id-generator.ts +0 -181
- package/src/utils/snow-memory-manager.ts +0 -605
- package/src/utils/snow-oauth.ts +0 -797
- package/src/utils/template-engine.ts +0 -463
- package/src/utils/theme-manager.ts +0 -295
- package/src/utils/unified-auth-store.ts +0 -222
- package/src/utils/update-set-importer.ts +0 -422
- package/src/utils/update-set-xml-packager.ts +0 -371
- package/src/utils/widget-template-generator.ts +0 -1744
- package/src/version.ts +0 -1950
|
@@ -1,474 +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
|
-
|
|
7
|
-
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
8
|
-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
9
|
-
import {
|
|
10
|
-
CallToolRequestSchema,
|
|
11
|
-
ErrorCode,
|
|
12
|
-
ListToolsRequestSchema,
|
|
13
|
-
McpError,
|
|
14
|
-
} from '@modelcontextprotocol/sdk/types.js';
|
|
15
|
-
import { MemorySystem } from '../memory/memory-system';
|
|
16
|
-
import { Logger } from '../utils/logger.js';
|
|
17
|
-
import * as path from 'path';
|
|
18
|
-
import * as fs from 'fs';
|
|
19
|
-
import * as os from 'os';
|
|
20
|
-
|
|
21
|
-
interface TodoItem {
|
|
22
|
-
id: string;
|
|
23
|
-
content: string;
|
|
24
|
-
status: 'pending' | 'in_progress' | 'completed';
|
|
25
|
-
priority: 'high' | 'medium' | 'low';
|
|
26
|
-
assignedAgent?: string;
|
|
27
|
-
dependencies?: string[];
|
|
28
|
-
timestamp?: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export class ServiceNowMemoryMCP {
|
|
32
|
-
private server: Server;
|
|
33
|
-
private memorySystem!: MemorySystem;
|
|
34
|
-
private memoryPath: string;
|
|
35
|
-
private logger: Logger;
|
|
36
|
-
|
|
37
|
-
constructor() {
|
|
38
|
-
this.server = new Server(
|
|
39
|
-
{
|
|
40
|
-
name: 'servicenow-memory',
|
|
41
|
-
version: '1.0.0',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
capabilities: {
|
|
45
|
-
tools: {},
|
|
46
|
-
},
|
|
47
|
-
}
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
this.logger = new Logger('ServiceNowMemoryMCP');
|
|
51
|
-
|
|
52
|
-
// Initialize memory path
|
|
53
|
-
this.memoryPath = process.env.MEMORY_PATH || path.join(process.env.SNOW_FLOW_HOME || path.join(os.homedir(), '.snow-flow'), 'memory');
|
|
54
|
-
|
|
55
|
-
// Ensure memory directory exists
|
|
56
|
-
if (!fs.existsSync(this.memoryPath)) {
|
|
57
|
-
fs.mkdirSync(this.memoryPath, { recursive: true });
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
this.setupHandlers();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
private setupHandlers(): void {
|
|
64
|
-
this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
65
|
-
tools: this.getTools(),
|
|
66
|
-
}));
|
|
67
|
-
|
|
68
|
-
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
69
|
-
const { name, arguments: args } = request.params;
|
|
70
|
-
return await this.handleToolCall(name, args || {});
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public async initialize(): Promise<void> {
|
|
75
|
-
// Initialize memory system
|
|
76
|
-
this.memorySystem = new MemorySystem({
|
|
77
|
-
dbPath: path.join(this.memoryPath, 'snow-flow-memory.db')
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
await this.memorySystem.initialize();
|
|
81
|
-
this.logger.info('Memory MCP server initialized');
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
getTools(): any[] {
|
|
85
|
-
return [
|
|
86
|
-
{
|
|
87
|
-
name: 'memory_store',
|
|
88
|
-
description: 'Store data in persistent memory for multi-agent coordination',
|
|
89
|
-
inputSchema: {
|
|
90
|
-
type: 'object',
|
|
91
|
-
properties: {
|
|
92
|
-
key: {
|
|
93
|
-
type: 'string',
|
|
94
|
-
description: 'Unique key for the data'
|
|
95
|
-
},
|
|
96
|
-
value: {
|
|
97
|
-
description: 'Data to store (can be any JSON-serializable value)'
|
|
98
|
-
},
|
|
99
|
-
ttl: {
|
|
100
|
-
type: 'number',
|
|
101
|
-
description: 'Time to live in milliseconds (optional)'
|
|
102
|
-
},
|
|
103
|
-
namespace: {
|
|
104
|
-
type: 'string',
|
|
105
|
-
description: 'Namespace for organizing data (optional)',
|
|
106
|
-
default: 'default'
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
required: ['key', 'value']
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
name: 'memory_get',
|
|
114
|
-
description: 'Retrieve data from persistent memory',
|
|
115
|
-
inputSchema: {
|
|
116
|
-
type: 'object',
|
|
117
|
-
properties: {
|
|
118
|
-
key: {
|
|
119
|
-
type: 'string',
|
|
120
|
-
description: 'Key to retrieve'
|
|
121
|
-
},
|
|
122
|
-
namespace: {
|
|
123
|
-
type: 'string',
|
|
124
|
-
description: 'Namespace to search in (optional)',
|
|
125
|
-
default: 'default'
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
required: ['key']
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
name: 'memory_list',
|
|
133
|
-
description: 'List all keys in memory',
|
|
134
|
-
inputSchema: {
|
|
135
|
-
type: 'object',
|
|
136
|
-
properties: {
|
|
137
|
-
namespace: {
|
|
138
|
-
type: 'string',
|
|
139
|
-
description: 'Namespace to list (optional)',
|
|
140
|
-
default: 'default'
|
|
141
|
-
},
|
|
142
|
-
pattern: {
|
|
143
|
-
type: 'string',
|
|
144
|
-
description: 'Pattern to filter keys (optional)'
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
name: 'memory_delete',
|
|
151
|
-
description: 'Delete data from memory',
|
|
152
|
-
inputSchema: {
|
|
153
|
-
type: 'object',
|
|
154
|
-
properties: {
|
|
155
|
-
key: {
|
|
156
|
-
type: 'string',
|
|
157
|
-
description: 'Key to delete'
|
|
158
|
-
},
|
|
159
|
-
namespace: {
|
|
160
|
-
type: 'string',
|
|
161
|
-
description: 'Namespace (optional)',
|
|
162
|
-
default: 'default'
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
required: ['key']
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
name: 'todo_write',
|
|
170
|
-
description: 'Create or update todo items for task coordination',
|
|
171
|
-
inputSchema: {
|
|
172
|
-
type: 'object',
|
|
173
|
-
properties: {
|
|
174
|
-
todos: {
|
|
175
|
-
type: 'array',
|
|
176
|
-
description: 'Array of todo items',
|
|
177
|
-
items: {
|
|
178
|
-
type: 'object',
|
|
179
|
-
properties: {
|
|
180
|
-
id: {
|
|
181
|
-
type: 'string',
|
|
182
|
-
description: 'Unique ID for the todo'
|
|
183
|
-
},
|
|
184
|
-
content: {
|
|
185
|
-
type: 'string',
|
|
186
|
-
description: 'Todo description'
|
|
187
|
-
},
|
|
188
|
-
status: {
|
|
189
|
-
type: 'string',
|
|
190
|
-
enum: ['pending', 'in_progress', 'completed'],
|
|
191
|
-
description: 'Todo status'
|
|
192
|
-
},
|
|
193
|
-
priority: {
|
|
194
|
-
type: 'string',
|
|
195
|
-
enum: ['high', 'medium', 'low'],
|
|
196
|
-
description: 'Todo priority'
|
|
197
|
-
},
|
|
198
|
-
assignedAgent: {
|
|
199
|
-
type: 'string',
|
|
200
|
-
description: 'Agent assigned to this todo (optional)'
|
|
201
|
-
},
|
|
202
|
-
dependencies: {
|
|
203
|
-
type: 'array',
|
|
204
|
-
items: { type: 'string' },
|
|
205
|
-
description: 'IDs of todos this depends on (optional)'
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
required: ['id', 'content', 'status', 'priority']
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
required: ['todos']
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
name: 'todo_read',
|
|
217
|
-
description: 'Read current todo list',
|
|
218
|
-
inputSchema: {
|
|
219
|
-
type: 'object',
|
|
220
|
-
properties: {
|
|
221
|
-
status: {
|
|
222
|
-
type: 'string',
|
|
223
|
-
enum: ['all', 'pending', 'in_progress', 'completed'],
|
|
224
|
-
description: 'Filter by status (optional)',
|
|
225
|
-
default: 'all'
|
|
226
|
-
},
|
|
227
|
-
assignedAgent: {
|
|
228
|
-
type: 'string',
|
|
229
|
-
description: 'Filter by assigned agent (optional)'
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
name: 'todo_update_status',
|
|
236
|
-
description: 'Update the status of a specific todo',
|
|
237
|
-
inputSchema: {
|
|
238
|
-
type: 'object',
|
|
239
|
-
properties: {
|
|
240
|
-
id: {
|
|
241
|
-
type: 'string',
|
|
242
|
-
description: 'Todo ID'
|
|
243
|
-
},
|
|
244
|
-
status: {
|
|
245
|
-
type: 'string',
|
|
246
|
-
enum: ['pending', 'in_progress', 'completed'],
|
|
247
|
-
description: 'New status'
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
required: ['id', 'status']
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
];
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
async handleToolCall(name: string, args: any): Promise<any> {
|
|
257
|
-
try {
|
|
258
|
-
switch (name) {
|
|
259
|
-
case 'memory_store':
|
|
260
|
-
return await this.handleMemoryStore(args);
|
|
261
|
-
case 'memory_get':
|
|
262
|
-
return await this.handleMemoryGet(args);
|
|
263
|
-
case 'memory_list':
|
|
264
|
-
return await this.handleMemoryList(args);
|
|
265
|
-
case 'memory_delete':
|
|
266
|
-
return await this.handleMemoryDelete(args);
|
|
267
|
-
case 'todo_write':
|
|
268
|
-
return await this.handleTodoWrite(args);
|
|
269
|
-
case 'todo_read':
|
|
270
|
-
return await this.handleTodoRead(args);
|
|
271
|
-
case 'todo_update_status':
|
|
272
|
-
return await this.handleTodoUpdateStatus(args);
|
|
273
|
-
default:
|
|
274
|
-
throw new McpError(ErrorCode.InvalidRequest, `Unknown tool: ${name}`);
|
|
275
|
-
}
|
|
276
|
-
} catch (error) {
|
|
277
|
-
this.logger.error(`Error in tool ${name}:`, error);
|
|
278
|
-
if (error instanceof McpError) {
|
|
279
|
-
throw error;
|
|
280
|
-
}
|
|
281
|
-
throw new McpError(ErrorCode.InternalError, error instanceof Error ? error.message : 'Unknown error');
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
private async handleMemoryStore(args: any): Promise<any> {
|
|
286
|
-
const { key, value, ttl, namespace = 'default' } = args;
|
|
287
|
-
|
|
288
|
-
const fullKey = namespace === 'default' ? key : `${namespace}:${key}`;
|
|
289
|
-
await this.memorySystem.store(fullKey, value, ttl);
|
|
290
|
-
|
|
291
|
-
return {
|
|
292
|
-
content: [
|
|
293
|
-
{
|
|
294
|
-
type: 'text',
|
|
295
|
-
text: `✅ Stored data with key: ${fullKey}`,
|
|
296
|
-
},
|
|
297
|
-
],
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
private async handleMemoryGet(args: any): Promise<any> {
|
|
302
|
-
const { key, namespace = 'default' } = args;
|
|
303
|
-
|
|
304
|
-
const fullKey = namespace === 'default' ? key : `${namespace}:${key}`;
|
|
305
|
-
const value = await this.memorySystem.get(fullKey);
|
|
306
|
-
|
|
307
|
-
if (value === null) {
|
|
308
|
-
return {
|
|
309
|
-
content: [
|
|
310
|
-
{
|
|
311
|
-
type: 'text',
|
|
312
|
-
text: `❌ No data found for key: ${fullKey}`,
|
|
313
|
-
},
|
|
314
|
-
],
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
return {
|
|
319
|
-
content: [
|
|
320
|
-
{
|
|
321
|
-
type: 'text',
|
|
322
|
-
text: `✅ Retrieved data for key: ${fullKey}\n\nValue: ${JSON.stringify(value, null, 2)}`,
|
|
323
|
-
},
|
|
324
|
-
],
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
private async handleMemoryList(args: any): Promise<any> {
|
|
329
|
-
const { namespace = 'default', pattern } = args;
|
|
330
|
-
|
|
331
|
-
// For now, return a simple response - actual implementation would query the database
|
|
332
|
-
return {
|
|
333
|
-
content: [
|
|
334
|
-
{
|
|
335
|
-
type: 'text',
|
|
336
|
-
text: `📋 Listing keys for namespace: ${namespace}\n\n⚠️ Implementation pending: Would query database for keys matching pattern: ${pattern || 'all'}`,
|
|
337
|
-
},
|
|
338
|
-
],
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
private async handleMemoryDelete(args: any): Promise<any> {
|
|
343
|
-
const { key, namespace = 'default' } = args;
|
|
344
|
-
|
|
345
|
-
const fullKey = namespace === 'default' ? key : `${namespace}:${key}`;
|
|
346
|
-
// Memory system doesn't have delete method, so we'll store null
|
|
347
|
-
await this.memorySystem.store(fullKey, null);
|
|
348
|
-
|
|
349
|
-
return {
|
|
350
|
-
content: [
|
|
351
|
-
{
|
|
352
|
-
type: 'text',
|
|
353
|
-
text: `✅ Deleted key: ${fullKey}`,
|
|
354
|
-
},
|
|
355
|
-
],
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
private async handleTodoWrite(args: any): Promise<any> {
|
|
360
|
-
const { todos } = args;
|
|
361
|
-
|
|
362
|
-
// Add timestamps to todos
|
|
363
|
-
const timestampedTodos = todos.map((todo: TodoItem) => ({
|
|
364
|
-
...todo,
|
|
365
|
-
timestamp: new Date().toISOString()
|
|
366
|
-
}));
|
|
367
|
-
|
|
368
|
-
// Store current todos
|
|
369
|
-
await this.memorySystem.store('todos:current', timestampedTodos);
|
|
370
|
-
|
|
371
|
-
// Store individual todos for quick access
|
|
372
|
-
for (const todo of timestampedTodos) {
|
|
373
|
-
await this.memorySystem.store(`todos:item:${todo.id}`, todo);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
return {
|
|
377
|
-
content: [
|
|
378
|
-
{
|
|
379
|
-
type: 'text',
|
|
380
|
-
text: `✅ Updated ${todos.length} todos\n\n📋 Todo Summary:\n${timestampedTodos.map(todo =>
|
|
381
|
-
`- ${todo.content} [${todo.status}] (${todo.priority})`
|
|
382
|
-
).join('\n')}`,
|
|
383
|
-
},
|
|
384
|
-
],
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
private async handleTodoRead(args: any): Promise<any> {
|
|
389
|
-
const { status = 'all', assignedAgent } = args;
|
|
390
|
-
|
|
391
|
-
// Get current todos
|
|
392
|
-
let todos: TodoItem[] = await this.memorySystem.get('todos:current') || [];
|
|
393
|
-
|
|
394
|
-
// Filter by status
|
|
395
|
-
if (status !== 'all') {
|
|
396
|
-
todos = todos.filter((t: TodoItem) => t.status === status);
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
// Filter by assigned agent
|
|
400
|
-
if (assignedAgent) {
|
|
401
|
-
todos = todos.filter((t: TodoItem) => t.assignedAgent === assignedAgent);
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
return {
|
|
405
|
-
content: [
|
|
406
|
-
{
|
|
407
|
-
type: 'text',
|
|
408
|
-
text: `📋 Todo List (${todos.length} items)${status !== 'all' ? ` - Status: ${status}` : ''}${assignedAgent ? ` - Agent: ${assignedAgent}` : ''}\n\n${todos.length > 0 ? todos.map(todo =>
|
|
409
|
-
`${todo.status === 'completed' ? '✅' : todo.status === 'in_progress' ? '🔄' : '⏳'} ${todo.content} [${todo.priority}]${todo.assignedAgent ? ` - ${todo.assignedAgent}` : ''}`
|
|
410
|
-
).join('\n') : 'No todos found.'}`,
|
|
411
|
-
},
|
|
412
|
-
],
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
private async handleTodoUpdateStatus(args: any): Promise<any> {
|
|
417
|
-
const { id, status } = args;
|
|
418
|
-
|
|
419
|
-
// Get current todos
|
|
420
|
-
const todos: TodoItem[] = await this.memorySystem.get('todos:current') || [];
|
|
421
|
-
|
|
422
|
-
// Find and update the specific todo
|
|
423
|
-
const todoIndex = todos.findIndex((t: TodoItem) => t.id === id);
|
|
424
|
-
if (todoIndex === -1) {
|
|
425
|
-
return {
|
|
426
|
-
content: [
|
|
427
|
-
{
|
|
428
|
-
type: 'text',
|
|
429
|
-
text: `❌ Todo not found: ${id}`,
|
|
430
|
-
},
|
|
431
|
-
],
|
|
432
|
-
};
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
todos[todoIndex].status = status;
|
|
436
|
-
|
|
437
|
-
// Update in memory
|
|
438
|
-
await this.memorySystem.store('todos:current', todos);
|
|
439
|
-
await this.memorySystem.store(`todos:item:${id}`, todos[todoIndex]);
|
|
440
|
-
|
|
441
|
-
return {
|
|
442
|
-
content: [
|
|
443
|
-
{
|
|
444
|
-
type: 'text',
|
|
445
|
-
text: `✅ Updated todo "${todos[todoIndex].content}" status to ${status}\n\n🔄 Status: ${status === 'completed' ? '✅ Completed' : status === 'in_progress' ? '🔄 In Progress' : '⏳ Pending'}`,
|
|
446
|
-
},
|
|
447
|
-
],
|
|
448
|
-
};
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
async run() {
|
|
452
|
-
try {
|
|
453
|
-
// Initialize memory system first
|
|
454
|
-
await this.initialize();
|
|
455
|
-
|
|
456
|
-
// Connect transport
|
|
457
|
-
const transport = new StdioServerTransport();
|
|
458
|
-
await this.server.connect(transport);
|
|
459
|
-
this.logger.info('ServiceNow Memory MCP Server running on stdio');
|
|
460
|
-
} catch (error) {
|
|
461
|
-
this.logger.error('Failed to start Memory MCP server:', error);
|
|
462
|
-
process.exit(1);
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
async shutdown(): Promise<void> {
|
|
467
|
-
if (this.memorySystem) {
|
|
468
|
-
await this.memorySystem.close();
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
const server = new ServiceNowMemoryMCP();
|
|
474
|
-
server.run().catch(console.error);
|