ckan-mcp-server

mjanez/ckan-mcp-server

3.2

If you are the rightful owner of ckan-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The CKAN-MCP-Server is a specialized server designed to facilitate the integration and management of data using the Model Context Protocol (MCP) within the CKAN data management system.

CKAN MCP Server

FastMCP Python

Smart MCP Agent for CKAN Open Data Portals

Semantic search, direct SQL queries, geospatial analysis, and advanced exploration of CKAN catalogs.

[!TIP] Recommended Test Portal: https://catalogo.datosabiertos.miteco.gob.es/catalogo

Key Features

  • Advanced semantic search with SOLR filters
  • Automatic detection of geospatial datasets (SHP, GeoJSON, WMS/WFS, etc.)
  • SQL queries on DataStore resources
  • Automatic inspection of portal schemas and capabilities
  • Data preview in Markdown table format
  • Smart caching and automatic retries for maximum stability
  • Full support for MCP resources (ckan://...)

Quick Installation

git clone https://github.com/mjanez/ckan-mcp-server.git
cd ckan-mcp-server
uv venv
source .venv/bin/activate    # Windows: .venv\Scripts\activate
uv pip install -e .

Optional Configuration (.env)

CKAN_URL=https://catalogo.datosabiertos.miteco.gob.es/catalogo
CKAN_API_KEY=                  # Only if you need authenticated actions
LOG_LEVEL=INFO

Usage

Development Mode (with Web Inspector)

uv run fastmcp dev src/server.py

The MCP Inspector will automatically open in your browser to test all tools.

Production Mode

uv run fastmcp run src/server.py

Claude Desktop Integration

Add one or more servers to the Claude Desktop configuration file:

{
  "mcpServers": {
    "ckan-miteco": {
      "command": "uv",
      "args": ["--directory", "/absolute/path/ckan-mcp-server", "run", "fastmcp", "run", "src/server.py"],
      "env": { "CKAN_URL": "https://catalogo.datosabiertos.miteco.gob.es/catalogo" }
    },
    "ckan-datosgob": {
      "command": "uv",
      "args": ["--directory", "/absolute/path/ckan-mcp-server", "run", "fastmcp", "run", "src/server.py"],
      "env": { "CKAN_URL": "https://datos.gob.es" }
    }
  }
}

Configuration paths:

  • macOS/Linux: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Available Tools

ToolDescription
search_datasetsAdvanced search with filters (formats, organization, geospatial only, etc.)
get_datasetsComplete dataset information
query_datastoreSQL queries on tabular resources
list_organizationsList of organizations with dataset counts
get_capabilitiesDetects active extensions (DataStore, Spatial, etc.)

MCP Resources

  • ckan://dataset/{id} → Complete dataset JSON
  • ckan://dataset/{id}/schema → DataStore Schemas
  • ckan://info → General portal information

Usage Examples with Claude

  • What datasets are available regarding air quality?
  • Search only for geospatial cadastre datasets
  • From resource 12345-abcd, execute: SELECT * FROM table WHERE year > 2020 LIMIT 20
  • Which organizations publish the most datasets?

Project

Key Technologies:

  • FastMCP v2.13+
  • ckanapi v4.7+
  • Pydantic v2
  • gettext
  • uv as package manager

Internationalization

The project uses gettext:

# Configure language (default is Spanish)
export CKAN_MCP_LANGUAGE=en  # English
export CKAN_MCP_LANGUAGE=es  # Spanish

# Compile translations (only if you modify .po files)
python src/i18n/compile.py

See src/i18n/README.md for more details.

Roadmap

  • Geospatial search by bounding box
  • Static map previews
  • Full DCAT-AP support and SPARQL queries
  • Automatic statistics on DataStore resources
  • Official Docker image
  • Tests + CI/CD

License

MIT © mjanez – see LICENSE

Acknowledgments

Recommended CKAN Portals for Testing


<div align="center"> <strong>Find this useful?</strong> → <a href="https://github.com/mjanez/ckan-mcp-server">Leave a ⭐ on GitHub!</a> </div>