kira-dosm
Click 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., "@kira-dosm What was Malaysia's GDP growth in 2023?"
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.
KIRA — Knowledge-Indexed Registry for Analytics
A statistics-literate MCP server for Malaysian official data.
kira (Malay): to count, to reckon. kira-kira: calculation.
Malaysian official statistics, with the caveats attached.
Existing Malaysian open-data MCP servers are couriers: they fetch a table
and hand it over. KIRA resolves a question to the right series, applies
the correct transformation in code, refuses invalid comparisons, and
returns every number with its provenance. See PROJECT_PLAN.md
for the full design and phase-by-phase progress log.
Unofficial. Not affiliated with DOSM, JDN, or the Ministry of Digital.
Data sourced from data.gov.my / open.dosm.gov.my,
attributed per dataset in every tool response's provenance block.
Why: three real cases, not a feature list
Full write-up with the actual tool calls in eval/baseline_comparison.md
— run against the hosted mcp-datagovmy baseline, not asserted.
The same query, with or without a warning. Asking for Malaysia's monthly unemployment rate across a range that spans DOSM's January 2025 census-baseline shift returns identical raw numbers from either server — DOSM documents the break in prose, in a separate metadata call. The baseline's data-fetching call carries none of that. KIRA's
get_seriesattaches the warning to the exact same query, automatically, every time.A refusal instead of a plausible wrong comparison.
compare_seriesrefuses to plot PPI's seasonally-adjusted and unadjusted series against each other, naming both series and why. The baseline has no such gate — nothing stops that comparison from happening.DOSM's own published growth rate, not a re-derived one.
get_seriesandcomputeuse the agency's owngrowth_yoy/growth_momrows for GDP, PPI, IPI, and trade where DOSM publishes them, rather than recomputing from levels — verified to match DOSM's figures exactly (seetests/test_engine.py), which matters most for chain-linked real GDP, where a naive level-ratio calc doesn't reproduce the official number.A real gap, found and fixed, not hidden.
find_seriesused to return nothing for homicide/crime queries and imply the data didn't exist — it does (homicide_ratenow), and DOSM publishes plenty more that KIRA still hasn't curated.find_seriesnow says so on a miss and points atraw_query_url, which reaches any DOSM/data.gov.my Parquet directly, sandboxed the same way asraw_query, no registration required. This is the one area where the baseline's full-catalogue search genuinely beats a curated-only design — worth stating plainly rather than glossing over.
Related MCP server: mcp-uk-ons
Status
All 10 originally-planned tools are built, plus one added to close a
real coverage gap: find_series, describe_series, get_series,
compare_series (with its SA/NSA refusal rule), compute
(cagr/real/per_capita/index_to/contribution_to_growth, plus yoy/mom/qoq),
explain_break, latest_release, raw_query (sandboxed SQL escape
hatch for dimensional breakdowns a registered series doesn't curate,
e.g. GDP by sector), raw_query_url (the same escape hatch for a DOSM
dataset with no registry entry at all — find_series only searches
KIRA's curated series, a fraction of what DOSM publishes; an empty
result now says so and points here instead of implying the data doesn't
exist), list_geographies (state/district/parlimen/DUN hierarchy), and
lookup_classification (MCOICOP, MSIC — hierarchy traversal, not just
single-code lookup).
21 series registered, covering every category in the build order (prices,
national accounts, labour, production, external trade, demography):
cpi_headline, cpi_core, ppi_headline + ppi_headline_sa,
ipi_headline + ipi_headline_sa, gdp_real + gdp_real_state,
gdp_nominal, labour_unemployment_rate +
labour_unemployment_rate_state, labour_force_participation_rate,
trade_exports, trade_imports, trade_balance, trade_total,
population_malaysia, household_income_median, vital_birth_rate,
vital_death_rate, homicide_rate. See PROJECT_PLAN.md section 6 for
the phase plan, eval/questions.yaml for the Phase 0 eval set (27
questions, 26 graded), and eval/baseline_comparison.md for the
head-to-head above, in full.
HTTP transport, Docker packaging, CI (tests + nightly source-drift check), in-process caching, and per-client rate limiting are done. Remaining: more series toward ~40, a hosted endpoint, submitting to MCP registries (Smithery, Glama, the GitHub MCP registry), and a dedicated adversarial security review (self-review only so far) — see PROJECT_PLAN.md's progress log for exact status.
Package name: kira-dosm — confirmed. kira and kira-mcp are
already taken on both PyPI and npm by unrelated projects.
Quickstart
uv sync
uv run pytest # -m "not network" to skip live-data tests
uv run python -m kira.server # stdio MCP server (default — for Claude Desktop, `mcp dev`, etc.)Point an MCP client's config at uv run --directory /path/to/KIRA python -m kira.server
(stdio) to use it locally.
# Ad-hoc query against a registered series:
from kira.registry import load_registry
from kira.engine import get_connection, get_series
reg = load_registry()
con = get_connection()
get_series(reg["cpi_headline"], con, date_from="2025-06", date_to="2025-06", transform="yoy")HTTP transport
KIRA_TRANSPORT=http KIRA_PORT=8000 uv run python -m kira.serverServes streamable-HTTP MCP at http://127.0.0.1:8000/mcp. Set
KIRA_HOST=0.0.0.0 to listen on all interfaces (e.g. inside a container).
The HTTP transport is rate limited per client IP —
KIRA_RATE_LIMIT_PER_MINUTE (default 60, set 0 to disable) — since a
public endpoint otherwise has no defense against one client hammering it
straight through to DOSM's live storage. Results are also cached
in-process for KIRA_CACHE_TTL_SECONDS (default 3600 = 1 hour; DOSM's
data doesn't change faster than that) — set 0 to disable, which is
what the test suite does. Neither applies to stdio: there's only ever
one client, and each session is a fresh process.
Docker
docker build -t kira-dosm .
docker run -p 8000:8000 kira-dosmRuns the HTTP transport by default (KIRA_TRANSPORT=http is baked into
the image). The container needs outbound HTTPS to storage.dosm.gov.my
— it queries DOSM's live Parquet files on every request, it doesn't
bundle or cache data.
Layout
registry/*.yaml— one file per series, the actual product (seeregistry/SCHEMA.md)src/kira/models.py— the registry schema (pydantic)src/kira/registry.py— loads + validatesregistry/*.yamlsrc/kira/engine.py— DuckDB query + transforms (yoy/mom/qoq) + provenance/warningssrc/kira/lookups.py— geography and classification lookup tables (list_geographies,lookup_classification)src/kira/cache.py— in-process TTL cache in front of every DOSM query (KIRA_CACHE_TTL_SECONDS)src/kira/ratelimit.py— per-client-IP rate limiting for the HTTP transport (KIRA_RATE_LIMIT_PER_MINUTE)src/kira/server.py— FastMCP server: 11 tools (find_series,describe_series,get_series,compare_series,compute,explain_break,latest_release,raw_query,raw_query_url,list_geographies,lookup_classification)eval/questions.yaml— Phase 0 eval set, each answer independently verified against live DOSM dataeval/baseline_comparison.md— head-to-head against themcp-datagovmybaselinescripts/check_sources.py— fetches every registrysource_urland fails loudly on 404 or schema drift; runs nightly via.github/workflows/nightly-source-check.yml.github/workflows/ci.yml— tests + registry validation + Docker build on every push/PR
Licence
MIT — see LICENSE. Data itself is DOSM's, under the terms of
data.gov.my's open data licence (CC BY 4.0 for the
datasets checked so far); this project adds no additional restriction on
top of that. Don't use DOSM's name, logo, or crest in any derivative
branding — KIRA is unofficial and says so in every response.
Available Tools
11 toolscompare_seriesCompare SeriesA
Align two or more series on a common date index. Refuses to compare a series against its own seasonally-adjusted/not-adjusted counterpart (see each series' sa_counterpart field) rather than silently returning a misleading comparison — call describe_series on each id first if you're unsure whether that applies.
Inputs: series_ids (required), date_to, date_from, transform. Returns: object
computeComputeA
Statistical operations beyond a plain lookup:
yoy / mom / qoq: same as get_series(transform=...), offered here too for a uniform entry point.
cagr: compound annual growth rate between date_from and date_to.
real: deflate series_id (nominal) by secondary_series_id (a price index, e.g. cpi_headline) into base_period prices (default: the latest date in range). secondary_series_id defaults to cpi_headline if omitted, but pick the deflator deliberately — CPI is a consumer basket, not a GDP deflator, and the two can diverge.
per_capita: divide series_id by population_series_id (default: population_malaysia), broadcasting the (annual) population estimate across every period within that year.
index_to: rebase series_id so its value at base_period (required) reads 100.
contribution_to_growth: how many percentage points of secondary_series_id's (the total's) change over the last periods_ago periods is attributable to series_id (the component). Requires secondary_series_id; both series must share a frequency.
Inputs: operation (required), series_id (required), date_to, date_from, +4 more. Returns: object
describe_seriesDescribe SeriesA
Full metadata for a series: coverage, unit, base years, known breaks/rebases, and caveats. Call this before trusting a comparison across time or before deciding whether a transform is needed.
Inputs: series_id (required). Returns: object
explain_breakExplain BreakA
Why does this series jump/change at a given date? Returns each documented break (rebase, methodology change, classification revision, census baseline shift) in plain language, or says there are none.
Inputs: series_id (required). Returns: object
find_seriesFind SeriesA
Find candidate series for a natural-language question about Malaysian official statistics. Returns ranked candidates, each with a one-line reason for the match — always call this before get_series if you don't already have a series id.
A curated KIRA series is not the only source of truth here: this only
searches the ~20 series KIRA has registered so far, a small fraction
of what DOSM actually publishes (open.dosm.gov.my/data-catalogue has
the full list). An empty result means "not curated yet," not "this
data doesn't exist" — see the no_match_hint field, and consider
raw_query_url once you've found the dataset another way (web search,
browsing the catalogue directly).
Inputs: query (required). Returns: object
get_seriesGet SeriesA
Fetch values for a series, optionally transformed (yoy/mom/qoq) and filtered by date range or geography. Every response carries a provenance block and a warnings array — never treat the bare numbers as the whole answer; read the warnings.
Inputs: series_id (required), date_to, date_from, geography, +1 more. Returns: object
latest_releaseLatest ReleaseB
The newest available data point for a series, plus an estimated next release date derived from the series' frequency and typical release lag. The estimate is not authoritative — DOSM's own release calendar is the source of truth.
Inputs: series_id (required). Returns: object
list_geographiesList GeographiesA
State / district / parliament (parlimen) / state assembly (DUN)
codes and hierarchy, sourced from DOSM's population tables. level is
one of state, district, parlimen, dun; pass parent (e.g. a state
name) to filter to that parent's children — district and parlimen
take a state, dun takes a parlimen.
Inputs: level (required), parent. Returns: object
lookup_classificationLookup ClassificationA
Look up or traverse a DOSM classification system: mcoicop
(consumer expenditure, what CPI divisions are coded against) or
msic (industry, Malaysian Standard Industrial Classification). Pass
code (e.g. a division or section letter) to get that code's
description and its full subtree; omit it to get the whole table.
Inputs: system (required), code. Returns: object
raw_queryRaw QueryA
Escape hatch for shapes the curated tools don't cover — e.g. a
division/sector/group breakdown a series' source table carries but no
registry entry filters to (get_series only ever returns the one row
per date the registry's filters picks out). Write a SELECT against
series (aliased to series_id's source Parquet); only read-only
single-statement SELECT/WITH queries are allowed, capped at row_limit
rows. Prefer get_series/compare_series/compute when they cover your
question — this bypasses the caveats, breaks, and warnings those
carry, since it returns raw table rows, not a curated response.
Inputs: sql (required), series_id (required), row_limit. Returns: object
raw_query_urlRaw Query UrlA
Escape hatch for a dataset find_series returns nothing for and
that has no registry entry at all — not even for raw_query, which
still requires an existing series_id. find_series only searches
KIRA's ~20 curated series; DOSM publishes far more than that (open
.dosm.gov.my/data-catalogue has the full list). If find_series comes
up empty, don't conclude the data doesn't exist — check DOSM's
catalogue (or web search) for a storage.dosm.gov.my /
storage.data.gov.my Parquet URL, then query it directly here, same
sandboxing as raw_query (single read-only SELECT, aliased as
series). No curation applies: no caveats, no breaks, no unit
conversion — read the result with the same care you'd bring to the
source file yourself. Only official Malaysian government open-data
storage hosts are reachable; this is not a general-purpose fetcher.
Inputs: sql (required), url (required), row_limit. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool targets a distinct phase of the workflow—discovery, metadata, values, comparisons, breaks, geography, transforms, raw SQL—and the raw_query vs raw_query_url distinction is clear. The one soft spot is compute deliberately duplicating get_series's yoy/mom/qoq transforms, which could cause an agent to pick either for the same task.
Most names follow a clear verb_noun pattern such as find_series, describe_series, get_series, and list_geographies. compute, raw_query, and raw_query_url break the pattern slightly, but the names remain readable and predictable overall.
Eleven tools is well-scoped for a statistics server, covering the full research workflow without bloat. Each tool has a clear role, and the two raw-query escapes are justified by the curated-only limitation of the main registry.
The set covers discovery, metadata, retrieval, comparison, break explanation, release timing, geography, derived statistics, classification lookup, and raw access, leaving no obvious dead ends. The escape hatches for uncurated datasets address the one major limitation of the curated registry.
Maintenance
Related MCP Connectors
Macroeconomic and other official data from 170+ publishers, resolved from natural language with provenance.
Discover, resolve, and query official Brazilian economic data with semantic search and provenance.
Query official statistics through MCP, with periods, places and citable sources in every answer.
data.gov.my / OpenDOSM (Department of Statistics Malaysia) — official Malaysian open-data API.…
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables natural language queries of U.S. Census Bureau data, translating plain English questions into proper API calls and returning demographic, economic, and housing statistics with proper statistical interpretation and context.320MIT
- AlicenseNot gradedqualityCmaintenanceEnables querying UK Office for National Statistics datasets and their editions through natural language, with no authentication required.72 npmMIT
- AlicenseAqualityDmaintenanceEnables natural language discovery, querying, and analysis of Thailand's official statistics from the National Statistical Office via SDMX REST API. It provides tools for searching dataflows, exploring structures, and fetching data with caching and bilingual support.8MIT
- AlicenseNot gradedqualityBmaintenanceEnables access to World Bank Data360 data through natural language queries.77 npmMIT