You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

配置Wiz远程MCP服务器时OAuth2认证报404及JSON输入异常求助

问题分析与解决方案

核心问题

你的MCP配置中,OAuth2认证请求默认使用JSON格式发送请求体,但Wiz的OAuth令牌端点仅接受application/x-www-form-urlencoded编码的请求,这导致服务器返回非JSON的404响应,触发了JSON解析错误。

修正后的MCP配置

在auth节点中添加body_format: "form",强制MCP以表单编码格式发送令牌请求:

{
  "mcpServers": {
    "wiz-remote": {
      "type": "remote",
      "url": "https://api.us63.app.wiz.io/graphql",
      "auth": {
        "type": "oauth2",
        "token_url": "https://auth.app.wiz.io/oauth/token",
        "client_id": "<client_id>",
        "client_secret": "<client_secret>",
        "grant_type": "client_credentials",
        "audience": "wiz-api",
        "body_format": "form"
      }
    }
  }
}

原理说明

  • 该配置项会让MCP将OAuth请求参数以grant_type=client_credentials&client_id=xxx&...的表单格式发送,与你手动用Python测试的请求格式完全匹配。
  • 这样Wiz的令牌端点就能正确处理请求,返回合法的JSON格式令牌响应,避免解析错误。

验证步骤

  1. 替换配置中的<client_id>和<client_secret>为你的实际凭证。
  2. 重启MCP服务。
  3. 测试与Wiz远程MCP服务器的连接,此时应能成功获取访问令牌并执行GraphQL查询。

内容的提问来源于stack exchange,提问作者Adarsh Udayan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.11 16:32:40