Skip to main content

ckanext-mcp

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.

How it works

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, search
  • ckan_resource — show, create, update, delete, patch, search
  • ckan_organization — show, list, create, update, delete, patch
  • ckan_tag — show, list, create, delete, search
  • ckan_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.

Installation

pip install ckanext-mcp

Add mcp to ckan.plugins in your ckan.ini or .env:

ckan.plugins = ... mcp

Configuration

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.

Client Setup

Generate a .mcp.json config for your MCP client:

ckan -c ckan.ini mcp init

This 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.

Authentication

The bridge piggybacks on CKAN's existing auth:

  • API token: pass in Authorization header — 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.

Search & Discovery

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.

MCP Protocol

  • 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

Development

git clone https://github.com/Mat-O-Lab/ckanext-mcp.git
cd ckanext-mcp
pip install -e .
pip install -r dev-requirements.txt

Run tests:

pytest --ckan-ini=test.ini ckanext/mcp

License

AGPL-3.0

Metadata

Release files for ckanext-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ckanext-mcp 0.1.0
File Size Uploaded Provenance Actions
ckanext_mcp-0.1.0.tar.gz 41.0 kB With provenance Details for ckanext_mcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ckanext-mcp 0.1.0
File Interpreter ABI Platform Actions
ckanext_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for ckanext_mcp-0.1.0-py3-none-any.whl

Total release size: 82.6 kB

Release files / ckanext_mcp-0.1.0.tar.gz

Download URL ckanext_mcp-0.1.0.tar.gz
Size 41.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d374175dc98e7bf99b0ee2bc8a893b73461de58ee9cef5fe699c2e20b00ed104
BLAKE2b-256 checksum
How to use checksums
51670f4d374632de0abcad327a5db4445f4251b224c3145ce22f81c6f5b0c74a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 28, 2026.

Transparency log

Release files / ckanext_mcp-0.1.0-py3-none-any.whl

Download URL ckanext_mcp-0.1.0-py3-none-any.whl
Size 41.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ce1da71a83086be1660898bee8627b648a83c6345a55c25dffa1897fa453d6d
BLAKE2b-256 checksum
How to use checksums
df3e59ef9e30270414b2faf9f11908ab0e780e859d99d19f5c0230b248ad5e89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 28, 2026.

Transparency log

Security for ckanext-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ckanext_mcp-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page