Skip to main content
Glama

English · Русский · Қазақша

An MCP server for data.egov.kz, Kazakhstan's official open data portal (about 4,000 government datasets: schools, hospitals, pharmacies, budgets, prices, regions and more).

Connect it to Claude Desktop, Claude Code, Cursor or any other MCP client, and ask questions in plain language. The assistant finds the right dataset, reads its fields, and filters or aggregates the data itself.

"How many schools are there in Arys, and what types are they?"

The assistant calls search_datasets("школ"), then get_dataset_info("mektepter_tizimi"), then aggregate_dataset(group_by="name7", filters={"name": "Арыс"}), and answers: 39 schools. 22 are general secondary schools (ЖОМ), 9 are small-class primary schools (ШЖБМ), 5 are primary schools (БМ)…, with a link to the source dataset.

No API key needed. The server uses the portal's public endpoints.

Demo

Real answers from the portal, shortened (Claude Desktop with this server, November 2026):

You: Count schools in Turkestan region by type.

Claude: (search_datasets → get_dataset_info → aggregate_dataset) According to the "List of schools" dataset (1,040 rows, 2016): general secondary (ЖОМ) 729, small-class primary (ШЖБМ) 68, НОМ 64, small-class secondary (ШЖЖОМ) 55, primary (БМ) 40, ОМ 24… Note: about 14 rows are district totals mixed into the data.

You: Which district has the most kindergartens?

Claude: The Turkestan dataset on the portal is empty, but Abai region has fresh data (December 2025): 177 kindergartens, most of them in Semey (74), then Ayagoz (12) and Urzhar (5).

flowchart LR
    U["You: a question in plain language"] --> A["AI assistant<br/>Claude · Cursor · …"]
    A -- MCP --> S["kz-opendata-mcp"]
    S -- "search · meta · query" --> P[("data.egov.kz<br/>~4000 datasets")]
    P --> S --> A --> U

Related MCP server: CKAN MCP Server

Tools

Tool

What it does

search_datasets

Searches the catalogue by keywords (in Russian, Kazakh or English). Returns dataset ids, titles, descriptions and tags.

get_dataset_info

Returns the title, description, owner agency, update date, versions, row count, and field labels. Field names on the portal are often opaque (name1, name2…), and the labels explain what they mean.

query_dataset

Reads rows with field filters, free-text search, paging, sorting and a field selection. Accepts a raw Elasticsearch query for advanced use, such as geo-distance.

aggregate_dataset

Computes count, sum, avg, min or max, optionally grouped by a field. Numbers stored as text ("1 219", "12,5") are parsed.

Installation

You need uv (brew install uv, or pip install uv).

Claude Desktop

Open Settings → Developer → Edit Config and add the server to claude_desktop_config.json:

{
  "mcpServers": {
    "kz-opendata": {
      "command": "uvx",
      "args": ["kz-opendata-mcp"]
    }
  }
}

Until the package is on PyPI, use "args": ["--from", "git+https://github.com/almatulymiras688-lgtm/kz-opendata-mcp", "kz-opendata-mcp"].

Then restart Claude Desktop. If Claude Desktop can't find uvx, replace it with the full path from which uvx.

macOS: Claude Desktop can't read files in ~/Documents, ~/Desktop or ~/Downloads (privacy protection), so a server installed there fails with PermissionError: Operation not permitted. Keep the source anywhere you like, but install it as a tool with uv tool install --python 3.12 /path/to/kz-opendata-mcp and use ~/.local/bin/kz-opendata-mcp (as a full path) as the command.

Claude Code

claude mcp add kz-opendata -- uvx kz-opendata-mcp

Cursor

Add the same block as for Claude Desktop to ~/.cursor/mcp.json.

Remote server (HTTP)

Public instance: https://kz-opendata-mcp.onrender.com/mcp. Add it in claude.ai under Settings → Connectors → Add custom connector (no installation needed), or in ChatGPT with developer mode. It runs on Render's free plan, so the first request after a quiet period can take about a minute.

The same server can run as a web service, so it can be used without installing anything: in claude.ai (Settings → Connectors → Add custom connector), ChatGPT developer mode, or any client that supports remote MCP.

kz-opendata-mcp --transport http --host 0.0.0.0 --port 8000   # endpoint: http://HOST:8000/mcp
docker build -t kz-opendata-mcp . && docker run -p 8000:8000 kz-opendata-mcp

Free hosting: the repository has a render.yaml, so on Render choose New → Blueprint, pick this repository, and you get https://<name>.onrender.com/mcp (the free plan sleeps after 15 minutes without requests and takes about a minute to wake up). GET /health returns the server status.

From source

git clone https://github.com/almatulymiras688-lgtm/kz-opendata-mcp
cd kz-opendata-mcp
uv venv && uv pip install -e ".[dev]"
.venv/bin/kz-opendata-mcp            # stdio server
npx @modelcontextprotocol/inspector .venv/bin/kz-opendata-mcp   # try it in the browser

Example questions

  • "Find datasets about pharmacies in Astana and show me 10 of them."

  • "Which districts of Turkistan region have the most schools?"

  • "What is the average number of pupils per school in Arys?"

  • "Find datasets about the state budget. Which agency publishes them, and when were they last updated?"

  • "Мектептер туралы деректер жинағын тауып, аудандар бойынша санын көрсет."

Configuration

Variable

Default

Meaning

EGOV_BASE_URL

https://data.egov.kz

Portal address

EGOV_TIMEOUT

30

HTTP timeout in seconds

MCP_TRANSPORT

stdio

stdio or http (same as --transport)

HOST, PORT

127.0.0.1, 8000

Address for the HTTP mode

How it works

The server uses four public parts of the portal:

  • /datasets/search?text=…: the catalogue search page (HTML)

  • /datasets/view?index=…: the dataset page, which lists the available versions (HTML)

  • /meta/{dataset}/{version}: metadata and field labels in Kazakh, Russian and English (JSON)

  • /api/detailed/{dataset}/{version}?source={…}: rows, using an Elasticsearch 1.x query (JSON)

/api/v4/… requires a personal API key, and the server doesn't need it.

Limitations:

  • The portal stores most values as text, so the portal itself can't compute sums or averages. aggregate_dataset pages through up to 20,000 matching rows and computes the result locally. It reports truncated: true if there were more.

  • Many datasets haven't been updated for years. The modified field in get_dataset_info shows when each was last changed.

  • Field filters use full-text matching, so {"name": "Арыс"} also matches "Арыс қаласы".

Development

uv venv && uv pip install -e ".[dev]"
pytest              # offline tests (HTTP is mocked)
pytest -m live      # smoke test against the real portal
ruff check . && ruff format --check .

Ideas for the roadmap

  • Publish to PyPI so uvx kz-opendata-mcp works

  • Remote HTTP mode for claude.ai, ChatGPT and other web clients

  • MCP resources for categories and government agencies

  • Results cache

  • Geo-search helper ("pharmacies within 1 km of a point")

  • Optional /api/v4 support with an API key

  • Integration with other KZ sources (stat.gov.kz, adilet.zan.kz)

License

MIT. The data belongs to its publishers on data.egov.kz. This project is not affiliated with the Government of the Republic of Kazakhstan.

Available Tools

4 tools
aggregate_datasetAggregate datasetA

Count rows or compute sum/avg/min/max of a numeric field, optionally per group.

Answers questions like "how many schools per district" (group_by="name", metric="count") or "average number of students" (metric="avg", metric_field="name6"). Values stored as text ("1 219", "12,5") are parsed as numbers; non-numeric values are skipped and reported. Groups use exact field values.

Args: dataset: Dataset index. version: Version. Defaults to the latest. group_by: Field to group by (optional). metric: "count", "sum", "avg", "min" or "max". metric_field: Numeric field for sum/avg/min/max. filters: Same as in query_dataset. text: Free-text filter across all fields. top: Max number of groups to return, largest first.

Inputs: dataset (required), top, text, metric, +4 more. Returns: object

get_dataset_infoDataset fields and metadataA

Describe a dataset: title, description, owner, update date, versions and its fields.

Field names are often opaque (name1, name2…) — use the returned labels to understand what each field means before filtering or aggregating.

Args: dataset: Dataset index from search_datasets, e.g. "mektepter_tizimi". version: Dataset version ("v1", "v2", …). Defaults to the latest one. lang: Language of labels: "ru", "kk" or "en".

Inputs: dataset (required), lang, version. Returns: object

query_datasetQuery dataset rowsA

Read rows of a dataset, optionally filtered.

Args: dataset: Dataset index, e.g. "mektepter_tizimi". version: Version ("v1"…). Defaults to the latest. filters: Field → value (full-text match on that field, all words must match), e.g. {"name": "Арыс"}. A list of values means "any of them". text: Free-text search across all fields. fields: Only return these fields (default: all). limit: Rows to return (1–500). offset: Rows to skip, for paging. sort_by: Field to sort by (sorting is lexical for text fields). sort_order: "asc" or "desc". es_query: Advanced: a raw Elasticsearch 1.x "query" object; replaces filters/text.

Inputs: dataset (required), text, limit, fields, +6 more. Returns: object

search_datasetsSearch datasetsA

Search Kazakhstan's official open data portal data.egov.kz (~4000 government datasets).

Use this, rather than web search, for any factual question about Kazakhstan that official data could answer: schools, hospitals, pharmacies, kindergartens, budgets, prices, population, transport, crime, regions and cities (Астана, Алматы, Шымкент, Арыс, областям/районам…). Questions may be in Russian, Kazakh or English.

Args: query: Keywords, e.g. "школы", "аптеки Астана", "бюджет", "мектеп". Russian and Kazakh keywords work best; short word stems ("школ") match more. page: Results page (10 datasets per page), starting at 1. lang: Language of titles/descriptions: "ru", "kk" (Kazakh) or "en".

Returns dataset ids ("index") to pass to get_dataset_info / query_dataset.

Inputs: query (required), lang, page. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool maps to a distinct stage of the data workflow: discover (search_datasets), understand schema (get_dataset_info), read rows (query_dataset), and summarize (aggregate_dataset). The only mild overlap is that query_dataset with filters and aggregate_dataset with metric='count' can both produce counts, but the descriptions make the split clear (row retrieval vs. aggregated statistics).

    Naming Consistency4/5

    All names follow a snake_case verb_noun pattern (search_datasets, get_dataset_info, query_dataset, aggregate_dataset). Minor deviation: search uses plural 'datasets' and get_dataset_info inserts an extra noun, but the verbs are consistent and predictable.

    Tool Count5/5

    Four tools is well within the ideal range and every tool earns its place in a search → inspect → query → aggregate pipeline. There are no redundant or filler tools, and no obvious missing operation that would require an additional tool.

    Completeness4/5

    The read-only lifecycle for an open-data portal is essentially covered: discovery with paging, dataset metadata/versions/field labels, filtered row reads with paging/sorting, and aggregation with grouping. Minor gaps: no explicit distinct-values enumeration or bulk export/download, though group_by aggregation can approximate the former.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to search, read, and explore thousands of public datasets from Chile's open government data portal (datos.gob.cl) without requiring an API key.
      24 npm
      1
      MIT
    • A
      license
      A
      quality
      A
      maintenance
      Enables AI assistants to search, explore, and query any CKAN open data portal through natural language, making public datasets accessible without requiring knowledge of the portal's API.
      20
      1,904 npm
      85
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to search and analyze Ukraine's national open-data portal (data.gov.ua) using natural language, with tools for finding datasets, inspecting metadata, and retrieving actual data.
      6
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to search, retrieve metadata, and query tabular resources from Latvia's Open Data portal (data.gov.lv) via CKAN.
      59 npm
      MIT