@patrick-rodgers/cron-claude 0.1.0
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/LICENSE +21 -0
- package/README.md +401 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +296 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +22 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +61 -0
- package/dist/config.js.map +1 -0
- package/dist/executor.d.ts +19 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +234 -0
- package/dist/executor.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +42 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +178 -0
- package/dist/logger.js.map +1 -0
- package/dist/mcp-server.d.ts +7 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +580 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/notifier.d.ts +17 -0
- package/dist/notifier.d.ts.map +1 -0
- package/dist/notifier.js +48 -0
- package/dist/notifier.js.map +1 -0
- package/dist/scheduler.d.ts +46 -0
- package/dist/scheduler.d.ts.map +1 -0
- package/dist/scheduler.js +230 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/types.d.ts +37 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/install.ps1 +93 -0
- package/package.json +52 -0
- package/uninstall.ps1 +59 -0
|
@@ -0,0 +1,580 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* Cron-Claude MCP Server
|
|
5
|
+
* Exposes scheduled task management via Model Context Protocol
|
|
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
|
+
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
|
12
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
13
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
14
|
+
const fs_1 = require("fs");
|
|
15
|
+
const path_1 = require("path");
|
|
16
|
+
const gray_matter_1 = __importDefault(require("gray-matter"));
|
|
17
|
+
const scheduler_js_1 = require("./scheduler.js");
|
|
18
|
+
const executor_js_1 = require("./executor.js");
|
|
19
|
+
const logger_js_1 = require("./logger.js");
|
|
20
|
+
const config_js_1 = require("./config.js");
|
|
21
|
+
const child_process_1 = require("child_process");
|
|
22
|
+
// Get project root
|
|
23
|
+
const PROJECT_ROOT = (0, path_1.resolve)(__dirname, '..');
|
|
24
|
+
const TASKS_DIR = (0, path_1.join)(PROJECT_ROOT, 'tasks');
|
|
25
|
+
// Ensure tasks directory exists
|
|
26
|
+
if (!(0, fs_1.existsSync)(TASKS_DIR)) {
|
|
27
|
+
(0, fs_1.mkdirSync)(TASKS_DIR, { recursive: true });
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Helper functions
|
|
31
|
+
*/
|
|
32
|
+
function getTaskFiles() {
|
|
33
|
+
try {
|
|
34
|
+
return (0, fs_1.readdirSync)(TASKS_DIR).filter((f) => f.endsWith('.md'));
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function parseTask(filename) {
|
|
41
|
+
const filePath = (0, path_1.join)(TASKS_DIR, filename);
|
|
42
|
+
const content = (0, fs_1.readFileSync)(filePath, 'utf-8');
|
|
43
|
+
const parsed = (0, gray_matter_1.default)(content);
|
|
44
|
+
return { filePath, ...parsed.data, instructions: parsed.content };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Define MCP tools
|
|
48
|
+
*/
|
|
49
|
+
const tools = [
|
|
50
|
+
{
|
|
51
|
+
name: 'cron_create_task',
|
|
52
|
+
description: 'Create a new scheduled task from a template or custom definition',
|
|
53
|
+
inputSchema: {
|
|
54
|
+
type: 'object',
|
|
55
|
+
properties: {
|
|
56
|
+
task_id: {
|
|
57
|
+
type: 'string',
|
|
58
|
+
description: 'Unique identifier for the task',
|
|
59
|
+
},
|
|
60
|
+
schedule: {
|
|
61
|
+
type: 'string',
|
|
62
|
+
description: 'Cron expression (e.g., "0 9 * * *" for 9 AM daily)',
|
|
63
|
+
default: '0 9 * * *',
|
|
64
|
+
},
|
|
65
|
+
invocation: {
|
|
66
|
+
type: 'string',
|
|
67
|
+
enum: ['cli', 'api'],
|
|
68
|
+
description: 'Execution method: cli (Claude CLI) or api (Anthropic API)',
|
|
69
|
+
default: 'cli',
|
|
70
|
+
},
|
|
71
|
+
instructions: {
|
|
72
|
+
type: 'string',
|
|
73
|
+
description: 'Task instructions in markdown format',
|
|
74
|
+
},
|
|
75
|
+
toast_notifications: {
|
|
76
|
+
type: 'boolean',
|
|
77
|
+
description: 'Enable Windows toast notifications',
|
|
78
|
+
default: true,
|
|
79
|
+
},
|
|
80
|
+
enabled: {
|
|
81
|
+
type: 'boolean',
|
|
82
|
+
description: 'Enable task immediately',
|
|
83
|
+
default: true,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
required: ['task_id', 'instructions'],
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'cron_register_task',
|
|
91
|
+
description: 'Register a task with Windows Task Scheduler',
|
|
92
|
+
inputSchema: {
|
|
93
|
+
type: 'object',
|
|
94
|
+
properties: {
|
|
95
|
+
task_id: {
|
|
96
|
+
type: 'string',
|
|
97
|
+
description: 'Task ID to register',
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
required: ['task_id'],
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'cron_unregister_task',
|
|
105
|
+
description: 'Unregister a task from Windows Task Scheduler',
|
|
106
|
+
inputSchema: {
|
|
107
|
+
type: 'object',
|
|
108
|
+
properties: {
|
|
109
|
+
task_id: {
|
|
110
|
+
type: 'string',
|
|
111
|
+
description: 'Task ID to unregister',
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
required: ['task_id'],
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: 'cron_list_tasks',
|
|
119
|
+
description: 'List all scheduled tasks with their status',
|
|
120
|
+
inputSchema: {
|
|
121
|
+
type: 'object',
|
|
122
|
+
properties: {},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: 'cron_enable_task',
|
|
127
|
+
description: 'Enable a task in Windows Task Scheduler',
|
|
128
|
+
inputSchema: {
|
|
129
|
+
type: 'object',
|
|
130
|
+
properties: {
|
|
131
|
+
task_id: {
|
|
132
|
+
type: 'string',
|
|
133
|
+
description: 'Task ID to enable',
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
required: ['task_id'],
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: 'cron_disable_task',
|
|
141
|
+
description: 'Disable a task in Windows Task Scheduler',
|
|
142
|
+
inputSchema: {
|
|
143
|
+
type: 'object',
|
|
144
|
+
properties: {
|
|
145
|
+
task_id: {
|
|
146
|
+
type: 'string',
|
|
147
|
+
description: 'Task ID to disable',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
required: ['task_id'],
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: 'cron_run_task',
|
|
155
|
+
description: 'Manually execute a task immediately (does not wait for schedule)',
|
|
156
|
+
inputSchema: {
|
|
157
|
+
type: 'object',
|
|
158
|
+
properties: {
|
|
159
|
+
task_id: {
|
|
160
|
+
type: 'string',
|
|
161
|
+
description: 'Task ID to run',
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
required: ['task_id'],
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: 'cron_view_logs',
|
|
169
|
+
description: 'View execution logs for a task from the memory skill',
|
|
170
|
+
inputSchema: {
|
|
171
|
+
type: 'object',
|
|
172
|
+
properties: {
|
|
173
|
+
task_id: {
|
|
174
|
+
type: 'string',
|
|
175
|
+
description: 'Task ID to view logs for',
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
required: ['task_id'],
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: 'cron_verify_log',
|
|
183
|
+
description: 'Verify the cryptographic signature of a log file',
|
|
184
|
+
inputSchema: {
|
|
185
|
+
type: 'object',
|
|
186
|
+
properties: {
|
|
187
|
+
log_content: {
|
|
188
|
+
type: 'string',
|
|
189
|
+
description: 'Full markdown content of the log file including frontmatter',
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
required: ['log_content'],
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: 'cron_status',
|
|
197
|
+
description: 'Show system status and configuration',
|
|
198
|
+
inputSchema: {
|
|
199
|
+
type: 'object',
|
|
200
|
+
properties: {},
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: 'cron_get_task',
|
|
205
|
+
description: 'Get the full definition of a specific task',
|
|
206
|
+
inputSchema: {
|
|
207
|
+
type: 'object',
|
|
208
|
+
properties: {
|
|
209
|
+
task_id: {
|
|
210
|
+
type: 'string',
|
|
211
|
+
description: 'Task ID to retrieve',
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
required: ['task_id'],
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
];
|
|
218
|
+
/**
|
|
219
|
+
* Initialize MCP server
|
|
220
|
+
*/
|
|
221
|
+
const server = new index_js_1.Server({
|
|
222
|
+
name: 'cron-claude',
|
|
223
|
+
version: '0.1.0',
|
|
224
|
+
}, {
|
|
225
|
+
capabilities: {
|
|
226
|
+
tools: {},
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
/**
|
|
230
|
+
* List available tools
|
|
231
|
+
*/
|
|
232
|
+
server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
|
|
233
|
+
return { tools };
|
|
234
|
+
});
|
|
235
|
+
/**
|
|
236
|
+
* Handle tool calls
|
|
237
|
+
*/
|
|
238
|
+
server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
239
|
+
const { name, arguments: args } = request.params;
|
|
240
|
+
try {
|
|
241
|
+
switch (name) {
|
|
242
|
+
case 'cron_create_task': {
|
|
243
|
+
const { task_id, schedule, invocation, instructions, toast_notifications, enabled } = args;
|
|
244
|
+
const template = `---
|
|
245
|
+
id: ${task_id}
|
|
246
|
+
schedule: "${schedule || '0 9 * * *'}"
|
|
247
|
+
invocation: ${invocation || 'cli'}
|
|
248
|
+
notifications:
|
|
249
|
+
toast: ${toast_notifications !== false}
|
|
250
|
+
enabled: ${enabled !== false}
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
${instructions}
|
|
254
|
+
`;
|
|
255
|
+
const filename = `${task_id}.md`;
|
|
256
|
+
const filePath = (0, path_1.join)(TASKS_DIR, filename);
|
|
257
|
+
if ((0, fs_1.existsSync)(filePath)) {
|
|
258
|
+
return {
|
|
259
|
+
content: [
|
|
260
|
+
{
|
|
261
|
+
type: 'text',
|
|
262
|
+
text: `Error: Task "${task_id}" already exists. Use a different ID or delete the existing task first.`,
|
|
263
|
+
},
|
|
264
|
+
],
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
(0, fs_1.writeFileSync)(filePath, template, 'utf-8');
|
|
268
|
+
return {
|
|
269
|
+
content: [
|
|
270
|
+
{
|
|
271
|
+
type: 'text',
|
|
272
|
+
text: `✓ Task created successfully: ${task_id}\n\nLocation: ${filePath}\n\nNext step: Register it with:\ncron_register_task(task_id="${task_id}")`,
|
|
273
|
+
},
|
|
274
|
+
],
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
case 'cron_register_task': {
|
|
278
|
+
const { task_id } = args;
|
|
279
|
+
const filename = `${task_id}.md`;
|
|
280
|
+
const filePath = (0, path_1.join)(TASKS_DIR, filename);
|
|
281
|
+
if (!(0, fs_1.existsSync)(filePath)) {
|
|
282
|
+
return {
|
|
283
|
+
content: [
|
|
284
|
+
{
|
|
285
|
+
type: 'text',
|
|
286
|
+
text: `Error: Task file not found: ${filename}`,
|
|
287
|
+
},
|
|
288
|
+
],
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
const task = parseTask(filename);
|
|
292
|
+
if (!task.schedule) {
|
|
293
|
+
return {
|
|
294
|
+
content: [
|
|
295
|
+
{
|
|
296
|
+
type: 'text',
|
|
297
|
+
text: 'Error: Task must have a schedule defined',
|
|
298
|
+
},
|
|
299
|
+
],
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
(0, scheduler_js_1.registerTask)(task_id, filePath, task.schedule, PROJECT_ROOT);
|
|
303
|
+
return {
|
|
304
|
+
content: [
|
|
305
|
+
{
|
|
306
|
+
type: 'text',
|
|
307
|
+
text: `✓ Task "${task_id}" registered successfully with Windows Task Scheduler\n\nSchedule: ${task.schedule}\nNext run will occur according to the schedule.`,
|
|
308
|
+
},
|
|
309
|
+
],
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
case 'cron_unregister_task': {
|
|
313
|
+
const { task_id } = args;
|
|
314
|
+
(0, scheduler_js_1.unregisterTask)(task_id);
|
|
315
|
+
return {
|
|
316
|
+
content: [
|
|
317
|
+
{
|
|
318
|
+
type: 'text',
|
|
319
|
+
text: `✓ Task "${task_id}" unregistered successfully`,
|
|
320
|
+
},
|
|
321
|
+
],
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
case 'cron_list_tasks': {
|
|
325
|
+
const files = getTaskFiles();
|
|
326
|
+
if (files.length === 0) {
|
|
327
|
+
return {
|
|
328
|
+
content: [
|
|
329
|
+
{
|
|
330
|
+
type: 'text',
|
|
331
|
+
text: 'No tasks found. Create one with cron_create_task.',
|
|
332
|
+
},
|
|
333
|
+
],
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
let output = 'Scheduled Tasks:\n\n';
|
|
337
|
+
for (const file of files) {
|
|
338
|
+
try {
|
|
339
|
+
const task = parseTask(file);
|
|
340
|
+
const status = (0, scheduler_js_1.getTaskStatus)(task.id);
|
|
341
|
+
output += `📋 ${task.id}\n`;
|
|
342
|
+
output += ` Schedule: ${task.schedule}\n`;
|
|
343
|
+
output += ` Method: ${task.invocation}\n`;
|
|
344
|
+
output += ` Enabled (file): ${task.enabled ? '✓' : '✗'}\n`;
|
|
345
|
+
if (status.exists) {
|
|
346
|
+
output += ` Registered: ✓\n`;
|
|
347
|
+
output += ` Status: ${status.enabled ? 'Enabled' : 'Disabled'}\n`;
|
|
348
|
+
if (status.lastRunTime && status.lastRunTime !== '12/30/1899 12:00:00 AM') {
|
|
349
|
+
output += ` Last run: ${status.lastRunTime}\n`;
|
|
350
|
+
}
|
|
351
|
+
if (status.nextRunTime) {
|
|
352
|
+
output += ` Next run: ${status.nextRunTime}\n`;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
output += ` Registered: ✗ (use cron_register_task)\n`;
|
|
357
|
+
}
|
|
358
|
+
output += '\n';
|
|
359
|
+
}
|
|
360
|
+
catch (error) {
|
|
361
|
+
output += `Error parsing ${file}: ${error}\n\n`;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return {
|
|
365
|
+
content: [
|
|
366
|
+
{
|
|
367
|
+
type: 'text',
|
|
368
|
+
text: output,
|
|
369
|
+
},
|
|
370
|
+
],
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
case 'cron_enable_task': {
|
|
374
|
+
const { task_id } = args;
|
|
375
|
+
(0, scheduler_js_1.enableTask)(task_id);
|
|
376
|
+
return {
|
|
377
|
+
content: [
|
|
378
|
+
{
|
|
379
|
+
type: 'text',
|
|
380
|
+
text: `✓ Task "${task_id}" enabled`,
|
|
381
|
+
},
|
|
382
|
+
],
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
case 'cron_disable_task': {
|
|
386
|
+
const { task_id } = args;
|
|
387
|
+
(0, scheduler_js_1.disableTask)(task_id);
|
|
388
|
+
return {
|
|
389
|
+
content: [
|
|
390
|
+
{
|
|
391
|
+
type: 'text',
|
|
392
|
+
text: `✓ Task "${task_id}" disabled`,
|
|
393
|
+
},
|
|
394
|
+
],
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
case 'cron_run_task': {
|
|
398
|
+
const { task_id } = args;
|
|
399
|
+
const filename = `${task_id}.md`;
|
|
400
|
+
const filePath = (0, path_1.join)(TASKS_DIR, filename);
|
|
401
|
+
if (!(0, fs_1.existsSync)(filePath)) {
|
|
402
|
+
return {
|
|
403
|
+
content: [
|
|
404
|
+
{
|
|
405
|
+
type: 'text',
|
|
406
|
+
text: `Error: Task file not found: ${filename}`,
|
|
407
|
+
},
|
|
408
|
+
],
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
// Execute task
|
|
412
|
+
await (0, executor_js_1.executeTask)(filePath);
|
|
413
|
+
return {
|
|
414
|
+
content: [
|
|
415
|
+
{
|
|
416
|
+
type: 'text',
|
|
417
|
+
text: `✓ Task "${task_id}" executed successfully\n\nCheck logs with: cron_view_logs(task_id="${task_id}")`,
|
|
418
|
+
},
|
|
419
|
+
],
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
case 'cron_view_logs': {
|
|
423
|
+
const { task_id } = args;
|
|
424
|
+
try {
|
|
425
|
+
const result = (0, child_process_1.execSync)(`odsp-memory recall --category=cron-task "${task_id}"`, {
|
|
426
|
+
encoding: 'utf-8',
|
|
427
|
+
});
|
|
428
|
+
return {
|
|
429
|
+
content: [
|
|
430
|
+
{
|
|
431
|
+
type: 'text',
|
|
432
|
+
text: result || `No logs found for task: ${task_id}`,
|
|
433
|
+
},
|
|
434
|
+
],
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
catch (error) {
|
|
438
|
+
return {
|
|
439
|
+
content: [
|
|
440
|
+
{
|
|
441
|
+
type: 'text',
|
|
442
|
+
text: `Error fetching logs: ${error}`,
|
|
443
|
+
},
|
|
444
|
+
],
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
case 'cron_verify_log': {
|
|
449
|
+
const { log_content } = args;
|
|
450
|
+
const result = (0, logger_js_1.verifyLogFile)(log_content);
|
|
451
|
+
if (result.valid) {
|
|
452
|
+
let output = '✓ Signature is valid - log has not been tampered with\n\n';
|
|
453
|
+
if (result.log) {
|
|
454
|
+
output += `Task: ${result.log.taskId}\n`;
|
|
455
|
+
output += `Execution: ${result.log.executionId}\n`;
|
|
456
|
+
output += `Status: ${result.log.status}\n`;
|
|
457
|
+
}
|
|
458
|
+
return {
|
|
459
|
+
content: [
|
|
460
|
+
{
|
|
461
|
+
type: 'text',
|
|
462
|
+
text: output,
|
|
463
|
+
},
|
|
464
|
+
],
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
return {
|
|
469
|
+
content: [
|
|
470
|
+
{
|
|
471
|
+
type: 'text',
|
|
472
|
+
text: `✗ Signature verification failed!\n\n${result.error}`,
|
|
473
|
+
},
|
|
474
|
+
],
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
case 'cron_status': {
|
|
479
|
+
const config = (0, config_js_1.loadConfig)();
|
|
480
|
+
const taskCount = getTaskFiles().length;
|
|
481
|
+
const output = `Cron-Claude System Status
|
|
482
|
+
|
|
483
|
+
Version: 0.1.0
|
|
484
|
+
Config directory: ${(0, config_js_1.getConfigDir)()}
|
|
485
|
+
Tasks directory: ${TASKS_DIR}
|
|
486
|
+
Total tasks: ${taskCount}
|
|
487
|
+
Secret key: ${config.secretKey ? '✓ Configured' : '✗ Not configured'}
|
|
488
|
+
|
|
489
|
+
Node version: ${process.version}
|
|
490
|
+
Platform: ${process.platform}
|
|
491
|
+
|
|
492
|
+
Available tools:
|
|
493
|
+
- cron_create_task - Create new scheduled tasks
|
|
494
|
+
- cron_register_task - Register with Task Scheduler
|
|
495
|
+
- cron_list_tasks - View all tasks
|
|
496
|
+
- cron_run_task - Execute immediately
|
|
497
|
+
- cron_enable/disable_task - Toggle tasks
|
|
498
|
+
- cron_view_logs - View execution history
|
|
499
|
+
- cron_verify_log - Verify log signatures
|
|
500
|
+
`;
|
|
501
|
+
return {
|
|
502
|
+
content: [
|
|
503
|
+
{
|
|
504
|
+
type: 'text',
|
|
505
|
+
text: output,
|
|
506
|
+
},
|
|
507
|
+
],
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
case 'cron_get_task': {
|
|
511
|
+
const { task_id } = args;
|
|
512
|
+
const filename = `${task_id}.md`;
|
|
513
|
+
const filePath = (0, path_1.join)(TASKS_DIR, filename);
|
|
514
|
+
if (!(0, fs_1.existsSync)(filePath)) {
|
|
515
|
+
return {
|
|
516
|
+
content: [
|
|
517
|
+
{
|
|
518
|
+
type: 'text',
|
|
519
|
+
text: `Error: Task file not found: ${filename}`,
|
|
520
|
+
},
|
|
521
|
+
],
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
const content = (0, fs_1.readFileSync)(filePath, 'utf-8');
|
|
525
|
+
const task = parseTask(filename);
|
|
526
|
+
const status = (0, scheduler_js_1.getTaskStatus)(task_id);
|
|
527
|
+
let output = `Task: ${task_id}\n\n`;
|
|
528
|
+
output += `Schedule: ${task.schedule}\n`;
|
|
529
|
+
output += `Method: ${task.invocation}\n`;
|
|
530
|
+
output += `Enabled: ${task.enabled}\n`;
|
|
531
|
+
output += `Notifications: ${task.notifications?.toast ? 'Yes' : 'No'}\n`;
|
|
532
|
+
output += `Registered: ${status.exists ? 'Yes' : 'No'}\n\n`;
|
|
533
|
+
output += `Full Definition:\n\n${content}`;
|
|
534
|
+
return {
|
|
535
|
+
content: [
|
|
536
|
+
{
|
|
537
|
+
type: 'text',
|
|
538
|
+
text: output,
|
|
539
|
+
},
|
|
540
|
+
],
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
default:
|
|
544
|
+
return {
|
|
545
|
+
content: [
|
|
546
|
+
{
|
|
547
|
+
type: 'text',
|
|
548
|
+
text: `Unknown tool: ${name}`,
|
|
549
|
+
},
|
|
550
|
+
],
|
|
551
|
+
isError: true,
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
catch (error) {
|
|
556
|
+
return {
|
|
557
|
+
content: [
|
|
558
|
+
{
|
|
559
|
+
type: 'text',
|
|
560
|
+
text: `Error executing ${name}: ${error instanceof Error ? error.message : String(error)}`,
|
|
561
|
+
},
|
|
562
|
+
],
|
|
563
|
+
isError: true,
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
/**
|
|
568
|
+
* Start the server
|
|
569
|
+
*/
|
|
570
|
+
async function main() {
|
|
571
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
572
|
+
await server.connect(transport);
|
|
573
|
+
// Log to stderr (stdout is reserved for MCP protocol)
|
|
574
|
+
console.error('Cron-Claude MCP server running on stdio');
|
|
575
|
+
}
|
|
576
|
+
main().catch((error) => {
|
|
577
|
+
console.error('Fatal error:', error);
|
|
578
|
+
process.exit(1);
|
|
579
|
+
});
|
|
580
|
+
//# sourceMappingURL=mcp-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";;AACA;;;GAGG;;;;;AAEH,wEAAmE;AACnE,wEAAiF;AACjF,iEAI4C;AAC5C,2BAAqF;AACrF,+BAAqC;AACrC,8DAAiC;AACjC,iDA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AC;gBAC5D,MAAM,IAAI,uBAAuB,OAAO,EAAE,CAAC;gBAE3C,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,MAAM;yBACb;qBACF;iBACF,CAAC;YACJ,CAAC;YAED;gBACE,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,iBAAiB,IAAI,EAAE;yBAC9B;qBACF;oBACD,OAAO,EAAE,IAAI;iBACd,CAAC;QACN,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,mBAAmB,IAAI,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;iBAC3F;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH;;GAEG;AACH,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,sDAAsD;IACtD,OAAO,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;AAC3D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Windows Toast Notification system
|
|
3
|
+
* Sends notifications when tasks complete
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Send a Windows toast notification
|
|
7
|
+
*/
|
|
8
|
+
export declare function sendNotification(title: string, message: string): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Send success notification
|
|
11
|
+
*/
|
|
12
|
+
export declare function notifySuccess(taskId: string, message?: string): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Send failure notification
|
|
15
|
+
*/
|
|
16
|
+
export declare function notifyFailure(taskId: string, error?: string): Promise<void>;
|
|
17
|
+
//# sourceMappingURL=notifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifier.d.ts","sourceRoot":"","sources":["../src/notifier.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBpF;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKnF;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKjF"}
|
package/dist/notifier.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Windows Toast Notification system
|
|
4
|
+
* Sends notifications when tasks complete
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.sendNotification = sendNotification;
|
|
11
|
+
exports.notifySuccess = notifySuccess;
|
|
12
|
+
exports.notifyFailure = notifyFailure;
|
|
13
|
+
const node_notifier_1 = __importDefault(require("node-notifier"));
|
|
14
|
+
/**
|
|
15
|
+
* Send a Windows toast notification
|
|
16
|
+
*/
|
|
17
|
+
async function sendNotification(title, message) {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
node_notifier_1.default.notify({
|
|
20
|
+
title,
|
|
21
|
+
message,
|
|
22
|
+
icon: undefined, // Could add a custom icon later
|
|
23
|
+
sound: true,
|
|
24
|
+
wait: false,
|
|
25
|
+
appID: 'cron-claude',
|
|
26
|
+
}, (err, response) => {
|
|
27
|
+
if (err) {
|
|
28
|
+
reject(err);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
resolve();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Send success notification
|
|
38
|
+
*/
|
|
39
|
+
async function notifySuccess(taskId, message) {
|
|
40
|
+
await sendNotification(`✓ Task Completed: ${taskId}`, message || 'Task executed successfully');
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Send failure notification
|
|
44
|
+
*/
|
|
45
|
+
async function notifyFailure(taskId, error) {
|
|
46
|
+
await sendNotification(`✗ Task Failed: ${taskId}`, error || 'Task execution failed');
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=notifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifier.js","sourceRoot":"","sources":["../src/notifier.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAOH,4CAoBC;AAKD,sCAKC;AAKD,sCAKC;AA7CD,kEAAqC;AAErC;;GAEG;AACI,KAAK,UAAU,gBAAgB,CAAC,KAAa,EAAE,OAAe;IACnE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,uBAAQ,CAAC,MAAM,CACb;YACE,KAAK;YACL,OAAO;YACP,IAAI,EAAE,SAAS,EAAE,gCAAgC;YACjD,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,aAAa;SACrB,EACD,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE;YAChB,IAAI,GAAG,EAAE,CAAC;gBACR,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC;iBAAM,CAAC;gBACN,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,aAAa,CAAC,MAAc,EAAE,OAAgB;IAClE,MAAM,gBAAgB,CACpB,qBAAqB,MAAM,EAAE,EAC7B,OAAO,IAAI,4BAA4B,CACxC,CAAC;AACJ,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,aAAa,CAAC,MAAc,EAAE,KAAc;IAChE,MAAM,gBAAgB,CACpB,kBAAkB,MAAM,EAAE,EAC1B,KAAK,IAAI,uBAAuB,CACjC,CAAC;AACJ,CAAC"}
|