@aborruso/ckan-mcp-server 0.3.2 → 0.4.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/.claude/settings.local.json +2 -1
- package/CLAUDE.md +81 -24
- package/LOG.md +72 -10
- package/README.md +87 -8
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/coverage-final.json +7 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +146 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +210 -0
- package/dist/worker.js +387 -0
- package/openspec/changes/add-cloudflare-workers/design.md +734 -0
- package/openspec/changes/add-cloudflare-workers/proposal.md +183 -0
- package/openspec/changes/add-cloudflare-workers/specs/cloudflare-deployment/spec.md +389 -0
- package/openspec/changes/add-cloudflare-workers/tasks.md +519 -0
- package/package.json +6 -2
- package/wrangler.toml +6 -0
- package/test-urls.js +0 -18
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
# Tasks: Add Cloudflare Workers Deployment
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Implementation broken into 4 phases with small, verifiable steps. Each task includes validation criteria.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Phase 1: Environment Setup (Prerequisites)
|
|
9
|
+
|
|
10
|
+
### Task 1.1: Install Wrangler CLI
|
|
11
|
+
**Description**: Install Cloudflare's official CLI tool globally
|
|
12
|
+
|
|
13
|
+
**Steps**:
|
|
14
|
+
```bash
|
|
15
|
+
npm install -g wrangler
|
|
16
|
+
wrangler --version
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Validation**:
|
|
20
|
+
- `wrangler --version` shows version >= 3.0.0
|
|
21
|
+
- Command `wrangler` available in PATH
|
|
22
|
+
|
|
23
|
+
**Duration**: 2 minutes
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
### Task 1.2: Create Cloudflare Account
|
|
28
|
+
**Description**: Sign up for free Cloudflare account (if not already registered)
|
|
29
|
+
|
|
30
|
+
**Steps**:
|
|
31
|
+
1. Visit https://dash.cloudflare.com/sign-up
|
|
32
|
+
2. Create account with email/password
|
|
33
|
+
3. Verify email address
|
|
34
|
+
|
|
35
|
+
**Validation**:
|
|
36
|
+
- Can log into https://dash.cloudflare.com
|
|
37
|
+
- Workers section visible in dashboard
|
|
38
|
+
|
|
39
|
+
**Duration**: 5 minutes
|
|
40
|
+
|
|
41
|
+
**Note**: If you already have a Cloudflare account, skip to Task 1.3
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### Task 1.3: Authenticate Wrangler
|
|
46
|
+
**Description**: Connect local Wrangler CLI to Cloudflare account
|
|
47
|
+
|
|
48
|
+
**Steps**:
|
|
49
|
+
```bash
|
|
50
|
+
wrangler login
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**What happens**:
|
|
54
|
+
- Browser opens with Cloudflare login
|
|
55
|
+
- Click "Allow" to grant Wrangler access
|
|
56
|
+
- Terminal shows "Successfully logged in"
|
|
57
|
+
|
|
58
|
+
**Validation**:
|
|
59
|
+
```bash
|
|
60
|
+
wrangler whoami
|
|
61
|
+
```
|
|
62
|
+
Shows your Cloudflare account email
|
|
63
|
+
|
|
64
|
+
**Duration**: 2 minutes
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
### Task 1.4: Install Wrangler as Dev Dependency
|
|
69
|
+
**Description**: Add Wrangler to project dependencies for reproducible builds
|
|
70
|
+
|
|
71
|
+
**Steps**:
|
|
72
|
+
```bash
|
|
73
|
+
npm install --save-dev wrangler
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Validation**:
|
|
77
|
+
- `package.json` devDependencies includes `"wrangler": "^3.x.x"`
|
|
78
|
+
- `node_modules/.bin/wrangler` exists
|
|
79
|
+
|
|
80
|
+
**Duration**: 1 minute
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Phase 2: Workers Configuration
|
|
85
|
+
|
|
86
|
+
### Task 2.1: Create wrangler.toml
|
|
87
|
+
**Description**: Create Cloudflare Workers configuration file
|
|
88
|
+
|
|
89
|
+
**Steps**:
|
|
90
|
+
Create `wrangler.toml` in project root:
|
|
91
|
+
|
|
92
|
+
```toml
|
|
93
|
+
name = "ckan-mcp-server"
|
|
94
|
+
main = "dist/worker.js"
|
|
95
|
+
compatibility_date = "2024-01-01"
|
|
96
|
+
|
|
97
|
+
[build]
|
|
98
|
+
command = "npm run build:worker"
|
|
99
|
+
|
|
100
|
+
[env.production]
|
|
101
|
+
name = "ckan-mcp-server"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Validation**:
|
|
105
|
+
- File exists at project root
|
|
106
|
+
- `wrangler.toml` syntax is valid (no errors when running `wrangler dev`)
|
|
107
|
+
|
|
108
|
+
**Duration**: 2 minutes
|
|
109
|
+
|
|
110
|
+
**Dependencies**: Task 1.4 complete
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
### Task 2.2: Add Build Scripts to package.json
|
|
115
|
+
**Description**: Add npm scripts for building and deploying Workers
|
|
116
|
+
|
|
117
|
+
**Steps**:
|
|
118
|
+
Add to `package.json` scripts section:
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
"build:worker": "node esbuild.worker.js",
|
|
122
|
+
"dev:worker": "wrangler dev",
|
|
123
|
+
"deploy": "npm run build:worker && wrangler deploy"
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Validation**:
|
|
127
|
+
- `npm run build:worker` command recognized (may fail until worker.ts exists)
|
|
128
|
+
- All 3 scripts visible in `npm run`
|
|
129
|
+
|
|
130
|
+
**Duration**: 2 minutes
|
|
131
|
+
|
|
132
|
+
**Dependencies**: Task 2.1 complete
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
### Task 2.3: Create esbuild.worker.js Configuration
|
|
137
|
+
**Description**: Separate build config for Workers bundle (different from Node.js bundle)
|
|
138
|
+
|
|
139
|
+
**Steps**:
|
|
140
|
+
Create `esbuild.worker.js`:
|
|
141
|
+
|
|
142
|
+
```javascript
|
|
143
|
+
import esbuild from 'esbuild';
|
|
144
|
+
|
|
145
|
+
await esbuild.build({
|
|
146
|
+
entryPoints: ['src/worker.ts'],
|
|
147
|
+
bundle: true,
|
|
148
|
+
outfile: 'dist/worker.js',
|
|
149
|
+
format: 'esm',
|
|
150
|
+
platform: 'browser',
|
|
151
|
+
target: 'es2022',
|
|
152
|
+
external: [], // Bundle everything for Workers
|
|
153
|
+
minify: false,
|
|
154
|
+
sourcemap: false,
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
console.log('✓ Workers build complete');
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Validation**:
|
|
161
|
+
- File exists in project root
|
|
162
|
+
- Running `node esbuild.worker.js` shows error about missing `src/worker.ts` (expected at this stage)
|
|
163
|
+
|
|
164
|
+
**Duration**: 3 minutes
|
|
165
|
+
|
|
166
|
+
**Dependencies**: Task 2.2 complete
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Phase 3: Code Implementation
|
|
171
|
+
|
|
172
|
+
### Task 3.1: Create src/worker.ts Entry Point
|
|
173
|
+
**Description**: Minimal Workers adapter that handles HTTP requests
|
|
174
|
+
|
|
175
|
+
**Steps**:
|
|
176
|
+
Create `src/worker.ts`:
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
180
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
181
|
+
|
|
182
|
+
export default {
|
|
183
|
+
async fetch(request: Request): Promise<Response> {
|
|
184
|
+
// Respond to health checks
|
|
185
|
+
if (request.method === 'GET' && new URL(request.url).pathname === '/health') {
|
|
186
|
+
return new Response(JSON.stringify({ status: 'ok', version: '0.4.0' }), {
|
|
187
|
+
headers: { 'Content-Type': 'application/json' }
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// TODO: Implement MCP protocol handling
|
|
192
|
+
return new Response('CKAN MCP Server - Workers Mode', { status: 200 });
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**Validation**:
|
|
198
|
+
- `npm run build:worker` succeeds
|
|
199
|
+
- `dist/worker.js` created
|
|
200
|
+
- File size < 100KB
|
|
201
|
+
|
|
202
|
+
**Duration**: 5 minutes
|
|
203
|
+
|
|
204
|
+
**Dependencies**: Task 2.3 complete
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
### Task 3.2: Test Local Development Server
|
|
209
|
+
**Description**: Run Workers locally to verify basic setup
|
|
210
|
+
|
|
211
|
+
**Steps**:
|
|
212
|
+
```bash
|
|
213
|
+
npm run dev:worker
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**What happens**:
|
|
217
|
+
- Wrangler starts local server on http://localhost:8787
|
|
218
|
+
- Terminal shows "Ready on http://localhost:8787"
|
|
219
|
+
|
|
220
|
+
**Validation**:
|
|
221
|
+
```bash
|
|
222
|
+
curl http://localhost:8787/health
|
|
223
|
+
```
|
|
224
|
+
Returns: `{"status":"ok","version":"0.4.0"}`
|
|
225
|
+
|
|
226
|
+
**Duration**: 2 minutes
|
|
227
|
+
|
|
228
|
+
**Dependencies**: Task 3.1 complete
|
|
229
|
+
|
|
230
|
+
**Note**: Keep wrangler dev running for next tasks
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
### Task 3.3: Implement MCP Protocol Handler
|
|
235
|
+
**Description**: Full Workers implementation with MCP server integration
|
|
236
|
+
|
|
237
|
+
**Steps**:
|
|
238
|
+
This is a larger task - update `src/worker.ts` to:
|
|
239
|
+
1. Import MCP server and all tool registrations
|
|
240
|
+
2. Handle POST /mcp endpoint
|
|
241
|
+
3. Process MCP JSON-RPC requests
|
|
242
|
+
4. Return JSON-RPC responses
|
|
243
|
+
|
|
244
|
+
**Validation**:
|
|
245
|
+
```bash
|
|
246
|
+
# Test with curl (wrangler dev still running)
|
|
247
|
+
curl -X POST http://localhost:8787/mcp \
|
|
248
|
+
-H "Content-Type: application/json" \
|
|
249
|
+
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
|
|
250
|
+
```
|
|
251
|
+
Returns list of 7 CKAN tools
|
|
252
|
+
|
|
253
|
+
**Duration**: 15-20 minutes
|
|
254
|
+
|
|
255
|
+
**Dependencies**: Task 3.2 complete
|
|
256
|
+
|
|
257
|
+
**Note**: We'll implement this together step-by-step
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
### Task 3.4: Test All MCP Tools Locally
|
|
262
|
+
**Description**: Verify each tool works in Workers environment
|
|
263
|
+
|
|
264
|
+
**Steps**:
|
|
265
|
+
Test each tool via curl:
|
|
266
|
+
1. `ckan_status_show` - server connectivity
|
|
267
|
+
2. `ckan_package_search` - basic search
|
|
268
|
+
3. `ckan_package_show` - dataset details
|
|
269
|
+
4. `ckan_organization_list` - list orgs
|
|
270
|
+
5. `ckan_organization_show` - org details
|
|
271
|
+
6. `ckan_organization_search` - search orgs
|
|
272
|
+
7. `ckan_datastore_search` - datastore query
|
|
273
|
+
|
|
274
|
+
**Validation**:
|
|
275
|
+
- All 7 tools return expected responses
|
|
276
|
+
- No HTTP 500 errors
|
|
277
|
+
- Response times < 30 seconds
|
|
278
|
+
|
|
279
|
+
**Duration**: 10 minutes
|
|
280
|
+
|
|
281
|
+
**Dependencies**: Task 3.3 complete
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Phase 4: Deployment and Documentation
|
|
286
|
+
|
|
287
|
+
### Task 4.1: Deploy to Cloudflare Workers
|
|
288
|
+
**Description**: First deployment to production Workers environment
|
|
289
|
+
|
|
290
|
+
**Steps**:
|
|
291
|
+
```bash
|
|
292
|
+
npm run deploy
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**What happens**:
|
|
296
|
+
- Build runs (`npm run build:worker`)
|
|
297
|
+
- Wrangler uploads to Cloudflare
|
|
298
|
+
- Deployment URL shown: `https://ckan-mcp-server.<account>.workers.dev`
|
|
299
|
+
|
|
300
|
+
**Validation**:
|
|
301
|
+
```bash
|
|
302
|
+
curl https://ckan-mcp-server.<account>.workers.dev/health
|
|
303
|
+
```
|
|
304
|
+
Returns: `{"status":"ok","version":"0.4.0"}`
|
|
305
|
+
|
|
306
|
+
**Duration**: 3 minutes
|
|
307
|
+
|
|
308
|
+
**Dependencies**: Task 3.4 complete, Tasks 1.1-1.3 complete
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
### Task 4.2: Test Production Deployment
|
|
313
|
+
**Description**: Verify all tools work in production Workers environment
|
|
314
|
+
|
|
315
|
+
**Steps**:
|
|
316
|
+
Same as Task 3.4, but using production URL:
|
|
317
|
+
```bash
|
|
318
|
+
curl -X POST https://ckan-mcp-server.<account>.workers.dev/mcp \
|
|
319
|
+
-H "Content-Type: application/json" \
|
|
320
|
+
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Test all 7 tools with real CKAN portals:
|
|
324
|
+
- dati.gov.it
|
|
325
|
+
- demo.ckan.org
|
|
326
|
+
- catalog.data.gov
|
|
327
|
+
|
|
328
|
+
**Validation**:
|
|
329
|
+
- All tools return correct results
|
|
330
|
+
- HTTPS works (no certificate errors)
|
|
331
|
+
- Global access (test from different network if possible)
|
|
332
|
+
|
|
333
|
+
**Duration**: 10 minutes
|
|
334
|
+
|
|
335
|
+
**Dependencies**: Task 4.1 complete
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
### Task 4.3: Create Deployment Documentation
|
|
340
|
+
**Description**: Write comprehensive deployment guide for contributors
|
|
341
|
+
|
|
342
|
+
**Steps**:
|
|
343
|
+
Create `docs/DEPLOYMENT.md` with:
|
|
344
|
+
1. Prerequisites (Cloudflare account, wrangler CLI)
|
|
345
|
+
2. Step-by-step deployment instructions
|
|
346
|
+
3. Environment configuration
|
|
347
|
+
4. Troubleshooting common issues
|
|
348
|
+
5. Monitoring and logs access
|
|
349
|
+
|
|
350
|
+
**Validation**:
|
|
351
|
+
- File exists at `docs/DEPLOYMENT.md`
|
|
352
|
+
- Includes code examples for all steps
|
|
353
|
+
- Links to Cloudflare documentation
|
|
354
|
+
|
|
355
|
+
**Duration**: 20 minutes
|
|
356
|
+
|
|
357
|
+
**Dependencies**: Task 4.2 complete
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
### Task 4.4: Update README.md
|
|
362
|
+
**Description**: Add Workers deployment option to main README
|
|
363
|
+
|
|
364
|
+
**Steps**:
|
|
365
|
+
Add new "Deployment Options" section:
|
|
366
|
+
|
|
367
|
+
```markdown
|
|
368
|
+
## Deployment Options
|
|
369
|
+
|
|
370
|
+
### Option 1: Local Installation (stdio mode)
|
|
371
|
+
[existing instructions]
|
|
372
|
+
|
|
373
|
+
### Option 2: Self-Hosted HTTP Server
|
|
374
|
+
[existing instructions]
|
|
375
|
+
|
|
376
|
+
### Option 3: Cloudflare Workers ⭐ NEW
|
|
377
|
+
Deploy to Cloudflare's global edge network for public HTTP access.
|
|
378
|
+
|
|
379
|
+
See [DEPLOYMENT.md](docs/DEPLOYMENT.md) for detailed instructions.
|
|
380
|
+
|
|
381
|
+
**Quick start**:
|
|
382
|
+
```bash
|
|
383
|
+
npm install -g wrangler
|
|
384
|
+
wrangler login
|
|
385
|
+
npm run deploy
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
Public endpoint: `https://ckan-mcp-server.<account>.workers.dev`
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
**Validation**:
|
|
392
|
+
- Section added after "Installation"
|
|
393
|
+
- Links to DEPLOYMENT.md work
|
|
394
|
+
- Code examples tested
|
|
395
|
+
|
|
396
|
+
**Duration**: 10 minutes
|
|
397
|
+
|
|
398
|
+
**Dependencies**: Task 4.3 complete
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
### Task 4.5: Update LOG.md
|
|
403
|
+
**Description**: Document deployment capability in changelog
|
|
404
|
+
|
|
405
|
+
**Steps**:
|
|
406
|
+
Add entry for today's date:
|
|
407
|
+
|
|
408
|
+
```markdown
|
|
409
|
+
## 2026-01-10
|
|
410
|
+
|
|
411
|
+
### Cloudflare Workers Deployment
|
|
412
|
+
- **Production deployment**: Server now available on Cloudflare Workers
|
|
413
|
+
- Public endpoint: `https://ckan-mcp-server.<account>.workers.dev`
|
|
414
|
+
- Global edge deployment (low latency worldwide)
|
|
415
|
+
- Free tier: 100k requests/day
|
|
416
|
+
- **New files**: `src/worker.ts`, `wrangler.toml`, `esbuild.worker.js`
|
|
417
|
+
- **New scripts**: `build:worker`, `dev:worker`, `deploy`
|
|
418
|
+
- **Documentation**: Created DEPLOYMENT.md with step-by-step guide
|
|
419
|
+
- **Testing**: All 7 MCP tools verified in Workers environment
|
|
420
|
+
- **No breaking changes**: stdio and self-hosted HTTP modes still supported
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
**Validation**:
|
|
424
|
+
- Entry added at top of LOG.md
|
|
425
|
+
- Date is 2026-01-10
|
|
426
|
+
- Includes deployment URL
|
|
427
|
+
|
|
428
|
+
**Duration**: 3 minutes
|
|
429
|
+
|
|
430
|
+
**Dependencies**: Task 4.4 complete
|
|
431
|
+
|
|
432
|
+
---
|
|
433
|
+
|
|
434
|
+
### Task 4.6: Final Validation
|
|
435
|
+
**Description**: End-to-end test with Claude Desktop
|
|
436
|
+
|
|
437
|
+
**Steps**:
|
|
438
|
+
1. Configure Claude Desktop to use Workers endpoint
|
|
439
|
+
2. Test MCP integration with all tools
|
|
440
|
+
3. Verify response formatting (markdown/json)
|
|
441
|
+
4. Check error handling
|
|
442
|
+
|
|
443
|
+
**Validation**:
|
|
444
|
+
- Claude Desktop successfully connects to Workers endpoint
|
|
445
|
+
- All tools accessible from Claude interface
|
|
446
|
+
- Responses properly formatted
|
|
447
|
+
- No unexpected errors
|
|
448
|
+
|
|
449
|
+
**Duration**: 10 minutes
|
|
450
|
+
|
|
451
|
+
**Dependencies**: All previous tasks complete
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
## Total Estimated Time
|
|
456
|
+
|
|
457
|
+
- **Phase 1**: 10 minutes (setup)
|
|
458
|
+
- **Phase 2**: 7 minutes (configuration)
|
|
459
|
+
- **Phase 3**: 32-37 minutes (implementation)
|
|
460
|
+
- **Phase 4**: 56 minutes (deployment + docs)
|
|
461
|
+
|
|
462
|
+
**Total**: ~1.5 - 2 hours (excluding breaks and troubleshooting)
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
466
|
+
## Dependencies Graph
|
|
467
|
+
|
|
468
|
+
```
|
|
469
|
+
Phase 1: Setup
|
|
470
|
+
├─ 1.1 Install Wrangler CLI
|
|
471
|
+
├─ 1.2 Create Cloudflare Account (optional)
|
|
472
|
+
├─ 1.3 Authenticate Wrangler (requires 1.2)
|
|
473
|
+
└─ 1.4 Install Wrangler Locally (requires 1.1)
|
|
474
|
+
|
|
475
|
+
Phase 2: Configuration (requires 1.4)
|
|
476
|
+
├─ 2.1 Create wrangler.toml
|
|
477
|
+
├─ 2.2 Add Build Scripts (requires 2.1)
|
|
478
|
+
└─ 2.3 Create esbuild.worker.js (requires 2.2)
|
|
479
|
+
|
|
480
|
+
Phase 3: Implementation (requires 2.3)
|
|
481
|
+
├─ 3.1 Create src/worker.ts
|
|
482
|
+
├─ 3.2 Test Local Dev Server (requires 3.1)
|
|
483
|
+
├─ 3.3 Implement MCP Handler (requires 3.2)
|
|
484
|
+
└─ 3.4 Test All Tools (requires 3.3)
|
|
485
|
+
|
|
486
|
+
Phase 4: Deployment (requires 3.4 + 1.1-1.3)
|
|
487
|
+
├─ 4.1 Deploy to Workers
|
|
488
|
+
├─ 4.2 Test Production (requires 4.1)
|
|
489
|
+
├─ 4.3 Create DEPLOYMENT.md (requires 4.2)
|
|
490
|
+
├─ 4.4 Update README.md (requires 4.3)
|
|
491
|
+
├─ 4.5 Update LOG.md (requires 4.4)
|
|
492
|
+
└─ 4.6 Final Validation (requires 4.5)
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
---
|
|
496
|
+
|
|
497
|
+
## Parallel Work Opportunities
|
|
498
|
+
|
|
499
|
+
These tasks can be done in parallel to save time:
|
|
500
|
+
|
|
501
|
+
- **During Phase 1**: While waiting for Cloudflare account verification (1.2), install Wrangler CLI (1.1)
|
|
502
|
+
- **During Phase 3.2**: While wrangler dev is running, can start writing worker.ts implementation (3.3)
|
|
503
|
+
- **During Phase 4**: Documentation tasks (4.3, 4.4, 4.5) can be drafted while deployment is in progress
|
|
504
|
+
|
|
505
|
+
---
|
|
506
|
+
|
|
507
|
+
## Rollback Plan
|
|
508
|
+
|
|
509
|
+
If deployment fails or issues arise:
|
|
510
|
+
|
|
511
|
+
1. **Workers deployment fails**: Keep using stdio/http modes (no breaking changes)
|
|
512
|
+
2. **Bundle too large**: Analyze with `esbuild --metafile` and remove unused code
|
|
513
|
+
3. **Runtime errors**: Use `wrangler tail` to view live logs and debug
|
|
514
|
+
4. **Rate limit exceeded**: User deploys own Workers instance (fork + deploy)
|
|
515
|
+
|
|
516
|
+
Each task is reversible - can revert by:
|
|
517
|
+
- Deleting new files (worker.ts, wrangler.toml, esbuild.worker.js)
|
|
518
|
+
- Removing npm scripts from package.json
|
|
519
|
+
- Running `wrangler delete` to remove Workers deployment
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aborruso/ckan-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "MCP server for interacting with CKAN open data portals",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -10,9 +10,12 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.js --external:@modelcontextprotocol/sdk --external:axios --external:express --external:zod",
|
|
12
12
|
"build:tsc": "node --max-old-space-size=8192 ./node_modules/typescript/bin/tsc",
|
|
13
|
+
"build:worker": "esbuild src/worker.ts --bundle --platform=browser --format=esm --outfile=dist/worker.js --target=es2022 --minify",
|
|
13
14
|
"start": "node dist/index.js",
|
|
14
15
|
"dev": "npm run build && node dist/index.js",
|
|
16
|
+
"dev:worker": "wrangler dev",
|
|
15
17
|
"watch": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.js --external:@modelcontextprotocol/sdk --external:axios --external:express --external:zod --watch",
|
|
18
|
+
"deploy": "npm run build:worker && wrangler deploy",
|
|
16
19
|
"test": "vitest",
|
|
17
20
|
"test:watch": "vitest --watch",
|
|
18
21
|
"test:coverage": "vitest --coverage"
|
|
@@ -38,7 +41,8 @@
|
|
|
38
41
|
"@vitest/coverage-v8": "^4.0.16",
|
|
39
42
|
"esbuild": "^0.27.2",
|
|
40
43
|
"typescript": "^5.4.5",
|
|
41
|
-
"vitest": "^4.0.16"
|
|
44
|
+
"vitest": "^4.0.16",
|
|
45
|
+
"wrangler": "^4.58.0"
|
|
42
46
|
},
|
|
43
47
|
"publishConfig": {
|
|
44
48
|
"access": "public"
|
package/wrangler.toml
ADDED
package/test-urls.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { getDatasetViewUrl, getOrganizationViewUrl } from './src/utils/url-generator.js';
|
|
2
|
-
|
|
3
|
-
const serverUrl = 'https://www.dati.gov.it/opendata';
|
|
4
|
-
const pkg = {
|
|
5
|
-
id: 'f20b37d0cd56764f77e4c707cc62b528eeb48ff24cdb415174a0dd31b63cad0c',
|
|
6
|
-
name: 'test-dataset'
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const org = {
|
|
10
|
-
id: 'org-id',
|
|
11
|
-
name: 'comune-di-bari'
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
console.log('Dataset URL:', getDatasetViewUrl(serverUrl, pkg));
|
|
15
|
-
console.log('Organization URL:', getOrganizationViewUrl(serverUrl, org));
|
|
16
|
-
|
|
17
|
-
const otherServer = 'https://demo.ckan.org';
|
|
18
|
-
console.log('Other Dataset URL:', getDatasetViewUrl(otherServer, pkg));
|