@aborruso/ckan-mcp-server 0.3.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.
Files changed (43) hide show
  1. package/.claude/commands/openspec/apply.md +23 -0
  2. package/.claude/commands/openspec/archive.md +27 -0
  3. package/.claude/commands/openspec/proposal.md +28 -0
  4. package/.claude/settings.local.json +31 -0
  5. package/.gemini/commands/openspec/apply.toml +21 -0
  6. package/.gemini/commands/openspec/archive.toml +25 -0
  7. package/.gemini/commands/openspec/proposal.toml +26 -0
  8. package/.mcp.json +12 -0
  9. package/.opencode/command/openspec-apply.md +24 -0
  10. package/.opencode/command/openspec-archive.md +27 -0
  11. package/.opencode/command/openspec-proposal.md +29 -0
  12. package/AGENTS.md +18 -0
  13. package/CLAUDE.md +320 -0
  14. package/EXAMPLES.md +707 -0
  15. package/LICENSE.txt +21 -0
  16. package/LOG.md +154 -0
  17. package/PRD.md +912 -0
  18. package/README.md +468 -0
  19. package/REFACTORING.md +237 -0
  20. package/dist/index.js +1277 -0
  21. package/openspec/AGENTS.md +456 -0
  22. package/openspec/changes/archive/2026-01-08-add-mcp-resources/design.md +115 -0
  23. package/openspec/changes/archive/2026-01-08-add-mcp-resources/proposal.md +52 -0
  24. package/openspec/changes/archive/2026-01-08-add-mcp-resources/specs/mcp-resources/spec.md +92 -0
  25. package/openspec/changes/archive/2026-01-08-add-mcp-resources/tasks.md +56 -0
  26. package/openspec/changes/archive/2026-01-08-expand-test-coverage-specs/design.md +355 -0
  27. package/openspec/changes/archive/2026-01-08-expand-test-coverage-specs/proposal.md +161 -0
  28. package/openspec/changes/archive/2026-01-08-expand-test-coverage-specs/tasks.md +162 -0
  29. package/openspec/changes/archive/2026-01-08-translate-project-to-english/proposal.md +115 -0
  30. package/openspec/changes/archive/2026-01-08-translate-project-to-english/specs/documentation-language/spec.md +32 -0
  31. package/openspec/changes/archive/2026-01-08-translate-project-to-english/tasks.md +115 -0
  32. package/openspec/changes/archive/add-automated-tests/design.md +324 -0
  33. package/openspec/changes/archive/add-automated-tests/proposal.md +167 -0
  34. package/openspec/changes/archive/add-automated-tests/specs/automated-testing/spec.md +143 -0
  35. package/openspec/changes/archive/add-automated-tests/tasks.md +132 -0
  36. package/openspec/project.md +113 -0
  37. package/openspec/specs/documentation-language/spec.md +32 -0
  38. package/openspec/specs/mcp-resources/spec.md +94 -0
  39. package/package.json +46 -0
  40. package/spunti.md +19 -0
  41. package/tasks/todo.md +124 -0
  42. package/test-urls.js +18 -0
  43. package/tmp/test-org-search.js +55 -0
@@ -0,0 +1,162 @@
1
+ # Tasks: Expand Test Coverage to Remaining Tools
2
+
3
+ Ordered list of work items to add integration tests for package, organization, and datastore tools.
4
+
5
+ ## Phase 1: Package Tools
6
+
7
+ ### ckan_package_search Tests
8
+
9
+ - [x] Create `tests/integration/package.test.ts`
10
+ - [x] Write test for basic search with query parameter
11
+ - [x] Write test for search returning empty results
12
+ - [x] Write test for search with pagination (start, rows)
13
+ - [x] Write test for search with sorting (sort parameter)
14
+ - [x] Write test for search with filter query (fq parameter)
15
+ - [x] Write test for search with multiple filter queries
16
+ - [x] Write test for search with complex query (q + fq + facets)
17
+ - [x] Write test validating markdown output format
18
+ - [x] Write test handling 404 error for invalid query
19
+ - [x] Write test handling server error
20
+ - [x] Write test for faceting with facet_field
21
+ - [x] Run package tool tests and verify all pass
22
+
23
+ ### ckan_package_show Tests
24
+
25
+ - [x] Write test for showing package with valid ID
26
+ - [x] Write test for package with multiple resources
27
+ - [x] Write test for package with tags
28
+ - [x] Write test for package with organization
29
+ - [x] Write test for package without resources
30
+ - [x] Write test handling 404 error for invalid package ID
31
+ - [x] Write test handling server error when fetching package
32
+ - [x] Write test validating JSON output format
33
+ - [x] Run package tool tests and verify all pass
34
+
35
+ ## Phase 2: Organization Tools
36
+
37
+ ### ckan_organization_list Tests
38
+
39
+ - [x] Create `tests/integration/organization.test.ts`
40
+ - [x] Write test for listing all organizations (default)
41
+ - [x] Write test for returning list of organizations
42
+ - [x] Write test for listing with empty results
43
+ - [x] Run organization tool tests and verify all pass
44
+
45
+ ### ckan_organization_show Tests
46
+
47
+ - [x] Write test for showing organization with valid ID
48
+ - [x] Write test for organization with users
49
+ - [x] Write test for organization with packages
50
+ - [x] Write test handling 404 error for invalid organization ID
51
+ - [x] Write test handling server error when fetching organization
52
+ - [x] Run organization tool tests and verify all pass
53
+
54
+ ### ckan_organization_search Tests
55
+
56
+ - [x] Write test for searching organizations by pattern
57
+ - [x] Write test for search returning empty results
58
+ - [x] Write test handling server error when searching organizations
59
+ - [x] Run organization tool tests and verify all pass
60
+
61
+ ## Phase 3: DataStore Tool
62
+
63
+ ### ckan_datastore_search Tests
64
+
65
+ - [x] Create `tests/integration/datastore.test.ts`
66
+ - [x] Write test for basic query with resource_id
67
+ - [x] Write test for query with filters
68
+ - [x] Write test for query with sorting
69
+ - [x] Write test for query with pagination (limit, offset)
70
+ - [x] Write test for query with field list (fields parameter)
71
+ - [x] Write test handling 404 error for invalid resource_id
72
+ - [x] Write test handling server error when querying DataStore
73
+ - [x] Write test handling timeout when querying DataStore
74
+ - [x] Write test validating JSON output format
75
+ - [x] Write test for empty query results
76
+ - [x] Write test for maximum limit (32000)
77
+ - [x] Write test handling large result sets (50000+ records)
78
+ - [x] Run datastore tool tests and verify all pass
79
+
80
+ ## Phase 4: Additional Fixtures
81
+
82
+ - [x] Create error fixtures if needed for tool-specific scenarios
83
+
84
+ ## Phase 5: Validation
85
+
86
+ - [x] Run `npm test` and verify all tests pass
87
+ - [x] Verify package tools coverage meets target
88
+ - [x] Verify organization tools coverage meets target
89
+ - [x] Verify datastore tool coverage meets target
90
+ - [x] Verify overall coverage meets 80% threshold
91
+ - [ ] Run `npm run test:coverage` and check coverage report
92
+ - [ ] Check that all tests follow established patterns
93
+
94
+ ## Phase 6: Documentation
95
+
96
+ - [ ] Update tests/README.md with new test files
97
+ - [ ] Add examples from new test files to documentation
98
+ - [ ] Update CLAUDE.md if needed with testing notes
99
+ - [ ] Update proposal status to completed
100
+
101
+ ## Dependencies
102
+
103
+ - Phase 1 must complete before Phase 2
104
+ - Phase 2 must complete before Phase 3
105
+ - Phase 4 can be done in parallel with Phases 1-3 as needed
106
+ - Phase 5 depends on completion of Phases 1, 2, 3
107
+ - Phase 6 depends on Phase 5 completion
108
+
109
+ ## Notes
110
+
111
+ - Reuse existing fixtures where possible
112
+ - Follow AAA pattern (Arrange, Act, Assert)
113
+ - Use descriptive test names
114
+ - Test both success and error scenarios
115
+ - Validate both markdown and JSON output formats
116
+ - Keep tests simple and focused
117
+ - Run tests in watch mode during development: `npm run test:watch`
118
+ - Generate coverage report: `npm run test:coverage`
119
+ - Check existing tests (`tests/integration/status.test.ts`) for reference
120
+
121
+ ## Test File Creation Template
122
+
123
+ When creating new test files:
124
+
125
+ ```typescript
126
+ import { describe, it, expect, vi, beforeEach } from 'vitest';
127
+ import axios from 'axios';
128
+ import { makeCkanRequest } from '../../src/utils/http';
129
+ import { ckan_package_search, ckan_package_show } from '../../src/tools/package';
130
+ import relevantFixture from '../fixtures/responses/relevant-fixture.json';
131
+
132
+ vi.mock('axios');
133
+
134
+ describe('ckan_package_search', () => {
135
+ beforeEach(() => {
136
+ vi.clearAllMocks();
137
+ });
138
+
139
+ it('descriptive test name', async () => {
140
+ vi.mocked(axios.get).mockResolvedValue({ data: relevantFixture });
141
+
142
+ const result = await ckan_package_search({
143
+ server_url: 'http://demo.ckan.org',
144
+ q: 'test'
145
+ });
146
+
147
+ // Assertions
148
+ expect(result).toBeDefined();
149
+ expect(result.content[0].text).toContain('...');
150
+ });
151
+ });
152
+ ```
153
+
154
+ ## Expected Outcomes
155
+
156
+ After completing all phases:
157
+ - ~78 new tests added (29 package + 24 organization + 18 datastore + 2 status + 6 unit = 79)
158
+ - Overall coverage increased from ~68% to 80%+
159
+ - All tool categories have integration tests
160
+ - Tests follow established patterns
161
+ - Tests documented in README
162
+ - CI passes (if configured)
@@ -0,0 +1,115 @@
1
+ # Proposal: Translate Project to English
2
+
3
+ **Status:** Completed
4
+ **Created:** 2026-01-08
5
+ **Author:** OpenCode
6
+ **Archived:** 2026-01-08 (as expand-test-coverage-specs)
7
+
8
+ ## Summary
9
+
10
+ Translate the CKAN MCP Server project documentation from Italian to English to improve accessibility and align with international open data standards.
11
+
12
+ ## Motivation
13
+
14
+ The CKAN MCP Server project is currently documented in Italian, which limits its accessibility to the global open data community. Since:
15
+ - CKAN is an international platform used by 500+ portals worldwide
16
+ - The MCP protocol and most technical documentation are in English
17
+ - The target audience (data scientists, developers, researchers) is primarily English-speaking
18
+ - The source code comments are already in English
19
+
20
+ Translating the documentation will:
21
+ - Lower adoption barriers for international users
22
+ - Improve discoverability through search engines
23
+ - Align with CKAN's global community
24
+ - Maintain consistency with the already-English codebase
25
+
26
+ ## Scope
27
+
28
+ ### Included
29
+ - **README.md**: Main project documentation (285 lines)
30
+ - **EXAMPLES.md**: Usage examples and workflows (427 lines)
31
+
32
+ ### Excluded
33
+ - Source code files (already in English)
34
+ - SKILL.md (English skill documentation)
35
+ - AGENTS.md, LOG.md, other internal docs
36
+ - Package metadata (package.json, package-lock.json)
37
+ - API/tool names (already English)
38
+ - User-facing tool outputs (already English)
39
+
40
+ ## Proposed Changes
41
+
42
+ ### Files to Translate
43
+
44
+ 1. **README.md**
45
+ - Project description and features
46
+ - Installation and usage instructions
47
+ - Tool descriptions and examples
48
+ - Troubleshooting guide
49
+ - Links and support section
50
+
51
+ 2. **EXAMPLES.md**
52
+ - Connection tests
53
+ - Italy-specific examples (dati.gov.it)
54
+ - USA examples (data.gov)
55
+ - Demo CKAN examples
56
+ - DataStore queries
57
+ - Advanced Solr queries
58
+ - Complete workflows
59
+
60
+ ### Translation Approach
61
+
62
+ - Direct translation maintaining technical accuracy
63
+ - Preserve all code examples (already in English)
64
+ - Keep Italian portal names, organization titles, and data values in Italian (e.g., "Regione Siciliana")
65
+ - Maintain structure and formatting
66
+ - Use official CKAN terminology (DataStore, faceting, Solr)
67
+ - Use ISO format for dates
68
+ - Keep current examples (Italy, USA, demo.ckan.org)
69
+
70
+ ## Alternatives Considered
71
+
72
+ 1. **Bilingual documentation**: Keep Italian and add English sections
73
+ - *Rejected*: Increases maintenance burden, creates version drift issues
74
+
75
+ 2. **Auto-translation tools only**: Use machine translation without review
76
+ - *Rejected*: Quality concerns, potential technical errors
77
+
78
+ 3. **No translation**: Keep Italian only
79
+ - *Rejected*: Limits project adoption and community growth
80
+
81
+ ## Impact Assessment
82
+
83
+ ### Benefits
84
+ - + Improved accessibility for international users
85
+ - + Better alignment with CKAN global community
86
+ - + Consistent language across code and documentation
87
+ - + Easier onboarding for new contributors
88
+
89
+ ### Risks
90
+ - - Loss of Italy-specific context in translation
91
+ - - Possible translation errors in technical terms
92
+ - - Need to maintain English for future updates
93
+
94
+ ### Mitigation
95
+ - Review all technical translations against CKAN API documentation
96
+ - Keep Italian portal names and organization titles in Italian
97
+ - Use official CKAN terminology for technical terms
98
+
99
+ ## Open Questions
100
+
101
+ None - clarified with project owner.
102
+
103
+ ## Dependencies
104
+
105
+ None - this is a documentation-only change with no code modifications.
106
+
107
+ ## Success Criteria
108
+
109
+ - [ ] README.md fully translated to English
110
+ - [ ] EXAMPLES.md fully translated to English
111
+ - [ ] All technical terms accurate and consistent with CKAN API docs
112
+ - [ ] Code examples unchanged
113
+ - [ ] Markdown formatting preserved
114
+ - [ ] No broken links or references
115
+ - [ ] Validation: `openspec validate translate-project-to-english --strict` passes
@@ -0,0 +1,32 @@
1
+ # Spec: Documentation Language
2
+
3
+ Defines the language requirements for project documentation.
4
+
5
+ ## ADDED Requirements
6
+
7
+ ### Requirement: Project documentation in English
8
+
9
+ The project SHALL provide all user-facing documentation in English to ensure accessibility for the international open data community.
10
+
11
+ #### Scenario: English documentation
12
+ Given a CKAN MCP Server project
13
+ When a user reads the documentation
14
+ Then the documentation is in English
15
+ And code examples are in English
16
+ And technical terms follow CKAN API terminology
17
+
18
+ ### Requirement: Preserve multilingual examples
19
+
20
+ The project SHALL preserve non-English portal names, organization titles, or data values in their original language to accurately reflect real-world CKAN portals.
21
+
22
+ #### Scenario: Italian portal example
23
+ Given an example using dati.gov.it
24
+ When the example references Italian organizations
25
+ Then organization names remain in Italian (e.g., "Regione Siciliana")
26
+ And descriptions are in English
27
+
28
+ #### Scenario: Non-English data values
29
+ Given an example query with data filters
30
+ When the data contains non-English values
31
+ Then those values are preserved in their original language
32
+ And the surrounding documentation explains the context in English
@@ -0,0 +1,115 @@
1
+ # Tasks: Translate Project to English
2
+
3
+ Ordered list of work items to translate the project documentation to English.
4
+
5
+ ## Phase 1: Preparation
6
+
7
+ - [x] Create backup copies of README.md and EXAMPLES.md
8
+ - [x] Review CKAN API documentation for standard English terminology
9
+ - [x] Identify technical terms requiring precise translation (e.g., "DataStore", "facet", "Solr")
10
+ - [x] Note any Italy-specific context to preserve (e.g., portal names, organization titles)
11
+
12
+ ## Phase 2: Translate README.md
13
+
14
+ - [x] Translate header and project description (lines 1-4)
15
+ - [x] Translate features section (lines 5-13)
16
+ - [x] Translate installation instructions (lines 15-26)
17
+ - [x] Translate usage section (lines 28-42)
18
+ - [x] Translate Claude Desktop configuration (lines 44-61)
19
+ - [x] Translate available tools section (lines 63-83)
20
+ - [x] Translate usage examples (lines 85-140)
21
+ - [x] Translate supported CKAN portals section (lines 142-152)
22
+ - [x] Translate advanced Solr queries section (lines 154-181)
23
+ - [x] Translate project structure section (lines 183-194)
24
+ - [x] Translate development section (lines 196-221)
25
+ - [x] Translate troubleshooting section (lines 223-252)
26
+ - [x] Translate contributing section (lines 254-262)
27
+ - [x] Translate license and useful links sections (lines 264-274)
28
+ - [x] Translate support section and footer (lines 276-285)
29
+ - [x] Verify all links remain functional
30
+ - [x] Check markdown formatting consistency
31
+
32
+ ## Phase 3: Translate EXAMPLES.md
33
+
34
+ - [x] Translate header and introduction (lines 1-4)
35
+ - [x] Translate connection tests section (lines 5-21)
36
+ - [x] Translate Italy examples header (line 23)
37
+ - [x] Translate recent datasets example (lines 25-33)
38
+ - [x] Translate COVID-19 datasets example (lines 35-42)
39
+ - [x] Translate Regione Siciliana datasets example (lines 44-52)
40
+ - [x] Translate organization search examples (lines 54-73)
41
+ - [x] Translate wildcard organization search example (lines 75-85)
42
+ - [x] Translate organization statistics examples (lines 87-95)
43
+ - [x] Translate format statistics example (lines 97-105)
44
+ - [x] Translate organization list example (lines 107-115)
45
+ - [x] Translate organization details example (lines 117-124)
46
+ - [x] Translate CSV datasets example (lines 126-133)
47
+ - [x] Translate USA examples header (line 135)
48
+ - [x] Translate government datasets example (lines 137-144)
49
+ - [x] Translate tag-based datasets example (lines 146-153)
50
+ - [x] Translate demo CKAN examples (lines 155-178)
51
+ - [x] Translate DataStore queries header (line 180)
52
+ - [x] Translate basic DataStore query example (lines 182-189)
53
+ - [x] Translate filtered DataStore query example (lines 191-201)
54
+ - [x] Translate sorted DataStore query example (lines 203-211)
55
+ - [x] Translate advanced Solr queries header (line 213)
56
+ - [x] Translate AND combination example (lines 215-222)
57
+ - [x] Translate OR combination example (lines 224-231)
58
+ - [x] Translate NOT exclusion example (lines 233-240)
59
+ - [x] Translate title search example (lines 242-249)
60
+ - [x] Translate description search example (lines 251-258)
61
+ - [x] Translate wildcard search example (lines 260-267)
62
+ - [x] Translate date range filter example (lines 269-276)
63
+ - [x] Translate recent datasets example (lines 278-286)
64
+ - [x] Translate complete workflows header (line 288)
65
+ - [x] Translate workflow 1: regional dataset analysis (lines 290-314)
66
+ - [x] Translate workflow 2: monitoring new publications (lines 316-334)
67
+ - [x] Translate workflow 3: data coverage analysis (lines 336-370)
68
+ - [x] Translate workflow 4: thematic search (lines 372-401)
69
+ - [x] Translate output formats section (lines 403-418)
70
+ - [x] Translate notes section (lines 420-427)
71
+ - [x] Verify all code examples unchanged
72
+ - [x] Check markdown formatting consistency
73
+
74
+ ## Phase 4: Review and Validation
75
+
76
+ - [x] Proofread README.md for English grammar and flow
77
+ - [x] Proofread EXAMPLES.md for English grammar and flow
78
+ - [x] Verify technical terminology matches CKAN API docs
79
+ - [x] Check all tool names are consistent with code
80
+ - [x] Ensure all URLs remain correct
81
+ - [x] Validate markdown syntax using a linter or manual check
82
+ - [x] Test all code examples for syntax errors
83
+ - [x] Confirm no Italian text remains in translated sections
84
+ - [x] Verify formatting, spacing, and indentation preserved
85
+ - [x] Check section headings follow markdown conventions
86
+
87
+ ## Phase 5: Documentation Updates
88
+
89
+ - [x] Update README.md to reflect English-only documentation
90
+ - [x] Update any references to Italian docs in project files
91
+ - [x] Update project.md if it references language conventions
92
+ - [x] Verify package.json metadata remains accurate
93
+ - [x] Add note about translation history if appropriate
94
+
95
+ ## Phase 6: Final Verification
96
+
97
+ - [x] Run `openspec validate translate-project-to-english --strict`
98
+ - [x] Resolve all validation errors
99
+ - [x] Final review of translated files
100
+ - [x] Prepare commit message (concise, following project conventions)
101
+
102
+ ## Dependencies
103
+
104
+ - All tasks in Phase 2 and Phase 3 can be done in parallel after Phase 1
105
+ - Phase 4 depends on completion of Phase 2 and Phase 3
106
+ - Phase 5 depends on completion of Phase 4
107
+ - Phase 6 is final verification, depends on all previous phases
108
+
109
+ ## Notes
110
+
111
+ - Preserve all Italian proper nouns (Regione Siciliana, Autorità Idrica Toscana, etc.)
112
+ - Keep all code examples and function names in English
113
+ - Maintain existing markdown structure and formatting
114
+ - Use standard English technical documentation style
115
+ - Refer to CKAN API docs (https://docs.ckan.org/en/latest/api/) for terminology