@cronicorn/mcp-server 1.19.0 → 1.19.1

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.
@@ -0,0 +1,558 @@
1
+ ---
2
+ id: api-reference
3
+ title: API Reference
4
+ description: Complete HTTP API reference for programmatic access to Cronicorn
5
+ tags:
6
+ - user
7
+ - api
8
+ - reference
9
+ sidebar_position: 5
10
+ mcp:
11
+ uri: file:///docs/api-reference.md
12
+ mimeType: text/markdown
13
+ priority: 0.90
14
+ lastModified: 2026-02-03T00:00:00Z
15
+ ---
16
+
17
+ # API Reference
18
+
19
+ **TL;DR:** Access Cronicorn programmatically using API keys (`x-api-key` header) or bearer tokens (OAuth device flow). Base URL is your API host (e.g., `https://api.cronicorn.com` or `http://localhost:3333`).
20
+
21
+ ## Authentication
22
+
23
+ ### API Keys
24
+
25
+ Generate API keys in the web UI at `/settings/api-keys`.
26
+
27
+ ```bash
28
+ curl -H "x-api-key: cron_abc123..." \
29
+ https://api.cronicorn.com/api/jobs
30
+ ```
31
+
32
+ ### Bearer Tokens (OAuth Device Flow)
33
+
34
+ For CLI tools and AI agents:
35
+
36
+ ```bash
37
+ # 1. Request device code
38
+ curl -X POST https://api.cronicorn.com/api/auth/device/code
39
+
40
+ # Response:
41
+ {
42
+ "device_code": "DEVICE_CODE",
43
+ "user_code": "ABCD-1234",
44
+ "verification_uri": "https://cronicorn.com/device",
45
+ "expires_in": 1800
46
+ }
47
+
48
+ # 2. User authorizes in browser
49
+
50
+ # 3. Poll for token
51
+ curl -X POST https://api.cronicorn.com/api/auth/device/token \
52
+ -H "Content-Type: application/json" \
53
+ -d '{"device_code": "DEVICE_CODE"}'
54
+
55
+ # Response:
56
+ {
57
+ "access_token": "eyJ...",
58
+ "token_type": "Bearer",
59
+ "expires_in": 2592000
60
+ }
61
+
62
+ # 4. Use in requests
63
+ curl -H "Authorization: Bearer eyJ..." \
64
+ https://api.cronicorn.com/api/jobs
65
+ ```
66
+
67
+ ---
68
+
69
+ ## Jobs API
70
+
71
+ ### Create Job
72
+
73
+ ```bash
74
+ curl -X POST https://api.cronicorn.com/api/jobs \
75
+ -H "x-api-key: YOUR_API_KEY" \
76
+ -H "Content-Type: application/json" \
77
+ -d '{
78
+ "name": "API Health Checks",
79
+ "description": "Monitor our production APIs"
80
+ }'
81
+ ```
82
+
83
+ **Response:**
84
+ ```json
85
+ {
86
+ "id": "job_abc123",
87
+ "name": "API Health Checks",
88
+ "description": "Monitor our production APIs",
89
+ "status": "active",
90
+ "createdAt": "2026-02-03T12:00:00Z"
91
+ }
92
+ ```
93
+
94
+ ### List Jobs
95
+
96
+ ```bash
97
+ curl -H "x-api-key: YOUR_API_KEY" \
98
+ "https://api.cronicorn.com/api/jobs?status=active"
99
+ ```
100
+
101
+ **Query Parameters:**
102
+ - `status` (optional): `active`, `paused`, or `archived`
103
+
104
+ ### Get Job
105
+
106
+ ```bash
107
+ curl -H "x-api-key: YOUR_API_KEY" \
108
+ https://api.cronicorn.com/api/jobs/job_abc123
109
+ ```
110
+
111
+ ### Update Job
112
+
113
+ ```bash
114
+ curl -X PATCH https://api.cronicorn.com/api/jobs/job_abc123 \
115
+ -H "x-api-key: YOUR_API_KEY" \
116
+ -H "Content-Type: application/json" \
117
+ -d '{
118
+ "name": "Production API Health Checks",
119
+ "description": "Updated description"
120
+ }'
121
+ ```
122
+
123
+ ### Archive Job
124
+
125
+ ```bash
126
+ curl -X POST https://api.cronicorn.com/api/jobs/job_abc123/archive \
127
+ -H "x-api-key: YOUR_API_KEY"
128
+ ```
129
+
130
+ ### Pause Job
131
+
132
+ ```bash
133
+ curl -X POST https://api.cronicorn.com/api/jobs/job_abc123/pause \
134
+ -H "x-api-key: YOUR_API_KEY"
135
+ ```
136
+
137
+ ### Resume Job
138
+
139
+ ```bash
140
+ curl -X POST https://api.cronicorn.com/api/jobs/job_abc123/resume \
141
+ -H "x-api-key: YOUR_API_KEY"
142
+ ```
143
+
144
+ ---
145
+
146
+ ## Endpoints API
147
+
148
+ ### Add Endpoint
149
+
150
+ ```bash
151
+ curl -X POST https://api.cronicorn.com/api/jobs/job_abc123/endpoints \
152
+ -H "x-api-key: YOUR_API_KEY" \
153
+ -H "Content-Type: application/json" \
154
+ -d '{
155
+ "name": "Main API Health",
156
+ "url": "https://api.example.com/health",
157
+ "method": "GET",
158
+ "baselineIntervalMs": 300000,
159
+ "minIntervalMs": 30000,
160
+ "maxIntervalMs": 900000,
161
+ "timeoutMs": 30000
162
+ }'
163
+ ```
164
+
165
+ **Required Fields:**
166
+ - `name`: Display name
167
+ - `url`: HTTP endpoint URL
168
+ - `method`: `GET`, `POST`, `PUT`, `PATCH`, or `DELETE`
169
+
170
+ **Schedule (one required):**
171
+ - `baselineCron`: Cron expression (e.g., `"*/5 * * * *"`)
172
+ - `baselineIntervalMs`: Interval in milliseconds
173
+
174
+ **Optional Fields:**
175
+ - `description`: Context for AI analysis
176
+ - `minIntervalMs`: Minimum interval constraint
177
+ - `maxIntervalMs`: Maximum interval constraint
178
+ - `timeoutMs`: Request timeout (default: 30000)
179
+ - `maxResponseSizeKb`: Response size limit (default: 100)
180
+ - `headersJson`: Request headers object
181
+ - `bodyJson`: Request body (for POST/PUT/PATCH)
182
+
183
+ ### List Endpoints
184
+
185
+ ```bash
186
+ curl -H "x-api-key: YOUR_API_KEY" \
187
+ https://api.cronicorn.com/api/jobs/job_abc123/endpoints
188
+ ```
189
+
190
+ ### Get Endpoint
191
+
192
+ ```bash
193
+ curl -H "x-api-key: YOUR_API_KEY" \
194
+ https://api.cronicorn.com/api/jobs/job_abc123/endpoints/ep_xyz789
195
+ ```
196
+
197
+ ### Update Endpoint
198
+
199
+ ```bash
200
+ curl -X PATCH https://api.cronicorn.com/api/jobs/job_abc123/endpoints/ep_xyz789 \
201
+ -H "x-api-key: YOUR_API_KEY" \
202
+ -H "Content-Type: application/json" \
203
+ -d '{
204
+ "baselineIntervalMs": 600000,
205
+ "description": "Updated monitoring interval"
206
+ }'
207
+ ```
208
+
209
+ ### Archive Endpoint
210
+
211
+ ```bash
212
+ curl -X POST https://api.cronicorn.com/api/jobs/job_abc123/endpoints/ep_xyz789/archive \
213
+ -H "x-api-key: YOUR_API_KEY"
214
+ ```
215
+
216
+ ### Pause/Resume Endpoint
217
+
218
+ ```bash
219
+ # Pause until specific time
220
+ curl -X POST https://api.cronicorn.com/api/endpoints/ep_xyz789/pause \
221
+ -H "x-api-key: YOUR_API_KEY" \
222
+ -H "Content-Type: application/json" \
223
+ -d '{
224
+ "pausedUntil": "2026-02-03T14:00:00Z",
225
+ "reason": "Maintenance window"
226
+ }'
227
+
228
+ # Resume immediately
229
+ curl -X POST https://api.cronicorn.com/api/endpoints/ep_xyz789/pause \
230
+ -H "x-api-key: YOUR_API_KEY" \
231
+ -H "Content-Type: application/json" \
232
+ -d '{
233
+ "pausedUntil": null,
234
+ "reason": "Maintenance complete"
235
+ }'
236
+ ```
237
+
238
+ ---
239
+
240
+ ## AI Scheduling API
241
+
242
+ ### Apply Interval Hint
243
+
244
+ Temporarily adjust execution frequency:
245
+
246
+ ```bash
247
+ curl -X POST https://api.cronicorn.com/api/endpoints/ep_xyz789/hints/interval \
248
+ -H "x-api-key: YOUR_API_KEY" \
249
+ -H "Content-Type: application/json" \
250
+ -d '{
251
+ "intervalMs": 30000,
252
+ "ttlMinutes": 60,
253
+ "reason": "Increased monitoring during incident"
254
+ }'
255
+ ```
256
+
257
+ ### Schedule One-Shot
258
+
259
+ Trigger a specific one-time execution:
260
+
261
+ ```bash
262
+ curl -X POST https://api.cronicorn.com/api/endpoints/ep_xyz789/hints/oneshot \
263
+ -H "x-api-key: YOUR_API_KEY" \
264
+ -H "Content-Type: application/json" \
265
+ -d '{
266
+ "nextRunAt": "2026-02-03T12:30:00Z",
267
+ "ttlMinutes": 30,
268
+ "reason": "Immediate investigation"
269
+ }'
270
+ ```
271
+
272
+ ### Clear Hints
273
+
274
+ Reset to baseline schedule:
275
+
276
+ ```bash
277
+ curl -X DELETE https://api.cronicorn.com/api/endpoints/ep_xyz789/hints \
278
+ -H "x-api-key: YOUR_API_KEY"
279
+ ```
280
+
281
+ ### Reset Failures
282
+
283
+ Clear failure count (resets exponential backoff):
284
+
285
+ ```bash
286
+ curl -X POST https://api.cronicorn.com/api/endpoints/ep_xyz789/reset-failures \
287
+ -H "x-api-key: YOUR_API_KEY"
288
+ ```
289
+
290
+ ---
291
+
292
+ ## Runs API
293
+
294
+ ### List Endpoint Runs
295
+
296
+ ```bash
297
+ curl -H "x-api-key: YOUR_API_KEY" \
298
+ "https://api.cronicorn.com/api/endpoints/ep_xyz789/runs?limit=20&status=failed"
299
+ ```
300
+
301
+ **Query Parameters:**
302
+ - `limit` (optional): Number of runs (default: 20)
303
+ - `offset` (optional): Pagination offset
304
+ - `status` (optional): `success` or `failed`
305
+
306
+ ### Get Run Details
307
+
308
+ ```bash
309
+ curl -H "x-api-key: YOUR_API_KEY" \
310
+ https://api.cronicorn.com/api/runs/run_abc123
311
+ ```
312
+
313
+ **Response:**
314
+ ```json
315
+ {
316
+ "id": "run_abc123",
317
+ "endpointId": "ep_xyz789",
318
+ "status": "success",
319
+ "statusCode": 200,
320
+ "durationMs": 145,
321
+ "responseBody": { "healthy": true, "queue_depth": 45 },
322
+ "startedAt": "2026-02-03T12:00:00Z",
323
+ "completedAt": "2026-02-03T12:00:00.145Z",
324
+ "source": "baseline-interval"
325
+ }
326
+ ```
327
+
328
+ ---
329
+
330
+ ## Monitoring API
331
+
332
+ ### Get Endpoint Health
333
+
334
+ ```bash
335
+ curl -H "x-api-key: YOUR_API_KEY" \
336
+ "https://api.cronicorn.com/api/endpoints/ep_xyz789/health?sinceHours=24"
337
+ ```
338
+
339
+ **Response:**
340
+ ```json
341
+ {
342
+ "endpointId": "ep_xyz789",
343
+ "successCount": 285,
344
+ "failureCount": 3,
345
+ "successRate": 98.96,
346
+ "avgDurationMs": 142,
347
+ "lastRunAt": "2026-02-03T12:00:00Z",
348
+ "lastStatus": "success",
349
+ "failureStreak": 0
350
+ }
351
+ ```
352
+
353
+ ### Get Dashboard Stats
354
+
355
+ ```bash
356
+ curl -H "x-api-key: YOUR_API_KEY" \
357
+ "https://api.cronicorn.com/api/dashboard?startDate=2026-02-01&endDate=2026-02-03"
358
+ ```
359
+
360
+ ---
361
+
362
+ ## AI Analysis API
363
+
364
+ Access AI scheduling explanations and analysis history.
365
+
366
+ ### List Analysis Sessions
367
+
368
+ Get AI analysis history for an endpoint to understand why scheduling decisions were made:
369
+
370
+ ```bash
371
+ curl -H "x-api-key: YOUR_API_KEY" \
372
+ "https://api.cronicorn.com/api/endpoints/ep_xyz789/analysis-sessions?limit=10"
373
+ ```
374
+
375
+ **Query Parameters:**
376
+ - `limit` (optional): Number of sessions (default: 10)
377
+ - `offset` (optional): Pagination offset
378
+
379
+ **Response:**
380
+ ```json
381
+ {
382
+ "sessions": [
383
+ {
384
+ "id": "session_abc123",
385
+ "endpointId": "ep_xyz789",
386
+ "createdAt": "2026-02-03T12:00:00Z",
387
+ "reasoning": "Queue depth increased from 50 to 200 over last 5 runs. Tightening monitoring interval from 5 minutes to 30 seconds for next hour.",
388
+ "toolsCalled": ["get_response_history", "propose_interval"],
389
+ "tokenUsage": 1250,
390
+ "durationMs": 3200,
391
+ "nextAnalysisAt": "2026-02-03T13:00:00Z",
392
+ "endpointFailureCount": 0
393
+ }
394
+ ],
395
+ "total": 45,
396
+ "hasMore": true
397
+ }
398
+ ```
399
+
400
+ ### Get Analysis Session Details
401
+
402
+ ```bash
403
+ curl -H "x-api-key: YOUR_API_KEY" \
404
+ https://api.cronicorn.com/api/analysis-sessions/session_abc123
405
+ ```
406
+
407
+ **Response:**
408
+ ```json
409
+ {
410
+ "id": "session_abc123",
411
+ "endpointId": "ep_xyz789",
412
+ "createdAt": "2026-02-03T12:00:00Z",
413
+ "reasoning": "Queue depth increased from 50 to 200 over last 5 runs...",
414
+ "toolsCalled": ["get_response_history", "propose_interval"],
415
+ "actionsApplied": [
416
+ {
417
+ "tool": "propose_interval",
418
+ "params": { "intervalMs": 30000, "ttlMinutes": 60 },
419
+ "result": "success"
420
+ }
421
+ ],
422
+ "tokenUsage": 1250,
423
+ "durationMs": 3200,
424
+ "confidence": "high"
425
+ }
426
+ ```
427
+
428
+ ---
429
+
430
+ ## Dynamic Scheduling Based on System Load
431
+
432
+ You can programmatically override AI adaptation parameters based on external system metrics. This is useful for integrating Cronicorn with your existing monitoring infrastructure.
433
+
434
+ ### Example: Tighten Monitoring During High Load
435
+
436
+ ```bash
437
+ #!/bin/bash
438
+ # Script that runs from your monitoring system
439
+
440
+ # Get current CPU load from your infrastructure
441
+ CPU_LOAD=$(curl -s https://your-monitoring.com/api/cpu-load | jq '.value')
442
+
443
+ if (( $(echo "$CPU_LOAD > 80" | bc -l) )); then
444
+ # High load detected: tighten monitoring to every 30 seconds
445
+ curl -X POST https://api.cronicorn.com/api/endpoints/ep_xyz789/hints/interval \
446
+ -H "x-api-key: YOUR_API_KEY" \
447
+ -H "Content-Type: application/json" \
448
+ -d '{
449
+ "intervalMs": 30000,
450
+ "ttlMinutes": 30,
451
+ "reason": "High CPU load detected ('"$CPU_LOAD"'%), increasing monitoring frequency"
452
+ }'
453
+ elif (( $(echo "$CPU_LOAD < 20" | bc -l) )); then
454
+ # Low load: relax monitoring to every 10 minutes
455
+ curl -X POST https://api.cronicorn.com/api/endpoints/ep_xyz789/hints/interval \
456
+ -H "x-api-key: YOUR_API_KEY" \
457
+ -H "Content-Type: application/json" \
458
+ -d '{
459
+ "intervalMs": 600000,
460
+ "ttlMinutes": 60,
461
+ "reason": "Low CPU load detected ('"$CPU_LOAD"'%), reducing monitoring frequency"
462
+ }'
463
+ else
464
+ # Normal load: clear any active hints to return to baseline
465
+ curl -X DELETE https://api.cronicorn.com/api/endpoints/ep_xyz789/hints \
466
+ -H "x-api-key: YOUR_API_KEY"
467
+ fi
468
+ ```
469
+
470
+ ### Example: Pause During Maintenance Windows
471
+
472
+ ```bash
473
+ # Pause all endpoints in a job during scheduled maintenance
474
+ curl -X POST https://api.cronicorn.com/api/jobs/job_abc123/pause \
475
+ -H "x-api-key: YOUR_API_KEY"
476
+
477
+ # ... perform maintenance ...
478
+
479
+ # Resume after maintenance
480
+ curl -X POST https://api.cronicorn.com/api/jobs/job_abc123/resume \
481
+ -H "x-api-key: YOUR_API_KEY"
482
+ ```
483
+
484
+ ### Example: Webhook Integration for Auto-Scaling
485
+
486
+ Configure your endpoint to return system load metrics, and Cronicorn's AI will automatically adjust:
487
+
488
+ ```json
489
+ // Your endpoint returns:
490
+ {
491
+ "status": "healthy",
492
+ "system_load": 85,
493
+ "queue_depth": 500,
494
+ "queue_max": 1000,
495
+ "processing_rate_per_min": 150
496
+ }
497
+ ```
498
+
499
+ The AI Planner sees these metrics and autonomously decides to tighten monitoring when load increases or relax when the system is idle.
500
+
501
+ ---
502
+
503
+ ## Common Response Formats
504
+
505
+ ### Success Response
506
+
507
+ ```json
508
+ {
509
+ "id": "resource_id",
510
+ "...": "resource data"
511
+ }
512
+ ```
513
+
514
+ ### Error Response
515
+
516
+ ```json
517
+ {
518
+ "error": {
519
+ "code": "VALIDATION_ERROR",
520
+ "message": "Invalid interval: must be at least 1000ms",
521
+ "details": { "field": "baselineIntervalMs" }
522
+ }
523
+ }
524
+ ```
525
+
526
+ ### Error Codes
527
+
528
+ | Code | HTTP Status | Description |
529
+ |------|-------------|-------------|
530
+ | `UNAUTHORIZED` | 401 | Invalid or missing API key |
531
+ | `FORBIDDEN` | 403 | Insufficient permissions |
532
+ | `NOT_FOUND` | 404 | Resource not found |
533
+ | `VALIDATION_ERROR` | 400 | Invalid request data |
534
+ | `RATE_LIMITED` | 429 | Too many requests |
535
+ | `INTERNAL_ERROR` | 500 | Server error |
536
+
537
+ ---
538
+
539
+ ## Rate Limits
540
+
541
+ | Tier | Requests/minute | Burst |
542
+ |------|-----------------|-------|
543
+ | Free | 60 | 10 |
544
+ | Pro | 300 | 50 |
545
+ | Enterprise | Custom | Custom |
546
+
547
+ Rate limit headers:
548
+ - `X-RateLimit-Limit`: Requests allowed per minute
549
+ - `X-RateLimit-Remaining`: Requests remaining
550
+ - `X-RateLimit-Reset`: Unix timestamp when limit resets
551
+
552
+ ---
553
+
554
+ ## See Also
555
+
556
+ - **[Quick Start](./quick-start.md)** - Create your first job via UI
557
+ - **[MCP Server](./mcp-server.md)** - Manage jobs via AI assistant
558
+ - **[Technical Reference](./technical/reference.md)** - Schema and field details
@@ -11,7 +11,7 @@ mcp:
11
11
  uri: file:///docs/core-concepts.md
12
12
  mimeType: text/markdown
13
13
  priority: 0.95
14
- lastModified: 2025-11-02T00:00:00Z
14
+ lastModified: 2026-02-03T00:00:00Z
15
15
  ---
16
16
 
17
17
  # Core Concepts
@@ -225,3 +225,11 @@ AI behavior:
225
225
  - Never exceeds API rate limits (min)
226
226
  - Ensures data freshness (max)
227
227
  ```
228
+
229
+ ---
230
+
231
+ ## See Also
232
+
233
+ - **[Quick Start](./quick-start.md)** - Create your first job
234
+ - **[How Scheduling Works](./technical/how-scheduling-works.md)** - Detailed scheduling logic
235
+ - **[Configuration and Constraints](./technical/configuration-and-constraints.md)** - Advanced configuration
@@ -13,12 +13,15 @@ sidebar_position: 1
13
13
  mcp:
14
14
  uri: file:///docs/introduction.md
15
15
  mimeType: text/markdown
16
- priority: 0.9
17
- lastModified: 2025-11-02T00:00:00Z
16
+ priority: 0.95
17
+ lastModified: 2026-02-03T00:00:00Z
18
18
  ---
19
19
 
20
20
  # Introduction to Cronicorn
21
21
 
22
+ [![GitHub Release](https://img.shields.io/github/v/release/weskerllc/cronicorn?style=flat-square)](https://github.com/weskerllc/cronicorn/releases)
23
+ [![npm version](https://badge.fury.io/js/@cronicorn%2Fmcp-server.svg)](https://www.npmjs.com/package/@cronicorn/mcp-server)
24
+
22
25
  **Cronicorn** is an intelligent scheduler that automatically adapts to your application's behavior. Set baseline schedules and let AI optimize execution timing based on real-world patterns.
23
26
 
24
27
  ---
@@ -48,10 +51,17 @@ Configure it with GitHub Copilot, Claude Desktop, or any MCP-compatible AI assis
48
51
  **Getting Started**
49
52
  - [Quick Start](./quick-start.md) - Create your first scheduled job in 5 minutes
50
53
  - [Core Concepts](./core-concepts.md) - Understand jobs, endpoints, and scheduling
54
+ - [MCP Server](./mcp-server.md) - Manage jobs via AI assistant
55
+
56
+ **Reference**
57
+ - [API Reference](./api-reference.md) - Programmatic access to Cronicorn
58
+ - [Use Cases](./use-cases.md) - Real-world scenarios and examples
59
+ - [Troubleshooting](./troubleshooting.md) - Diagnose and fix common issues
51
60
 
52
- **Learn More**
53
- - [Use Cases & Examples](./use-cases.md) - Real-world scenarios across industries
54
- - [Technical Architecture](./technical/system-architecture.md) - Deep dive - How Cronicorn works behind the scenes
61
+ **Technical Deep Dive**
62
+ - [System Architecture](./technical/system-architecture.md) - Dual-worker design
63
+ - [How Scheduling Works](./technical/how-scheduling-works.md) - Governor and constraints
64
+ - [How AI Adaptation Works](./technical/how-ai-adaptation-works.md) - AI tools and hints
55
65
 
56
66
  ---
57
67