Description
The @modelcontextprotocol/server-github package cannot access private GitHub repositories, consistently returning a "Not Found" error despite having a correctly authorized Personal Access Token (PAT). The same server successfully accesses public repositories with or without a token, indicating that the authentication mechanism is not being properly applied to API requests for private repositories.
Environment
- OS: macOS 24.3.0
- Node.js version: Latest stable
- MCP server package:
@modelcontextprotocol/server-github (latest)
- Configuration: Using npx to run the server
- Cursor v0.46.8
Reproduction Steps
- Create a GitHub Personal Access Token (PAT) with the
repo scope
- Configure the MCP server with this token:
{
"mcpServers": {
"github": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-github"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "your_token_here"
}
}
}
}
- Attempt to list issues from a private repository using:
mcp__list_issues({owner: "OWNER", repo: "PRIVATE_REPO", per_page: 3})
Actual Result
{"error":"MCP error -32603: Not Found: Resource not found: Not Found"}
Expected Result
The MCP server should successfully list issues from the private repository, similar to how it works with public repositories.
Verification Steps
-
Token authentication works correctly with public repositories:
mcp__list_issues({owner: "microsoft", repo: "vscode", per_page: 3})
Result: Successfully returns issues from the microsoft/vscode repository.
-
Direct API calls to the private repository using the same token work properly:
-
Using curl:
curl -H "Authorization: token GITHUB_TOKEN" https://api.github.com/repos/OWNER/PRIVATE_REPO/issues
Result: Successfully returns issues from the private repository.
-
Using a custom Node.js script:
// Custom script with same token
const fetch = require('node-fetch');
async function getIssues() {
const response = await fetch(
'https://api.github.com/repos/OWNER/PRIVATE_REPO/issues',
{
headers: {
Authorization: `token ${process.env.GITHUB_TOKEN}`,
'User-Agent': 'GitHub-API-Test'
}
}
);
if (response.ok) {
const issues = await response.json();
console.log(JSON.stringify(issues, null, 2));
} else {
console.error('Error:', response.status, await response.text());
}
}
getIssues();
Result: Successfully returns issues from the private repository.
Additional Information
- Various environment variable names were tried (GITHUB_TOKEN, GH_TOKEN) with no difference in results
- The token permissions were thoroughly verified and confirmed to have the necessary
repo scope
- The error only occurs when trying to access private repositories through the MCP GitHub server
- The MCP server appears to be ignoring the authentication token when making API requests to GitHub for private repositories, as the behavior is identical with or without a token
Description
The
@modelcontextprotocol/server-githubpackage cannot access private GitHub repositories, consistently returning a "Not Found" error despite having a correctly authorized Personal Access Token (PAT). The same server successfully accesses public repositories with or without a token, indicating that the authentication mechanism is not being properly applied to API requests for private repositories.Environment
@modelcontextprotocol/server-github(latest)Reproduction Steps
reposcope{ "mcpServers": { "github": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-github" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "your_token_here" } } } }Actual Result
Expected Result
The MCP server should successfully list issues from the private repository, similar to how it works with public repositories.
Verification Steps
Token authentication works correctly with public repositories:
Result: Successfully returns issues from the microsoft/vscode repository.
Direct API calls to the private repository using the same token work properly:
Using curl:
Result: Successfully returns issues from the private repository.
Using a custom Node.js script:
Result: Successfully returns issues from the private repository.
Additional Information
reposcope