🇰🇿 kz-opendata-mcp
Ask AI assistants about Kazakhstan's open government data.
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("школ"), thenget_dataset_info("mektepter_tizimi"), thenaggregate_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
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,~/Desktopor~/Downloads(privacy protection), so a server installed there fails withPermissionError: Operation not permitted. Keep the source anywhere you like, but install it as a tool withuv tool install --python 3.12 /path/to/kz-opendata-mcpand use~/.local/bin/kz-opendata-mcp(as a full path) as thecommand.
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)
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_datasetpages through up to 20,000 matching rows and computes the result locally. It reportstruncated: trueif there were more. - Many datasets haven't been updated for years. The
modifiedfield inget_dataset_infoshows 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-mcpworks - 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/v4support 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.
Metadata
Release files for kz-opendata-mcp 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kz_opendata_mcp-0.2.0.tar.gz | 29.3 kB | With provenance | Details for kz_opendata_mcp-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kz_opendata_mcp-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for kz_opendata_mcp-0.2.0-py3-none-any.whl |
Total release size: 44.3 kB
Release files / kz_opendata_mcp-0.2.0.tar.gz
| Download URL | kz_opendata_mcp-0.2.0.tar.gz |
|---|---|
| Size | 29.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f36bf5f34780ee1d4fa5b90868a5258f3e906e610d308658327774972869b6cc
|
|
BLAKE2b-256 checksum How to use checksums |
f4b67e4dd9453466e37530e1212e9d85b78d21f891c8526c6de32517ba5ec1b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / kz_opendata_mcp-0.2.0-py3-none-any.whl
| Download URL | kz_opendata_mcp-0.2.0-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5f9222e4ec26dc2d7e7b6385ee85f9ad004de324d078c5bf1c1b249030053f54
|
|
BLAKE2b-256 checksum How to use checksums |
5a3db9b55db21b6f2a9f98b22b961da8e64c854e6f354c003a7647da03e1fd43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logSecurity for kz-opendata-mcp 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for kz_opendata_mcp-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.