Provides Git operations via MCP for AI assistants, including clone, status, add, commit, push, pull, branch and stash management.
Configuration
View docs{
"mcpServers": {
"sheshiyer-git-mcp-v2": {
"command": "node",
"args": [
"path/to/git-mcp-v2/build/index.js"
],
"env": {
"GIT_DEFAULT_PATH": "\\/path\\/to\\/default\\/git\\/directory",
"GITHUB_PERSONAL_ACCESS_TOKEN": "your-github-pat"
}
}
}
}You can run a dedicated MCP server that exposes a full suite of Git operations through a standardized MCP interface. This makes it easy for AI assistants to manage repositories, branches, remotes, stashes, and more with consistent, automated commands.
You interact with the Git MCP Server through an MCP client. Use it to initialize repositories, clone or pull changes, check status, add and commit changes, push to remotes, and pull updates from remotes. Manage branches and tags, configure remotes, and handle work-in-progress with stash operations. You can also execute multiple operations in sequence to automate common workflows and integrate Git with GitHub using a Personal Access Token.
Typical usage patterns include creating a new repository in a chosen directory, cloning existing projects, and performing routine maintenance like checking status, staging changes, committing with messages, and syncing with a remote. You can list, create, or delete branches, switch between them, and manage tags. Remotes can be listed, added, or removed, and stash operations allow you to save and apply work cleanly.
Prerequisites: ensure you have Node.js installed on your system. You will also need a working shell environment to run commands.
Step 1: Clone the server repository to your workstation.
Step 2: Install dependencies.
Step 3: Build the project before you start it.
Step 4: Start the server using the standard MCP runtime command shown in the configuration example.
Configure the MCP server by adding an entry to your MCP settings that points to the local runtime of the server. The following example shows how to run the server locally with Node and the built index file, including environment variables for default paths and GitHub authentication.
{
"mcpServers": {
"git_v2": {
"type": "stdio",
"command": "node",
"args": ["path/to/git-mcp-v2/build/index.js"],
"env": {
"GIT_DEFAULT_PATH": "/path/to/default/git/directory",
"GITHUB_PERSONAL_ACCESS_TOKEN": "your-github-pat"
}
}
}
}GIT_DEFAULT_PATH: Optional default path for Git operations. GITHUB_PERSONAL_ACCESS_TOKEN: Optional GitHub Personal Access Token for GitHub operations.
Initialize a new Git repository in the current directory, creating the .git folder and initial metadata.
Clone a repository to a new directory, fetching all branches and tags.
Show the working tree status including staged and unstaged changes.
Stage changes by adding file paths to the index for the next commit.
Record changes to the repository with a message describing the commit.
Push committed changes to a remote repository along with associated branches.
Fetch and integrate changes from a remote repository into your current branch.
List all branches in the current repository.
Create a new branch from the current HEAD or a specified base.
Delete a local branch.
Switch to another branch or restore working tree files from a commit.
List all tags in the repository.
Create a new tag pointing at a commit.
Delete an existing tag.
List all configured remotes for the repository.
Add a new remote with a name and URL.
Remove an existing remote by name.
List all stashes saved in the repository.
Save current changes to a new stash.
Apply the latest stash and remove it from the stash list.
Execute multiple Git operations in sequence as a single workflow.