Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 23, 2025

Summary

Add GITHUB_ACCESS_TOKEN environment variable as the preferred name, with GITHUB_PERSONAL_ACCESS_TOKEN as deprecated fallback. The old name incorrectly implied only PATs work when OAuth tokens (e.g., from VS Code) are equally valid.

Why

The environment variable name GITHUB_PERSONAL_ACCESS_TOKEN is too restrictive. OAuth tokens provisioned by IDEs work fine but the name suggests otherwise, forcing users toward manual PAT creation unnecessarily.

What changed

  • cmd/github-mcp-server/main.go: Check GITHUB_ACCESS_TOKEN first, fallback to GITHUB_PERSONAL_ACCESS_TOKEN
  • Error message now mentions both variables
  • Documentation updated: README, server-configuration.md, all installation guides, e2e tests
  • Both variables work; new one takes precedence when both set

MCP impact

  • No tool or API changes

Configuration change only—no MCP protocol or tool changes.

Prompts tested (tool changes only)

N/A

Security / limits

  • No security or limits impact

Uses existing token validation; only changes variable name lookup.

Tool renaming

  • I am not renaming tools as part of this PR

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Updated (README / docs / examples)

All documentation and examples now use GITHUB_ACCESS_TOKEN. Added deprecation notice for old variable name.

Original prompt

This section details on the original issue you should resolve

<issue_title>GITHUB_PERSONAL_ACCESS_TOKEN env var name assumes a PAT will be used</issue_title>
<issue_description>The GitHub MCP server must be spawned with GITHUB_PERSONAL_ACCESS_TOKEN as an environment variable set with a value to use in GitHub API calls.
But the very name of this environment variable specifies too much. A personal access token is an access token that is provisioned manually by the user (through https://github.com/settings/tokens). This is tedious and a 'last resort' for authorizing apps.

A far preferable way to get an access token (which presumably works for this MCP server) is to use OAuth 2.0. For example, the Visual Studio keychain can produce such a token automatically for the user. But this is not a personal access token, but rather merely an access token.

The environment variable name suggests it must be a PAT, but in fact it's just an access token that's required.

Please consider adding support for GITHUB_ACCESS_TOKEN as an environment variable, document that, and deprecate use of the old environment variable name.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits December 23, 2025 13:51
- Support GITHUB_ACCESS_TOKEN as the primary environment variable
- Keep GITHUB_PERSONAL_ACCESS_TOKEN as deprecated fallback
- GITHUB_ACCESS_TOKEN takes precedence when both are set
- Update error message to mention both variables
- All existing tests pass

Co-authored-by: SamMorrowDrums <[email protected]>
- Update e2e tests to use new GITHUB_ACCESS_TOKEN variable
- Update e2e README documentation

Co-authored-by: SamMorrowDrums <[email protected]>
- Update README.md with GITHUB_ACCESS_TOKEN and deprecation notice
- Update docs/server-configuration.md
- Update all installation guides
- Update script/conformance-test
- Add note that server accepts any GitHub access token (PAT or OAuth)

Co-authored-by: SamMorrowDrums <[email protected]>
Copilot AI changed the title [WIP] Update GITHUB_PERSONAL_ACCESS_TOKEN env var to access token Support GITHUB_ACCESS_TOKEN for OAuth and PAT compatibility Dec 23, 2025
Copilot AI requested a review from SamMorrowDrums December 23, 2025 14:04
@SamMorrowDrums SamMorrowDrums marked this pull request as ready for review December 23, 2025 14:47
@SamMorrowDrums SamMorrowDrums requested a review from a team as a code owner December 23, 2025 14:47
Copilot AI review requested due to automatic review settings December 23, 2025 14:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for GITHUB_ACCESS_TOKEN as the preferred environment variable name for GitHub authentication, while maintaining backward compatibility with GITHUB_PERSONAL_ACCESS_TOKEN. The change addresses the misleading naming that suggested only Personal Access Tokens (PATs) work, when OAuth tokens from IDEs are equally valid.

Key Changes:

  • Added fallback logic in cmd/github-mcp-server/main.go to check GITHUB_ACCESS_TOKEN first, then GITHUB_PERSONAL_ACCESS_TOKEN
  • Updated error messages to reference both variable names
  • Comprehensively updated all documentation, installation guides, examples, and test files to use the new variable name

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
cmd/github-mcp-server/main.go Implements the environment variable fallback logic with clear precedence ordering and updated error message
e2e/e2e_test.go Updates Docker environment variable and comments in end-to-end test setup
e2e/README.md Updates documentation to reference the new variable name
script/conformance-test Updates conformance test script to use new variable name
docs/server-configuration.md Updates all configuration examples throughout the server configuration guide
docs/installation-guides/install-claude.md Updates all Claude installation examples and commands
docs/installation-guides/install-cursor.md Updates Docker configuration example for Cursor IDE
docs/installation-guides/install-gemini-cli.md Updates Gemini CLI configuration examples for both Docker and binary installations
docs/installation-guides/install-windsurf.md Updates Windsurf configuration example
docs/installation-guides/install-other-copilot-ides.md Updates configuration examples for various Copilot-enabled IDEs
docs/installation-guides/install-antigravity.md Updates Docker configuration example for Antigravity IDE
README.md Updates all examples, prerequisites section, and Docker commands; adds deprecation notice for old variable name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GITHUB_PERSONAL_ACCESS_TOKEN env var name assumes a PAT will be used

2 participants