@aborruso/ckan-mcp-server 0.4.6 → 0.4.7
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/EXAMPLES.md +10 -0
- package/LOG.md +6 -0
- package/README.md +35 -36
- package/dist/index.js +74 -12
- package/dist/worker.js +130 -74
- package/openspec/changes/update-search-parser-config/proposal.md +13 -0
- package/openspec/changes/update-search-parser-config/specs/ckan-insights/spec.md +11 -0
- package/openspec/changes/update-search-parser-config/specs/ckan-search/spec.md +11 -0
- package/openspec/changes/update-search-parser-config/tasks.md +6 -0
- package/openspec/project.md +9 -7
- package/openspec/specs/ckan-insights/spec.md +8 -1
- package/package.json +1 -1
- /package/openspec/changes/{add-ckan-find-relevant-datasets → archive/2026-01-10-add-ckan-find-relevant-datasets}/proposal.md +0 -0
- /package/openspec/changes/{add-ckan-find-relevant-datasets → archive/2026-01-10-add-ckan-find-relevant-datasets}/specs/ckan-insights/spec.md +0 -0
- /package/openspec/changes/{add-ckan-find-relevant-datasets → archive/2026-01-10-add-ckan-find-relevant-datasets}/tasks.md +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Change: Update CKAN search parser handling per portal
|
|
2
|
+
|
|
3
|
+
## Why
|
|
4
|
+
Some CKAN portals (notably dati.gov.it) use a default edismax parser with restrictive `mm` settings that breaks long OR queries. For those portals, the Lucene standard parser on the `text` field yields correct results.
|
|
5
|
+
|
|
6
|
+
## What Changes
|
|
7
|
+
- Add per-portal search configuration to `src/portals.json` to force `text:(...)` queries where needed.
|
|
8
|
+
- Add an optional tool override to force the text-field parser regardless of portal defaults.
|
|
9
|
+
- Update tool documentation to describe the behavior and override.
|
|
10
|
+
|
|
11
|
+
## Impact
|
|
12
|
+
- Affected specs: `ckan-insights`, new `ckan-search` capability
|
|
13
|
+
- Affected code: `src/portals.json`, `src/tools/package.ts`, `src/utils/*` (if new helper is added)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## MODIFIED Requirements
|
|
2
|
+
### Requirement: Find relevant datasets
|
|
3
|
+
The system SHALL provide a `ckan_find_relevant_datasets` tool that accepts `server_url`, `query`, `limit`, optional weights for title, notes, tags, and organization, and an optional search parser override, and returns the top N datasets ranked by score with a per-field score breakdown.
|
|
4
|
+
|
|
5
|
+
#### Scenario: Ranked results returned
|
|
6
|
+
- **WHEN** the tool is invoked with a query and limit
|
|
7
|
+
- **THEN** the system uses `package_search` results to return the top N datasets with numeric scores and field contributions
|
|
8
|
+
|
|
9
|
+
#### Scenario: Search parser override applied
|
|
10
|
+
- **WHEN** the tool is invoked with a search parser override
|
|
11
|
+
- **THEN** the system applies the override to the underlying `package_search` query
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## ADDED Requirements
|
|
2
|
+
### Requirement: Package search parser override
|
|
3
|
+
The system SHALL support a per-portal default and a per-request override to force package search queries through the `text` field when needed.
|
|
4
|
+
|
|
5
|
+
#### Scenario: Portal default applies
|
|
6
|
+
- **WHEN** a portal is configured to force the text-field parser
|
|
7
|
+
- **THEN** `ckan_package_search` uses `text:(...)` for non-fielded queries by default
|
|
8
|
+
|
|
9
|
+
#### Scenario: Request override applies
|
|
10
|
+
- **WHEN** a client explicitly requests the text-field parser
|
|
11
|
+
- **THEN** `ckan_package_search` uses `text:(...)` regardless of portal defaults
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
## 1. Implementation
|
|
2
|
+
- [x] 1.1 Add per-portal search config for forcing text-field parser
|
|
3
|
+
- [x] 1.2 Add tool override input and apply parser selection in package search
|
|
4
|
+
- [x] 1.3 Apply same override logic in find-relevant datasets
|
|
5
|
+
- [x] 1.4 Update tool docs and examples
|
|
6
|
+
- [x] 1.5 Add/adjust tests if present for query handling
|
package/openspec/project.md
CHANGED
|
@@ -22,24 +22,25 @@ Exposes MCP tools for:
|
|
|
22
22
|
|
|
23
23
|
### Code Style
|
|
24
24
|
- TypeScript strict mode enabled
|
|
25
|
-
-
|
|
26
|
-
- Utility functions for reusable operations (makeCkanRequest, truncateText, formatDate
|
|
25
|
+
- Modular tool files in `src/tools/*`
|
|
26
|
+
- Utility functions for reusable operations (makeCkanRequest, truncateText, formatDate)
|
|
27
27
|
- Zod schemas for strict input validation (reject extra parameters)
|
|
28
28
|
- Italian locale for date formatting (it-IT)
|
|
29
29
|
- Markdown output optimized for human readability; JSON available for programmatic use
|
|
30
30
|
|
|
31
31
|
### Architecture Patterns
|
|
32
|
-
- **
|
|
33
|
-
- **Tool-based architecture** -
|
|
34
|
-
- **
|
|
32
|
+
- **Modular MCP server** - registration in `src/server.ts`
|
|
33
|
+
- **Tool-based architecture** - 13 registered MCP tools for CKAN operations
|
|
34
|
+
- **Multiple transport modes**:
|
|
35
35
|
- stdio (default) - for local MCP client integration
|
|
36
36
|
- HTTP - for remote access via POST /mcp endpoint
|
|
37
|
+
- Cloudflare Workers - `/mcp` endpoint in `src/worker.ts`
|
|
37
38
|
- **Read-only operations** - no data modification on CKAN
|
|
38
39
|
- **No caching** - fresh API calls for each request
|
|
39
40
|
- **Error handling** - HTTP errors, timeouts, server validation
|
|
40
41
|
|
|
41
42
|
### Testing Strategy
|
|
42
|
-
- **
|
|
43
|
+
- **Automated tests** with Vitest (integration fixtures)
|
|
43
44
|
- Manual testing:
|
|
44
45
|
- stdio mode: direct integration testing with Claude Desktop
|
|
45
46
|
- HTTP mode: curl-based testing against localhost endpoint
|
|
@@ -67,6 +68,7 @@ Exposes MCP tools for:
|
|
|
67
68
|
- Output truncated to 50000 characters max (hardcoded)
|
|
68
69
|
- Dates formatted in Italian locale
|
|
69
70
|
- File sizes in human-readable format
|
|
71
|
+
- `server_url` for Italy uses `https://dati.gov.it/opendata`
|
|
70
72
|
|
|
71
73
|
## Important Constraints
|
|
72
74
|
|
|
@@ -91,7 +93,7 @@ Exposes MCP tools for:
|
|
|
91
93
|
|
|
92
94
|
### CKAN Portals
|
|
93
95
|
Major supported portals:
|
|
94
|
-
- 🇮🇹 https://dati.gov.it (Italia)
|
|
96
|
+
- 🇮🇹 https://dati.gov.it/opendata (Italia)
|
|
95
97
|
- 🇺🇸 https://catalog.data.gov (United States)
|
|
96
98
|
- 🇨🇦 https://open.canada.ca/data (Canada)
|
|
97
99
|
- 🇬🇧 https://data.gov.uk (United Kingdom)
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
## Purpose
|
|
4
4
|
Describe dataset insight tools (relevance, freshness, structure) once implemented.
|
|
5
|
-
|
|
6
5
|
## Requirements
|
|
7
6
|
### Requirement: Insights capability reserved
|
|
8
7
|
The system SHALL maintain this specification to document dataset insight tools when they are added.
|
|
@@ -10,3 +9,11 @@ The system SHALL maintain this specification to document dataset insight tools w
|
|
|
10
9
|
#### Scenario: Insight tools documented
|
|
11
10
|
- **WHEN** new insight tools are implemented
|
|
12
11
|
- **THEN** their requirements are captured in this specification
|
|
12
|
+
|
|
13
|
+
### Requirement: Find relevant datasets
|
|
14
|
+
The system SHALL provide a `ckan_find_relevant_datasets` tool that accepts `server_url`, `query`, `limit`, and optional weights for title, notes, tags, and organization, and returns the top N datasets ranked by score with a per-field score breakdown.
|
|
15
|
+
|
|
16
|
+
#### Scenario: Ranked results returned
|
|
17
|
+
- **WHEN** the tool is invoked with a query and limit
|
|
18
|
+
- **THEN** the system uses `package_search` results to return the top N datasets with numeric scores and field contributions
|
|
19
|
+
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|