This document explains how to set up and use the GitHub MCP (Model Context Protocol) integration in the Automated Dependency Update System.
The GitHub MCP server now runs using Docker - no local installation required!
When you use the application, it will automatically:
- Pull the official GitHub MCP Docker image if not present
- Run the MCP server in a container
- Connect and perform GitHub operations
- Clean up the container after use
Requirements:
- Docker must be installed and running (Install Docker)
- Internet connection to pull the Docker image
- GitHub Personal Access Token (see below)
GitHub MCP is a Model Context Protocol server that provides programmatic access to GitHub's API through a standardized interface. This integration replaces the need for the GitHub CLI (gh) and provides more robust, programmatic access to GitHub operations.
- No CLI required: Works without installing the GitHub CLI
- Docker-based: Portable and easy to set up across platforms
- No manual building: Docker image is pre-built and ready to use
- Programmatic access: Direct API integration for better error handling
- Standardized interface: Uses the MCP protocol for consistent tool calling
- Better error messages: More detailed error reporting
- Token-based auth: Simple environment variable authentication
- Automatic cleanup: Docker containers are removed after use
Install a Docker-compatible container runtime on your system:
macOS (recommended):
# Option 1: OrbStack (lightweight, fast, recommended)
brew install orbstack
# Option 2: Docker Desktop
# Download from https://www.docker.com/products/docker-desktopImportant for macOS Users - Fix PATH:
If you encounter "docker: command not found" errors in Python, add docker to your PATH:
# For zsh (macOS default)
echo 'export PATH="/usr/local/bin:/opt/homebrew/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
# For bash
echo 'export PATH="/usr/local/bin:/opt/homebrew/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profileLinux:
# Ubuntu/Debian
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# Verify installation
docker --versionWindows:
- Download Docker Desktop from https://www.docker.com/products/docker-desktop
Verify it's working:
docker ps
# Or for OrbStack/Podman
docker --versionThe GitHub MCP container image will be automatically pulled when first used:
ghcr.io/github/github-mcp-server
Supported Container Runtimes: The system auto-detects and works with:
- Docker Desktop
- OrbStack (macOS)
- Podman Desktop
- Rancher Desktop
Install the MCP Python package:
pip install mcp>=1.0.0Or install all dependencies from requirements.txt:
pip install -r requirements.txtCreate a GitHub Personal Access Token with the following scopes:
Required scopes:
repo- Full control of private repositoriesworkflow- Update GitHub Action workflows
Steps to create token:
- Go to https://github.com/settings/tokens
- Click "Generate new token" → "Generate new token (classic)"
- Give it a descriptive name (e.g., "Dependency Update MCP")
- Select the required scopes:
repo,workflow - Click "Generate token"
- Copy the token immediately (you won't be able to see it again)
Set the GitHub token as an environment variable:
export GITHUB_PERSONAL_ACCESS_TOKEN='your_token_here'To make it permanent, add to your shell profile:
# For bash
echo 'export GITHUB_PERSONAL_ACCESS_TOKEN="your_token"' >> ~/.bashrc
source ~/.bashrc
# For zsh
echo 'export GITHUB_PERSONAL_ACCESS_TOKEN="your_token"' >> ~/.zshrc
source ~/.zshrc-
github_mcp_client.py - Main MCP client module
GitHubMCPClientclass for async operationscreate_pr_sync()- Synchronous PR creation wrappercreate_issue_sync()- Synchronous issue creation wrapper- Runs GitHub MCP server in stdio mode via Docker
-
smart_dependency_updater.py - Updated to use MCP
create_github_pr()tool - Uses MCP instead of gh CLIcreate_github_issue()tool - Uses MCP instead of gh CLI
-
auto_update_dependencies.py - Updated prerequisites
- Uses Docker to run GitHub MCP server
- Checks for GITHUB_PERSONAL_ACCESS_TOKEN
Application Tool Call
↓
smart_dependency_updater.py
create_github_pr() or create_github_issue()
↓
github_mcp_client.py
create_pr_sync() or create_issue_sync()
↓
GitHubMCPClient (async)
↓
MCP Protocol over stdio (IMPORTANT: server runs in stdio mode)
↓
Docker Container
ghcr.io/github/github-mcp-server stdio
↓
GitHub REST API
The GitHub MCP server must run in stdio mode for MCP protocol communication:
docker run -i --rm \
-e GITHUB_PERSONAL_ACCESS_TOKEN='token' \
ghcr.io/github/github-mcp-server \
stdio # ← Required argumentWithout the stdio argument, the server will not respond to MCP requests.
The GitHub MCP server provides many tools. Here are the main ones used:
- create_pull_request - Create a new pull request
- create_issue - Create a new issue
- get_repository - Get repository information
- list_pull_requests - List pull requests
- list_issues - List issues
- get_pull_request - Get specific PR details
- get_issue - Get specific issue details
Docker is not installed or not running.
Solution:
# Check if Docker is installed
docker --version
# Check if Docker daemon is running
docker ps
# Start Docker (Linux systemd)
sudo systemctl start docker
# Or use Docker Desktop GUI on macOS/WindowsNetwork issues or Docker registry problems.
Solution:
# Manually pull the image
docker pull ghcr.io/github/github-mcp-server
# Check if image exists
docker images | grep github-mcp-serverThe environment variable is missing.
Solution: Set the token:
export GITHUB_PERSONAL_ACCESS_TOKEN='your_token'The MCP server may have issues with the connection.
Potential causes:
- Invalid token
- Network issues
- Server not responding
Solution: Check token validity and retry.
The token doesn't have sufficient permissions.
Solution: Ensure token has repo and workflow scopes.
The Python MCP package is not installed.
Solution:
pip install mcp>=1.0.0| Feature | GitHub CLI (gh) | GitHub MCP (Docker) |
|---|---|---|
| Installation | Requires gh CLI binary | Requires Docker only |
| Authentication | gh auth login |
Environment variable |
| Interface | Command-line subprocess | Python async/await |
| Error Handling | Parse stderr text | Structured responses |
| Integration | Shell commands | Native Python |
| Dependencies | External binary | Docker + Python package |
| Performance | Subprocess overhead | Direct API calls |
| Flexibility | CLI flags only | Full API access |
| Portability | OS-specific binary | Cross-platform (Docker) |
| Updates | Manual upgrades | Docker image updates |
If you were using the GitHub CLI (gh):
Before (GitHub CLI):
# Authentication
gh auth login
# Create PR
gh pr create --repo owner/repo --title "Title" --body "Body"After (GitHub MCP):
# Authentication
export GITHUB_PERSONAL_ACCESS_TOKEN='token'
# Create PR (Python)
python -c "from github_mcp_client import create_pr_sync; print(create_pr_sync('owner/repo', 'branch', 'Title', 'Body'))"- Never commit your token to version control
- Use environment variables or secret management
- Rotate tokens regularly
- Use tokens with minimal required scopes
- Consider using GitHub Apps for production
For issues with:
- GitHub MCP Server: https://github.com/github/github-mcp-server/issues
- This integration: https://github.com/codeWithUtkarsh/AiAgentToolCalling/issues