Environment Variables¶
Configure GitHub to MCP using environment variables.
Required Variables¶
None! All environment variables are optional, but some are highly recommended.
Recommended Variables¶
GITHUB_TOKEN¶
GitHub personal access token for API authentication.
| Without Token | With Token |
|---|---|
| 60 requests/hour | 5,000 requests/hour |
| Public repos only | Private repos accessible |
| Basic metadata | Full repository access |
Creating a Token:
- Go to GitHub Settings → Developer Settings → Personal Access Tokens
- Generate new token (classic)
- Select scopes:
repo(private) orpublic_repo(public only) - Copy the token
Optional Variables¶
LOG_LEVEL¶
Control logging verbosity.
| Value | Description |
|---|---|
debug | All messages including debug |
info | Informational messages (default) |
warn | Warnings and errors only |
error | Errors only |
silent | No output |
OPENAI_API_KEY¶
OpenAI API key for enhanced extraction (experimental).
Used for: - Improved tool descriptions - Better README parsing - Code understanding
GITHUB_API_URL¶
Custom GitHub API URL for GitHub Enterprise.
Default: https://api.github.com
HTTP_PROXY / HTTPS_PROXY¶
Proxy server for HTTP requests.
NO_COLOR¶
Disable colored output.
Setting Environment Variables¶
Temporary (Current Session)¶
Permanent¶
Per-Project¶
Create a .env file:
Security
Add .env to .gitignore to avoid committing secrets.
Using with Claude Desktop¶
Pass environment variables to MCP servers:
claude_desktop_config.json
{
"mcpServers": {
"my-repo": {
"command": "node",
"args": ["/path/to/server.mjs"],
"env": {
"GITHUB_TOKEN": "ghp_xxxxx",
"LOG_LEVEL": "debug"
}
}
}
}
Variable Precedence¶
- CLI flags (highest priority)
- Environment variables
- Config file
- Defaults (lowest priority)
# CLI flag overrides environment variable
export LOG_LEVEL=error
github-to-mcp <url> --verbose # Uses verbose, not error
See Also¶
- Configuration Options - All options
- Private Repos - Token setup
- CLI Reference - Command-line usage