Skip to content

z.ai MCPs stopped working at 1.0.137 #5278

Closed

Description

@renanwilliam

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

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Dec 9, 2025
  2. github-actions commented on Dec 9, 2025

    @github-actions
    Contributor

    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:

    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.

  3. renanwilliam commented on Dec 9, 2025

    @renanwilliam
    Author

    downgraded to 1.0.134 and works fine:

    Image
  4. renanwilliam commented on Dec 9, 2025

    @renanwilliam
    Author

    🔧 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingopentuiThis relates to changes in v1.0, now that opencode uses opentui

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions