@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,456 @@
1
+ # OpenSpec Instructions
2
+
3
+ Instructions for AI coding assistants using OpenSpec for spec-driven development.
4
+
5
+ ## TL;DR Quick Checklist
6
+
7
+ - Search existing work: `openspec spec list --long`, `openspec list` (use `rg` only for full-text search)
8
+ - Decide scope: new capability vs modify existing capability
9
+ - Pick a unique `change-id`: kebab-case, verb-led (`add-`, `update-`, `remove-`, `refactor-`)
10
+ - Scaffold: `proposal.md`, `tasks.md`, `design.md` (only if needed), and delta specs per affected capability
11
+ - Write deltas: use `## ADDED|MODIFIED|REMOVED|RENAMED Requirements`; include at least one `#### Scenario:` per requirement
12
+ - Validate: `openspec validate [change-id] --strict` and fix issues
13
+ - Request approval: Do not start implementation until proposal is approved
14
+
15
+ ## Three-Stage Workflow
16
+
17
+ ### Stage 1: Creating Changes
18
+ Create proposal when you need to:
19
+ - Add features or functionality
20
+ - Make breaking changes (API, schema)
21
+ - Change architecture or patterns
22
+ - Optimize performance (changes behavior)
23
+ - Update security patterns
24
+
25
+ Triggers (examples):
26
+ - "Help me create a change proposal"
27
+ - "Help me plan a change"
28
+ - "Help me create a proposal"
29
+ - "I want to create a spec proposal"
30
+ - "I want to create a spec"
31
+
32
+ Loose matching guidance:
33
+ - Contains one of: `proposal`, `change`, `spec`
34
+ - With one of: `create`, `plan`, `make`, `start`, `help`
35
+
36
+ Skip proposal for:
37
+ - Bug fixes (restore intended behavior)
38
+ - Typos, formatting, comments
39
+ - Dependency updates (non-breaking)
40
+ - Configuration changes
41
+ - Tests for existing behavior
42
+
43
+ **Workflow**
44
+ 1. Review `openspec/project.md`, `openspec list`, and `openspec list --specs` to understand current context.
45
+ 2. Choose a unique verb-led `change-id` and scaffold `proposal.md`, `tasks.md`, optional `design.md`, and spec deltas under `openspec/changes/<id>/`.
46
+ 3. Draft spec deltas using `## ADDED|MODIFIED|REMOVED Requirements` with at least one `#### Scenario:` per requirement.
47
+ 4. Run `openspec validate <id> --strict` and resolve any issues before sharing the proposal.
48
+
49
+ ### Stage 2: Implementing Changes
50
+ Track these steps as TODOs and complete them one by one.
51
+ 1. **Read proposal.md** - Understand what's being built
52
+ 2. **Read design.md** (if exists) - Review technical decisions
53
+ 3. **Read tasks.md** - Get implementation checklist
54
+ 4. **Implement tasks sequentially** - Complete in order
55
+ 5. **Confirm completion** - Ensure every item in `tasks.md` is finished before updating statuses
56
+ 6. **Update checklist** - After all work is done, set every task to `- [x]` so the list reflects reality
57
+ 7. **Approval gate** - Do not start implementation until the proposal is reviewed and approved
58
+
59
+ ### Stage 3: Archiving Changes
60
+ After deployment, create separate PR to:
61
+ - Move `changes/[name]/` → `changes/archive/YYYY-MM-DD-[name]/`
62
+ - Update `specs/` if capabilities changed
63
+ - Use `openspec archive <change-id> --skip-specs --yes` for tooling-only changes (always pass the change ID explicitly)
64
+ - Run `openspec validate --strict` to confirm the archived change passes checks
65
+
66
+ ## Before Any Task
67
+
68
+ **Context Checklist:**
69
+ - [ ] Read relevant specs in `specs/[capability]/spec.md`
70
+ - [ ] Check pending changes in `changes/` for conflicts
71
+ - [ ] Read `openspec/project.md` for conventions
72
+ - [ ] Run `openspec list` to see active changes
73
+ - [ ] Run `openspec list --specs` to see existing capabilities
74
+
75
+ **Before Creating Specs:**
76
+ - Always check if capability already exists
77
+ - Prefer modifying existing specs over creating duplicates
78
+ - Use `openspec show [spec]` to review current state
79
+ - If request is ambiguous, ask 1–2 clarifying questions before scaffolding
80
+
81
+ ### Search Guidance
82
+ - Enumerate specs: `openspec spec list --long` (or `--json` for scripts)
83
+ - Enumerate changes: `openspec list` (or `openspec change list --json` - deprecated but available)
84
+ - Show details:
85
+ - Spec: `openspec show <spec-id> --type spec` (use `--json` for filters)
86
+ - Change: `openspec show <change-id> --json --deltas-only`
87
+ - Full-text search (use ripgrep): `rg -n "Requirement:|Scenario:" openspec/specs`
88
+
89
+ ## Quick Start
90
+
91
+ ### CLI Commands
92
+
93
+ ```bash
94
+ # Essential commands
95
+ openspec list # List active changes
96
+ openspec list --specs # List specifications
97
+ openspec show [item] # Display change or spec
98
+ openspec validate [item] # Validate changes or specs
99
+ openspec archive <change-id> [--yes|-y] # Archive after deployment (add --yes for non-interactive runs)
100
+
101
+ # Project management
102
+ openspec init [path] # Initialize OpenSpec
103
+ openspec update [path] # Update instruction files
104
+
105
+ # Interactive mode
106
+ openspec show # Prompts for selection
107
+ openspec validate # Bulk validation mode
108
+
109
+ # Debugging
110
+ openspec show [change] --json --deltas-only
111
+ openspec validate [change] --strict
112
+ ```
113
+
114
+ ### Command Flags
115
+
116
+ - `--json` - Machine-readable output
117
+ - `--type change|spec` - Disambiguate items
118
+ - `--strict` - Comprehensive validation
119
+ - `--no-interactive` - Disable prompts
120
+ - `--skip-specs` - Archive without spec updates
121
+ - `--yes`/`-y` - Skip confirmation prompts (non-interactive archive)
122
+
123
+ ## Directory Structure
124
+
125
+ ```
126
+ openspec/
127
+ ├── project.md # Project conventions
128
+ ├── specs/ # Current truth - what IS built
129
+ │ └── [capability]/ # Single focused capability
130
+ │ ├── spec.md # Requirements and scenarios
131
+ │ └── design.md # Technical patterns
132
+ ├── changes/ # Proposals - what SHOULD change
133
+ │ ├── [change-name]/
134
+ │ │ ├── proposal.md # Why, what, impact
135
+ │ │ ├── tasks.md # Implementation checklist
136
+ │ │ ├── design.md # Technical decisions (optional; see criteria)
137
+ │ │ └── specs/ # Delta changes
138
+ │ │ └── [capability]/
139
+ │ │ └── spec.md # ADDED/MODIFIED/REMOVED
140
+ │ └── archive/ # Completed changes
141
+ ```
142
+
143
+ ## Creating Change Proposals
144
+
145
+ ### Decision Tree
146
+
147
+ ```
148
+ New request?
149
+ ├─ Bug fix restoring spec behavior? → Fix directly
150
+ ├─ Typo/format/comment? → Fix directly
151
+ ├─ New feature/capability? → Create proposal
152
+ ├─ Breaking change? → Create proposal
153
+ ├─ Architecture change? → Create proposal
154
+ └─ Unclear? → Create proposal (safer)
155
+ ```
156
+
157
+ ### Proposal Structure
158
+
159
+ 1. **Create directory:** `changes/[change-id]/` (kebab-case, verb-led, unique)
160
+
161
+ 2. **Write proposal.md:**
162
+ ```markdown
163
+ # Change: [Brief description of change]
164
+
165
+ ## Why
166
+ [1-2 sentences on problem/opportunity]
167
+
168
+ ## What Changes
169
+ - [Bullet list of changes]
170
+ - [Mark breaking changes with **BREAKING**]
171
+
172
+ ## Impact
173
+ - Affected specs: [list capabilities]
174
+ - Affected code: [key files/systems]
175
+ ```
176
+
177
+ 3. **Create spec deltas:** `specs/[capability]/spec.md`
178
+ ```markdown
179
+ ## ADDED Requirements
180
+ ### Requirement: New Feature
181
+ The system SHALL provide...
182
+
183
+ #### Scenario: Success case
184
+ - **WHEN** user performs action
185
+ - **THEN** expected result
186
+
187
+ ## MODIFIED Requirements
188
+ ### Requirement: Existing Feature
189
+ [Complete modified requirement]
190
+
191
+ ## REMOVED Requirements
192
+ ### Requirement: Old Feature
193
+ **Reason**: [Why removing]
194
+ **Migration**: [How to handle]
195
+ ```
196
+ If multiple capabilities are affected, create multiple delta files under `changes/[change-id]/specs/<capability>/spec.md`—one per capability.
197
+
198
+ 4. **Create tasks.md:**
199
+ ```markdown
200
+ ## 1. Implementation
201
+ - [ ] 1.1 Create database schema
202
+ - [ ] 1.2 Implement API endpoint
203
+ - [ ] 1.3 Add frontend component
204
+ - [ ] 1.4 Write tests
205
+ ```
206
+
207
+ 5. **Create design.md when needed:**
208
+ Create `design.md` if any of the following apply; otherwise omit it:
209
+ - Cross-cutting change (multiple services/modules) or a new architectural pattern
210
+ - New external dependency or significant data model changes
211
+ - Security, performance, or migration complexity
212
+ - Ambiguity that benefits from technical decisions before coding
213
+
214
+ Minimal `design.md` skeleton:
215
+ ```markdown
216
+ ## Context
217
+ [Background, constraints, stakeholders]
218
+
219
+ ## Goals / Non-Goals
220
+ - Goals: [...]
221
+ - Non-Goals: [...]
222
+
223
+ ## Decisions
224
+ - Decision: [What and why]
225
+ - Alternatives considered: [Options + rationale]
226
+
227
+ ## Risks / Trade-offs
228
+ - [Risk] → Mitigation
229
+
230
+ ## Migration Plan
231
+ [Steps, rollback]
232
+
233
+ ## Open Questions
234
+ - [...]
235
+ ```
236
+
237
+ ## Spec File Format
238
+
239
+ ### Critical: Scenario Formatting
240
+
241
+ **CORRECT** (use #### headers):
242
+ ```markdown
243
+ #### Scenario: User login success
244
+ - **WHEN** valid credentials provided
245
+ - **THEN** return JWT token
246
+ ```
247
+
248
+ **WRONG** (don't use bullets or bold):
249
+ ```markdown
250
+ - **Scenario: User login** ❌
251
+ **Scenario**: User login ❌
252
+ ### Scenario: User login ❌
253
+ ```
254
+
255
+ Every requirement MUST have at least one scenario.
256
+
257
+ ### Requirement Wording
258
+ - Use SHALL/MUST for normative requirements (avoid should/may unless intentionally non-normative)
259
+
260
+ ### Delta Operations
261
+
262
+ - `## ADDED Requirements` - New capabilities
263
+ - `## MODIFIED Requirements` - Changed behavior
264
+ - `## REMOVED Requirements` - Deprecated features
265
+ - `## RENAMED Requirements` - Name changes
266
+
267
+ Headers matched with `trim(header)` - whitespace ignored.
268
+
269
+ #### When to use ADDED vs MODIFIED
270
+ - ADDED: Introduces a new capability or sub-capability that can stand alone as a requirement. Prefer ADDED when the change is orthogonal (e.g., adding "Slash Command Configuration") rather than altering the semantics of an existing requirement.
271
+ - MODIFIED: Changes the behavior, scope, or acceptance criteria of an existing requirement. Always paste the full, updated requirement content (header + all scenarios). The archiver will replace the entire requirement with what you provide here; partial deltas will drop previous details.
272
+ - RENAMED: Use when only the name changes. If you also change behavior, use RENAMED (name) plus MODIFIED (content) referencing the new name.
273
+
274
+ Common pitfall: Using MODIFIED to add a new concern without including the previous text. This causes loss of detail at archive time. If you aren’t explicitly changing the existing requirement, add a new requirement under ADDED instead.
275
+
276
+ Authoring a MODIFIED requirement correctly:
277
+ 1) Locate the existing requirement in `openspec/specs/<capability>/spec.md`.
278
+ 2) Copy the entire requirement block (from `### Requirement: ...` through its scenarios).
279
+ 3) Paste it under `## MODIFIED Requirements` and edit to reflect the new behavior.
280
+ 4) Ensure the header text matches exactly (whitespace-insensitive) and keep at least one `#### Scenario:`.
281
+
282
+ Example for RENAMED:
283
+ ```markdown
284
+ ## RENAMED Requirements
285
+ - FROM: `### Requirement: Login`
286
+ - TO: `### Requirement: User Authentication`
287
+ ```
288
+
289
+ ## Troubleshooting
290
+
291
+ ### Common Errors
292
+
293
+ **"Change must have at least one delta"**
294
+ - Check `changes/[name]/specs/` exists with .md files
295
+ - Verify files have operation prefixes (## ADDED Requirements)
296
+
297
+ **"Requirement must have at least one scenario"**
298
+ - Check scenarios use `#### Scenario:` format (4 hashtags)
299
+ - Don't use bullet points or bold for scenario headers
300
+
301
+ **Silent scenario parsing failures**
302
+ - Exact format required: `#### Scenario: Name`
303
+ - Debug with: `openspec show [change] --json --deltas-only`
304
+
305
+ ### Validation Tips
306
+
307
+ ```bash
308
+ # Always use strict mode for comprehensive checks
309
+ openspec validate [change] --strict
310
+
311
+ # Debug delta parsing
312
+ openspec show [change] --json | jq '.deltas'
313
+
314
+ # Check specific requirement
315
+ openspec show [spec] --json -r 1
316
+ ```
317
+
318
+ ## Happy Path Script
319
+
320
+ ```bash
321
+ # 1) Explore current state
322
+ openspec spec list --long
323
+ openspec list
324
+ # Optional full-text search:
325
+ # rg -n "Requirement:|Scenario:" openspec/specs
326
+ # rg -n "^#|Requirement:" openspec/changes
327
+
328
+ # 2) Choose change id and scaffold
329
+ CHANGE=add-two-factor-auth
330
+ mkdir -p openspec/changes/$CHANGE/{specs/auth}
331
+ printf "## Why\n...\n\n## What Changes\n- ...\n\n## Impact\n- ...\n" > openspec/changes/$CHANGE/proposal.md
332
+ printf "## 1. Implementation\n- [ ] 1.1 ...\n" > openspec/changes/$CHANGE/tasks.md
333
+
334
+ # 3) Add deltas (example)
335
+ cat > openspec/changes/$CHANGE/specs/auth/spec.md << 'EOF'
336
+ ## ADDED Requirements
337
+ ### Requirement: Two-Factor Authentication
338
+ Users MUST provide a second factor during login.
339
+
340
+ #### Scenario: OTP required
341
+ - **WHEN** valid credentials are provided
342
+ - **THEN** an OTP challenge is required
343
+ EOF
344
+
345
+ # 4) Validate
346
+ openspec validate $CHANGE --strict
347
+ ```
348
+
349
+ ## Multi-Capability Example
350
+
351
+ ```
352
+ openspec/changes/add-2fa-notify/
353
+ ├── proposal.md
354
+ ├── tasks.md
355
+ └── specs/
356
+ ├── auth/
357
+ │ └── spec.md # ADDED: Two-Factor Authentication
358
+ └── notifications/
359
+ └── spec.md # ADDED: OTP email notification
360
+ ```
361
+
362
+ auth/spec.md
363
+ ```markdown
364
+ ## ADDED Requirements
365
+ ### Requirement: Two-Factor Authentication
366
+ ...
367
+ ```
368
+
369
+ notifications/spec.md
370
+ ```markdown
371
+ ## ADDED Requirements
372
+ ### Requirement: OTP Email Notification
373
+ ...
374
+ ```
375
+
376
+ ## Best Practices
377
+
378
+ ### Simplicity First
379
+ - Default to <100 lines of new code
380
+ - Single-file implementations until proven insufficient
381
+ - Avoid frameworks without clear justification
382
+ - Choose boring, proven patterns
383
+
384
+ ### Complexity Triggers
385
+ Only add complexity with:
386
+ - Performance data showing current solution too slow
387
+ - Concrete scale requirements (>1000 users, >100MB data)
388
+ - Multiple proven use cases requiring abstraction
389
+
390
+ ### Clear References
391
+ - Use `file.ts:42` format for code locations
392
+ - Reference specs as `specs/auth/spec.md`
393
+ - Link related changes and PRs
394
+
395
+ ### Capability Naming
396
+ - Use verb-noun: `user-auth`, `payment-capture`
397
+ - Single purpose per capability
398
+ - 10-minute understandability rule
399
+ - Split if description needs "AND"
400
+
401
+ ### Change ID Naming
402
+ - Use kebab-case, short and descriptive: `add-two-factor-auth`
403
+ - Prefer verb-led prefixes: `add-`, `update-`, `remove-`, `refactor-`
404
+ - Ensure uniqueness; if taken, append `-2`, `-3`, etc.
405
+
406
+ ## Tool Selection Guide
407
+
408
+ | Task | Tool | Why |
409
+ |------|------|-----|
410
+ | Find files by pattern | Glob | Fast pattern matching |
411
+ | Search code content | Grep | Optimized regex search |
412
+ | Read specific files | Read | Direct file access |
413
+ | Explore unknown scope | Task | Multi-step investigation |
414
+
415
+ ## Error Recovery
416
+
417
+ ### Change Conflicts
418
+ 1. Run `openspec list` to see active changes
419
+ 2. Check for overlapping specs
420
+ 3. Coordinate with change owners
421
+ 4. Consider combining proposals
422
+
423
+ ### Validation Failures
424
+ 1. Run with `--strict` flag
425
+ 2. Check JSON output for details
426
+ 3. Verify spec file format
427
+ 4. Ensure scenarios properly formatted
428
+
429
+ ### Missing Context
430
+ 1. Read project.md first
431
+ 2. Check related specs
432
+ 3. Review recent archives
433
+ 4. Ask for clarification
434
+
435
+ ## Quick Reference
436
+
437
+ ### Stage Indicators
438
+ - `changes/` - Proposed, not yet built
439
+ - `specs/` - Built and deployed
440
+ - `archive/` - Completed changes
441
+
442
+ ### File Purposes
443
+ - `proposal.md` - Why and what
444
+ - `tasks.md` - Implementation steps
445
+ - `design.md` - Technical decisions
446
+ - `spec.md` - Requirements and behavior
447
+
448
+ ### CLI Essentials
449
+ ```bash
450
+ openspec list # What's in progress?
451
+ openspec show [item] # View details
452
+ openspec validate --strict # Is it correct?
453
+ openspec archive <change-id> [--yes|-y] # Mark complete (add --yes for automation)
454
+ ```
455
+
456
+ Remember: Specs are truth. Changes are proposals. Keep them in sync.
@@ -0,0 +1,115 @@
1
+ # Design: MCP Resource Templates
2
+
3
+ ## Context
4
+
5
+ MCP protocol supports two primitives:
6
+ - **Tools**: Functions that perform actions (current implementation)
7
+ - **Resources**: Data that can be read directly (to be added)
8
+
9
+ The `@modelcontextprotocol/sdk` provides `server.registerResourceTemplate()` for dynamic resources with URI templates.
10
+
11
+ ## Goals / Non-Goals
12
+
13
+ ### Goals
14
+ - Expose CKAN data as MCP resources using `ckan://` URI scheme
15
+ - Support dataset, resource, and organization access
16
+ - Reuse existing `makeCkanRequest()` for CKAN API calls
17
+ - Maintain consistency with tool output formats
18
+
19
+ ### Non-Goals
20
+ - Write operations (resources are read-only by design)
21
+ - Caching implementation (defer to future enhancement)
22
+ - Authentication support (public endpoints only, same as tools)
23
+ - Real-time subscriptions (defer to future enhancement)
24
+
25
+ ## Decisions
26
+
27
+ ### URI Scheme Design
28
+
29
+ **Decision**: Use `ckan://{server}/type/{id}` pattern
30
+
31
+ ```
32
+ ckan://dati.gov.it/dataset/vaccini-covid
33
+ ckan://data.gov/resource/abc-123
34
+ ckan://demo.ckan.org/organization/sample-org
35
+ ```
36
+
37
+ **Rationale**:
38
+ - Server in hostname position enables multi-server support
39
+ - Type in path makes intent clear
40
+ - ID as final segment matches REST conventions
41
+
42
+ **Alternatives considered**:
43
+ 1. `ckan://dataset/{server}/{id}` - rejected: server as path segment is unusual
44
+ 2. `ckan+https://{server}/...` - rejected: overly complex
45
+ 3. Query parameters `ckan://data?server=...&id=...` - rejected: less readable
46
+
47
+ ### Module Structure
48
+
49
+ **Decision**: Create `src/resources/` directory with one file per resource type
50
+
51
+ ```
52
+ src/resources/
53
+ ├── index.ts # Export registerAllResources()
54
+ ├── dataset.ts # ckan://{server}/dataset/{id}
55
+ ├── resource.ts # ckan://{server}/resource/{id}
56
+ └── organization.ts # ckan://{server}/organization/{name}
57
+ ```
58
+
59
+ **Rationale**: Mirrors existing `src/tools/` structure for consistency.
60
+
61
+ ### URI Parsing
62
+
63
+ **Decision**: Extract server from URI hostname, type and ID from path
64
+
65
+ ```typescript
66
+ function parseResourceUri(uri: URL): { server: string; type: string; id: string } {
67
+ const server = uri.hostname;
68
+ const [, type, id] = uri.pathname.split('/');
69
+ return { server: `https://${server}`, type, id };
70
+ }
71
+ ```
72
+
73
+ **Rationale**: Simple parsing, assumes HTTPS (most CKAN servers use it).
74
+
75
+ ### Response Format
76
+
77
+ **Decision**: Return JSON by default (no markdown option for resources)
78
+
79
+ **Rationale**:
80
+ - Resources are meant for programmatic access
81
+ - LLMs can interpret JSON directly
82
+ - Keeps implementation simple
83
+ - Tools still support markdown for interactive use
84
+
85
+ ## Risks / Trade-offs
86
+
87
+ | Risk | Mitigation |
88
+ |------|------------|
89
+ | SDK API changes | Pin SDK version, test before updates |
90
+ | URI parsing edge cases | Validate URIs before processing |
91
+ | Large responses | Apply existing `CHARACTER_LIMIT` truncation |
92
+ | Server unreachable | Same error handling as tools |
93
+
94
+ ## Migration Plan
95
+
96
+ 1. Add resources alongside existing tools (no breaking changes)
97
+ 2. Resources are additive - tools remain fully functional
98
+ 3. No migration needed for existing users
99
+
100
+ ## Implementation Sequence
101
+
102
+ 1. Create `src/resources/` directory structure
103
+ 2. Implement URI parsing utility
104
+ 3. Implement dataset resource template
105
+ 4. Implement resource resource template
106
+ 5. Implement organization resource template
107
+ 6. Register resources in `src/index.ts`
108
+ 7. Add tests for resource handlers
109
+ 8. Update documentation
110
+
111
+ ## Open Questions
112
+
113
+ 1. Should resources support `response_format` parameter like tools?
114
+ 2. Should we add `ckan://{server}/search?q=...` for search results as resource?
115
+ 3. How to handle CKAN servers that require `www.` prefix (e.g., dati.gov.it)?
@@ -0,0 +1,52 @@
1
+ # Change: Add MCP Resource Templates
2
+
3
+ ## Why
4
+
5
+ MCP has two primitives for exposing data: **Tools** (functions) and **Resources** (data). Currently we only expose tools. Adding resources enables:
6
+
7
+ 1. Direct data access without tool calls
8
+ 2. Native caching and subscription support
9
+ 3. Better LLM context injection
10
+ 4. Alignment with MCP best practices (see Data.gov MCP server pattern)
11
+
12
+ ## What Changes
13
+
14
+ - Add MCP Resource Templates using RFC 6570 URI syntax
15
+ - Implement `ckan://` URI scheme for dataset and resource access
16
+ - Create new module `src/resources/` for resource handlers
17
+ - Register resources alongside existing tools
18
+
19
+ **New URI templates**:
20
+ - `ckan://{server}/dataset/{id}` - Dataset metadata
21
+ - `ckan://{server}/resource/{id}` - Resource metadata and download URL
22
+ - `ckan://{server}/organization/{name}` - Organization details
23
+
24
+ ## Impact
25
+
26
+ - Affected specs: New capability `mcp-resources`
27
+ - Affected code:
28
+ - `src/index.ts` - import and register resources
29
+ - `src/resources/` - new directory with resource handlers
30
+ - `src/utils/http.ts` - may need minor adjustments
31
+ - No breaking changes to existing tools
32
+ - Dependencies: No new dependencies required
33
+
34
+ ## Benefits
35
+
36
+ | Aspect | Current (Tools) | With Resources |
37
+ |--------|-----------------|----------------|
38
+ | Data access | Tool call required | Direct read |
39
+ | Caching | Manual | MCP native |
40
+ | Subscriptions | Not supported | Supported |
41
+ | Context loading | Via tool results | Direct injection |
42
+
43
+ ## Risks
44
+
45
+ - **URI parsing complexity**: Need to handle `ckan://` scheme correctly
46
+ - **Error handling**: Different pattern than tools
47
+ - **Testing**: New test patterns needed for resources
48
+
49
+ ## References
50
+
51
+ - [MCP Resources Specification](https://modelcontextprotocol.io/specification/2025-11-25)
52
+ - [Data.gov MCP Server](https://skywork.ai/skypage/en/unlocking-government-data-mcp-server/1980445961155629056) - uses `datagov://` scheme