# GitHub MCP Server Configuration
# Copy this file to .env for local development/testing only and fill in your values
# Note: In production, configure environment variables via your Claude Desktop `claude_desktop_config.json` (mcpServers.env)
# ============================================================================
# AUTHENTICATION - Choose ONE method (GitHub App is preferred)
# ============================================================================
# Option 1: GitHub App Authentication (Recommended for production)
# Provides higher rate limits and better security
# Get these from: https://github.com/settings/apps/YOUR_APP_NAME
GITHUB_APP_ID=your_app_id_here
GITHUB_APP_INSTALLATION_ID=your_installation_id_here
# Private key can be provided in two ways:
# Option A: Direct key content (for CI/CD or containerized environments)
GITHUB_APP_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----"
# Option B: Path to key file (for local development)
# Windows example:
GITHUB_APP_PRIVATE_KEY_PATH=C:\Users\YourName\Documents\github-mcp-server-key.pem
# Linux/Mac example:
# GITHUB_APP_PRIVATE_KEY_PATH=/home/username/.ssh/github-mcp-server-key.pem
# Option 2: Personal Access Token (Fallback or simple setup)
# Get from: https://github.com/settings/tokens
# GitHub App will be tried first, then falls back to PAT if App is not configured
GITHUB_TOKEN=ghp_your_personal_access_token_here
# ============================================================================
# WORKSPACE CONFIGURATION
# ============================================================================
# Workspace root directory (optional, defaults to current directory)
# Used by workspace tools (grep, str_replace, etc.)
MCP_WORKSPACE_ROOT=/path/to/workspace
# ============================================================================
# CODE-FIRST MODE
# ============================================================================
# Code-first mode is enforced by the architecture - no configuration needed!
# The server always exposes only the execute_code tool, providing 98% token savings.
# Legacy environment variables like MCP_CODE_FIRST_MODE are not required and will be ignored.
# MCP_CODE_FIRST_MODE=true # Obsolete - not needed
# ============================================================================
# NOTES
# ============================================================================
# Authentication Priority:
# 1. GitHub App (if GITHUB_APP_ID, GITHUB_APP_INSTALLATION_ID, and
# either GITHUB_APP_PRIVATE_KEY or GITHUB_APP_PRIVATE_KEY_PATH are set)
# 2. Personal Access Token (if GITHUB_TOKEN is set)
# 3. No authentication (public repos only)
# GitHub App Setup:
# 1. Create a GitHub App at: https://github.com/settings/apps/new
# 2. Set permissions (contents:read, contents:write, pull_requests:write, etc.)
# 3. Install the app on your organization/user account
# 4. Get Installation ID from: https://github.com/settings/installations
# 5. Download the private key (.pem file) from app settings
# Security Best Practices:
# - Never commit .env file to version control
# - Use GITHUB_APP_PRIVATE_KEY_PATH for local development
# - Use GITHUB_APP_PRIVATE_KEY (env var) for CI/CD
# - Rotate tokens and keys regularly
# - Use least-privilege permissions