-
Notifications
You must be signed in to change notification settings - Fork 86
Description
What happened?
The GitHub MCP server fails to authenticate when installed via mcpm, returning 401 Bad credentials errors for all API calls despite having a valid GitHub Personal Access Token configured.
Root Cause:
The Docker command in the server metadata (~/.mcpm/servers/github/metadata.json) uses incorrect syntax for passing environment variables. The -e flag is passed with only the token value instead of the KEY=VALUE format.
Current (broken) configuration in metadata.json:
"args": [
"run",
"-i",
"--rm",
"-e",
"${GITHUB_PERSONAL_ACCESS_TOKEN}",
"ghcr.io/github/github-mcp-server"
]This generates:
docker run -i --rm -e ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ghcr.io/github/github-mcp-serverDocker interprets this as creating an environment variable named ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx with no value, rather than setting GITHUB_PERSONAL_ACCESS_TOKEN to that value.
Steps to Reproduce:
- Install GitHub MCP server via mcpm:
mcpm install github - Configure
GITHUB_PERSONAL_ACCESS_TOKENin mcpm - Enable the server for a client:
mcpm client edit claude-code(or any other client) - Try to use any GitHub MCP tool (e.g.,
get_me,list_repositories) - Observe
401 Bad credentialserror
Verification that token is valid:
curl -H "Authorization: Bearer ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" https://api.github.com/user
# Returns user data successfullyWhat did you expect?
The -e flag should pass the variable name and value together in KEY=VALUE format:
Correct configuration:
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN=${GITHUB_PERSONAL_ACCESS_TOKEN}",
"ghcr.io/github/github-mcp-server"
]This should generate:
docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ghcr.io/github/github-mcp-serverThe GitHub MCP server should authenticate successfully and all API calls should work.
MCPM Version
2.9.0
OS
macOS
Logs
**Error from MCP tool call:**
MCP error -32603: failed to get user: GET https://api.github.com/user: 401 Bad credentials []
**Docker container environment inspection:**
$ docker inspect <container_id> --format '{{range .Config.Env}}{{println .}}{{end}}' | grep GITHUB
ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The environment variable is being set with the token as the variable name instead of `GITHUB_PERSONAL_ACCESS_TOKEN=<token>`.
**After manual fix:**
After manually updating `~/.mcpm/servers/github/metadata.json` (line 48) and `~/.claude.json` with the correct syntax, the GitHub MCP server authenticates successfully and returns the correct username.
---
**Impact:**
- GitHub MCP server is completely non-functional when installed via mcpm
- Affects all Docker-based installations of the GitHub MCP server
- This issue is propagated to all client configurations that mcpm generates
**Suggested Fix:**
Update the `metadata.json` for the GitHub MCP server in mcpm's server repository:
"args": [
"run",
"-i",
"--rm",
"-e",
- "${GITHUB_PERSONAL_ACCESS_TOKEN}",
+ "GITHUB_PERSONAL_ACCESS_TOKEN=${GITHUB_PERSONAL_ACCESS_TOKEN}",
"ghcr.io/github/github-mcp-server"
],