GitHub Copilot MCP Server OAuth Authentication Issue - Solved!
GitHub Copilot MCP Server OAuth Authentication Issue - Solved!
The Problem
If you're seeing this error in 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
You're not alone. This frustrating error can make Copilot's advanced features unavailable, even though you're signed into VS Code.
Root Cause
The issue stems from your ~/.copilot/mcp-config.json file. If you have manually created or edited this configuration file without including the OAuth token, the MCP server will fail to authenticate.
Here's what a problematic config looks like:
{
"mcpServers": {
"github-mcp-server": {
"type": "http",
"url": "https://api.individual.githubcopilot.com/mcp/readonly"
}
}
}
Notice the missing authentication credentials? That's the culprit.
The Easy Fix (Recommended)
Simply delete the mcp-config.json file:
rm ~/.copilot/mcp-config.json
Then:
- Open VS Code
- Sign in to GitHub Copilot if you haven't already
- Close and reopen VS Code, or reload the window
That's it! VS Code will automatically create the correct configuration with proper OAuth authentication when you sign in.
After this, you should see:
● 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
The checkmark (✓) indicates the server is now properly authenticated and connected!
Alternative: Keep the Config File
If you prefer to keep a mcp-config.json file (perhaps to add custom MCP servers later), you must include the OAuth token:
Unfortunately, the OAuth token is typically managed securely by VS Code and isn't directly exposed in the config file. The safest approach is to:
- Let VS Code manage the built-in github-mcp-server configuration automatically
- Add any additional custom MCP servers you need in
mcp-config.json - Never manually edit the github-mcp-server entry in the config file
Key Takeaways
- The simplest solution: Delete
~/.copilot/mcp-config.jsonand let VS Code handle it - VS Code manages OAuth automatically: You don't need to manually add tokens to the config
- Manual editing is error-prone: If you manually create this file, you're likely to encounter this issue
- The file location: Configuration is stored at
~/.copilot/mcp-config.json(note the dot directory)
Verification
To verify your setup is working correctly:
- Open VS Code
- Open the Copilot Chat panel
- If you can write and submit messages to Copilot without errors, the MCP server is properly authenticated
You should also see no error icons or "Failed" status messages in the MCP server configuration.
Still Having Issues?
If you've deleted the config file and re-signed in but still see authentication errors:
- Make sure you're signed into GitHub: Open the VS Code command palette and run
GitHub: Open on GitHubto verify your authentication - Restart VS Code completely (including all windows)
- Check that you have the latest VS Code and GitHub Copilot extension installed
- If problems persist, try logging out and back in:
Settings > Accounts > Sign outthen sign back in
Conclusion
The GitHub Copilot MCP authentication issue is usually caused by a manually created configuration file without proper OAuth credentials. The easiest and most reliable fix is to delete the config file and let VS Code handle the authentication automatically. This is the intended design—VS Code securely manages the token so you don't have to worry about it.
Happy coding with GitHub Copilot! 🚀
Fixed on: March 5, 2026
Environment: 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
Post a Comment