GIT MCP Server
simple-git
library for core functionality while maintaining proper security boundaries.Table of Contents
- Overview
- Features
- Installation
- Usage
- Project Structure
- Tools
- Resources
- Development
- License
Overview
- Repository Management: Initialize, clone, and check repository status
- Branch Operations: Create, list, checkout, delete, and merge branches
- Working Directory: Stage files, commit changes, create diffs
- Remote Operations: Add remotes, fetch, pull, push
- Advanced Git Commands: Manage tags, stash changes, cherry-pick, rebase
Architecture & Components
- MCP Server (`server.ts`): Uses the
@modelcontextprotocol/sdk
to create a server exposing resources and tools.
- Git Service (`services/git-service.ts`): Abstraction layer over the
simple-git
library providing clean interfaces for Git operations.
- Resources (`resources/`): Expose Git data (like status, logs, file content) through MCP resources with consistent URI templates.
- Tools (`tools/`): Expose Git actions (like commit, push, pull) through MCP tools with well-defined input schemas (validated using Zod).
- Error Handling (`services/error-service.ts`): Standardized error handling and reporting for Git and MCP operations.
- Entry Point (`index.ts`): Initializes and starts the server, connecting it to the standard I/O transport.
Features
Resource Access
- Repository Information: Access basic Git repository information including current branch, status, and reference details
- Repository Branches: List all branches in the repository with current branch indicator
- Repository Remotes: List all configured remote repositories with their URLs
- Repository Tags: List all tags in the repository with their references
- File Content: Access content of specific files at a given Git reference
- Directory Listing: View lists of files and directories at a specific path and reference
- Diffs: Get differences between references, unstaged changes, or staged changes
- Commit History: View detailed commit logs with author, date, and message information
- File Blame: See line-by-line attribution showing which commit last modified each line
- Commit Details: Access detailed information about specific commits including diff changes
Git Operations
- Repository Operations: Initialize repositories, clone from remotes, check repository status
- Branch Operations: Create branches, list branches, checkout, delete branches, merge
- Working Directory Operations: Stage files, unstage files, commit changes, create diffs
- Remote Operations: Add remotes, list remotes, fetch, pull, push
- Advanced Operations: Manage tags, stash changes, cherry-pick commits, rebase branches, reset, clean
Installation
Prerequisites
- Node.js 16 or higher
- Git installed and available in the PATH
Install from NPM
Install from Source
Usage
Running the Server
Integration with Claude
cline_mcp_settings.json
or claude_desktop_config.json
):Integration with Other MCP Clients
Project Structure
Tools
Repository Operations
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
Branch Operations
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
Working Directory Operations
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
Remote Operations
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
Advanced Operations
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
Resources
Repository Resources
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
Development
Build and Test
License
GIT MCP Server
simple-git
library for core functionality while maintaining proper security boundaries.Table of Contents
- Overview
- Features
- Installation
- Usage
- Project Structure
- Tools
- Resources
- Development
- License
Overview
- Repository Management: Initialize, clone, and check repository status
- Branch Operations: Create, list, checkout, delete, and merge branches
- Working Directory: Stage files, commit changes, create diffs
- Remote Operations: Add remotes, fetch, pull, push
- Advanced Git Commands: Manage tags, stash changes, cherry-pick, rebase
Architecture & Components
- MCP Server (`server.ts`): Uses the
@modelcontextprotocol/sdk
to create a server exposing resources and tools.
- Git Service (`services/git-service.ts`): Abstraction layer over the
simple-git
library providing clean interfaces for Git operations.
- Resources (`resources/`): Expose Git data (like status, logs, file content) through MCP resources with consistent URI templates.
- Tools (`tools/`): Expose Git actions (like commit, push, pull) through MCP tools with well-defined input schemas (validated using Zod).
- Error Handling (`services/error-service.ts`): Standardized error handling and reporting for Git and MCP operations.
- Entry Point (`index.ts`): Initializes and starts the server, connecting it to the standard I/O transport.
Features
Resource Access
- Repository Information: Access basic Git repository information including current branch, status, and reference details
- Repository Branches: List all branches in the repository with current branch indicator
- Repository Remotes: List all configured remote repositories with their URLs
- Repository Tags: List all tags in the repository with their references
- File Content: Access content of specific files at a given Git reference
- Directory Listing: View lists of files and directories at a specific path and reference
- Diffs: Get differences between references, unstaged changes, or staged changes
- Commit History: View detailed commit logs with author, date, and message information
- File Blame: See line-by-line attribution showing which commit last modified each line
- Commit Details: Access detailed information about specific commits including diff changes
Git Operations
- Repository Operations: Initialize repositories, clone from remotes, check repository status
- Branch Operations: Create branches, list branches, checkout, delete branches, merge
- Working Directory Operations: Stage files, unstage files, commit changes, create diffs
- Remote Operations: Add remotes, list remotes, fetch, pull, push
- Advanced Operations: Manage tags, stash changes, cherry-pick commits, rebase branches, reset, clean
Installation
Prerequisites
- Node.js 16 or higher
- Git installed and available in the PATH
Install from NPM
Install from Source
Usage
Running the Server
Integration with Claude
cline_mcp_settings.json
or claude_desktop_config.json
):Integration with Other MCP Clients
Project Structure
Tools
Repository Operations
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
Branch Operations
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
Working Directory Operations
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
Remote Operations
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
Advanced Operations
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
Resources
Repository Resources
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |