dhis2_setup_dev_environment
Configure a DHIS2 app development environment with proxy setup and hot reload. Input instance URL, credentials, and optional settings like port or HTTPS to streamline local development.
Instructions
Set up development environment for DHIS2 app with proper proxy and hot reload
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dhis2Instance | Yes | DHIS2 instance URL for development proxy | |
| envFile | No | Path to environment file (default: .env.local) | |
| https | No | Use HTTPS for local development | |
| password | Yes | DHIS2 password for development | |
| port | No | Local development server port (default: 3000) | |
| username | Yes | DHIS2 username for development |
Implementation Reference
- src/webapp-generators.ts:290-348 (handler)The core handler function that generates the complete development environment setup guide, including environment variables, proxy configuration, CORS browser settings, troubleshooting tips, and security notes.export function generateDevEnvironmentConfig(args: any): string { const { dhis2Instance, username, password, port = 3000, https = false, envFile = '.env.local' } = args; return `# DHIS2 Development Environment Setup ## Environment File (${envFile}) \`\`\`bash # DHIS2 Instance Configuration REACT_APP_DHIS2_BASE_URL=${dhis2Instance} DHIS2_CORE_HOST=${dhis2Instance} DHIS2_CORE_USERNAME=${username} DHIS2_CORE_PASSWORD=${password} # Development Server Configuration PORT=${port} ${https ? 'HTTPS=true' : '# HTTPS=false'} # API Configuration REACT_APP_DHIS2_API_VERSION=40 GENERATE_SOURCEMAP=true \`\`\` ## Development Commands \`\`\`bash # Start with proxy yarn start --proxy # Start with specific port yarn start --port ${port} # Start with HTTPS${https ? '' : ' (if needed)'} ${https ? 'yarn start --https' : '# yarn start --https'} \`\`\` ## Browser Configuration for CORS ### Chrome (recommended for development) \`\`\`bash # Start Chrome with disabled security (development only!) google-chrome --disable-web-security --user-data-dir=/tmp/chrome-dev \`\`\` ### Firefox 1. Open about:config 2. Set \`network.cookie.sameSite.laxByDefault\` to \`false\` 3. Set \`network.cookie.sameSite.noneRequiresSecure\` to \`false\` ## Troubleshooting Tips - Clear browser cache if authentication fails - Check DHIS2 CORS allowlist settings - Verify DHIS2 instance is accessible - Use browser dev tools Network tab for debugging ## Security Notes ⚠️ **Never commit credentials to version control!** - Add ${envFile} to .gitignore - Use different credentials for development - Rotate passwords regularly `; }
- src/index.ts:997-1007 (registration)The tool dispatch/registration in the main MCP server handler that calls the generateDevEnvironmentConfig function with user arguments and returns the generated markdown content.case 'dhis2_setup_dev_environment': const devEnvArgs = args as any; const devEnvConfig = generateDevEnvironmentConfig(devEnvArgs); return { content: [ { type: 'text', text: devEnvConfig, }, ], };
- src/permission-system.ts:136-136 (registration)Permission mapping that requires 'canConfigureApps' permission to use this development tool.['dhis2_setup_dev_environment', 'canConfigureApps'],