
MCP data.gouv.fr: querying French open data from Claude Code
The problem with French open data
data.gouv.fr hosts thousands of public datasets: elected officials, budgets, geography, transport, health, education. In practice, using them stays painful — twenty minutes navigating the interface, a CSV downloaded, opened in a spreadsheet, only to discover it's the wrong file or the format changed since the last update.
data.gouv.fr shipped an official MCP server. MCP (Model Context Protocol) is an open standard that plugs external data sources straight into an AI assistant: you ask the question in plain language in your terminal, and the AI digs through the datasets.
Setup
No repo to clone, no Docker, no API key. The server runs on a free public instance with no signup:
claude mcp add --transport http datagouv https://mcp.data.gouv.fr/mcp
The config lands in ~/.claude.json. Verify with claude mcp list: if datagouv shows up with http transport, you're set. Otherwise restart Claude Code fully — an /mcp reset isn't enough.
For Claude Desktop, Cursor, Windsurf or VS Code, you need npx mcp-remote as a wrapper:
{
"mcpServers": {
"datagouv": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://mcp.data.gouv.fr/mcp"]
}
}
}
The toolbox
Datasets
| Tool | What it does |
|---|---|
search_datasets | Keyword search |
get_dataset_info | Dataset metadata (title, licence, dates...) |
list_dataset_resources | Available files (CSV, JSON, XLS...) |
query_resource_data | Direct query on a CSV/XLSX via the Tabular API |
get_resource_info | Technical info (format, size, URL) |
download_and_parse_resource | Download and parse a JSON/JSONL |
query_resource_data is by far the most useful: query a 50,000-row CSV without downloading it, with filters (exact, contains, less, greater), sorting and pagination.
Dataservices (third-party APIs)
| Tool | What it does |
|---|---|
search_dataservices | Search registered APIs |
get_dataservice_info | API metadata (base URL, docs) |
get_dataservice_openapi_spec | OpenAPI spec to inspect the endpoints |
You can land on the Adresse API or the Sirene API and read their OpenAPI spec directly to understand how to call them, without going through third-party docs.
Metrics
A single tool, get_metrics: visit and download stats. Useful to tell whether a dataset is actively maintained or abandoned years ago.
A concrete case: validating elected-officials data
A JSON file of 581 deputy entries — names, departments, political groups — of uncertain freshness. Resignations, substitutes, name changes: parliament moves constantly.
search_datasets on "Répertoire National des Élus" immediately returns the Ministry of the Interior dataset, ID 5c34c4d1634f4173183a64f1 — the authoritative source. list_dataset_resources lists the files: deputies, senators, mayors, regional councillors, each with its ID, format and size.
query_resource_data on the deputies file returns 575 rows against 581 locally. Problem identified in 30 seconds, without opening anything.
The name-by-name comparison then surfaced: 4 entries that weren't deputies at all (former ministers left in the file), 13 deputies no longer in office, 21 missing, around sixty names with accents or hyphens differing from the official source, and 5 departments spelled "Reunion" instead of "La Réunion".
Half a day of manual cleanup reduced to twenty minutes of conversation.
The workflow
The pattern always repeats:
search_datasets -> get_dataset_info -> list_dataset_resources -> query_resource_data
Search with short keywords, identify the right dataset from its metadata, list the files, query with filters and pagination.
For third-party APIs, same logic in three steps:
search_dataservices -> get_dataservice_info -> get_dataservice_openapi_spec
The gotchas
Keywords require precision. "Assemblée nationale députés" works; "list of French deputies open data" returns nothing. The API does logical AND matching on terms: fewer words gives more results.
Start small. page_size=20 to discover the structure, then scale up. Asking for 500 rows straight away on an unknown dataset (36,000 postcodes, say) is wasted effort.
Large files aren't its strength. Beyond 1,000 rows, download_and_parse_resource beats paginating 50 times. Hard limit of 50 MB per file.
No auth. The public instance requires no key and no account. You just need an MCP client that handles streamable HTTP transport — native in Claude Code.
Metrics only work in production, not on the demo environment. Worth knowing if get_metrics returns errors.
Verdict
For working with French public data, it's a clear shortcut over manually browsing data.gouv.fr. It's a standard MCP server, so it works with Claude Code, Claude Desktop, Cursor, VS Code and Gemini CLI — thirty seconds to integrate into an existing MCP setup.
Project link: datagouv/datagouv-mcp on GitHub
Public instance: https://mcp.data.gouv.fr/mcp
Related articles