z.ai MCPs stopped working at 1.0.137 #3422

Closed
opened 2026-02-16 17:40:01 -05:00 by yindo · 3 comments
Owner

Originally created by @renanwilliam on GitHub (Dec 9, 2025).

Description

Web Search MCP Server and Web Reader MCP Server stopped work after this morning update.

OpenCode version

1.0.137

Steps to reproduce

  1. add z.ai mcp servers to opencode config
  2. start a new opencode session
  3. check /status

Screenshot and/or share link

Image

Operating System

macOS 15.7.2 (24G325)

Terminal

iTerm2

Originally created by @renanwilliam on GitHub (Dec 9, 2025). ### Description [Web Search MCP Server](https://docs.z.ai/devpack/mcp/search-mcp-server) and [Web Reader MCP Server](https://docs.z.ai/devpack/mcp/reader-mcp-server) stopped work after this morning update. ### OpenCode version 1.0.137 ### Steps to reproduce 1. add z.ai mcp servers to opencode config 2. start a new opencode session 3. check /status ### Screenshot and/or share link <img width="586" height="283" alt="Image" src="https://github.com/user-attachments/assets/14e9eba0-4ddb-4982-84e9-4a9fc69f91d3" /> ### Operating System macOS 15.7.2 (24G325) ### Terminal iTerm2
yindo added the opentuibug labels 2026-02-16 17:40:01 -05:00
yindo closed this issue 2026-02-16 17:40:01 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 9, 2025):

This issue appears to be related to changes in version 1.0.137. Several other issues were reported in the same version around the same time:

  • #5270: Unclear error issue (also with z.ai models in 1.0.137)
  • #5276: Commands Not Receiving Context (in 1.0.137)
  • #5274: File paths in assistant responses not clickable in Zed editor (in 1.0.137)

These might all be symptoms of a broader regression introduced in the 1.0.137 update. You may want to check if reverting or identifying the specific change in that version resolves multiple issues.

@github-actions[bot] commented on GitHub (Dec 9, 2025): This issue appears to be related to changes in version 1.0.137. Several other issues were reported in the same version around the same time: - #5270: Unclear error issue (also with z.ai models in 1.0.137) - #5276: Commands Not Receiving Context (in 1.0.137) - #5274: File paths in assistant responses not clickable in Zed editor (in 1.0.137) These might all be symptoms of a broader regression introduced in the 1.0.137 update. You may want to check if reverting or identifying the specific change in that version resolves multiple issues.
Author
Owner

@renanwilliam commented on GitHub (Dec 9, 2025):

downgraded to 1.0.134 and works fine:

Image
@renanwilliam commented on GitHub (Dec 9, 2025): downgraded to `1.0.134` and works fine: <img width="2032" height="1167" alt="Image" src="https://github.com/user-attachments/assets/df336d65-e1fd-4181-9b07-f28b00dd0a22" />
Author
Owner

@renanwilliam commented on GitHub (Dec 9, 2025):

🔧 Fix for z.ai MCP Servers Stopped Working in v1.0.137

Problem

After updating to OpenCode v1.0.137, z.ai MCP servers (Web Search and Web Reader) stopped working and show connection failures in /status.

Root Cause

OpenCode v1.0.137 introduced OAuth authentication auto-detection for all remote MCP servers. This breaks existing API key-based authentication used by z.ai servers.

What changed:

  • OAuth is now enabled by default for all remote MCP servers
  • Custom headers (like API keys) are only used when OAuth is explicitly disabled
  • The system attempts OAuth authentication first, which fails for API key setups

Solution

Update your OpenCode configuration to explicitly disable OAuth for z.ai MCP servers:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "zai-search": {
      "type": "remote",
      "url": "https://api.z.ai/mcp/search",
      "oauth": false,
      "headers": {
        "Authorization": "Bearer YOUR_ZAI_API_KEY"
      }
    },
    "zai-reader": {
      "type": "remote",
      "url": "https://api.z.ai/mcp/reader",
      "oauth": false,
      "headers": {
        "Authorization": "Bearer YOUR_ZAI_API_KEY"
      }
    }
  }
}

Key changes:

  • Add "oauth": false to each z.ai MCP server configuration
  • Keep your existing API key in the headers.Authorization field
  • Replace YOUR_ZAI_API_KEY with your actual z.ai API key

Configuration File Location

Your OpenCode configuration is typically located at:

  • macOS/Linux: ~/.opencode/config.json
  • Windows: %USERPROFILE%\.opencode\config.json

Verification Steps

  1. Update your OpenCode config file
  2. Restart OpenCode
  3. Run /status to verify servers show connected status
  4. Test z.ai MCP tools to ensure they work

Expected Status After Fix

/status
┌─────────────────────────────────────────────────────────────────┐
│ MCP Servers                                                       │
├─────────────────────┬─────────────┬─────────────────────────────┤
│ Server              │ Status      │ Tools                       │
├─────────────────────┼─────────────┼─────────────────────────────┤
│ zai-search          │ connected   │ web_search                  │
│ zai-reader          │ connected   │ web_reader                  │
└─────────────────────┴─────────────┴─────────────────────────────┘

For Other MCP Servers

If you have other remote MCP servers using API key authentication, apply the same fix by adding "oauth": false to their configurations:

{
  "mcp": {
    "your-mcp-server": {
      "type": "remote",
      "url": "https://your-mcp-server.com",
      "oauth": false,
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

OAuth vs API Key Authentication

OAuth Authentication

Use when MCP server supports OAuth 2.0 flow:

{
  "oauth": {
    "clientId": "your-client-id",
    "clientSecret": "your-client-secret",
    "scope": "required-scopes"
  }
}

API Key Authentication

Use "oauth": false + headers.Authorization for API key authentication:

{
  "oauth": false,
  "headers": {
    "Authorization": "Bearer YOUR_API_KEY"
  }
}

Troubleshooting

Still Not Working?

  1. Check API Key: Ensure your z.ai API key is valid and active
  2. Verify URLs: Confirm the MCP server URLs are correct
  3. Check Network: Ensure you can reach the z.ai API endpoints
  4. Restart OpenCode: Sometimes a full restart is required

Common Errors

  • needs_auth: OAuth is trying to authenticate → Add "oauth": false
  • failed: Connection error → Check API key and URL
  • disabled: Server is explicitly disabled → Remove "enabled": false

Migration Summary

This fix ensures backward compatibility while allowing the new OAuth feature to work with servers that support it. Most existing MCP server configurations will need the "oauth": false flag to continue working with API key authentication.


Related Issue: #5278
Version: OpenCode v1.0.137+
Last Updated: 2025-12-09

@renanwilliam commented on GitHub (Dec 9, 2025): # 🔧 Fix for z.ai MCP Servers Stopped Working in v1.0.137 ## Problem After updating to OpenCode v1.0.137, z.ai MCP servers (Web Search and Web Reader) stopped working and show connection failures in `/status`. ## Root Cause OpenCode v1.0.137 introduced **OAuth authentication auto-detection** for all remote MCP servers. This breaks existing API key-based authentication used by z.ai servers. ### What changed: - OAuth is now **enabled by default** for all remote MCP servers - Custom headers (like API keys) are only used when OAuth is explicitly disabled - The system attempts OAuth authentication first, which fails for API key setups ## Solution ✅ Update your OpenCode configuration to explicitly disable OAuth for z.ai MCP servers: ```json { "$schema": "https://opencode.ai/config.json", "mcp": { "zai-search": { "type": "remote", "url": "https://api.z.ai/mcp/search", "oauth": false, "headers": { "Authorization": "Bearer YOUR_ZAI_API_KEY" } }, "zai-reader": { "type": "remote", "url": "https://api.z.ai/mcp/reader", "oauth": false, "headers": { "Authorization": "Bearer YOUR_ZAI_API_KEY" } } } } ``` ### Key changes: - Add `"oauth": false` to each z.ai MCP server configuration - Keep your existing API key in the `headers.Authorization` field - Replace `YOUR_ZAI_API_KEY` with your actual z.ai API key ### Configuration File Location Your OpenCode configuration is typically located at: - **macOS/Linux**: `~/.opencode/config.json` - **Windows**: `%USERPROFILE%\.opencode\config.json` ## Verification Steps 1. Update your OpenCode config file 2. Restart OpenCode 3. Run `/status` to verify servers show `connected` status 4. Test z.ai MCP tools to ensure they work ### Expected Status After Fix ``` /status ┌─────────────────────────────────────────────────────────────────┐ │ MCP Servers │ ├─────────────────────┬─────────────┬─────────────────────────────┤ │ Server │ Status │ Tools │ ├─────────────────────┼─────────────┼─────────────────────────────┤ │ zai-search │ connected │ web_search │ │ zai-reader │ connected │ web_reader │ └─────────────────────┴─────────────┴─────────────────────────────┘ ``` ## For Other MCP Servers If you have other remote MCP servers using API key authentication, apply the same fix by adding `"oauth": false` to their configurations: ```json { "mcp": { "your-mcp-server": { "type": "remote", "url": "https://your-mcp-server.com", "oauth": false, "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } ``` ## OAuth vs API Key Authentication ### OAuth Authentication Use when MCP server supports OAuth 2.0 flow: ```json { "oauth": { "clientId": "your-client-id", "clientSecret": "your-client-secret", "scope": "required-scopes" } } ``` ### API Key Authentication Use `"oauth": false` + `headers.Authorization` for API key authentication: ```json { "oauth": false, "headers": { "Authorization": "Bearer YOUR_API_KEY" } } ``` ## Troubleshooting ### Still Not Working? 1. **Check API Key**: Ensure your z.ai API key is valid and active 2. **Verify URLs**: Confirm the MCP server URLs are correct 3. **Check Network**: Ensure you can reach the z.ai API endpoints 4. **Restart OpenCode**: Sometimes a full restart is required ### Common Errors - `needs_auth`: OAuth is trying to authenticate → Add `"oauth": false` - `failed`: Connection error → Check API key and URL - `disabled`: Server is explicitly disabled → Remove `"enabled": false` ## Migration Summary This fix ensures backward compatibility while allowing the new OAuth feature to work with servers that support it. Most existing MCP server configurations will need the `"oauth": false` flag to continue working with API key authentication. --- **Related Issue**: [#5278](https://github.com/sst/opencode/issues/5278) **Version**: OpenCode v1.0.137+ **Last Updated**: 2025-12-09
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3422