@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Patrick Rodgers
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
# Cron-Claude MCP Server
|
|
2
|
+
|
|
3
|
+
**Scheduled Claude task execution via Model Context Protocol**
|
|
4
|
+
|
|
5
|
+
Cron-Claude is an MCP server that allows you to schedule Claude to perform tasks automatically on a recurring schedule, similar to cron jobs. Tasks are defined in markdown files and managed through MCP tools available in all your Claude Code sessions.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- 🕐 **Schedule tasks** using familiar cron expressions
|
|
10
|
+
- 🔐 **Audit logging** with HMAC-SHA256 signatures for integrity verification
|
|
11
|
+
- 💾 **Memory integration** - All logs stored via odsp-memory skill
|
|
12
|
+
- 🔔 **Windows notifications** - Optional toast notifications on completion
|
|
13
|
+
- 🎯 **Flexible execution** - Run tasks via Claude CLI or Anthropic API
|
|
14
|
+
- 🛡️ **Windows Task Scheduler** - Reliable, native scheduling that survives reboots
|
|
15
|
+
- 🔌 **MCP Integration** - Seamlessly integrated into all Claude Code sessions
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
### 1. Clone and Build
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
git clone <repository-url>
|
|
23
|
+
cd cron-claude
|
|
24
|
+
npm install
|
|
25
|
+
npm run build
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 2. Install MCP Server
|
|
29
|
+
|
|
30
|
+
Run the install script to register with Claude Code:
|
|
31
|
+
|
|
32
|
+
```powershell
|
|
33
|
+
.\install.ps1
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This adds cron-claude to your `~/.claude/config.json` for all sessions.
|
|
37
|
+
|
|
38
|
+
### 3. Restart Claude Code
|
|
39
|
+
|
|
40
|
+
Restart Claude Code to load the MCP server.
|
|
41
|
+
|
|
42
|
+
### 4. Verify Installation
|
|
43
|
+
|
|
44
|
+
Ask Claude:
|
|
45
|
+
```
|
|
46
|
+
Show me my cron-claude status
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Claude will use the `cron_status` tool to verify the installation.
|
|
50
|
+
|
|
51
|
+
## Quick Start
|
|
52
|
+
|
|
53
|
+
### Create Your First Task
|
|
54
|
+
|
|
55
|
+
Just ask Claude naturally:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
Create a cron task called "daily-summary" that runs every day at 9 AM.
|
|
59
|
+
The task should check my calendar and create a summary report.
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Claude will use the `cron_create_task` tool to create the task file.
|
|
63
|
+
|
|
64
|
+
### Register with Task Scheduler
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
Register my daily-summary task with Windows Task Scheduler
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Claude will use the `cron_register_task` tool.
|
|
71
|
+
|
|
72
|
+
### View All Tasks
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
Show me all my scheduled cron tasks
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Claude will use the `cron_list_tasks` tool.
|
|
79
|
+
|
|
80
|
+
## Available MCP Tools
|
|
81
|
+
|
|
82
|
+
All tools are automatically available in Claude Code sessions:
|
|
83
|
+
|
|
84
|
+
### Task Management
|
|
85
|
+
|
|
86
|
+
- **`cron_create_task`** - Create a new scheduled task
|
|
87
|
+
- Parameters: task_id, schedule, invocation, instructions, toast_notifications, enabled
|
|
88
|
+
|
|
89
|
+
- **`cron_register_task`** - Register task with Windows Task Scheduler
|
|
90
|
+
- Parameters: task_id
|
|
91
|
+
|
|
92
|
+
- **`cron_unregister_task`** - Remove task from scheduler
|
|
93
|
+
- Parameters: task_id
|
|
94
|
+
|
|
95
|
+
- **`cron_enable_task`** - Enable a task
|
|
96
|
+
- Parameters: task_id
|
|
97
|
+
|
|
98
|
+
- **`cron_disable_task`** - Disable a task
|
|
99
|
+
- Parameters: task_id
|
|
100
|
+
|
|
101
|
+
### Task Execution
|
|
102
|
+
|
|
103
|
+
- **`cron_run_task`** - Execute a task immediately
|
|
104
|
+
- Parameters: task_id
|
|
105
|
+
|
|
106
|
+
- **`cron_list_tasks`** - Show all tasks with status
|
|
107
|
+
- No parameters
|
|
108
|
+
|
|
109
|
+
- **`cron_get_task`** - Get full task definition
|
|
110
|
+
- Parameters: task_id
|
|
111
|
+
|
|
112
|
+
### Logging & Verification
|
|
113
|
+
|
|
114
|
+
- **`cron_view_logs`** - View execution logs from memory skill
|
|
115
|
+
- Parameters: task_id
|
|
116
|
+
|
|
117
|
+
- **`cron_verify_log`** - Verify log cryptographic signature
|
|
118
|
+
- Parameters: log_content
|
|
119
|
+
|
|
120
|
+
### System
|
|
121
|
+
|
|
122
|
+
- **`cron_status`** - Show system status and configuration
|
|
123
|
+
- No parameters
|
|
124
|
+
|
|
125
|
+
## Usage Examples
|
|
126
|
+
|
|
127
|
+
### Example 1: Create and Schedule a Task
|
|
128
|
+
|
|
129
|
+
**You:**
|
|
130
|
+
```
|
|
131
|
+
Create a cron task that runs every Monday at 9 AM to generate a weekly report.
|
|
132
|
+
Use the CLI invocation method and enable toast notifications.
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Claude will:**
|
|
136
|
+
1. Use `cron_create_task` to create the task file
|
|
137
|
+
2. Ask you to review the task definition
|
|
138
|
+
3. Use `cron_register_task` to schedule it
|
|
139
|
+
|
|
140
|
+
### Example 2: Check Task Status
|
|
141
|
+
|
|
142
|
+
**You:**
|
|
143
|
+
```
|
|
144
|
+
What cron tasks do I have and when will they run next?
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Claude will:**
|
|
148
|
+
1. Use `cron_list_tasks` to show all tasks
|
|
149
|
+
2. Display schedule, status, and next run times
|
|
150
|
+
|
|
151
|
+
### Example 3: Run a Task Immediately
|
|
152
|
+
|
|
153
|
+
**You:**
|
|
154
|
+
```
|
|
155
|
+
Run my daily-summary task right now for testing
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Claude will:**
|
|
159
|
+
1. Use `cron_run_task` to execute immediately
|
|
160
|
+
2. Use `cron_view_logs` to show the results
|
|
161
|
+
|
|
162
|
+
### Example 4: Verify Logs
|
|
163
|
+
|
|
164
|
+
**You:**
|
|
165
|
+
```
|
|
166
|
+
Verify the integrity of the logs for my backup task
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**Claude will:**
|
|
170
|
+
1. Use `cron_view_logs` to retrieve logs
|
|
171
|
+
2. Use `cron_verify_log` to check signatures
|
|
172
|
+
3. Report if logs are authentic and unmodified
|
|
173
|
+
|
|
174
|
+
## Task Definition Format
|
|
175
|
+
|
|
176
|
+
Tasks are defined in markdown files with YAML frontmatter:
|
|
177
|
+
|
|
178
|
+
```markdown
|
|
179
|
+
---
|
|
180
|
+
id: my-task
|
|
181
|
+
schedule: "0 9 * * *" # Cron expression
|
|
182
|
+
invocation: cli # 'cli' or 'api'
|
|
183
|
+
notifications:
|
|
184
|
+
toast: true # Windows toast notifications
|
|
185
|
+
enabled: true # Enable/disable task
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
# Task Instructions
|
|
189
|
+
|
|
190
|
+
Your instructions for Claude in markdown format.
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Cron Schedule Format
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
┌─── minute (0-59)
|
|
197
|
+
│ ┌─── hour (0-23)
|
|
198
|
+
│ │ ┌─── day of month (1-31)
|
|
199
|
+
│ │ │ ┌─── month (1-12)
|
|
200
|
+
│ │ │ │ ┌─── day of week (0-6, Sunday=0)
|
|
201
|
+
* * * * *
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Common Examples:**
|
|
205
|
+
- `0 9 * * *` - Every day at 9 AM
|
|
206
|
+
- `0 */2 * * *` - Every 2 hours
|
|
207
|
+
- `30 8 * * 1-5` - 8:30 AM on weekdays
|
|
208
|
+
- `0 0 * * 0` - Midnight every Sunday
|
|
209
|
+
- `*/15 * * * *` - Every 15 minutes
|
|
210
|
+
|
|
211
|
+
### Invocation Methods
|
|
212
|
+
|
|
213
|
+
**CLI Mode (`invocation: cli`)**
|
|
214
|
+
- Uses local `claude-code` command
|
|
215
|
+
- Full Claude environment with all tools
|
|
216
|
+
- Best for complex, interactive tasks
|
|
217
|
+
- Requires Claude CLI installed
|
|
218
|
+
|
|
219
|
+
**API Mode (`invocation: api`)**
|
|
220
|
+
- Direct Anthropic API calls
|
|
221
|
+
- More reliable for simple tasks
|
|
222
|
+
- Requires `ANTHROPIC_API_KEY` environment variable
|
|
223
|
+
- May incur API costs
|
|
224
|
+
|
|
225
|
+
## Audit Logging & Security
|
|
226
|
+
|
|
227
|
+
### Automatic Logging
|
|
228
|
+
|
|
229
|
+
Every task execution is automatically logged with:
|
|
230
|
+
- ✅ Every action and step taken
|
|
231
|
+
- ✅ All outputs and errors
|
|
232
|
+
- ✅ Timestamps for each operation
|
|
233
|
+
- ✅ HMAC-SHA256 cryptographic signature
|
|
234
|
+
|
|
235
|
+
Logs are stored via the `odsp-memory` skill in OneDrive for automatic sync and backup.
|
|
236
|
+
|
|
237
|
+
### Log Verification
|
|
238
|
+
|
|
239
|
+
Ask Claude to verify any log:
|
|
240
|
+
```
|
|
241
|
+
Verify the logs for task [task-id] haven't been tampered with
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Claude will check the HMAC signature to ensure authenticity.
|
|
245
|
+
|
|
246
|
+
### Secret Key
|
|
247
|
+
|
|
248
|
+
On first use, cron-claude generates a secret key:
|
|
249
|
+
- Stored in: `~/.cron-claude/config.json`
|
|
250
|
+
- Used for: Signing all log entries
|
|
251
|
+
- Keep secure: Treat like a password
|
|
252
|
+
|
|
253
|
+
## Architecture
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
cron-claude/
|
|
257
|
+
├── src/
|
|
258
|
+
│ ├── mcp-server.ts # MCP server (stdio protocol)
|
|
259
|
+
│ ├── scheduler.ts # Windows Task Scheduler integration
|
|
260
|
+
│ ├── executor.ts # Task execution engine
|
|
261
|
+
│ ├── logger.ts # Audit logging with HMAC signing
|
|
262
|
+
│ ├── notifier.ts # Toast notifications
|
|
263
|
+
│ ├── config.ts # Configuration management
|
|
264
|
+
│ └── types.ts # TypeScript type definitions
|
|
265
|
+
├── tasks/ # Task definition files (*.md)
|
|
266
|
+
├── dist/ # Compiled JavaScript
|
|
267
|
+
├── install.ps1 # MCP server registration script
|
|
268
|
+
└── uninstall.ps1 # MCP server removal script
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Requirements
|
|
272
|
+
|
|
273
|
+
- **OS:** Windows 10/11 (uses Windows Task Scheduler)
|
|
274
|
+
- **Node.js:** >= 18.0.0
|
|
275
|
+
- **Claude Code:** With MCP support
|
|
276
|
+
- **Claude CLI:** For CLI invocation mode
|
|
277
|
+
- **Anthropic API Key:** For API invocation mode
|
|
278
|
+
- **odsp-memory skill:** For log storage
|
|
279
|
+
|
|
280
|
+
## Troubleshooting
|
|
281
|
+
|
|
282
|
+
### MCP Server Not Available
|
|
283
|
+
|
|
284
|
+
1. Check if registered:
|
|
285
|
+
```bash
|
|
286
|
+
cat ~/.claude/config.json
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
2. Look for `cron-claude` in `mcpServers`
|
|
290
|
+
|
|
291
|
+
3. Re-run install script:
|
|
292
|
+
```powershell
|
|
293
|
+
.\install.ps1
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
4. Restart Claude Code
|
|
297
|
+
|
|
298
|
+
### Task Not Executing on Schedule
|
|
299
|
+
|
|
300
|
+
Ask Claude:
|
|
301
|
+
```
|
|
302
|
+
Check the status of my [task-id] cron task
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
Claude will:
|
|
306
|
+
1. Check if task is registered
|
|
307
|
+
2. Verify it's enabled
|
|
308
|
+
3. Show next scheduled run time
|
|
309
|
+
|
|
310
|
+
You can also check Windows Task Scheduler manually:
|
|
311
|
+
- Open Task Scheduler
|
|
312
|
+
- Look for tasks named `CronClaude_[task-id]`
|
|
313
|
+
|
|
314
|
+
### No Toast Notifications
|
|
315
|
+
|
|
316
|
+
- Verify `notifications.toast: true` in task file
|
|
317
|
+
- Check Windows notification settings
|
|
318
|
+
- Disable "Focus Assist" temporarily
|
|
319
|
+
|
|
320
|
+
### Logs Not Appearing
|
|
321
|
+
|
|
322
|
+
- Verify odsp-memory skill is working:
|
|
323
|
+
```bash
|
|
324
|
+
odsp-memory status
|
|
325
|
+
```
|
|
326
|
+
- Check fallback location: `./logs/` directory
|
|
327
|
+
|
|
328
|
+
## Uninstallation
|
|
329
|
+
|
|
330
|
+
To remove the MCP server from Claude Code:
|
|
331
|
+
|
|
332
|
+
```powershell
|
|
333
|
+
.\uninstall.ps1
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
This removes the MCP server registration but keeps:
|
|
337
|
+
- Task files in `tasks/`
|
|
338
|
+
- Logs in memory skill
|
|
339
|
+
- Config in `~/.cron-claude/`
|
|
340
|
+
|
|
341
|
+
To completely remove:
|
|
342
|
+
```powershell
|
|
343
|
+
# Remove MCP registration
|
|
344
|
+
.\uninstall.ps1
|
|
345
|
+
|
|
346
|
+
# Delete task files
|
|
347
|
+
rm -r tasks/
|
|
348
|
+
|
|
349
|
+
# Delete config
|
|
350
|
+
rm -r ~/.cron-claude/
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
## Advanced Usage
|
|
354
|
+
|
|
355
|
+
### Using API Mode
|
|
356
|
+
|
|
357
|
+
Set your API key:
|
|
358
|
+
```powershell
|
|
359
|
+
$env:ANTHROPIC_API_KEY = "sk-ant-..."
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
Ask Claude to create tasks with API invocation:
|
|
363
|
+
```
|
|
364
|
+
Create a simple cron task using API mode to check something daily
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Monitoring Multiple Tasks
|
|
368
|
+
|
|
369
|
+
```
|
|
370
|
+
Show me the status of all my cron tasks and their next run times
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### Batch Operations
|
|
374
|
+
|
|
375
|
+
```
|
|
376
|
+
Disable all my weekly cron tasks temporarily
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
Claude can operate on multiple tasks using the MCP tools.
|
|
380
|
+
|
|
381
|
+
## Example Tasks
|
|
382
|
+
|
|
383
|
+
See the `tasks/` directory for examples:
|
|
384
|
+
- `example-daily-summary.md` - Daily summary report
|
|
385
|
+
- `example-weekly-backup.md` - Weekly backup task
|
|
386
|
+
|
|
387
|
+
## Contributing
|
|
388
|
+
|
|
389
|
+
Contributions welcome! This project demonstrates:
|
|
390
|
+
- MCP server implementation
|
|
391
|
+
- Windows Task Scheduler integration
|
|
392
|
+
- Cryptographic log signing
|
|
393
|
+
- Stdio protocol communication
|
|
394
|
+
|
|
395
|
+
## License
|
|
396
|
+
|
|
397
|
+
MIT
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
**Built with ❤️ for automating Claude workflows through MCP**
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;GAGG"}
|