GitHub MCP Server
Provides 29 Git operations and 11 workflow combinations for AI assistants and developers, enabling comprehensive Git repository management through a standardized interface.
README
Github MCP Server
🔗 View on MCP Market
<br />
🔗 View on MCP Registry
<br />
📦 Available on npm<br/>
A 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.
🚀 Quick Installation
Option 1: .vscode/mcp.json (Recommended)
{
"mcpServers": {
"github-mcp-server": {
"command": "npx",
"args": ["-y", "@0xshariq/github-mcp-server@latest"]
}
}
}
Option 2: For CLI
pnpm i -g @0xshariq/github-mcp-server@latest
# Test Commands After Installation
gstatus
gadd
glog 10
gpush
Option 3: Symbolic Links (Alternative - No Package Manager)
# Clone and setup
git clone https://github.com/0xshariq/github-mcp-server.git
cd github-mcp-server
npm install && npm run build
# Create symbolic links (cross-platform)
./setup-symbolic.sh --user # User installation
# OR
sudo ./setup-symbolic.sh # System-wide (Linux/macOS)
# Test the installation
gstatus
glist
🛠️ Having Issues? If commands aren't working after installation, see our Complete Troubleshooting Guide for solutions to all common problems including "command not found" errors, path conflicts, PNPM issues, and the symbolic links alternative.
🎯 About
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
🚀 Features Overview
This server provides comprehensive Git repository management through two main categories:
📁 Basic Git Operations (17 operations)
Essential daily Git commands organized in 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
🚀 Advanced Git Operations (12 operations)
Sophisticated workflows and automation in 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
🛠️ Installation
See markdown/INSTALLATION.md for detailed installation guide for Windows, macOS, WSL, and all platforms.
🏗️ 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/TROUBLESHOOTING.md - 🛠️ Complete troubleshooting guide - Solutions to all common issues
- 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
📡 MCP Server Core (src/index.ts)
- 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
⚙️ Git Operations Engine (src/github.ts)
- 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
🖥️ Enhanced CLI System
- 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
glistcommand with category filtering
🛡️ Error Handling & Safety
- 🔍 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
🛠️ Troubleshooting
Having issues with installation or commands not working? We've got you covered! Our comprehensive troubleshooting guide covers solutions to all common problems:
🚨 Most Common Issues & Quick Fixes
| Problem | Quick Solution |
|---|---|
💥 command not found errors |
unset command_not_found_handle |
| 📁 Path conflicts with PNPM | Remove /5/ from global directory |
| 🔗 Commands show help instead of executing | Update wrapper scripts to pass command names |
| 🚫 Permission denied | chmod +x ~/.local/share/pnpm/g* |
👉 For detailed solutions, step-by-step fixes, and diagnostic tools, see our Complete Troubleshooting Guide
🆘 Quick Diagnostic
# Test if commands are working
gstatus # Should show repository status
env gstatus # Alternative if above fails
which gstatus # Should show path to command
# If still having issues, see TROUBLESHOOTING.md for complete solutions
License
ISC License
Author
Created for use with AI assistants that support the Model Context Protocol.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。