Fonsora
Search public datasets by topic, inspect sources and reuse terms, and retrieve open CSV or Parquet files with SHA-256 checksums.
Hosted MCP Server
npx add-mcp 'https://fonsora.net/mcp'Installs into Claude Code, Codex, Cursor and more
Documentation
Agent quickstart
Find an edition, check its terms and verify a file. The public catalog accepts requests without an API key.
Connect an agent
Add https://fonsora.net/mcp as a remote MCP server using Streamable HTTP. Use search_editions to find identifiers, get_edition for source metadata, get_manifest for terms and downloads, get_rows to read open observations, and get_values to count the values in a column.
In an annotated CSV schema field, x-fonsora-semantic gives the logical type and its evidence basis. A fixed unit appears as unit. When unitField is present, read that column alongside each measurement. Follow unitValues to see the units in the edition.
Use get_schema to list CSV fields in order and get_profile to check one field’s empty cells, distinct nonempty values and numeric bounds. Open manifests also link to the schema and each field links to its profile. Inspect the solar capacity schema.
For HTTP clients, start with the API index or import the OpenAPI description.
Python’s urllib.request can POST to https://fonsora.net/mcp with its default User-Agent. For direct catalog and file requests, the Python example sends an application name and version.
Find an edition
Set limit=0 to count matches and see collection and access counts before fetching records. Search also returns X-Total-Count on HEAD. Count editions with at least ten observations.
Search the metadata and follow the response’s next link for more results. Use access=open to find files with direct download access. Each edition lists its own reuse terms.
curl -fsSG 'https://fonsora.net/data/catalog.json' \
-d view=search --data-urlencode 'q=solar generation' \
-d access=open -d limit=5 -d fields=identifier,name,url
Query observations across columns
Pass a JSON object in the query parameter of view=rows, or pass the object directly to the MCP tool get_rows. A where array combines up to eight conditions. Use exact eq, case-insensitive prefix or contains, or typed gte and lte bounds. The query runs before paging and export.
{
"where": [
{
"column": "geography",
"op": "prefix",
"value": "brit"
},
{
"column": "unit",
"op": "eq",
"value": "people"
}
],
"latest": {
"per": [
"geography",
"unit"
],
"period": "period",
"count": 2
},
"aggregate": {
"by": [
"geography",
"unit"
],
"measure": "value"
},
"orderBy": [
{
"column": "numericCount",
"direction": "desc",
"as": "number"
},
{
"column": "geography",
"direction": "asc"
}
]
}
Run this employment query. It selects records in people, keeps the two most recent rows per geography and unit, and returns row count, numeric count and exact numeric bounds. Group comparable measures and units together. Bounds preserve the source spelling. An empty bound means the group has no numeric observations.
Latest ranks calendar periods by end then start and fiscal years by labelled year. Use a consistent reporting convention within each group. Ties retain source order. Read the latest fiscal-year operating expenses for each federal port series. Order results by up to eight text, number or period fields, each ascending or descending. Invalid typed sort values come last. Project source fields or grouped fields using fields, then follow the pinned CSV or NDJSON export.
Find places, fields and editions
Find British Columbia in French. Follow its editions link, or pass geo=CA-BC to search. The bbox filter compares a west,south,east,north rectangle in OGC:CRS84 to generalized regional bounds from Natural Earth. Coverage comes from exact geographic labels in open editions. For individual observation points, pass bbox inside the row query. This requires a checksum-pinned schema with x-fonsora-spatial declaring longitude, latitude and the geographic coordinate reference system.
Use lang=fr or lang=en on a schema. Add q to search the original column names and available bilingual labels. The response retains the complete column order and includes matching names in x-fonsora-field-matches.
Request view=batch with ids as a JSON array of up to 20 edition identifiers. Each result has its own status. Agreement editions point to the terms page. Use view=versions with one edition ID for its current file pair and any predecessor attested in the pinned lineage. The two directional links identify file revisions. For an older snapshot, follow its version link or supply its CSV and Parquet checksums in revision. Read the November 28 construction employment version record. The manifest supplies current download URLs.
Analyze and sync observations
Pass an operation in spec to view=analysis or use get_analysis in MCP. For paged operations, follow next to keep the source checksum. The cube operation returns one JSON-stat document.
Find series and combinations
List series keys. Find observed geography and unit combinations. Each tuple includes an observation count. Use a where condition to restrict the inventory.
Resolve codes and joins
Read the status dictionary. Inspect verified primary and foreign keys. Code lists have English and French labels and a source snapshot hash. Follow x-fonsora-resources to resolve each foreign key.
Select and sample observations
Sample three observations from two provinces. The sample uses the seed and CSV checksum, without replacement. Use a status, symbol or security label from its dictionary.
Filter aggregate results
Keep groups with at least ten observations. The having conditions run after grouping.
Inspect the distribution
Get P10, median and P90. Count observations in numeric bins. Percentiles use nearest rank and preserve the observed decimal spelling. Bin counts include the final upper edge and report missing and out-of-range values separately.
Change the time scale
Calculate annual means. Select sum, mean or last and a target quarter or year. The rollup checks declared reporting intervals and rejects a source period that spans more than one target bucket. Totals cover the released sample. Each result reports numeric and observed counts. Compare with the same period last year. Fiscal-year labels can also be compared year over year. Compare airport inspection device uptake by fiscal year. Calendar rollups require a calendar period. Percentage changes and means round to twelve fractional places. Missing comparisons and zero denominators return null.
Get a statistical cube
Download a JSON-stat table. Choose dimensions that uniquely identify each cell. The response preserves category order, empty observations and sparse cells. Narrow large cubes using where.
Resolve a vintage and sync changes
Look up the December 1 file vintage. The response identifies the latest retained release manifest at or before the supplied UTC time. If the dated files have been withdrawn, the HTTP 410 response still includes their checksums and version link. Start a row-level sync. For incremental sync, pass the preceding CSV checksum from the versions view. Changes to newly populated or removed columns count as revisions by default. Select mode=sharedFields to compare only shared observation fields. Removed rows are counted.
Read notes and scheduled releases
Read hospital observation scope notes. Read announced Labour Force Survey dates. Notes refer to a particular source row. Calendar dates are taken from published source schedules. nextRelease holds the next announced event and is null when no future date is recorded. next links to another results page.
Traverse places and download files
Traverse the city of Calgary or the Calgary census metropolitan area. Both lead to Alberta and Canada. Follow the editions link for a search that includes descendants. Prepare a CSV and Parquet ZIP. Follow download to retrieve files, hashes, credits and terms. Up to twelve distinct open editions and 8 MiB of source files fit in one bundle. A missing or agreement-only selection prevents the download.
Crawl the download index
Open the file index (JSON) to get edition identifiers, terms, file sizes, checksums and download links in one page. You can add a search term, a collection, or access=open. Follow next to continue in identifier order. In MCP, call search_editions with the same fields and pass the last identifier as after.
For open files, save the ETag alongside a verified download. Use If-None-Match to check it again. To finish a partial file, send Range and the same strong ETag in If-Range. Append bytes only on HTTP 206 with the expected range. Replace the partial copy on HTTP 200 and check the completed file’s SHA-256.
Check the source and verify the file
Paste an identifier from the search results to inspect the edition. The source record gives its origins and the manifest lists usage conditions, media types, sizes and SHA-256 checksums.
Read the column names, select the fields you need and follow next for more rows. Each page link pins the CSV checksum. If the edition changes, restart from the first page. Read two solar capacity observations (JSON).
To retrieve a subset, choose a column from the preview. List the solar reporting years and their counts, then read the 2022 observation. Pass the same sha256 to both calls to query one revision. Matching uses the exact cell text, including spaces and empty strings.
Use as=number for measurements and as=period for calendar years, quarters, months, days and spans with two calendar endpoints. Find business observations whose periods include April 2020. Supply one or both inclusive bounds with gte and lte. Add order=desc for the largest or latest values first. Find the largest solar values at or above 35,000 MW or read 2022–2023 in reverse chronological order.
Each row preview includes exports.csv and exports.ndjson for the same selection and source revision. Download up to 1,000 rows per page and follow the HTTP Link with rel="next" for more. Each CSV page starts with a header. Download the 2022 solar capacity observations as CSV.
A file marked agreement-page requires a visit to the agreement page. After reviewing a direct-access edition’s terms, replace collection/edition below with its identifier. The Python 3 example writes the destination only after the size and checksum match.
python3 fonsora_agent.py download collection/edition csv edition.csv
Credit the original source and cite the canonical edition URL. The citation view also offers RIS and BibTeX.
Find what changed since your last visit
Keep the ETag returned by the full catalog or sitemap. Send it back on the same URL with If-None-Match. HTTP 304 confirms that the saved inventory is still current. A new inventory returns HTTP 200.
Use modifiedSince and modifiedBefore in REST or MCP search for a fixed UTC time window. The start is inclusive and the end is exclusive. Select dateModified to read the material change time from the sitemap. Use sort=id and follow next until the window is complete. Compare sitemap membership to find withdrawals. Read the five most recently changed editions.
To decide whether to download files again or refresh descriptions, select changeKind=files or changeKind=metadata. Both work with time windows and newest-first sorting. File dates track the reviewed distributions. Metadata dates cover the catalog description and structured edition-page metadata. Compare both dates.
Save the edition sitemap after each successful crawl. The example compares canonical URLs and their material change dates and reports added, updated and delisted editions as JSON Lines.
curl -fsS https://fonsora.net/sitemap.xml -o current.xml
python3 fonsora_agent.py changes current.xml --previous previous.xml
On your first run, omit --previous previous.xml. Keep the new snapshot as your baseline after processing the results. A delisted URL should leave your active inventory. A 404 indicates an unavailable edition. On a 429 or 503, pause and retry later, honoring Retry-After when supplied. Keep the last successful snapshot during an error.