@aborruso/ckan-mcp-server 0.4.9 โ†’ 0.4.11

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,273 @@
1
+ {
2
+ "repo_notes": [
3
+ {
4
+ "content": ""
5
+ }
6
+ ],
7
+ "pages": [
8
+ {
9
+ "title": "Overview",
10
+ "purpose": "Introduce the CKAN MCP Server system, explaining its purpose as a Model Context Protocol server that enables AI agents to interact with 500+ CKAN open data portals worldwide through natural language and structured queries",
11
+ "page_notes": [
12
+ {
13
+ "content": ""
14
+ }
15
+ ]
16
+ },
17
+ {
18
+ "title": "Key Features",
19
+ "purpose": "Highlight the main capabilities: 15+ CKAN tools, dual runtime support, MCP Resource Templates, and global edge deployment",
20
+ "parent": "Overview",
21
+ "page_notes": [
22
+ {
23
+ "content": ""
24
+ }
25
+ ]
26
+ },
27
+ {
28
+ "title": "Architecture Overview",
29
+ "purpose": "Provide a high-level architectural diagram showing the two-tier system: MCP Server Core and CKAN Portals, plus the dual deployment model",
30
+ "parent": "Overview",
31
+ "page_notes": [
32
+ {
33
+ "content": ""
34
+ }
35
+ ]
36
+ },
37
+ {
38
+ "title": "Getting Started",
39
+ "purpose": "Guide users through the fastest path to using the system based on their needs and technical expertise",
40
+ "page_notes": [
41
+ {
42
+ "content": ""
43
+ }
44
+ ]
45
+ },
46
+ {
47
+ "title": "Claude Desktop Setup",
48
+ "purpose": "Configure Claude Desktop to use the MCP server via stdio (local) or HTTP (remote/Workers) transport modes",
49
+ "parent": "Getting Started",
50
+ "page_notes": [
51
+ {
52
+ "content": ""
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ "title": "Installation Options",
58
+ "purpose": "Compare the three deployment options: npm global install, Cloudflare Workers, and self-hosted HTTP server",
59
+ "parent": "Getting Started",
60
+ "page_notes": [
61
+ {
62
+ "content": ""
63
+ }
64
+ ]
65
+ },
66
+ {
67
+ "title": "Architecture",
68
+ "purpose": "Deep dive into the system architecture, component relationships, and design decisions",
69
+ "page_notes": [
70
+ {
71
+ "content": ""
72
+ }
73
+ ]
74
+ },
75
+ {
76
+ "title": "System Components",
77
+ "purpose": "Explain the modular architecture: entry points, transport layer, server core, tool handlers, resource templates, and utilities",
78
+ "parent": "Architecture",
79
+ "page_notes": [
80
+ {
81
+ "content": ""
82
+ }
83
+ ]
84
+ },
85
+ {
86
+ "title": "MCP Server Core",
87
+ "purpose": "Explain the MCP server implementation: tool registration system, request routing, Zod validation, and error handling",
88
+ "parent": "Architecture",
89
+ "page_notes": [
90
+ {
91
+ "content": ""
92
+ }
93
+ ]
94
+ },
95
+ {
96
+ "title": "Transport Layer",
97
+ "purpose": "Document the three transport modes: stdio (12 lines), HTTP (27 lines), and Cloudflare Workers WebStandardStreamable, explaining how the same tools run across different runtimes",
98
+ "parent": "Architecture",
99
+ "page_notes": [
100
+ {
101
+ "content": ""
102
+ }
103
+ ]
104
+ },
105
+ {
106
+ "title": "Tool Layer",
107
+ "purpose": "Describe the tool implementation pattern: Zod schemas, handler functions, makeCkanRequest abstraction, and output formatting (1,465+ lines of business logic)",
108
+ "parent": "Architecture",
109
+ "page_notes": [
110
+ {
111
+ "content": ""
112
+ }
113
+ ]
114
+ },
115
+ {
116
+ "title": "Dual Runtime Design",
117
+ "purpose": "Explain how the same codebase runs on Node.js and Cloudflare Workers V8 isolates, including build targets, bundle sizes, and runtime differences",
118
+ "parent": "Architecture",
119
+ "page_notes": [
120
+ {
121
+ "content": ""
122
+ }
123
+ ]
124
+ },
125
+ {
126
+ "title": "User Guides",
127
+ "purpose": "Practical guides for end users interacting with CKAN data through the system",
128
+ "page_notes": [
129
+ {
130
+ "content": ""
131
+ }
132
+ ]
133
+ },
134
+ {
135
+ "title": "Querying CKAN Data",
136
+ "purpose": "Guide to common CKAN queries: searching datasets, exploring organizations, querying DataStore, using facets, and understanding Solr syntax",
137
+ "parent": "User Guides",
138
+ "page_notes": [
139
+ {
140
+ "content": ""
141
+ }
142
+ ]
143
+ },
144
+ {
145
+ "title": "Advanced Search Techniques",
146
+ "purpose": "Document Solr query syntax: fuzzy search (~N), proximity search (\"phrase\"~N), boosting (^N), range queries, date math, wildcards, and boolean operators",
147
+ "parent": "User Guides",
148
+ "page_notes": [
149
+ {
150
+ "content": ""
151
+ }
152
+ ]
153
+ },
154
+ {
155
+ "title": "DataStore Queries",
156
+ "purpose": "Explain DataStore functionality: basic key-value filtering, SQL queries, field selection, sorting, pagination, and the 32,000 record limit",
157
+ "parent": "User Guides",
158
+ "page_notes": [
159
+ {
160
+ "content": ""
161
+ }
162
+ ]
163
+ },
164
+ {
165
+ "title": "Working with Organizations",
166
+ "purpose": "Guide to organization tools: listing with package counts, searching by pattern, retrieving details, and understanding organizational hierarchies",
167
+ "parent": "User Guides",
168
+ "page_notes": [
169
+ {
170
+ "content": ""
171
+ }
172
+ ]
173
+ },
174
+ {
175
+ "title": "Tool Reference",
176
+ "purpose": "Complete reference documentation for all 15+ MCP tools with parameters, return types, and usage examples",
177
+ "page_notes": [
178
+ {
179
+ "content": ""
180
+ }
181
+ ]
182
+ },
183
+ {
184
+ "title": "Dataset Tools",
185
+ "purpose": "Document ckan_package_search, ckan_find_relevant_datasets, ckan_package_show, ckan_package_list with detailed parameter descriptions and examples",
186
+ "parent": "Tool Reference",
187
+ "page_notes": [
188
+ {
189
+ "content": ""
190
+ }
191
+ ]
192
+ },
193
+ {
194
+ "title": "Organization Tools",
195
+ "purpose": "Document ckan_organization_list, ckan_organization_show, ckan_organization_search with sorting, pagination, and filtering options",
196
+ "parent": "Tool Reference",
197
+ "page_notes": [
198
+ {
199
+ "content": ""
200
+ }
201
+ ]
202
+ },
203
+ {
204
+ "title": "DataStore Tools",
205
+ "purpose": "Document ckan_datastore_search and ckan_datastore_search_sql with filtering syntax, SQL query examples, and limit constraints",
206
+ "parent": "Tool Reference",
207
+ "page_notes": [
208
+ {
209
+ "content": ""
210
+ }
211
+ ]
212
+ },
213
+ {
214
+ "title": "Metadata Tools",
215
+ "purpose": "Document ckan_tag_list, ckan_group_list, ckan_group_show, ckan_group_search, and ckan_status_show for portal exploration",
216
+ "parent": "Tool Reference",
217
+ "page_notes": [
218
+ {
219
+ "content": ""
220
+ }
221
+ ]
222
+ },
223
+ {
224
+ "title": "MCP Resource Templates",
225
+ "purpose": "Explain the ckan:// URI scheme for accessing datasets, resources, and organizations via MCP Resource Templates",
226
+ "parent": "Tool Reference",
227
+ "page_notes": [
228
+ {
229
+ "content": ""
230
+ }
231
+ ]
232
+ },
233
+ {
234
+ "title": "Developer Guide",
235
+ "purpose": "Guide for developers who want to modify, extend, or contribute to the codebase",
236
+ "page_notes": [
237
+ {
238
+ "content": ""
239
+ }
240
+ ]
241
+ },
242
+ {
243
+ "title": "Project Structure",
244
+ "purpose": "Document the codebase organization: src/ structure, tool modules (1,465+ lines), utilities (138+ lines), resources (50+ lines), and test organization (2,340 lines)",
245
+ "parent": "Developer Guide",
246
+ "page_notes": [
247
+ {
248
+ "content": ""
249
+ }
250
+ ]
251
+ },
252
+ {
253
+ "title": "Adding New Tools",
254
+ "purpose": "Step-by-step guide to implementing a new MCP tool: defining Zod schemas, creating handlers, using makeCkanRequest, formatting outputs, and registering with the server",
255
+ "parent": "Developer Guide",
256
+ "page_notes": [
257
+ {
258
+ "content": ""
259
+ }
260
+ ]
261
+ },
262
+ {
263
+ "title": "Utility Functions",
264
+ "purpose": "Document the utility layer: makeCkanRequest (51 lines, 98.59% coverage), formatting functions (37 lines, 98% coverage), query resolution, and URL generation",
265
+ "parent": "Developer Guide",
266
+ "page_notes": [
267
+ {
268
+ "content": ""
269
+ }
270
+ ]
271
+ }
272
+ ]
273
+ }
package/AGENTS.md CHANGED
@@ -33,173 +33,68 @@ Keep this managed block so 'openspec update' can refresh the instructions.
33
33
 
34
34
  - No `.cursor/rules`, `.cursorrules`, or `.github/copilot-instructions.md` found
35
35
 
36
- ## Core Commands
36
+ ## Commands
37
37
 
38
- Install deps:
38
+ **Install**: `npm install`
39
39
 
40
- ```bash
41
- npm install
42
- ```
40
+ **Build**: `npm run build` | `npm run build:tsc` | `npm run build:worker`
43
41
 
44
- Build (node bundle):
45
-
46
- ```bash
47
- npm run build
48
- ```
42
+ **Run**: `npm start` | `npm run dev` | `npm run watch` | `npm run dev:worker` | `npm run deploy`
49
43
 
50
- Build (worker bundle):
44
+ **Test**: `npm test` | `npm run test:watch` | `npm run test:coverage`
51
45
 
52
- ```bash
53
- npm run build:worker
54
- ```
46
+ **Single test**: `npm test -- tests/unit/http.test.ts` | `npm test -- -t "testName"`
55
47
 
56
- TypeScript build (tsc):
48
+ ## TypeScript Style
57
49
 
58
- ```bash
59
- npm run build:tsc
60
- ```
50
+ Use strict typing, avoid `any` unless from CKAN payloads. Prefer explicit return types, `type` aliases, ESM imports with `.js` extensions. Keep `noUnusedLocals` and `noUnusedParameters` clean.
61
51
 
62
- Start server (stdio or HTTP via env):
52
+ ## Import Conventions
63
53
 
64
- ```bash
65
- npm start
66
- ```
54
+ Use `import type` for type-only imports. Group by kind: external, internal, types. Double quotes, relative paths.
67
55
 
68
- Dev build + run:
56
+ ## Naming
69
57
 
70
- ```bash
71
- npm run dev
72
- ```
58
+ `camelCase` vars/functions, `PascalCase` types/classes, `UPPER_SNAKE_CASE` constants. Tool names match MCP tool ids.
73
59
 
74
- Watch build:
60
+ ## Error Handling
75
61
 
76
- ```bash
77
- npm run watch
78
- ```
62
+ Wrap tool handlers in `try/catch`. Return `{ isError: true }` for MCP errors. Include context, map HTTP errors to readable messages, preserve cause when rethrowing.
79
63
 
80
- Cloudflare dev:
64
+ ## Tool Responses
81
65
 
82
- ```bash
83
- npm run dev:worker
84
- ```
66
+ Use `ResponseFormat` for markdown vs JSON. `truncateText` for large payloads. Pretty-print JSON, include `structuredContent` for JSON mode.
85
67
 
86
- Deploy worker:
68
+ ## Testing Guidelines
87
69
 
88
- ```bash
89
- npm run deploy
90
- ```
70
+ Vitest with `globals: true`. Place tests in `tests/unit` or `tests/integration`. AAA pattern, mock via fixtures in `tests/fixtures`, descriptive names.
91
71
 
92
- ## Tests
72
+ ## Configuration
93
73
 
94
- Run all tests:
74
+ Node `>=18`. Worker build in `wrangler.toml`. Vitest coverage thresholds enforced.
95
75
 
96
- ```bash
97
- npm test
98
- ```
76
+ ## Change Hygiene
99
77
 
100
- Watch tests:
78
+ Minimal focused diffs. No unrelated refactors. Update tests for behavior changes. Avoid editing `dist/`.
101
79
 
102
- ```bash
103
- npm run test:watch
104
- ```
80
+ ## Project Layout
105
81
 
106
- Coverage:
82
+ `src/index.ts` entry, `src/server.ts` wiring, `src/tools/` handlers, `src/utils/` helpers, `src/resources/` templates, `src/transport/` stdio/HTTP. `tests/unit/` utilities, `tests/integration/` behavior, `tests/fixtures/` mocks.
107
83
 
108
- ```bash
109
- npm run test:coverage
110
- ```
84
+ ## CSV Data Exploration
111
85
 
112
- Run a single file:
86
+ For exploring CSV resources from datasets, use duckdb CLI (already installed) with direct HTTP URL:
113
87
 
114
88
  ```bash
115
- npm test -- tests/unit/http.test.ts
89
+ duckdb -jsonlines -c "DESCRIBE SELECT * FROM read_csv('http://url/file.csv')"
90
+ duckdb -jsonlines -c "SUMMARIZE SELECT * FROM read_csv('http://url/file.csv')"
91
+ duckdb -jsonlines -c "SELECT * FROM read_csv('http://url/file.csv') USING SAMPLE 10"
116
92
  ```
117
93
 
118
- Run a single test name:
119
-
120
- ```bash
121
- npm test -- -t "makeCkanRequest"
122
- ```
94
+ Use direct resource URLs (http/https), not GitHub view/blob URLs. The `-jsonlines` parameter outputs in JSONL format, easier for AI to parse.
123
95
 
124
- Run single file with Vitest directly:
96
+ For random sampling, use `USING SAMPLE N` syntax (where N is the number of rows):
125
97
 
126
98
  ```bash
127
- npx vitest tests/unit/http.test.ts
99
+ duckdb -jsonlines -c "SELECT * FROM read_csv('http://url/file.csv') USING SAMPLE 10"
128
100
  ```
129
-
130
- ## Lint and Format
131
-
132
- - No ESLint or Prettier config detected
133
- - Do not add new formatters unless requested
134
- - Keep formatting consistent with existing files
135
-
136
- ## Project Layout
137
-
138
- - `src/index.ts` entry point
139
- - `src/server.ts` server wiring
140
- - `src/tools/` MCP tool handlers
141
- - `src/utils/` helpers (http, formatting, search)
142
- - `src/resources/` MCP resource templates
143
- - `src/transport/` stdio + HTTP
144
- - `tests/unit/` utilities
145
- - `tests/integration/` tool behavior
146
- - `tests/fixtures/` mocked CKAN API responses
147
-
148
- ## TypeScript Style
149
-
150
- - Use strict typing (`tsconfig.json` has `strict: true`)
151
- - Avoid `any` unless unavoidable or from CKAN payloads
152
- - Prefer explicit return types for exported functions
153
- - Use `type` aliases for structured objects
154
- - Keep `noUnusedLocals` and `noUnusedParameters` clean
155
- - ESM imports with `.js` extensions for local modules
156
-
157
- ## Import Conventions
158
-
159
- - Use `import type` for type-only imports
160
- - Group imports by kind: external, internal, types
161
- - Use double quotes for strings
162
- - Keep import paths relative and short
163
-
164
- ## Naming
165
-
166
- - `camelCase` for vars/functions
167
- - `PascalCase` for types/classes
168
- - `UPPER_SNAKE_CASE` for constants
169
- - Tool names match MCP tool id strings
170
-
171
- ## Error Handling
172
-
173
- - Wrap tool handlers in `try/catch`
174
- - Return `{ isError: true }` for MCP errors
175
- - Include user-facing error text with context
176
- - For HTTP errors, map to readable messages
177
- - Preserve error cause when rethrowing
178
-
179
- ## Tool Responses
180
-
181
- - Use `ResponseFormat` for markdown vs JSON
182
- - Use `truncateText` for large payloads
183
- - Keep JSON output pretty-printed
184
- - Include `structuredContent` for JSON mode
185
-
186
- ## Testing Guidelines
187
-
188
- - Tests use Vitest and `globals: true`
189
- - Place new tests in `tests/unit` or `tests/integration`
190
- - Follow AAA pattern: Arrange, Act, Assert
191
- - Mock CKAN API via fixtures under `tests/fixtures`
192
- - Name tests descriptively with expected behavior
193
-
194
- ## Configuration Notes
195
-
196
- - Node engine: `>=18`
197
- - Worker build command set in `wrangler.toml`
198
- - Vitest coverage thresholds enforced in `vitest.config.ts`
199
-
200
- ## Change Hygiene
201
-
202
- - Keep diffs minimal and focused
203
- - Avoid unrelated refactors
204
- - Update tests for behavior changes
205
- - Avoid editing `dist/` (generated)
package/CLAUDE.md CHANGED
@@ -378,3 +378,21 @@ When releasing a new version:
378
378
  7. **Deploy to Cloudflare** (if code changed): `npm run deploy`
379
379
 
380
380
  See `docs/DEPLOYMENT.md` for detailed Cloudflare deployment instructions.
381
+
382
+ ## CSV Data Exploration
383
+
384
+ For exploring CSV resources from datasets, use duckdb CLI (already installed) with direct HTTP URL:
385
+
386
+ ```bash
387
+ duckdb -jsonlines -c "DESCRIBE SELECT * FROM read_csv('http://url/file.csv')"
388
+ duckdb -jsonlines -c "SUMMARIZE SELECT * FROM read_csv('http://url/file.csv')"
389
+ duckdb -jsonlines -c "SELECT * FROM read_csv('http://url/file.csv') USING SAMPLE 10"
390
+ ```
391
+
392
+ Use direct resource URLs (http/https), not GitHub view/blob URLs. The `-jsonlines` parameter outputs in JSONL format, easier for AI to parse.
393
+
394
+ For random sampling, use `USING SAMPLE N` syntax (where N is the number of rows):
395
+
396
+ ```bash
397
+ duckdb -jsonlines -c "SELECT * FROM read_csv('http://url/file.csv') USING SAMPLE 10"
398
+ ```
package/LOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # LOG
2
2
 
3
+ ## 2026-01-15
4
+
5
+ ### Version 0.4.11 - Prompt argument coercion
6
+ - **Fix**: Prompt arguments now coerce numeric strings (e.g., rows) for MCP prompt requests
7
+ - **Docs**: Updated evaluation notes for 0.4.11
8
+ - **No breaking changes**: Prompt names and outputs unchanged
9
+
10
+ ### Version 0.4.10 - Guided MCP prompts
11
+ - **Feature**: Added 5 guided MCP prompts (theme, organization, format, recent datasets, dataset analysis)
12
+ - **Docs**: README and new `docs/prompts.md` updated with usage examples
13
+ - **Tests**: Added prompt unit tests; total now 184 tests (all passing)
14
+ - **Files**: New `src/prompts/*`, updates in `src/server.ts`, `src/worker.ts`, README.md
15
+
3
16
  ## 2026-01-11
4
17
 
5
18
  ### Version 0.4.9 - Security, Testing & Documentation
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
- # CKAN MCP Server
2
-
3
1
  [![npm version](https://img.shields.io/npm/v/@aborruso/ckan-mcp-server)](https://www.npmjs.com/package/@aborruso/ckan-mcp-server)
2
+ [![GitHub](https://img.shields.io/badge/github-aborruso%2Fckan--mcp--server-blue?logo=github)](https://github.com/aborruso/ckan-mcp-server)
3
+ [![deepwiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/aborruso/ckan-mcp-server)
4
+
5
+ # CKAN MCP Server
4
6
 
5
7
  MCP (Model Context Protocol) server for interacting with CKAN-based open data portals.
6
8
 
@@ -14,7 +16,14 @@ MCP (Model Context Protocol) server for interacting with CKAN-based open data po
14
16
  - ๐ŸŽจ Output in Markdown or JSON format
15
17
  - โšก Pagination and faceting support
16
18
  - ๐Ÿ“„ MCP Resource Templates for direct data access
17
- - ๐Ÿงช Test suite with 179 tests (100% passing)
19
+ - ๐Ÿงญ Guided MCP prompts for common workflows
20
+ - ๐Ÿงช Test suite with 184 tests (100% passing)
21
+
22
+ ---
23
+
24
+ ๐Ÿ‘‰ If you want to dive deeper, the [**AI-generated DeepWiki**](https://deepwiki.com/aborruso/ckan-mcp-server) is very well done.
25
+
26
+ ---
18
27
 
19
28
  ## Installation
20
29
 
@@ -36,7 +45,7 @@ npm install
36
45
  # Build with esbuild (fast, ~4ms)
37
46
  npm run build
38
47
 
39
- # Run tests (179 tests)
48
+ # Run tests (184 tests)
40
49
  npm test
41
50
  ```
42
51
 
@@ -202,6 +211,29 @@ ckan://demo.ckan.org/resource/abc-123
202
211
  ckan://data.gov/organization/sample-org
203
212
  ```
204
213
 
214
+ ## Guided Prompts
215
+
216
+ Prompt templates that guide users through common CKAN workflows:
217
+
218
+ - **ckan-search-by-theme**: Find a theme/group and list datasets under it
219
+ - **ckan-search-by-organization**: Discover an organization and list its datasets
220
+ - **ckan-search-by-format**: Find datasets by resource format (CSV/JSON/etc.)
221
+ - **ckan-recent-datasets**: List recently updated datasets
222
+ - **ckan-analyze-dataset**: Inspect dataset metadata and explore DataStore resources
223
+
224
+ Example (retrieve a prompt by name with args):
225
+
226
+ ```json
227
+ {
228
+ "name": "ckan-search-by-theme",
229
+ "arguments": {
230
+ "server_url": "https://www.dati.gov.it/opendata",
231
+ "theme": "ambiente",
232
+ "rows": 10
233
+ }
234
+ }
235
+ ```
236
+
205
237
  ## Usage Examples
206
238
 
207
239
  ### Search datasets on dati.gov.it (natural language: "search for population datasets")
@@ -497,10 +529,17 @@ ckan-mcp-server/
497
529
  โ”‚ โ”‚ โ”œโ”€โ”€ dataset.ts
498
530
  โ”‚ โ”‚ โ”œโ”€โ”€ resource.ts
499
531
  โ”‚ โ”‚ โ””โ”€โ”€ organization.ts
532
+ โ”‚ โ”œโ”€โ”€ prompts/ # MCP Guided Prompts
533
+ โ”‚ โ”‚ โ”œโ”€โ”€ index.ts
534
+ โ”‚ โ”‚ โ”œโ”€โ”€ theme.ts
535
+ โ”‚ โ”‚ โ”œโ”€โ”€ organization.ts
536
+ โ”‚ โ”‚ โ”œโ”€โ”€ format.ts
537
+ โ”‚ โ”‚ โ”œโ”€โ”€ recent.ts
538
+ โ”‚ โ”‚ โ””โ”€โ”€ dataset-analysis.ts
500
539
  โ”‚ โ””โ”€โ”€ transport/
501
540
  โ”‚ โ”œโ”€โ”€ stdio.ts # Stdio transport
502
541
  โ”‚ โ””โ”€โ”€ http.ts # HTTP transport
503
- โ”œโ”€โ”€ tests/ # Test suite (179 tests)
542
+ โ”œโ”€โ”€ tests/ # Test suite (184 tests)
504
543
  โ”œโ”€โ”€ dist/ # Compiled files (generated)
505
544
  โ”œโ”€โ”€ package.json
506
545
  โ””โ”€โ”€ README.md