ckan-mcp-server
AGENTS.md60 starsChanged 10 months agoMITView on GitHub
These instructions are for AI assistants working in this project. Always open @/openspec/AGENTS.md when the request: Use @/openspec/AGENTS.md to learn: Keep this managed block so 'openspec update' can refresh the instructions. Install: npm install Build: npm run build | npm run build:tsc | npm run build:worker Run: npm start | npm run dev | npm run watch | npm run dev:worker | npm run deploy Test: npm test | npm run test:watch | npm run test:coverage Single test: npm test…
- Sends data out
- Commits and pushes
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository4 other files it gives its agents.
- openspec/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- data-explorationSkill
- ckan-mcpSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
15 rules. About 0 are common, 3 are distinctive, and 12 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 6
Always open @/openspec/AGENTS.md when the request:
- Very specific: line 12
Use @/openspec/AGENTS.md to learn:
- Distinctive: line 18
Keep this managed block so 'openspec update' can refresh the instructions.
- Very specific: line 50
Before deploying, you can test the current dev build by pointing your MCP client at the Node entrypoint in dist/:
- Very specific: line 57
When creating issues with multi-line bodies, avoid literal \n in --body.
- Very specific: line 67
When writing GitHub release notes, avoid literal \n in --notes.
- Very specific: line 87
Use strict typing, avoid any unless from CKAN payloads.
- Very specific: line 91
Use import type for type-only imports.
- Very specific: line 103
Use ResponseFormat for markdown vs JSON.
- Very specific: line 111
Never use demo.ckan.org for tests.
- Distinctive: line 123
Before committing and pushing any locally testable change:
- Very specific: line 154
Always include both Content-Type: application/json and Accept: application/json, text/event-stream
- Very specific: line 155
Use node dist/index.js directly, not npm start
- Distinctive: line 156
Use port 3001 to avoid conflicts
- Very specific: line 172
Use direct resource URLs (http/https), not GitHub view/blob URLs.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- OPENSPEC:START -->OpenSpec Instructions
These instructions are for AI assistants working in this project.
Always open @/openspec/AGENTS.md when the request:
- Mentions planning or proposals (words like proposal, spec, change, plan)
- Introduces new capabilities, breaking changes, architecture shifts, or big performance/security work
- Sounds ambiguous and you need the authoritative spec before coding
Use @/openspec/AGENTS.md to learn:
- How to create and apply change proposals
- Spec format and conventions
- Project structure and guidelines
Keep this managed block so 'openspec update' can refresh the instructions.
<!-- OPENSPEC:END -->Agent Guide
Scope
- Repo:
ckan-mcp-server - Stack: Node.js + TypeScript (ESM)
- Tests: Vitest
- Build: esbuild
- Cloudflare Workers:
wrangler
Cursor and Copilot Rules
- No
.cursor/rules,.cursorrules, or.github/copilot-instructions.mdfound
Commands
Install: npm install
Build: npm run build | npm run build:tsc | npm run build:worker
Run: npm start | npm run dev | npm run watch | npm run dev:worker | npm run deploy
Test: npm test | npm run test:watch | npm run test:coverage
Single test: npm test -- tests/unit/http.test.ts | npm test -- -t "testName"
Local MCP Client Build Test
Before deploying, you can test the current dev build by pointing your MCP client at the Node entrypoint in dist/:
- Build:
npm run build - Example absolute path:
/home/aborruso/git/idee/ckan-mcp-server/dist/index.js(adjust to your local checkout)
GitHub CLI Notes
When creating issues with multi-line bodies, avoid literal \n in --body. Use a here-doc
or -F - to preserve newlines:
cat <<'EOF' | gh issue create --title "Title" --body-file - --repo ondata/ckan-mcp-server
Line 1
Line 2
EOFWhen writing GitHub release notes, avoid literal \n in --notes. Always pass a here-doc
via --notes-file - so line breaks render correctly:
cat <<'EOF' | gh release create v0.X.Y --title "v0.X.Y - Title" --notes-file -
## What's New
### Changes
- Item 1
- Item 2
### No Breaking Changes
- All existing functionality preserved
**Full Changelog**: https://github.com/ondata/ckan-mcp-server/compare/v0.X-1.Y...v0.X.Y
EOFTypeScript Style
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.
Import Conventions
Use import type for type-only imports. Group by kind: external, internal, types. Double quotes, relative paths.
Naming
camelCase vars/functions, PascalCase types/classes, UPPER_SNAKE_CASE constants. Tool names match MCP tool ids.
Error Handling
Wrap tool handlers in try/catch. Return { isError: true } for MCP errors. Include context, map HTTP errors to readable messages, preserve cause when rethrowing.
Tool Responses
Use ResponseFormat for markdown vs JSON. truncateText for large payloads. Pretty-print JSON, include structuredContent for JSON mode.
Testing Guidelines
Vitest with globals: true. Place tests in tests/unit or tests/integration. AAA pattern, mock via fixtures in tests/fixtures, descriptive names.
Test Targets
Never use demo.ckan.org for tests. Always use https://www.dati.gov.it/opendata.
Configuration
Node >=18. Worker build in wrangler.toml. Vitest coverage thresholds enforced.
Change Hygiene
Minimal focused diffs. No unrelated refactors. Update tests for behavior changes. Avoid editing dist/.
Pre-commit Checklist
Before committing and pushing any locally testable change:
- Build:
npm run build - Automated tests:
npm test— all must pass - Manual queries: run real requests against the built server to verify end-to-end behavior
How to run manual queries
# Terminal 1 — start server
TRANSPORT=http PORT=3001 node dist/index.js
# Terminal 2 — call a tool
curl -s -X POST http://localhost:3001/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc":"2.0",
"method":"tools/call",
"params":{
"name":"ckan_package_search",
"arguments":{
"server_url":"https://www.dati.gov.it/opendata",
"q":"ambiente",
"page":1,
"page_size":3
}
},
"id":1
}'- Always include both
Content-Type: application/jsonandAccept: application/json, text/event-stream - Use
node dist/index.jsdirectly, notnpm start - Use port 3001 to avoid conflicts
Project Layout
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.
CSV Data Exploration
For exploring CSV resources from datasets, use duckdb CLI (already installed) with direct HTTP URL:
duckdb -jsonlines -c "DESCRIBE SELECT * FROM read_csv('http://url/file.csv')"
duckdb -jsonlines -c "SUMMARIZE SELECT * FROM read_csv('http://url/file.csv')"
duckdb -jsonlines -c "SELECT * FROM read_csv('http://url/file.csv') USING SAMPLE 10"Use direct resource URLs (http/https), not GitHub view/blob URLs. The -jsonlines parameter outputs in JSONL format, easier for AI to parse.
For random sampling, use USING SAMPLE N syntax (where N is the number of rows):
duckdb -jsonlines -c "SELECT * FROM read_csv('http://url/file.csv') USING SAMPLE 10"Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

