Statistics Query and Verification MCP
OfficialClick on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Statistics Query and Verification MCP Check query scope for https://example.com/statistics: what is the unemployment rate?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Statistics Query and Verification MCP
This repository contains a Python MCP server for answering questions about official statistics from a single user-supplied publication URL.
Current Scaffold
Scope-first flow:
check_query_scope(url, question)is the intended first tool callShared scope gate reused by retrieval tools before they return publication data
HTML parsing for publication title, sections, and linked CSV/XLSX files
CSV/XLSX loading helpers for tabular data retrieval
Related MCP server: pxweb-mcp
Tool Surface
check_query_scope(url, question)get_publication_overview(url)get_publication_text(url, question, section_keyword=None)get_data_file(url, question, file_url, sheet_name=None, max_rows=100)search_publication(url, question, search_term, max_matches=20)
Local Setup
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -e .[dev]Run In VS Code
The workspace includes .vscode/mcp.json for a stdio MCP configuration.
Run Manually
python -m stats_query_mcp.serverSet STATS_QUERY_MCP_TRANSPORT to sse or streamable-http when wiring a deployed transport.
Demo Flow
Run the packaged demonstration against the ONS migration bulletin:
python -m stats_query_mcp.demoOr, after installing the package:
stats-query-mcp-demoThe demo runs the full MCP flow in order:
check_query_scopeget_publication_overviewget_publication_textsearch_publicationget_data_file
It prints a small demonstration summary with the verified excerpt, source section, and an example data-table sample.
By default, the demo uses the registered MCP tool surface in-process so it is quick and reliable to run live. If you want the demo to go through a spawned stdio MCP server as well, use:
python -m stats_query_mcp.demo --stdioYou can override the defaults:
python -m stats_query_mcp.demo --question "What was long-term net migration in year ending December 2025?" --search-term "171,000"Available Tools
5 toolscheck_query_scopeB
Determine whether a question is valid for the supplied publication URL.
Inputs: url (required), question (required).
get_data_fileB
Fetch and parse a linked CSV or XLSX file after passing the shared scope gate.
Inputs: url (required), file_url (required), question (required), max_rows, +1 more.
get_publication_overviewA
Fetch publication metadata, sections, and linked data files.
Inputs: url (required).
get_publication_textC
Fetch narrative publication text after passing the shared scope gate.
Inputs: url (required), question (required), section_keyword.
search_publicationC
Search publication text and linked data files after passing the shared scope gate.
Inputs: url (required), question (required), search_term (required), max_matches.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose: validation, overview, text retrieval, data file retrieval, and search. There is no overlap in functionality, and the descriptions reinforce the boundaries.
All tool names use snake_case and a verb-object structure, but there is a minor inconsistency: three tools use the 'get_publication_*' prefix, while 'get_data_file' omits 'publication' and 'search_publication' uses a different object. This is a slight deviation from a fully uniform pattern.
With 5 tools, the server is well-scoped for its stated purpose of querying and verifying statistics in a publication. Each tool contributes a necessary function without redundancy or bloat.
The core workflow of validating, retrieving metadata, fetching text and data, and searching is covered. A minor gap is the lack of a direct tool to fetch specific sections or subsets of a data file beyond the full file, but the search tool partially mitigates this.
Related MCP Connectors
Query official statistics through MCP, with periods, places and citable sources in every answer.
MCP server for Statistics Sweden (SCB) - 1200+ tables with population, economy, environment data
Hosted MCP server for finding authoritative primary data sources and official portals.
Experimental MCP exploring Statistics Finland PxWeb statistical datasets.
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server for official statistics from Statistics Finland (Tilastokeskus) — the StatFin database, exposed through the PxWeb API. Search 3000+ tables, inspect their dimensions, and pull data as JSON-stat2.457 npmMIT
- AlicenseAqualityDmaintenanceMCP server for accessing statistical data via the PxWeb API v2.63MIT
- AlicenseNot gradedqualityCmaintenanceMCP server that enables querying Latvian official statistics from data.stat.gov.lv via PxWeb tables, allowing retrieval of table definitions and data through natural language or direct tool calls.70 npmMIT
- AlicenseNot gradedqualityCmaintenanceMCP server for Statistics Norway (SSB) PxWebApi, enabling table metadata queries via a single tool.79 npmMIT