Skip to main content
Glama
markusl

Tilastokeskus StatFin MCP Server

by markusl

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
PORTNoHTTP server port8080
API_TOKENNoOptional authentication token
LOG_LEVELNoLogging level (debug, info, warn, error)info
MCP_TRANSPORTNoSet to 'http' for HTTP transportstdio

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": true
}

Tools

Functions exposed to the LLM to take actions

NameDescription
search_statisticsA

Search Statistics Finland's StatFin database for statistical tables by keyword.

USE THIS FIRST when looking for data. Returns ranked results with relevance scores.

Examples:

  • "väestö Helsinki" → population tables for Helsinki

  • "unemployment" → employment/labor market tables

  • "housing prices" → real estate statistics

Returns: tableId (needed for query_table), title, relevance score, publication date.

After finding a table, use get_table_metadata to see its structure before querying.

list_subject_areasA

List all 149 subject areas (topics) in StatFin database.

Use this to explore what statistics are available when you don't have a specific search term.

Topic examples:

  • vaerak: Population structure

  • tyti: Labor force

  • ashi: Housing prices

  • synt: Births and deaths

  • muutl: Migration

After finding an area, use list_tables to see all tables in that topic.

list_tablesA

List all statistical tables within a subject area.

Each area typically has 20-40 tables with different data views.

Common subject areas:

  • "vaerak" → 30+ population tables (age, gender, region, etc.)

  • "tyti" → 35+ employment tables (employment rate, unemployment, etc.)

  • "ashi" → 15+ housing price tables

Use list_subject_areas first to find the area ID, or use search_statistics for direct search.

get_table_metadataA

Get the structure of a table: what variables it has and what values are available.

REQUIRED before querying - shows you:

  • Variable codes (table-specific and version-stamped, e.g. "alue_23_20260101" for region, "timeperiod_y" for the time variable). Always read these here - never assume or reuse codes from another table.

  • Value codes (KU091=Helsinki, SSS=Total, 2024=year 2024)

  • Which variables are required vs optional

  • Total possible data combinations

Example: a region variable may have 300+ values, a year variable 50+.

After understanding the structure, use query_table with the exact codes from this output.

get_variable_valuesA

Get the complete list of values for a variable when metadata only shows first 20.

Useful for:

  • Finding specific region codes (KU091=Helsinki, MK01=Uusimaa region)

  • Getting all available years (1972-2024)

  • Finding specific category codes

Common region codes:

  • SSS = Whole country (Finland)

  • MK01-MK19 = Regions (maakunta)

  • KU091 = Helsinki, KU049 = Espoo, KU837 = Tampere

Use search parameter to filter: search="Helsinki" returns only matching values.

query_tableA

Execute a query to retrieve actual statistical data from a table.

WORKFLOW: search_statistics → get_table_metadata → query_table

Selection types:

  • filter: "item" + values: ["KU091", "2024"] → specific values

  • filter: "top" + top: 5 → latest 5 values (good for time variables)

  • filter: "all" → all values (use carefully, can be large!)

Example - Helsinki population for last 5 years (the variable codes below are from table 11re.px; YOUR table's codes WILL differ - always read them from get_table_metadata first, never reuse these): { "tableId": "11re.px", "selections": [ {"variable": "alue_23_20260101", "filter": "item", "values": ["KU091"]}, {"variable": "timeperiod_y", "filter": "top", "top": 5}, {"variable": "sukupuoli_9_20180101", "filter": "item", "values": ["SSS"]}, {"variable": "ikaryhma_10_20180101", "filter": "item", "values": ["SSS"]}, {"variable": "contentscode", "filter": "item", "values": ["vaerak-vaesto"]} ] }

IMPORTANT: Variable codes are table-specific; get them from get_table_metadata. Use VALUE CODES (KU091, SSS), not labels (Helsinki, Total).

get_api_statusA

Get server health, rate limit status, and cache statistics.

Use when:

  • Queries are failing or slow

  • Need to check remaining API quota

  • Debugging connection issues

Rate limit: 8 requests per minute per instance.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A4.6/5.0

Scored across 7 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: search, list topics, list tables, get metadata, get variable values, query data, and check status. No overlaps or ambiguous boundaries; the workflow is explicitly sequential and each step is unique.

Naming Consistency5/5

All tool names follow a consistent verb_noun snake_case pattern: search_statistics, list_subject_areas, list_tables, get_table_metadata, get_variable_values, query_table, get_api_status. Predictable and uniform.

Tool Count5/5

With 7 tools, the server is well-scoped for a statistical database access. Each tool is essential and earns its place—no redundant or missing operations. The count is comfortably within the optimal 3-15 range.

Completeness5/5

The toolset covers the entire lifecycle from discovery (search, list subject areas, list tables) to detailed exploration (metadata, variable values) to data retrieval (query) and system status. No significant gaps; the workflow is fully supported.

Maintenance

ActivityInactive
ResponsivenessSlow