DHIS2 MCP Server
The DHIS2 MCP Server is a comprehensive development assistant for building DHIS2 web and Android applications, providing code generation, project configuration, debugging, and API integration tools.
Project Setup & Configuration: Initialize new DHIS2 projects with proper scaffolding, configure build systems (Webpack, Vite, d2 CLI, Gradle), set up development environments with proxy and hot reload, and generate app manifests and runtime configurations.
Code & UI Generation: Create boilerplate code and UI components using DHIS2 UI library patterns (@dhis2/ui for web, Jetpack Compose for Android), generate authentication patterns, design system tokens, and Android data model classes.
DHIS2 API Integration: Perform operations on data elements, programs, events, analytics, reporting, and bulk data import/export across aggregate and event/tracker data models.
Development Support: Diagnose CORS issues, authentication problems, and build errors; assist with migrating from deprecated d2 library to modern App Platform; provide performance optimization guidance and validate development environments.
Mobile-Specific Features: Configure offline-first data synchronization, GPS/location services, camera integration, push notifications, and various authentication methods for Android apps.
Testing & Documentation: Set up testing frameworks (Jest, Cypress, Playwright for web; JUnit, Espresso, Robolectric for Android), generate test patterns, and provide access to local and web-based documentation.
System Management: Retrieve and export audit logs, provide server information and permission details, and manage compatible server registrations for composition workflows.
Planned integration for DHIS2 Android SDK, providing tools for mobile project setup, offline-first architecture patterns, GPS and media capture support, and synchronization strategies for health data collection apps.
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., "@DHIS2 MCP Server generate a data entry form for a malaria program"
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.
DHIS2 MCP Server
Let your AI assistant (Claude, ChatGPT, Cursor, Codex, VS Code and other MCP hosts) work with your DHIS2 server. It reads your data and metadata, designs and builds configuration on a development server, imports data, and prepares changes for production. Nothing changes without your approval, and production servers are only ever read.
Setup: two steps
1. Add it to your assistant. Most hosts accept this configuration (your assistant can add it for you):
{ "mcpServers": { "dhis2": { "command": "npx", "args": ["-y", "dhis2-mcp-server"] } } }For Claude Code: claude mcp add --scope user dhis2 -- npx -y dhis2-mcp-server
2. Sign in once, in a terminal window:
npx -y dhis2-mcp-server loginIt asks four things:
the address of your DHIS2 server;
whether it is a development, training or production server;
your username;
your password. The password is hidden as you type and never shown to the assistant.
The login is checked straight away and saved on your computer:
Your computer | Where the password is kept |
Windows | encrypted for your Windows account |
macOS | the Keychain |
Linux | the system keyring, or a private file if there is none |
Restart your assistant and it is ready. Run login again for each further server, for example a read-only production server alongside your development server.
You need Node.js 20 or newer.
Related MCP server: Datto RMM MCP Server
What your assistant can do
Read: metadata, aggregate data, analytics, dashboards, and tracker records (people, enrollments, events). Before it shows individual-level records it asks you once per session. It can count records without downloading them.
Build on a development or training server:
It designs data sets, programs, indicators, option sets and more.
It checks the design against DHIS2's rules for your server's version.
It trial-runs the change with DHIS2's own dry run, then asks you to approve it.
It applies the change exactly as approved and reads it back to confirm.
Import data: aggregate values, events and tracker records, with the same plan, dry run, approve and read-back steps. Existing values are never deleted.
Change sharing (who can see or enter what), with your approval.
Move finished work to production: it prepares a reviewed package, a production administrator imports it, and the assistant then confirms production matches.
Keep a project record: requirements tied to your documents, questions for you in one batch, and a handover note of what was built and verified.
The full list of tools is in docs/TOOLS.md.
What it will not do
Change a production server. Production connections are read-only in two independent places: the tool policy, and a connection that refuses anything but reads.
Apply anything without your approval in your assistant's approval prompt. The assistant cannot approve on your behalf.
Delete data, or change users, roles or passwords.
Show your password to the assistant, or put it in any configuration file.
The details and their tests are in SECURITY-MODEL.md.
DHIS2 versions
Your server | What the assistant does |
2.39 – 2.43 | Full support. The assistant detects the version when it connects and uses that version's API, parameter names and rules. |
Older than 2.39 | Read-only. |
Newer than 2.43 | Treated like 2.43 and flagged as untested. Every change still has to pass DHIS2's own dry run first. |
Where a feature needs a newer DHIS2 than yours, the assistant uses that version's workaround instead of asking you to upgrade. For example, program-indicator disaggregation arrived in 2.42; on 2.41 the workaround is one indicator per category option.
Other commands
npx -y dhis2-mcp-server status # saved servers, and whether each login still works
npx -y dhis2-mcp-server logout dev # forget a saved server
npx -y dhis2-mcp-server install # print the host configuration (for assistants)Also included
The server also has helpers for building DHIS2 web and Android apps: project scaffolding, UI patterns, and debugging guides for CORS, authentication and builds. They need no DHIS2 connection.
Upgrading from 1.x
Setup: version 2 replaces environment-variable passwords and the
dhis2_configurearguments with the one-timeloginabove.Changes: the direct create, update and delete tools are gone. Every change now goes through a plan you approve.
Development
npm ci
npm test # unit tests
npm run test:e2e-security # end-to-end tests against fake DHIS2 serversThe tests workflow runs everything on Windows, macOS and Linux:
unit tests;
end-to-end tests against fake DHIS2 servers that behave like each version from 2.38 to 2.43;
a real round trip through each operating system's secret store.
Issues and ideas: GitHub issues, or the DHIS2 community thread.
Licence
MIT. See LICENSE.
Available Tools
47 toolsandroid_generate_bottom_sheetC
Generate Android bottom sheet component (Compose)
Inputs: componentName, persistent.
android_generate_list_adapterC
Generate Android RecyclerView adapter and layout for DHIS2-style lists
Inputs: adapterName, itemLayout, shimmer, pullToRefresh, +1 more.
android_generate_material_formC
Generate Android Jetpack Compose form patterns (Material Design)
Inputs: screenName, includeValidation, includeDatePicker, includeMultiSelect, +4 more.
dhis2_android_configure_cameraC
Set up camera and media capture capabilities for DHIS2 Android app
Inputs: cameraFeatures (required), imageSettings, videoSettings, barcodeTypes, +1 more.
dhis2_android_configure_gradleB
Generate Gradle build configuration for DHIS2 Android SDK integration
Inputs: dhis2SdkVersion (required), buildFeatures, proguardRules, buildVariants, +1 more.
dhis2_android_configure_notificationsC
Set up push notifications and local notifications for DHIS2 Android app
Inputs: notificationTypes (required), pushProvider, triggers, scheduling, +1 more.
dhis2_android_configure_storageC
Set up local storage and database configuration for DHIS2 Android app
Inputs: storageType (required), encryptionLevel, cacheStrategy, purgePolicy.
dhis2_android_configure_ui_patternsC
Generate Android UI patterns and components for DHIS2 apps
Inputs: uiFramework (required), components (required), designSystem, accessibility, +1 more.
dhis2_android_generate_data_modelsC
Generate Android data model classes and repositories for DHIS2 entities
Inputs: entities (required), architecture (required), dataBinding, validation, +1 more.
dhis2_android_init_projectC
Initialize a new Android project with DHIS2 SDK integration
Inputs: projectName (required), applicationId (required), language (required), minSdkVersion, +4 more.
dhis2_android_performance_optimizationC
Generate performance optimization patterns and monitoring for DHIS2 Android app
Inputs: optimizationAreas (required), monitoring, batterOptimization, memoryManagement.
dhis2_android_setup_authenticationC
Configure authentication and security patterns for DHIS2 Android app
Inputs: authMethods (required), biometricSettings, sessionManagement, securityFeatures.
dhis2_android_setup_location_servicesC
Configure GPS and location services for DHIS2 Android app
Inputs: locationAccuracy (required), permissions, geofencing, coordinateCapture, +1 more.
dhis2_android_setup_offline_analyticsC
Configure offline analytics and reporting capabilities for DHIS2 Android app
Inputs: analyticsFeatures (required), chartTypes, dataAggregation, caching, +1 more.
dhis2_android_setup_syncC
Configure offline-first data synchronization patterns for DHIS2 Android app
Inputs: syncStrategy (required), syncScope, conflictResolution, networkConditions, +1 more.
dhis2_android_setup_testingC
Configure testing framework and generate test patterns for DHIS2 Android app
Inputs: testingFrameworks (required), testTypes (required), mockStrategies, coverage.
dhis2_clear_audit_logB
Clear the audit log (requires confirmation)
Inputs: confirmed.
dhis2_configure_app_manifestC
Generate or update manifest.webapp file for DHIS2 app
Inputs: name (required), version (required), description (required), developer (required), +5 more.
dhis2_configure_build_systemC
Set up build system configuration for DHIS2 app (d2.config.js, webpack, etc.)
Inputs: appName (required), entryPoints, customAuthorities, pwa, +2 more.
dhis2_configure_cors_allowlistB
Generate instructions and configuration for DHIS2 CORS allowlist setup
Inputs: allowedOrigins (required), dhis2Version, includeSteps.
dhis2_create_ui_componentsC
Generate common UI components using DHIS2 UI library patterns
Inputs: componentType (required), componentName (required), features, dataIntegration, +1 more.
dhis2_debug_authenticationC
Debug authentication issues including login failures, session management, and cookie problems
Inputs: issueType (required), dhis2Instance (required), authMethod (required), errorDetails, +1 more.
dhis2_diagnose_cors_issuesB
Diagnose and provide solutions for CORS (Cross-Origin Resource Sharing) issues in DHIS2 app development
Inputs: dhis2Instance (required), localDevelopmentUrl (required), browser (required), errorMessage, +1 more.
dhis2_export_audit_logB
Export complete audit log as JSON for compliance reporting
Inputs: no named parameters.
dhis2_export_for_compositionC
Export the result of a DHIS2 operation in a format suitable for other MCP servers
Inputs: toolName (required), data (required), targetServer, metadata.
dhis2_fix_proxy_configurationC
Generate proxy configuration and fixes for local development against DHIS2 instances
Inputs: proxyType (required), targetInstance (required), localPort, authentication, +1 more.
dhis2_generate_app_runtime_configC
Generate configuration for DHIS2 App Runtime integration
Inputs: appName (required), apiVersion, features, errorBoundary, +1 more.
dhis2_generate_design_systemC
Generate design system tokens (palette, typography, spacing) and dark mode support
Inputs: theme, enableDarkMode, palette, typography, +3 more.
dhis2_generate_test_setupC
Generate testing setup and example tests for DHIS2 app
Inputs: testFramework (required), testTypes, coverage, mockSetup.
dhis2_generate_ui_data_displayC
Generate @dhis2/ui data display patterns (tables, cards, lists, modal, loading states)
Inputs: componentName, includeTable, includePagination, includeCards, +8 more.
dhis2_generate_ui_form_patternsC
Generate @dhis2/ui form patterns (inputs, validation, date picker, file upload, multi-select)
Inputs: componentName, includeValidation, includeDatePicker, includeFileUpload, +6 more.
dhis2_get_audit_logC
Retrieve audit log of all MCP operations performed
Inputs: limit.
dhis2_get_audit_summaryB
Get summary statistics of audit log and system usage
Inputs: no named parameters.
dhis2_get_composition_examplesB
Get examples of how to integrate this DHIS2 MCP server with other MCP servers
Inputs: no named parameters.
dhis2_get_composition_recommendationsC
Get recommendations for integrating the result of the last operation with other MCP servers
Inputs: lastTool.
dhis2_get_permission_infoB
Get detailed information about current user permissions and available tools
Inputs: no named parameters.
dhis2_get_server_infoB
Get information about this MCP server and its composition capabilities
Inputs: no named parameters.
dhis2_init_webappC
Initialize a new DHIS2 web application project with proper scaffolding
Inputs: appName (required), appTitle (required), appDescription, namespace, +5 more.
dhis2_migration_assistantC
Assist with migrating from deprecated d2 library to modern App Platform
Inputs: currentStack (required), targetPlatform, migrationScope, codeComplexity.
dhis2_optimize_performanceC
Identify and fix performance issues in DHIS2 web applications
Inputs: performanceIssue (required), metrics, targetMetrics, appComplexity.
dhis2_register_compatible_serverC
Register information about a compatible MCP server for composition workflows
Inputs: name (required), version (required), capabilities (required), description (required).
dhis2_resolve_build_issuesC
Diagnose and resolve common DHIS2 app build and bundling issues
Inputs: buildTool (required), issueType (required), errorMessage, packageManager, +2 more.
dhis2_setup_authentication_patternsC
Generate authentication patterns and examples for DHIS2 app
Inputs: authType (required), providers, sessionManagement, securityFeatures, +1 more.
dhis2_setup_dev_environmentC
Set up development environment for DHIS2 app with proper proxy and hot reload
Inputs: dhis2Instance (required), username (required), password (required), port, +2 more.
dhis2_validate_environmentC
Validate and troubleshoot DHIS2 development environment setup
Inputs: checkAll, components, nodeVersion, dhis2Instance, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 47 tools
The tools are organized into clear categories (Android development, web development, audit/logging, composition, configuration), which helps disambiguation. However, there is significant overlap within categories, such as multiple Android configuration tools (e.g., dhis2_android_configure_camera, dhis2_android_configure_gradle) that could be confused for similar setup tasks, and web tools like dhis2_generate_ui_form_patterns and dhis2_generate_ui_data_display that might blur boundaries in UI generation.
Most tools follow a consistent snake_case pattern with a clear prefix structure (e.g., dhis2_, android_). The naming is largely predictable, grouping related tools by domain. Minor deviations exist, such as android_generate_* vs. dhis2_generate_* for similar generation tasks, but overall the conventions are readable and well-structured.
With 47 tools, the count is excessive for a single server, leading to potential overwhelm and redundancy. While the server covers a broad domain (DHIS2 app development for Android and web), many tools could be consolidated (e.g., multiple configuration or setup tools). This high number suggests poor scoping and may hinder agent usability due to choice overload.
The tool set provides comprehensive coverage for DHIS2 app development, including initialization, configuration, UI generation, testing, debugging, performance optimization, and integration with other MCP servers. It spans both Android and web platforms, with no obvious gaps in the development lifecycle, from setup to deployment and maintenance.
Maintenance
Related MCP Connectors
26 deterministic tools: PDF, image, QR, CSV/Excel, HTML to PDF, DNS/RDAP, FX rates, time zones.
19 Data/API/Code MCP tools: OpenAPI, GraphQL, cURL, SQL/ER, JSON-TS/Path/Diff, YAML, SemVer.
Read and edit GA4, Search Console and Google Tag Manager from any MCP client. 29 tools.
49 developer tools via MCP: DNS, WHOIS, IP lookup, JWT, hashing, QR, and more.
Related MCP Servers
- AlicenseAqualityDmaintenanceConnects DHIS2 health information systems to AI assistants via the Model Context Protocol, enabling natural language queries for analytics, metadata, and tracker data.13MIT
- AlicenseBqualityDmaintenanceComprehensive read/write access to the Datto RMM API v2, enabling management of devices, sites, alerts, audits, jobs, variables, filters, and activity logs through 46 tools.46MIT
- AlicenseAqualityBmaintenanceEnables AI agents to query Kenya health facilities, maternal health indicators, immunization coverage, and disease surveillance data via the DHIS2 public API.366 PyPIMIT
- AlicenseAqualityDmaintenanceEnables read-only interaction with DHIS2 health data by searching indicators and querying compact analytics results, designed for small local models.2MIT