dhis2-mcp
dhis2-mcp
一个用于读取 DHIS2 健康数据的只读 MCP 服务器。它通过 stdio 运行。
该服务器专为小型本地模型而设计。每个工具返回紧凑的 JSON,而不是原始 DHIS2 响应。小的上下文窗口是一种预算,而这些工具会尽量少地占用它。
工具
工具 | 功能 |
| 按名称搜索 DHIS2 指标。返回 id、名称和描述。 |
| 获取一个指标按期间拆分、针对一个组织单元的汇总值。 |
先运行 search_indicators 获取指标 id。然后再将该 id 传给 query_analytics。
Related MCP server: WHO MCP Server
要求
Node.js 20 或更高版本。
一个 DHIS2 实例。默认使用公共 play demo,因此无需任何配置即可开始。
安装与构建
git clone https://github.com/brianmituka/dhis2-mcp.git
cd dhis2-mcp
npm install
npm run build配置
设置以下环境变量。这三个都可选。
变量 | 默认值 | 含义 |
|
| DHIS2 实例的基础 URL |
|
| Basic auth 用户名 |
|
| Basic auth 密码 |
play demo 每晚都会重置。请使用主机 play.im.dhis2.org,而不是 play.dhis2.org——旧主机地址会重定向到 HTML 页面。
与 LM Studio 配合使用
LM Studio 0.3.17 或更高版本支持 MCP。请打开 Program 标签页,然后编辑 mcp.json。添加以下条目:
{
"mcpServers": {
"dhis2": {
"command": "node",
"args": ["/absolute/path/to/dhis2-mcp/dist/index.js"],
"env": {
"DHIS2_BASE_URL": "https://play.im.dhis2.org/stable-2-43-1",
"DHIS2_USERNAME": "admin",
"DHIS2_PASSWORD": "district"
}
}
}
}将路径替换为你克隆的位置。编辑文件后,重启模型聊天。
与其他 MCP 客户端配合使用
任何基于 stdio 的 MCP 客户端都可以使用。例如,在 Claude Code 中:
claude mcp add dhis2 -- node /absolute/path/to/dhis2-mcp/dist/index.js使用 MCP Inspector 测试
npx @modelcontextprotocol/inspector node dist/index.jsInspector 在重新构建之后不会重新加载服务器。每次 npm run build 之后,请在 Inspector 中点击 Restart。
许可证
MIT. 请参阅 LICENSE。
Available Tools
2 toolsquery_analyticsQuery DHIS2 analyticsA
Get aggregated values for one indicator, split by period, for one organisation unit. Run search_indicators first to get the indicator id.
| Name | Required | Description | Default |
|---|---|---|---|
| period | No | DHIS2 period: 'LAST_12_MONTHS', 'THIS_YEAR', '2025', or '202501' | LAST_12_MONTHS |
| org_unit | No | Organisation unit id. 'USER_ORGUNIT' means the account's root unit | USER_ORGUNIT |
| indicator_id | Yes | Indicator id, from search_indicators |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations available, the description carries the behavioral burden. It makes clear this is a read-oriented query returning aggregated values by period/org unit, but it does not disclose authentication needs, output shape, or any limitations beyond the single-indicator constraint.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is very concise: two sentences, no filler. The main behavior is front-loaded, and the required workflow hint is placed second, making it easy for an agent to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers the necessary prerequisite workflow and the parameters are fully documented in the schema. However, there is no output schema and no discussion of response structure, pagination, result size, or error behavior, so some operational details remain unclear.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema already describes all parameters with defaults and examples, so schema coverage is high. The description adds the prerequisite relationship to search_indicators, but otherwise does not meaningfully expand on what the schema already communicates.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states that the tool returns aggregated values for one indicator, split by period, for one organisation unit. It distinguishes itself from the sibling tool by positioning search_indicators as a prerequisite, making the purpose and scope easy to identify.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly tells the agent to run search_indicators first to get the indicator id, which is practical workflow guidance. It does not explicitly state when not to use the tool, such as when multiple indicators or multiple organisation units are needed, but the scope is clear enough.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_indicatorsSearch DHIS2 indicatorsA
Search DHIS2 indicators by name. Returns id, name, and description for each match.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum results to return | |
| query | Yes | Search text, for example 'ANC' |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description correctly signals that this is a read/search operation and transparently states what will be returned for each match. It does not mention edge cases like empty results, case sensitivity, or search matching behavior, but the core behavioral expectations are disclosed.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is exceptionally efficient: two short sentences with no fluff. The main verb, resource, search target, and expected output shape are all front-loaded. Every word earns its place, supporting quick agent comprehension.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple two-parameter search tool with no output schema, the description supplies the key return details (id, name, description) and makes the domain clear. Minor missing elements, such as the fact that the limit default is 10 (already in schema) or behavior when no matches exist, are not critical given the simplicity of the tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema already documents both parameters with full coverage, but the description adds meaning by clarifying that the query parameter searches against the indicator name specifically. This helps the agent understand that the if the query should be treated as a name filter rather than a keyword search across all fields.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific action ('Search'), a specific resource ('DHIS2 indicators'), and a scoping criterion ('by name'), and includes the exact return fields ('id, name, and description'). This clearly distinguishes it from the sibling tool query_analytics, which very likely focuses on analytical data rather than indicator metadata.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies the tool should be used when an agent needs to find indicators by their name, but it does not explicitly discuss when another tool should be preferred or contrast itself with query_analytics. There is no exclusionary guidance, leaving usage somewhat to inference.
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.
2 tool updates
v0.2.0- First observed
query_analytics - First observed
search_indicators
TDQS
Scored across 2 tools
The two tools are clearly distinct: search_indicators handles metadata discovery while query_analytics retrieves aggregated data. The explicit dependency between them removes any ambiguity.
Both tools follow the same verb_noun pattern with snake_case naming (search_indicators, query_analytics), making the naming perfectly consistent and predictable.
Two tools feels very thin for a DHIS2 server, which typically covers a broad health information system domain. The server only exposes a small analytics niche, so the count does not match the implied scope.
The core workflow of searching for indicators then querying analytics is present, but there is no way to discover organization units, periods, or other metadata within the server. This forces agents to obtain those identifiers from outside the tool surface.
Maintenance
Related MCP Connectors
Read-only Google Search Console and Google Analytics for AI agents.
Query 29,500+ World Bank development indicators for 200+ countries across 60+ years.
Search and query 1,500+ OECD statistical datasets via SDMX. Keyless.
US healthcare public data, one endpoint: prices, Medicare, MA benefits, Stars, Medicaid, providers.
Related MCP Servers
- AlicenseBqualityFmaintenanceEnables comprehensive interaction with DHIS2 health information systems through 40+ tools covering complete Web API functionality. Supports data management, tracker programs, analytics, and bulk operations for DHIS2 development and administration.4746 npm7MIT
- AlicenseBqualityDmaintenanceProvides access to the World Health Organization's Global Health Observatory data, enabling AI assistants to search, retrieve, and analyze comprehensive health indicators, country statistics, disease burden data, and regional health trends through WHO's OData API.1MIT
- AlicenseAqualityDmaintenanceConnects DHIS2 health information systems to AI assistants via the Model Context Protocol, enabling natural language queries for analytics, metadata, and tracker data.13MIT
- AlicenseAqualityAmaintenanceEnables AI agents to query Kenya health facilities, maternal health indicators, immunization coverage, and disease surveillance data via the DHIS2 public API.368 PyPIMIT