This is an example of a MCP CKAN Plugin that register tools to answer data based on Open Data.
- Init a package repository:
uv init --package mcp-ckan-exampleplugin- Define a
register_tools(mcp)function that register tools in a MCP Server:
def register_tools(mcp):
@mcp.tool()
def greetings_from_examplepythontools():
return "Hello from mcp_ckan_examplepythontools!"- Register a new
mcp_ckanentrypoint in thepyproject.tomlfile that calls theregister_toolsfunction.
[project.entry-points."mcp_ckan"]
mcp-ckan-examplepythontools = "mcp_ckan_examplepythontools:register_tools"- Install it in the same virtual environment as your server.
uv pip install "git+https://github.com/okfn/mcp-ckan"
uv pip install "git+https://github.com/okfn/mcp-ckan-examplepythontools"
uv run mcp-ckan