[BUG] 官方 github 插件无法完成 MCP 授权:connecto…
环境
项 | 值 |
|---|---|
IDE | Trae CN 1.107.1 (stable) |
commit | 11ec4a1cb1e8fe52bbfe5c40743c0aa2ee84f42e |
OS | Windows 11 企业版 10.0.26300 (AMD64) |
插件 |
|
MCP serverId |
|
MCP url |
|
问题描述
安装并连接官方 github 插件后,GitHub 连接器可以完成 OAuth(回调 trae-cn://trae.ai-ide/connector-oauth?provider=github&status=success),但该插件提供的 MCP 始终处于「未授权」状态,无法调用任何工具。反复重新授权、清除授权、重启 IDE 均无效。
复现步骤
安装
trae-remote-official:github插件,按提示连接 GitHub 账号(OAuth 回调返回status=success)。在对话中调用该插件 MCP 的工具(例如
get_me)。观察
/mcp状态与日志(%APPDATA%\Trae CN\logs\\)。
实际结果
工具调用失败:
[info] McpService callTool github get_me {}
[error] McpService callTool Extension github not foundmcp-servers-main.log:
[info] MCPOauthService Getting tokens for serverId: mcp.config.plugin.global.trae-remote-official:github.github, serverUrl: https://api.githubcopilot.com/mcp/
[info] MCPOauthProvider [...] No token data found
...
[info] MCPOauthProvider [...] Saving discovery state (authServer: https://github.com/login/oauth)
[info] MCPOauthProvider [...] Get client metadata: {"client_name":"Trae","redirect_uris":["http://localhost:56507/callback"],"grant_types":["authorization_code","refresh_token"],"response_types":["code"],"token_endpoint_auth_method":"none"}
[info] MCPOauthProvider [...] No client info found
[error] MCPOauthService Error during auth completion: Incompatible auth server: does not support dynamic client registrationmcp-servers-render.log(注意解析后的 headers 为空):
[info] McpService resolve plugin connector config succeeded {"pluginId":"trae-remote-official:github","marketplaceName":"trae-remote-official","serverName":"github","headerKeys":[],"envKeys":[]}
[info] McpClientService startExtension: mcp.config.plugin.global.trae-remote-official:github.github {"type":"http","url":"https://api.githubcopilot.com/mcp","headers":{}}另一次会话中表现为:
[info] MCPOauthProvider [...] Token expired without refresh token期望结果
连接器授权成功后,插件 MCP 的请求头应被正确注入 connector.github.ACCESS_TOKEN,从而能够调用 GitHub MCP;或至少允许为该 MCP 手动配置静态 header / PAT。
根因分析
存在两个叠加问题,任一都足以导致该 MCP 永久不可用:
插件声明的 token 未注入到 MCP 请求头。 插件
.mcp.json中声明:{ "mcpServers": { "github": { "type": "http", "url": "https://api.githubcopilot.com/mcp/", "headers": { "Authorization": "Bearer ${connector.github.ACCESS_TOKEN}" } } } }但 Trae 解析结果为
headerKeys: []、headers: {},即${connector.github.ACCESS_TOKEN}占位符没有被替换,Authorization头为空。Trae 于是在 MCP 层改用自带 OAuth 流程,而 GitHub 不支持动态客户端注册(RFC 7591 / DCR)。 Trae 向
https://api.githubcopilot.com/mcp/做 RFC 8414 发现后,得到授权服务器https://github.com/login/oauth,随后尝试动态注册客户端,因 GitHub 不支持 dynamic client registration 而失败,报Incompatible auth server: does not support dynamic client registration,因此永远无法拿到 token。
由于第 2 点是协议层的确定性失败,因此清缓存 / 重新授权 / 重启都不会改变结果。
影响范围
Trae CN 1.107.1 下,官方 trae-remote-official:github 插件完全不可用;同类「连接器提供静态 Bearer token + 目标服务不支持 DCR」的插件预计同样受影响。
建议修复方向
修复插件连接器 token 到 MCP 请求头的注入(让
${connector..ACCESS_TOKEN}在.mcp.json的headers中正确解析)。MCP OAuth 流程在服务端不支持 DCR 时,应支持降级为静态 header / 预注册 client id / 手动 PAT,而不是直接判定授权失败。
临时规避
改用本地 stdio MCP(不涉及 OAuth/DCR):
{
"mcpServers": {
"github-pat": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "" }
}
}
}Issue 由用户手动排查后提交,日志来自 %APPDATA%\Trae CN\logs\\mcp-servers-main.log 与 mcp-servers-render.log。
成为第一条评论!
Nobody's responded to this post yet. Add your thoughts and get the conversation going.