#19101: feat: Auto-configure Z.AI MCP tools during onboard
commands
size: L
Cluster:
Model Provider Integrations
## 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
#13814: feat(web-search): add ZAI Search (zsearch) provider
by strelov1 · 2026-02-11
73.7%
#21530: feat: Native MCP (Model Context Protocol) client support
by amor71 · 2026-02-20
73.7%
#19326: Agents: improve z.ai GLM-5 integration and failover
by gabrielespinheira · 2026-02-17
73.0%
#9337: fix: correct GLM MCP web-search-prime API parameter name and respon...
by shoa-lin · 2026-02-05
72.5%
#22175: fix: support xai tool stream and compat flags
by ShunsukeHayashi · 2026-02-20
72.1%
#22941: feat: add ZHIPU provider + doctor chat check (Phase 1A)
by feelega · 2026-02-21
70.4%
#13079: feat: Add OpenAI-compatible API option to CLI for self-hosted models
by MikeWang0316tw · 2026-02-10
70.1%
#9339: fix: enhance OpenAI compatibility for tool calling
by 0xrushi · 2026-02-05
69.4%
#9511: feat: add tool error fallback toggle
by bolismauro · 2026-02-05
69.3%
#22893: Add Z.AI image format support
by AlexanderWillner · 2026-02-21
69.0%