← Back to PRs

#19101: feat: Auto-configure Z.AI MCP tools during onboard

by tianxiao1430-jpg open 2026-02-17 11:25 View on GitHub →
commands size: L
## Summary Auto-configure Z.AI MCP tools (zread, zai-vision, zai-web-search) during the onboard flow when user selects Z.AI provider. ## Changes - Added `configureZaiMcpTools` function to automatically configure MCP tools - Integrated into Z.AI auth choice flow in `auth-choice.apply.api-providers.ts` - Creates/updates `~/.openclaw/workspace/config/mcporter.json` with MCP tool configs ## Tools Configured | Tool | Transport | Purpose | |------|-----------|---------| | zread | HTTP | GitHub repo analysis | | zai-vision | stdio | Image/video analysis | | zai-web-search | HTTP | Web search | ## Benefits - **Better DX**: Users get all Z.AI tools working immediately after onboard - **GLM Coding Plan value**: Highlights exclusive features - **Reduced friction**: No manual JSON editing required ## Related - Closes #18741 - Related to #18173 (Z.AI tool_stream support) ## Testing - [ ] Tested locally with `openclaw onboard` and Z.AI provider - [ ] Verified mcporter.json is created/updated correctly - [ ] Verified MCP tools are usable after onboard ## AI Assistance 🤖 This implementation was written with Claude assistance (OpenClaw agent). ## Checklist - [x] Mark as AI-assisted - [x] I understand what the code does - [x] Follows CONTRIBUTING.md guidelines <!-- greptile_comment --> <h3>Greptile Summary</h3> Auto-configures Z.AI MCP tools (zread, zai-vision, zai-web-search) during onboarding when users select Z.AI as their provider. Creates/updates `mcporter.json` in the agent directory with authentication headers and environment variables for the three MCP tools. **Key Changes:** - Added `configureZaiMcpTools` function to handle MCP tool configuration - Integrated into Z.AI auth flow with non-fatal error handling - Configures HTTP-based tools (zread, web-search) with Bearer auth and stdio-based tool (vision) with API key env var **Issues Found:** - Missing test coverage for the new functionality - Config merging could be more robust (doesn't explicitly ensure `mcpServers` exists in parsed JSON) <h3>Confidence Score: 4/5</h3> - Safe to merge with minor improvements recommended - Implementation is straightforward and follows existing patterns in the codebase. Error handling is appropriate (non-fatal try/catch). The main concerns are lack of test coverage and slightly fragile config merging, but these don't prevent the feature from working correctly in typical scenarios. - Consider adding tests for `src/commands/zai-mcp-tools-config.ts` to verify config creation and merging behavior <sub>Last reviewed commit: 4ac2318</sub> <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs