A small experimental Python client and agent-tool layer for exploring public data from data.gouv.fr.
The client calls the public data.gouv.fr APIs directly and provides Python methods plus OpenAI-compatible function schemas for dataset discovery, metadata, resources, downloads, and dataservices. It mirrors a subset of the read-only workflows available through the official data.gouv.fr MCP server, but it is not the official server and does not implement MCP transport.
Status: early prototype. Install from source; this project is not published on PyPI.
- Search datasets and dataservices.
- Read dataset, resource, and dataservice metadata.
- Download and parse CSV, TSV, JSON, JSONL, and Parquet resources.
- Generate OpenAI-compatible function definitions for agent loops.
- Register additional local tool runners.
- Build a small public-spending data demo from data.gouv.fr sources.
| Path | Purpose |
|---|---|
src/datagouv_client/ |
Python API client and agent-tool schemas |
examples/ |
Small Python usage examples |
scripts/ |
Data preparation and validation scripts |
app/ |
React public-spending demo using generated static JSON |
Python 3.13 and uv are recommended.
git clone https://github.com/offmann/datagouv-mcp-client.git
cd datagouv-mcp-client
uv syncfrom datagouv_client import DatagouvClient
client = DatagouvClient()
result = client.search_datasets("qualite de l'air")
print(result["datasets"][:3])
dataset = client.get_dataset_info("56fd8e8788ee387079c352f7")
print(dataset["title"], dataset["resources_count"])from datagouv_client import DatagouvClient
from datagouv_client.client import get_openai_tools, run_tool
client = DatagouvClient()
tools = get_openai_tools()
# Run a tool selected by an agent.
result = run_tool("search_datasets", {"query": "air quality"}, client)These are function-call schemas and local Python runners. To connect an MCP-compatible assistant directly to data.gouv.fr, use the official hosted endpoint:
https://mcp.data.gouv.fr/mcp
See datagouv/datagouv-mcp for supported clients and configuration.
The repository also contains a small React demonstration built from generated static JSON:
uv run python scripts/prepare_data.py
uv run python scripts/validate_data_contract.py
cd app
npm install
npm run devThe preparation pipeline records source provenance and falls back to configured direct URLs when resource metadata lookup fails. See docs/data_pipeline_modes.md.
- The client has no persistent cache.
- Downloads are held in memory while being parsed.
max_size_mbrejects resources after download when they exceed the configured limit.max_rowslimits parsed output; it does not limit network transfer size.
MIT