A comprehensive Model Context Protocol (MCP) server that provides Git repository management capabilities for AI assistants and automation tools. Includes 29 Git operations + 11 workflow combinations with complete CLI alias system and advanced developer pr
npm install github-mcp-serverA Model Context Protocol (MCP) server that provides 29 Git operations + 11 workflow combinations for AI assistants and developers. This server exposes comprehensive Git repository management through a standardized interface, enabling AI models and developers to safely manage complex version control workflows.
GitHub MCP Server bridges AI assistants with Git repositories and provides powerful developer productivity tools. It provides:
- Safe Git operations through a standardized MCP interface (29 operations)
- Complete version control capabilities including advanced operations (tag, merge, rebase, cherry-pick, blame, bisect)
- 31 workflow combinations for enhanced developer productivity
- Advanced developer tools (backup, cleanup, workflow automation)
- Error handling and validation to prevent common Git mistakes
- Direct integration with VS Code and AI assistants like GitHub Copilot
- CLI wrapper for terminal access and automation
This server provides comprehensive Git repository management through two main categories:
bin/basic/ - see Basic Operations Guide for detailed documentation.- File Management: Add, remove files from staging area
- Repository Information: Status, history, differences
- Commit Operations: Create commits, push, pull
- Branch Management: Create, switch branches
- Remote Management: Add, remove, configure remotes
- Stash Operations: Temporarily save changes
- Reset Operations: Repository state management
bin/advanced/ - see Advanced Workflows Guide for comprehensive documentation.- Workflow Combinations: Complete flows (addβcommitβpush), quick commits, sync operations
- Development Tools: Smart development workflows, backup systems
- Advanced Git Features: Tags, merging, rebasing, cherry-picking, blame, bisect
- Maintenance & Safety: Repository cleanup, optimization, backup management
- Professional Workflows: Release management, hotfix procedures, team collaboration
The fastest way to use GitHub MCP Server is with npx - no installation required!
``bashBasic Git operations
npx github-mcp-server gstatus
npx github-mcp-server gadd
npx github-mcp-server gcommit "your commit message"
npx github-mcp-server gpush
$3
For frequent use, install globally:
`bash
Using npm
npm install -g github-mcp-serverUsing pnpm (recommended)
pnpm add -g github-mcp-serverThen use directly
gstatus
gflow "your message"
gsync
`$3
See markdown/INSTALLATION.md for detailed installation guide for Windows, macOS, WSL, and all platforms.
π€ MCP Server Integration (Cursor, Claude, etc.)
$3
Cursorμμ GitHub MCP Serverλ₯Ό μ¬μ©νλ €λ©΄ λ€μ μ€μ μ μΆκ°νμΈμ:
File:
~/.cursor/mcp_config.json#### π GitHub ν ν° μ€μ (κΆμ₯)
GitHub ν ν°μ μ€μ νλ©΄ μΈμ¦ μ€λ₯ μμ΄ Git μμ
μ μνν μ μμ΅λλ€:
1. GitHub Personal Access Token μμ±:
- GitHub.com β Settings β Developer settings β Personal access tokens β Tokens (classic)
- "Generate new token" β "Generate new token (classic)"
- κΆν μ€μ :
repo, workflow, write:packages λ± νμν κΆν μ ν
- ν ν° μμ± ν μμ ν κ³³μ μ μ₯2. νκ²½λ³μ μ€μ :
-
GITHUB_TOKEN: GitHub Personal Access Token
- GITHUB_USERNAME: GitHub μ¬μ©μλͺ
(μ νμ¬ν, κΈ°λ³Έκ°: 'git')`json
{
"mcpServers": {
"github-mcp-server": {
"command": "npx",
"args": ["github-mcp-server-mcp"],
"env": {
"GITHUB_TOKEN": "your_github_personal_access_token",
"GITHUB_USERNAME": "your_github_username"
},
"capabilities": ["tools", "resources", "prompts"]
}
}
}
`$3
#### Claude Desktop
File:
~/.config/claude/claude_desktop_config.json`json
{
"mcpServers": {
"github-mcp-server": {
"command": "npx",
"args": ["github-mcp-server", "mcp"],
"env": {}
}
}
}
`#### Continue (VS Code Extension)
File:
~/.continue/config.json`json
{
"models": [
{
"title": "GitHub MCP Assistant",
"provider": "anthropic",
"model": "claude-3-5-sonnet-20241022",
"contextLength": 200000,
"mcpServers": [
{
"name": "github-mcp-server",
"command": "npx",
"args": ["github-mcp-server", "mcp"],
"env": {}
}
]
}
]
}
`$3
npm ν¨ν€μ§λ‘ μ€μΉλ MCP μλ²λ₯Ό μ§μ μ€νν μλ μμ΅λλ€:
`bash
κΈλ‘λ² μ€μΉ ν
npm install -g github-mcp-server
github-mcp-server mcpλλ npxλ‘ μ§μ μ€ν
npx github-mcp-server mcp
`$3
MCP μλ²λ₯Ό ν΅ν΄ μ¬μ©ν μ μλ 29κ° Git μμ
:
- κΈ°λ³Έ μμ
: git-status, git-add, git-commit, git-push, git-pull
- λΈλμΉ κ΄λ¦¬: git-branch, git-checkout, git-merge, git-rebase
- κ³ κΈ μμ
: git-tag, git-cherry-pick, git-blame, git-bisect
- μν¬νλ‘μ°: git-flow, git-sync, git-backup, git-clean
μμΈν μ€μ μ markdown/MCP_UNIVERSAL_CONFIG.mdλ₯Ό μ°Έμ‘°νμΈμ.
π Quick Usage Guide
$3
`bash
Check repository status
npx github-mcp-server gstatusAdd all files and commit
npx github-mcp-server gadd
npx github-mcp-server gcommit "your commit message"Push to remote
npx github-mcp-server gpushPull from remote
npx github-mcp-server gpullBranch operations
npx github-mcp-server gbranch feature-auth
npx github-mcp-server gcheckout feature-authView history and differences
npx github-mcp-server glog 5
npx github-mcp-server gdiff main
`$3
`bash
Complete workflow (add β commit β push)
npx github-mcp-server gflow "implement new feature"Quick commit without push
npx github-mcp-server gquick "fix typo"Sync with remote (pull β push)
npx github-mcp-server gsyncDevelopment session management
npx github-mcp-server gdev feature-authBackup and safety
npx github-mcp-server gbackup --emergencyRepository cleanup
npx github-mcp-server gclean --optimize
`$3
`bash
Tag management
npx github-mcp-server gtag create v1.0.0 "Release version"Merge operations
npx github-mcp-server gmerge feature-branchRebase operations
npx github-mcp-server grebase mainCherry-pick specific commit
npx github-mcp-server gcherry abc1234Line-by-line authorship
npx github-mcp-server gblame src/app.js
`$3
`bash
List all available operations
npx github-mcp-server listGet help for specific operation
npx github-mcp-server helpShow basic operations
npx github-mcp-server glist basicShow advanced workflows
npx github-mcp-server glist advanced
`ποΈ Project Structure & Architecture
GitHub MCP Server is organized for clarity and progressive learning:
`
github-mcp-server/
βββ src/
β βββ index.ts # MCP server (29 tool registrations, schema definitions)
β βββ github.ts # Git operations engine (all 29 implementations)
βββ bin/
β βββ basic/ # π 17 Essential Git Operations
β β βββ README.md # Comprehensive basic operations guide
β β βββ gadd.js # Add files (git add)
β β βββ gcommit.js # Create commits (git commit)
β β βββ gpush.js # Push changes (git push)
β β βββ gpull.js # Pull changes (git pull)
β β βββ gstatus.js # Repository status (git status)
β β βββ gbranch.js # Branch management (git branch)
β β βββ gcheckout.js # Branch switching (git checkout)
β β βββ glog.js # Commit history (git log)
β β βββ gdiff.js # Show differences (git diff)
β β βββ gstash.js # Stash operations (git stash)
β β βββ gpop.js # Apply stash (git stash pop)
β β βββ greset.js # Reset operations (git reset)
β β βββ gclone.js # Clone repositories (git clone)
β β βββ gremote.js # Remote management (git remote)
β β βββ ginit.js # Initialize repository (git init)
β βββ advanced/ # π 13 Advanced Workflows & Automation
β βββ README.md # Comprehensive advanced workflows guide
β βββ gflow.js # Complete workflow (addβcommitβpush)
β βββ gquick.js # Quick commit workflow
β βββ gsync.js # Sync workflow (pullβpush)
β βββ gdev.js # Development session management
β βββ gworkflow.js # Professional workflow combinations
β βββ gfix.js # Smart fix and patch workflows
β βββ gfresh.js # Fresh start workflows
β βββ gbackup.js # Backup and safety operations
β βββ gclean.js # Repository cleanup and optimization
β βββ gsave.js # Save and preserve workflows
β βββ glist.js # Tool discovery and help system
β βββ grelease.js # Release management workflows
β βββ common.js # Shared utilities and helpers
βββ markdown/
β βββ INSTALLATION.md # Detailed installation guide
β βββ DEPLOY.md # Production deployment guide
β βββ DOCKER.md # Docker setup and deployment guide
β βββ QUICK_REFERENCES.md # Copy-paste command reference
βββ mcp-cli.js # Enhanced CLI wrapper (organized by structure)
βββ package.json # Project configuration & npm scripts
βββ tsconfig.json # TypeScript configuration
βββ README.md # This comprehensive guide
`π Documentation Structure
- bin/basic/README.md - Complete guide to 17 essential Git operations
- bin/advanced/README.md - Comprehensive advanced workflows documentation
- markdown/INSTALLATION.md - Step-by-step installation for all platforms
- markdown/MCP_UNIVERSAL_CONFIG.md - Universal MCP configuration for all LLM clients
- markdown/QUICK_REFERENCES.md - Copy-paste commands for quick reference
- markdown/DOCKER.md - Docker setup, deployment, and containerization
- markdown/DEPLOY.md - Production deployment and hosting strategies
π§ Technical Architecture
$3
- 29 Tool Registrations with complete JSON schemas
- Enhanced Metadata with operation tracking and performance monitoring
- Input Validation using Zod schemas for type safety
- Error Handling Pipeline with timeout protection and meaningful messages
- Cross-platform Compatibility with environment normalization$3
- Comprehensive Implementation of all 29 Git operations
- Security Features - Command injection prevention and input sanitization
- Enhanced Error Handling with context-aware messaging for common scenarios
- Performance Monitoring - Operation duration tracking and logging
- Safety Checks - Repository validation and file existence verification$3
- Smart Organization - Tools categorized by basic vs advanced operations
- Directory-Aware Help - References to specific README files for detailed guidance
- Progressive Learning - Clear path from basic to advanced operations
- Tool Discovery - Enhanced glist` command with category filtering- π Repository Validation: Ensures directory is a valid Git repository
- π File Existence Checks: Validates files exist before Git operations
- β±οΈ Timeout Protection: 30-second timeout for operations
- π« Input Sanitization: Prevents command injection
- π Detailed Error Messages: Clear, actionable error descriptions