MCP bridge for CKAN — exposes all API actions from CKAN core and installed extensions as MCP tools. LLMs act as the authenticated user, inheriting all CKAN permissions.
CKAN installations have ~200 API actions depending on installed extensions. Exposing all of them as flat MCP tools would overwhelm any LLM. Instead, ckanext-mcp builds ~25 synthetic entity tools at startup:
ckan_package— show, list, create, update, delete, patch, searchckan_resource— show, create, update, delete, patch, searchckan_organization— show, list, create, update, delete, patchckan_tag— show, list, create, delete, searchckan_search_tools— discover any of the ~200 actions by keyword, entity, or source- ... and more, derived automatically from installed plugins
Each entity tool bundles CRUD operations. The LLM passes an operation parameter to select the action:
{
"name": "ckan_package",
"arguments": {
"operation": "show",
"id": "my-dataset"
}
}Zero hardcoding — entity grouping derived from CKAN's naming convention (package_show → entity package), source from IActions plugin registry, read/write from side_effect_free attribute.
pip install ckanext-mcpAdd mcp to ckan.plugins in your ckan.ini or .env:
ckan.plugins = ... mcp
| Option | Default | Description |
|---|---|---|
ckanext.mcp.categories |
(empty) | Comma-separated entity or source filter (e.g. package,resource,harvest) |
The MCP endpoint is always available at /mcp.
Generate a .mcp.json config for your MCP client:
ckan -c ckan.ini mcp initThis creates .mcp.json:
{
"mcpServers": {
"ckan": {
"type": "http",
"url": "https://your-ckan.example.com/mcp",
"headers": {
"Authorization": "Bearer <YOUR_API_KEY>"
}
}
}
}Replace <YOUR_API_KEY> with your CKAN API key, then point your MCP client (Claude Code, Cursor, etc.) at this file.
The bridge piggybacks on CKAN's existing auth:
- API token: pass in
Authorizationheader — CKAN middleware resolves the user before the MCP endpoint runs - Session: browser-based MCP clients use the existing CKAN session
CKAN's action-level auth enforces all permissions. The LLM can only do what the authenticated user can do.
The ckan_search_tools tool lets the LLM discover actions beyond the default entity tools:
{
"name": "ckan_search_tools",
"arguments": {"entity": "harvest_source"}
}Returns full MCP definitions (name, description, inputSchema) for all matching actions — the LLM can then call them through their entity tool.
- Spec: 2025-11-25
- Transport: Streamable HTTP (JSON-RPC 2.0 over POST)
- Methods:
initialize,notifications/initialized,tools/list,tools/call - No external MCP dependencies — manual JSON-RPC implementation
git clone https://github.com/Mat-O-Lab/ckanext-mcp.git
cd ckanext-mcp
pip install -e .
pip install -r dev-requirements.txtRun tests:
pytest --ckan-ini=test.ini ckanext/mcpAGPL-3.0