What this thread does
The problem
The GitHub MCP server returns 404 or Bad credentials for private repositories that belong to your organization, although the same token seems fine elsewhere. The GitHub issue was opened by adamklepacz on 2025-04-07 as a feature request. It was closed on 2025-12-23.
What the maintainers said
- Collaborator juruen (2025-04-07): private org repos already work; the token needs access to them, and the agent must be prompted correctly.
- Collaborator SamMorrowDrums (2025-04-10): ask whether the org uses SSO, because after creating a personal access token you may need to give it access to that restricted org. On 2025-04-23 he relabeled it a documentation gap: orgs set their own token rules, so this is GitHub auth working as intended and you would see the same calling the API directly.
- Closing comment (2025-12-23, by tommaso-moro, a project contributor) summarized what worked for users:
1. Use a classic PAT with the required scopes. 2. For a fine-grained PAT, set the Resource Owner to your organization, not your personal account. 3. If the org uses SSO, authorize the token for SSO after creating it.
What commenters added (not confirmed by maintainers)
- One commenter found a classic token with the top-level
reposcope was needed; partial scopes gave no private repo support. - Commenters said the org must allow PAT access in its settings, and that you must restart the MCP server after changing the token environment variable.
- A commenter said the agent only worked once the prompt named the org as the owner; another saw a VS Code assistant use a plain web request instead of the MCP tools until told to use the tools.
- Some commenters with correct tokens still got
Bad credentialsthrough the server while the same token worked with cURL (Aug and Sept 2025). Nobody answered them.
Read-only and tool filtering
A user asked for read-only access to a private repo. SamMorrowDrums pointed to the documented read-only mode (for the remote server via URL, regardless of token) and a contributor added the X-MCP-Tools header or the local --tools flag. I confirmed X-MCP-Tools, --tools and --read-only in the repository's server-configuration docs, which also list X-MCP-Readonly (or a /readonly URL) for the remote server and say read-only mode takes precedence over other options by disabling write tools. Read-only mode filters tools; it does not reduce the token's own permissions.
OAuth instead of a token
Commenters in 2026 argued that a static token is not equivalent to OAuth for apps used by many people. A maintainer replied (2026-09-04) that you can supply your own OAuth app, that clients lacking this are a client gap, and that the local stdio server can now run its own OAuth flow (better with the release binary than Docker because of the callback port). I did not test that.
Not covered
Fetching raw file URLs with a signed query token was acknowledged by a collaborator as worth investigating; the thread shows no outcome. I did not run any of this.
Sources
- github/github-mcp-server issue 153 was read through the GitHub API with all comments. Checked: opened 2025-04-07 by adamklepacz, closed 2025-12-23; the collaborator comments of 2025-04-07 and 04-10 and the 2025-04-23 relabel as a documentation gap; the 2025-06-26 raw-file remark; the 2025-12-19 read-only answer; the closing comment of 2025-12-23 by a project contributor listing the three token fixes; the 2026-09-04 OAuth reply.
- The server-configuration doc in the same repository was read through the API. Checked: toolsets, individual tools (X-MCP-Tools, --tools), read-only mode (X-MCP-Readonly, --read-only) and the precedence note.
Not checked: the commenters' Bad credentials reports and the stdio OAuth flow; nothing was run.
Started from a post by @adamklepacz, packaged by the editor. Original post