Skip to main content
Glama

stat-gov-mcp

Local MCP server for the Polish Central Statistical Office (GUS) Bank Danych Lokalnych (BDL) — the definitive public source for Polish socioeconomic statistics: population, prices, business demographics, unemployment, GDP, at country / voivodeship / powiat / gmina resolution.

Part of the honest-mcp family of small, auditable, local-first MCP servers.

Why

BDL contains tens of thousands of time series about Poland. Its web UI (bdl.stat.gov.pl) is powerful but slow to navigate when you know exactly what you want. The public REST API is the fast path but has enough concepts (subjects → variables → units → data) to make manual use annoying. This server lets your AI find the right variable and unit and pull the data — one conversation, done.

Same trust model as the rest of the family: data flows only between your machine and GUS.

Related MCP server: Tilastokeskus StatFin MCP Server

Features

Five tools:

  • search_subjects — browse or search the subject tree (e.g., "CENY", "LUDNOŚĆ")

  • search_variables — find data series in a subject

  • search_units — find territorial units (voivodeship, powiat, gmina) by name and/or level

  • get_unit_details — full record for a unit ID

  • get_data — pull actual values for a variable across chosen units and year range

Data source

  • Endpoint: bdl.stat.gov.pl/api/v1 — GUS BDL public REST API

  • No API key required for the free tier (5 req/sec, ~5000 req/day)

  • Higher-volume tier available with free registration; not needed for typical interactive use

Requirements

  • Python 3.10+

Setup

git clone https://github.com/bartosz-kuc/stat-gov-mcp.git
cd stat-gov-mcp
python3 -m venv venv
./venv/bin/pip install -r requirements.txt

Register with Claude Code:

claude mcp add stat-gov /absolute/path/to/venv/bin/python /absolute/path/to/server.py

Claude Desktop claude_desktop_config.json:

{
  "mcpServers": {
    "stat-gov": {
      "command": "/absolute/path/to/venv/bin/python",
      "args": ["/absolute/path/to/server.py"]
    }
  }
}

Example usage

"How has the average monthly wage changed in Mazowieckie over the last 10 years?"

Three-step: search_variables(name="przeciętne wynagrodzenie") → note variable ID → search_units(name="mazowieckie", level=2) → note unit ID → get_data(variable_id=..., unit_ids=[...], year_from=2015).

"Which voivodeships had the highest unemployment in 2024?"

search_variables(name="stopa bezrobocia")get_data(variable_id=..., year_from=2024, year_to=2024) — default returns all voivodeships.

Data flow

Your AI client
     ↕  MCP stdio
This server (Python, on your machine)
     ↕  HTTPS
bdl.stat.gov.pl (GUS)

No cloud middle. No telemetry.

Author

Bartosz Kuć — Warsaw-based developer, JDG owner running skanfirmy.pl.

Consulting

Available for consulting on Polish tax and business integrations (KSeF, GUS/NFZ/GIOŚ APIs, mBank data), MCP server design, and AI-assisted tooling for JDGs and small teams. See skanfirmy.pl/uslugi for productized packages (audit 3k PLN, setup 8-15k PLN, retainer 2-4k PLN/mo), or reach out via email.

License

MIT — see LICENSE.

Available Tools

5 tools
get_dataA

Get actual data (time series) for a variable in one or more territorial units. Example: GDP per capita for all voivodeships over 2015-2024. Returns the raw values with year, unit, and unit label.

ParametersJSON Schema
NameRequiredDescriptionDefault
year_toNoOptional last year to include
unit_idsNoList of unit IDs (from search_units). Default: all voivodeships.
year_fromNoOptional first year to include
limit_unitsNoMax units to include when unit_ids is empty
variable_idYesVariable ID from search_variables

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It does reveal the return shape ('raw values with year, unit, and unit label') and clarifies that this is actual time-series data, which is useful. However, it does not mention defaults, limitations, or any side effects beyond the obvious read-only nature of 'Get'.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact and front-loaded with the core action and resource. The example adds concrete value without unnecessary verbosity, and every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no output schema, the description adequately covers the purpose, example usage, and return contents. It lacks explicit workflow guidance and default-behavior detail, but the schema fills most gaps, making this reasonably complete for an agent to call correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already explains all five parameters. The description adds context about time-series and raw values, but it does not add parameter-specific meaning beyond what the schema provides; the baseline of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb ('Get') and resource ('actual data (time series) for a variable in one or more territorial units'), and the GDP example concretely illustrates the intended use. This clearly distinguishes it from the sibling search tools, which retrieve metadata rather than data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies a workflow by referencing 'search_units' and 'search_variables' in the schema and by contrasting 'actual data' with search-oriented siblings, but it never explicitly states when to use this tool instead of get_unit_details or search tools. The intended pipeline is inferable rather than stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_unit_detailsB

Get full details of a territorial unit by ID.

ParametersJSON Schema
NameRequiredDescriptionDefault
unit_idYesUnit ID (12-digit territorial code)

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full behavioral burden. It only restates the action and does not disclose output format, error behavior, permissions, or what 'full details' actually includes.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no filler. Every word contributes to identifying the action and target resource.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple: one required parameter, no nested objects, and full schema coverage. However, without an output schema or annotations, the description leaves the response unspecified and provides minimal context for choosing the tool confidently.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already documents unit_id as 'Unit ID (12-digit territorial code)' with 100% coverage. The description adds no additional parameter meaning beyond that, so the baseline score of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a clear action ('Get full details') on a specific resource ('territorial unit') keyed by ID. It is distinguishable from siblings like search_units, though it does not explicitly contrast itself with them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'by ID' implies the tool should be used when a specific territorial unit identifier is already known. However, it gives no explicit guidance about when to prefer this over search_units or other sibling tools, and it lists no exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_subjectsA

Browse or search GUS BDL subject categories (top-level topics like 'CENY', 'LUDNOŚĆ', 'FINANSE PRZEDSIĘBIORSTW'). Use to discover subject IDs which then anchor variable searches.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameNoOptional partial name to filter results (case-insensitive)
limitNoMax results
parent_idNoOptional parent subject ID to browse children (omit for top-level)

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

There are no annotations, so the description carries the behavioral transparency burden. It clearly implies a non-mutating browse/search operation and reveals the key outcome (subject IDs), but it does not describe the return format, pagination, or any side effects beyond what the schema already covers.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences, front-loaded with the action and resource, followed by the practical purpose. No filler or repetition; every phrase earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read-only search tool with no output schema and all parameters optional, the description covers purpose and workflow integration. It stops short of describing the response shape, but 'discover subject IDs' implies the essential return value.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds strategic context rather than parameter-level details, and the schema already explains name filtering, limit, and parent_id sufficiently.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Browse or search') and names a concrete resource ('GUS BDL subject categories') with concrete examples. It also states the downstream purpose ('discover subject IDs which then anchor variable searches'), distinguishing it from sibling tools like search_variables and search_units.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives clear context for when to use the tool: to discover subject IDs that lead into variable searches. It does not explicitly name alternatives or state when not to use it, but the intended workflow placement is clear enough for an agent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_unitsA

Search for territorial units by name — voivodeships, powiats, gminas. Returns unit IDs used with get_data. Level meanings: 0=Kraj (country), 2=Województwo, 5=Powiat, 6=Gmina.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYesPartial name (case-insensitive), e.g. 'Warszawa'
levelNoOptional territorial level (0..7)
limitNo

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It adds valuable behavioral context by stating the return value (unit IDs for `get_data`) and by defining level code meanings (0, 2, 5, 6), which explain how the `level` parameter changes results. The word 'Search' implies a read-only operation; however, it does not discuss auth, error behavior, or pagination, slightly limiting transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three tight sentences with no filler. The core purpose is front-loaded, the output usage follows, and the level mapping is presented concisely as a legend. Every sentence adds distinct value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple search tool with three parameters and no output schema, the description is largely sufficient. It covers what results are for and the meaning of an ambiguous parameter. It could be more complete by stating that omitting `level` searches across all levels or by describing the exact response shape, but these are minor gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaning beyond the schema by decoding the `level` parameter values (0=Kraj, 2=Województwo, etc.), which the schema only describes as 'Optional territorial level (0..7)'. It does not add detail for `limit` or `name`, but the schema already provides adequate descriptions for those.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Search') and resource ('territorial units'), backed by concrete examples (voivodeships, powiats, gminas). It distinguishes itself from siblings by targeting a specific entity type while noting the output feeds `get_data`, which is a distinct purpose from `search_subjects` or `search_variables`.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context: use this to find territorial unit IDs for use with `get_data`. It implicitly signals when to use this tool versus siblings by focusing on territorial units, though it does not explicitly state when not to use it or mention alternatives by name.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_variablesA

Search for variables (data series) in GUS BDL. Variables are the atomic units of statistical data — each has an ID used with get_data. Filter by subject_id (from search_subjects) and/or name.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameNoOptional partial name to search for
limitNo
subject_idNoOptional subject ID to scope the search

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden, and it does provide non-obvious context: variables are atomic units and their IDs feed get_data. However, it does not disclose return format, whether results are partial-name matches, pagination, or limit behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences front-load the core purpose, then add the minimum necessary conceptual and filtering context. No filler or redundant restatement of the name.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple optional-parameter search tool with no output schema, the description covers what the tool returns conceptually (variable records with IDs), how to filter, and how it fits with get_data. It omits only limit handling and explicit return-field details, which are minor for this class of tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 67%; the schema already documents name and subject_id, and the description adds that subject_id comes from search_subjects and that filters combine with 'and/or'. It adds no semantics for the 'limit' parameter, which remains undocumented in both schema and description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb and resource ('Search for variables (data series) in GUS BDL') and defines what a variable is, distinguishing it clearly from search_subjects/search_units by its atomic data-series role and connection to get_data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives clear context by instructing the user to filter by 'subject_id (from search_subjects) and/or name', which implies the correct workflow of selecting subjects first and then finding variables. It does not explicitly name alternatives or exclusions, so it stops short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv0.1.0
    • First observedget_data
    • First observedget_unit_details
    • First observedsearch_subjects
    • First observedsearch_units
    • First observedsearch_variables

TDQS

A4/5.0
Disambiguation5/5

Each tool targets a clearly distinct entity or action: subjects, variables, units, unit details, and data. The descriptions cross-reference IDs and usage patterns, making it easy for an agent to select the right tool.

Naming Consistency5/5

Tool names follow a consistent verb_noun pattern: search_subjects, search_variables, search_units, get_unit_details, get_data. All use lowercase snake_case and the prefixes search_ and get_ clearly distinguish discovery from retrieval.

Tool Count5/5

Five tools is well-scoped for a statistical data access server. Each tool covers a necessary part of the browsing and data retrieval workflow without unnecessary or redundant additions.

Completeness4/5

The core workflow is complete: discover subjects, search variables, locate territorial units, get unit details, and fetch data. Minor gaps exist such as detailed variable metadata or subject detail endpoints, but they are not essential for typical data retrieval.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    MCP server providing AI assistants access to Polish public registries (KRS, CEIDG) and statistical data (GUS BDL) for querying companies, sole proprietorships, and regional statistics.
    14
    7
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP 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.
    14
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    MCP server that provides AI agents with Polish business data tools: identifier validation (NIP, PESEL, REGON, KRS, IBAN), VAT whitelist checks, EU VIES lookups, and NBP exchange rates.
    5
    21
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bartosz-kuc/stat-gov-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server