github / github/copilot-cli

MCP OAuth intermittently fails on Windows with socket error 10013

未关闭
#4,463 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

area:authentication area:mcp area:platform-windows
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

Describe the bug

OAuth authentication for a remote HTTP MCP server intermittently fails before the browser authorization flow opens.

OAuth authentication failed: MCPOAuthError: An attempt was made to 
access a socket in a way forbidden by its access permissions. (os error 10013)
Affected version

1.0.79

Steps to reproduce the behavior
  1. Configure an OAuth-enabled remote HTTP MCP server without specifying auth.redirectPort.
  2. Start a new Copilot CLI session.
  3. Run /mcp auth <server-name>.
  4. Authentication may fail while creating the local OAuth callback listener.
Expected behavior

Copilot CLI should select an available callback port. If binding fails, it should retry using another port and report the attempted port if all retries fail.

Additional context
Workaround

Pinning a known-available port and restarting Copilot CLI allowed authentication to complete:

"auth": {
  "redirectPort": 47000
}

The problem is intermittent. Authentication later worked without the override, possibly because credentials were cached or automatic port selection chose a usable port.

Environment
  • Copilot CLI: 1.0.79
  • Package: 1.0.79-9
  • OS: Windows x64

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

/mcp auth 流程以及创建本地 OAuth 回调监听器的 auth.redirectPort 处理开始;在不覆盖端口的情况下,使用启用 OAuth 的远程 HTTP MCP 服务器在 Windows 上重现该失败。完成标准是:自动端口选择在 bind 失败后重试,并在所有重试都失败时报告尝试过的端口。

由索引模型根据 Issue 内容生成。

评估

领域
authentication, cli, networking
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
67/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。