A New Collection of Thoughtful Learning Apps — Now Available on iOS & Android

Image
I’m excited to share a set of mobile apps I’ve recently completed and published on both the Google Play Store and the Apple App Store. These apps are designed with a simple goal in mind: to make meaningful, structured content more accessible, whether you’re studying theology or improving your English vocabulary. 📱 Now Available on Both Platforms All apps are live and available for download: Google Play Developer Page: https://play.google.com/store/apps/dev?id=5835943159853189043 Apple App Store Developer Page: https://apps.apple.com/ca/developer/q-z-l-corp/id1888794100 📖 Theology & Confession Study Apps For those interested in Reformed theology and classical Christian teachings, I’ve developed a series of apps that present foundational texts in a clean, focused reading format: The Belgic Confession Canons of Dort Heidelberg Catechism Westminster Shorter Catechism Each app is designed to provide a distraction-free experience, making it easier to read, reflect, and revisit these im...

GitHub Copilot MCP 服务器 OAuth 认证问题 - 完美解决!

GitHub Copilot MCP 服务器 OAuth 认证问题 - 完美解决!



问题描述

如果你在 VS Code 中看到这个错误:

● MCP Server: github-mcp-server
  Type:     http
  URL:      https://api.individual.githubcopilot.com/mcp/readonly
  Status:   ✗ Failed
  Error:    OAuth authentication failed for github-mcp-server

你不是一个人。这个令人沮丧的错误会导致 Copilot 的高级功能不可用,即使你已经登录了 VS Code。

根本原因

这个问题源于你的 ~/.copilot/mcp-config.json 文件。如果你手动创建或编辑过这个配置文件,但没有包含 OAuth 令牌,MCP 服务器将无法进行身份验证。

以下是一个有问题的配置示例:

{
  "mcpServers": {
    "github-mcp-server": {
      "type": "http",
      "url": "https://api.individual.githubcopilot.com/mcp/readonly"
    }
  }
}

看到缺失的身份验证凭据了吗?那就是罪魁祸首。

最简单的解决方案(推荐)

只需删除 mcp-config.json 文件:

rm ~/.copilot/mcp-config.json

然后:

  1. 打开 VS Code
  2. 如果还没有登录,请登录 GitHub Copilot
  3. 关闭并重新打开 VS Code,或重新加载窗口

就这样!当你登录时,VS Code 会自动使用正确的 OAuth 身份验证创建正确的配置。

做完这些后,你应该会看到:

● Environment loaded: 1 MCP server

  MCP Servers

  No user-configured servers.

  Built-in:
  ❯✓ github-mcp-server   http   https://api.individual.github
                                  copilot.com/mcp/readonly

对号符(✓)表示服务器现在已正确身份验证并已连接!

替代方案:保留配置文件

如果你想保留 mcp-config.json 文件(例如,稍后添加自定义 MCP 服务器),你必须包含 OAuth 令牌:

遗憾的是,OAuth 令牌通常由 VS Code 安全管理,不会直接暴露在配置文件中。最安全的方法是:

  1. 让 VS Code 自动管理内置的 github-mcp-server 配置
  2. mcp-config.json 中添加任何额外的自定义 MCP 服务器
  3. 永远不要手动编辑配置文件中的 github-mcp-server 条目

关键要点

  • 最简单的解决方案:删除 ~/.copilot/mcp-config.json,让 VS Code 处理它
  • VS Code 自动管理 OAuth:你不需要手动将令牌添加到配置中
  • 手动编辑容易出错:如果你手动创建这个文件,你很可能会遇到这个问题
  • 文件位置:配置存储在 ~/.copilot/mcp-config.json(注意点目录)

验证设置

要验证你的设置是否正常工作:

  1. 打开 VS Code
  2. 打开 Copilot Chat 面板
  3. 如果你可以在没有错误的情况下编写消息并将其提交给 Copilot,那么 MCP 服务器已正确身份验证

你也不应该在 MCP 服务器配置中看到错误图标或"Failed"状态消息。

仍然有问题?

如果你已删除配置文件并重新登录,但仍看到身份验证错误:

  1. 确保你已登录 GitHub:打开 VS Code 命令面板并运行 GitHub: Open on GitHub 来验证你的身份验证
  2. 完全重启 VS Code(包括所有窗口)
  3. 检查你是否已安装最新的 VS Code 和 GitHub Copilot 扩展
  4. 如果问题仍然存在,请尝试登出并重新登录:Settings > Accounts > Sign out,然后重新登录

这个问题为什么会发生

GitHub Copilot MCP 身份验证问题通常是由手动创建的配置文件引起的,该文件没有包含适当的 OAuth 凭据。最简单和最可靠的解决方案是删除配置文件,让 VS Code 自动处理身份验证。这是设计的初衷——VS Code 安全地管理令牌,所以你不必担心它。

总结

GitHub Copilot MCP 认证问题通常是由手动创建的配置文件而没有适当的 OAuth 凭据引起的。最简单和最可靠的修复是删除配置文件,让 VS Code 自动处理身份验证。这是预期的设计——VS Code 安全地管理令牌,所以你不必担心它。

祝你使用 GitHub Copilot 开心!🚀


修复于:2026 年 3 月 5 日
环境:macOS, VS Code, GitHub Copilot

❤️ Support This Blog


If this post helped you, you can support my writing with a small donation. Thank you for reading.


Comments

Popular Posts

Fix “A problem occurred starting process 'command node'” in Android Studio for React Native

Fix up watchman issue with Ghost

Using Mutual TLS (mTLS) in Next.js (Server-Side Only)