@cronicorn/mcp-server 1.4.2

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 ADDED
@@ -0,0 +1,247 @@
1
+ # Cronicorn MCP Server
2
+
3
+ Model Context Protocol server that enables AI agents to manage cron jobs through Cronicorn.
4
+
5
+ ## Overview
6
+
7
+ This MCP server provides tools for AI assistants (like Claude Desktop, Cline, etc.) to:
8
+ - Create and manage cron jobs
9
+ - List existing jobs and their schedules
10
+ - Pause/unpause jobs
11
+ - View job execution history
12
+
13
+ Authentication uses OAuth 2.0 Device Authorization Grant (RFC 8628) to securely connect to your Cronicorn account.
14
+
15
+ ## Installation
16
+
17
+ ### Published Package (Recommended)
18
+
19
+ ```bash
20
+ npm install -g @cronicorn/mcp-server
21
+ # or
22
+ pnpm add -g @cronicorn/mcp-server
23
+ ```
24
+
25
+ ### From Source (Development)
26
+
27
+ ```bash
28
+ # From monorepo root
29
+ pnpm install
30
+ pnpm --filter @cronicorn/mcp-server build
31
+
32
+ # Link globally (optional)
33
+ cd apps/mcp-server
34
+ pnpm link --global
35
+ ```
36
+
37
+ ## Usage
38
+
39
+ ### Claude Desktop
40
+
41
+ Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
42
+
43
+ ```json
44
+ {
45
+ "mcpServers": {
46
+ "cronicorn": {
47
+ "command": "cronicorn-mcp"
48
+ }
49
+ }
50
+ }
51
+ ```
52
+
53
+ ### First Run - OAuth Device Flow
54
+
55
+ On first run, the server will:
56
+
57
+ 1. Display a device code and user code
58
+ 2. Open your browser to https://app.cronicorn.com/device/approve
59
+ 3. Enter the user code and approve access
60
+ 4. Store credentials securely in `~/.cronicorn/credentials.json`
61
+
62
+ Subsequent runs will use the stored access token automatically.
63
+
64
+ ## Available Tools
65
+
66
+ ### `create_job`
67
+
68
+ Create a new cron job.
69
+
70
+ **Parameters:**
71
+ - `name` (string, required): Job name
72
+ - `endpoint` (object, required):
73
+ - `url` (string): HTTP endpoint URL
74
+ - `method` (string): HTTP method (GET, POST, etc.)
75
+ - `headers` (object, optional): HTTP headers
76
+ - `body` (string, optional): Request body
77
+ - `schedule` (string, required): Cron expression (e.g., "0 9 * * *")
78
+ - `timezone` (string, optional): IANA timezone (e.g., "America/New_York")
79
+
80
+ **Example:**
81
+ ```
82
+ Please create a job that checks my website health every 5 minutes
83
+ ```
84
+
85
+ ### `list_jobs`
86
+
87
+ List all jobs for the authenticated user.
88
+
89
+ **Parameters:**
90
+ - `status` (string, optional): Filter by status (active, paused, all)
91
+
92
+ **Example:**
93
+ ```
94
+ Show me all my active cron jobs
95
+ ```
96
+
97
+ ### `pause_job`
98
+
99
+ Pause or unpause a job.
100
+
101
+ **Parameters:**
102
+ - `job_id` (string, required): Job ID
103
+ - `paused` (boolean, required): true to pause, false to unpause
104
+
105
+ **Example:**
106
+ ```
107
+ Pause the job named "website-health-check"
108
+ ```
109
+
110
+ ### `get_job_history`
111
+
112
+ Get execution history for a job.
113
+
114
+ **Parameters:**
115
+ - `job_id` (string, required): Job ID
116
+ - `limit` (number, optional): Number of recent runs to return (default: 10)
117
+
118
+ **Example:**
119
+ ```
120
+ Show me the last 5 runs of my backup job
121
+ ```
122
+
123
+ ## Configuration
124
+
125
+ ### Token Lifetime
126
+
127
+ Access tokens are valid for **30 days** from authentication. The server automatically:
128
+ - Checks token expiry on startup
129
+ - Displays expiry information and days remaining
130
+ - Triggers re-authentication when tokens expire
131
+
132
+ **When tokens expire:**
133
+ - You'll see: `⚠️ Token expired at [timestamp]`
134
+ - Server automatically starts device flow
135
+ - Complete authorization in browser to get new 30-day token
136
+
137
+ **Monitoring token expiry:**
138
+ - On startup, server logs: `📅 Token expires: [ISO timestamp] (in ~X days)`
139
+ - Tokens are refreshed weekly to maintain session
140
+ - Manual re-auth required every 30 days
141
+
142
+ This follows industry standards (AWS CLI, GitHub CLI use similar lifetimes).
143
+
144
+ ### Credentials Storage
145
+
146
+ Credentials are stored in `~/.cronicorn/credentials.json` with permissions `0600` (owner read/write only).
147
+
148
+ **File structure:**
149
+ ```json
150
+ {
151
+ "access_token": "...",
152
+ "refresh_token": "...",
153
+ "expires_at": 1234567890000
154
+ }
155
+ ```
156
+
157
+ ### Environment Variables
158
+
159
+ - `CRONICORN_API_URL`: Override API base URL (default: `https://api.cronicorn.com`)
160
+ - `CRONICORN_WEB_URL`: Override web UI URL (default: `https://app.cronicorn.com`)
161
+
162
+ ## Development
163
+
164
+ ```bash
165
+ # Build
166
+ pnpm build
167
+
168
+ # Watch mode
169
+ pnpm watch
170
+
171
+ # Type check
172
+ pnpm typecheck
173
+ ```
174
+
175
+ ## Publishing
176
+
177
+ The MCP server is published as a **bundled package** - all dependencies (including `@cronicorn/api-contracts`) are bundled into a single executable. See [BUNDLING.md](./BUNDLING.md) for technical details.
178
+
179
+ ### Release Workflow
180
+
181
+ ```bash
182
+ # 1. Update version
183
+ cd apps/mcp-server
184
+ npm version patch|minor|major
185
+
186
+ # 2. Build the bundle
187
+ pnpm build
188
+
189
+ # 3. Verify bundle contents
190
+ pnpm pack
191
+ tar -tzf cronicorn-mcp-server-*.tgz
192
+
193
+ # 4. Publish to npm
194
+ pnpm publish --access public
195
+
196
+ # 5. Tag and push
197
+ git add package.json
198
+ git commit -m "chore(mcp-server): release v0.1.x"
199
+ git tag mcp-server-v0.1.x
200
+ git push --follow-tags
201
+ ```
202
+
203
+ ### What Gets Published
204
+
205
+ - `dist/index.js` (470KB bundled executable)
206
+ - `dist/index.js.map` (source maps)
207
+ - `package.json`
208
+ - `README.md`
209
+
210
+ **Note**: Only production dependency is `@modelcontextprotocol/sdk` - everything else is bundled.
211
+
212
+ ## Security
213
+
214
+ - OAuth 2.0 Device Authorization Grant for secure authentication
215
+ - Credentials stored locally with strict file permissions
216
+ - No API keys or secrets stored in server code
217
+ - Uses standard MCP stdio transport (no network exposure)
218
+
219
+ ## Troubleshooting
220
+
221
+ ### Token expired
222
+
223
+ **Symptom:** Server shows `⚠️ Token expired at [timestamp]`
224
+
225
+ **Solution:** Automatic - server triggers device flow for re-authentication. Complete authorization in browser.
226
+
227
+ **Manual test:** Run `pnpm test:expiry` to check current token status and test expiry handling.
228
+
229
+ ### "No credentials found" error
230
+
231
+ Delete `~/.cronicorn/credentials.json` and re-authenticate.
232
+
233
+ ### Browser doesn't open automatically
234
+
235
+ Manually visit the URL shown in the terminal and enter the user code.
236
+
237
+ ### "Invalid grant" error
238
+
239
+ Your access token may have expired or been revoked. Delete credentials and re-authenticate:
240
+
241
+ ```bash
242
+ rm ~/.cronicorn/credentials.json
243
+ ```
244
+
245
+ ## License
246
+
247
+ MIT