Git Repo Browser MCP
Provides tools for Git repository operations including browsing directory structures, reading files, searching code, comparing branches, viewing commit history, and checking local changes.
Enables browsing and analyzing GitHub repositories, including retrieving file contents, searching code, and examining commit history across branches.
Integrates with GitHub Actions for CI/CD workflows, specifically for automating npm package publishing when changes are pushed to the master branch.
Supports automated publishing to the npm registry through CI/CD workflows and provides package distribution through the npm ecosystem.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Git Repo Browser MCP show me the directory structure of https://github.com/example/project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Git Repo Browser (Node.js)
A Node.js implementation of a Git repository browser using the Model Context Protocol (MCP).
Installation
NPM (Recommended)
npm install -g git-commands-mcpManual Installation
git clone https://github.com/bsreeram08/git-commands-mcp.git
cd git-commands-mcp
npm installRelated MCP server: MCP Git Repo Browser
Configuration
Add this to your MCP settings configuration file:
{
"mcpServers": {
"git-commands-mcp": {
"command": "git-commands-mcp"
}
}
}For manual installation, use:
{
"mcpServers": {
"git-commands-mcp": {
"command": "node",
"args": ["/path/to/git-commands-mcp/src/index.js"]
}
}
}Features
The server provides the following tools:
Basic Repository Operations
git_directory_structure: Returns a tree-like representation of a repository's directory structureInput: Repository URL
Output: ASCII tree representation of the repository structure
git_read_files: Reads and returns the contents of specified files in a repositoryInput: Repository URL and list of file paths
Output: Dictionary mapping file paths to their contents
git_search_code: Searches for patterns in repository codeInput: Repository URL, search pattern, optional file patterns, case sensitivity, and context lines
Output: JSON with search results including matching lines and context
Branch Operations
git_branch_diff: Compare two branches and show files changed between themInput: Repository URL, source branch, target branch, and optional show_patch flag
Output: JSON with commit count and diff summary
Commit Operations
git_commit_history: Get commit history for a branch with optional filteringInput: Repository URL, branch name, max count, author filter, since date, until date, and message grep
Output: JSON with commit details
git_commits_details: Get detailed information about commits including full messages and diffsInput: Repository URL, branch name, max count, include_diff flag, author filter, since date, until date, and message grep
Output: JSON with detailed commit information
git_local_changes: Get uncommitted changes in the working directoryInput: Local repository path
Output: JSON with status information and diffs
Project Structure
git-commands-mcp/
├── src/
│ ├── index.js # Entry point
│ ├── server.js # Main server implementation
│ ├── handlers/ # Tool handlers
│ │ └── index.js # Tool implementation functions
│ └── utils/ # Utility functions
│ └── git.js # Git-related helper functions
├── package.json
└── readme.mdImplementation Details
Uses Node.js native modules (crypto, path, os) for core functionality
Leverages fs-extra for enhanced file operations
Uses simple-git for Git repository operations
Implements clean error handling and resource cleanup
Creates deterministic temporary directories based on repository URL hashes
Reuses cloned repositories when possible for efficiency
Modular code structure for better maintainability
Requirements
Node.js 14.x or higher
Git installed on the system
Usage
If installed globally via npm:
git-commands-mcpIf installed manually:
node src/index.jsThe server runs on stdio, making it compatible with MCP clients.
CI/CD
This project uses GitHub Actions for continuous integration and deployment:
Automatic NPM Publishing
The repository is configured with a GitHub Actions workflow that automatically publishes the package to npm when changes are pushed to the master branch.
Setting up NPM_AUTOMATION_TOKEN
To enable automatic publishing, you need to add an npm Automation token as a GitHub secret (this works even with accounts that have 2FA enabled):
Generate an npm Automation token:
Log in to your npm account on npmjs.com
Go to your profile settings
Select "Access Tokens"
Click "Generate New Token"
Select "Automation" token type
Set the appropriate permissions (needs "Read and write" for packages)
Copy the generated token
Add the token to your GitHub repository:
Go to your GitHub repository
Navigate to "Settings" > "Secrets and variables" > "Actions"
Click "New repository secret"
Name:
NPM_AUTOMATION_TOKENValue: Paste your npm Automation token
Click "Add secret"
Once configured, any push to the master branch will trigger the workflow to publish the package to npm.
License
MIT License - see the LICENSE file for details.
Links
Available Tools
27 toolsgit_archiveC
Create a git archive (zip or tar).
Inputs: repo_path (required), output_path (required), format, prefix, +1 more.
git_attributesC
Manage git attributes for files.
Inputs: repo_path (required), action (required), pattern, attribute.
git_blameC
Get blame information for a file.
Inputs: repo_path (required), file_path (required), rev.
git_branch_diffC
Compare two branches and show files changed between them.
Inputs: repo_url (required), source_branch (required), target_branch (required), show_patch.
git_checkout_branchC
Create and/or checkout a branch.
Inputs: repo_path (required), branch_name (required), start_point, create.
git_cleanC
Perform git clean operations.
Inputs: repo_path (required), directories, force, dry_run.
git_commitC
Create a commit with the specified message.
Inputs: repo_path (required), message (required).
git_commit_historyB
Get commit history for a branch with optional filtering.
Inputs: repo_url (required), branch, max_count, author, +3 more.
git_commits_detailsC
Get detailed information about commits including full messages and diffs.
Inputs: repo_url (required), branch, max_count, include_diff, +4 more.
git_configC
Configure git settings for the repository.
Inputs: repo_path (required), key (required), value (required), scope.
git_create_tagC
Create a tag.
Inputs: repo_path (required), tag_name (required), message, annotated.
git_delete_branchC
Delete a branch from the repository.
Inputs: repo_path (required), branch_name (required), force.
git_directory_structureC
Clone a Git repository and return its directory structure in a tree format.
Inputs: repo_url (required).
git_hooksC
Manage git hooks in the repository.
Inputs: repo_path (required), action (required), hook_name, script.
git_lfsC
Manage Git LFS (Large File Storage).
Inputs: repo_path (required), action (required), patterns.
git_lfs_fetchC
Fetch LFS objects from the remote repository.
Inputs: repo_path (required), dry_run, pointers.
git_local_changesC
Get uncommitted changes in the working directory.
Inputs: repo_path (required).
git_merge_branchC
Merge a source branch into the current or target branch.
Inputs: repo_path (required), source_branch (required), target_branch, no_fast_forward.
git_pullC
Pull changes from a remote repository.
Inputs: repo_path (required), remote, branch, rebase.
git_pushC
Push changes to a remote repository.
Inputs: repo_path (required), remote, branch, force.
git_read_filesC
Read the contents of specified files in a given git repository.
Inputs: repo_url (required), file_paths (required).
git_rebaseC
Rebase the current branch onto another branch or commit.
Inputs: repo_path (required), onto (required), interactive.
git_resetC
Reset repository to specified commit or state.
Inputs: repo_path (required), mode, to.
git_revertC
Revert the current branch to a commit or state.
Inputs: repo_path (required), commit, no_commit.
git_search_codeC
Search for patterns in repository code.
Inputs: repo_url (required), pattern (required), file_patterns, case_sensitive, +1 more.
git_stashC
Create or apply a stash.
Inputs: repo_path (required), action, message, index.
git_trackC
Track (stage) specific files or all files.
Inputs: repo_path (required), files.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 27 tools
Most tools have distinct purposes targeting specific Git operations, but some overlap exists. For example, git_commit_history and git_commits_details both handle commit information retrieval, and git_clean and git_reset both involve repository state management, which could cause minor confusion. However, descriptions clarify their specific focuses, keeping ambiguity manageable.
All tool names follow a consistent snake_case pattern with a 'git_' prefix and descriptive verb_noun combinations. Examples include git_checkout_branch, git_merge_branch, and git_search_code. This uniformity makes the tool set predictable and easy to navigate for an agent.
With 27 tools, the count is excessive for a Git repository browser. Many tools cover niche or low-level operations that could be consolidated, such as git_lfs and git_lfs_fetch, or git_attributes and git_hooks. This bloated set may overwhelm agents and complicate task selection.
The tool set provides comprehensive coverage of Git operations, including cloning, branching, committing, merging, searching, and configuration. It supports full CRUD and lifecycle management for repositories, with no obvious gaps. Agents can perform end-to-end workflows without dead ends.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
A MCP server built for developers enabling Git based project management with project and personal…
A Model Context Protocol (MCP) application for automated GitHub PR analysis and issue management.…
Related MCP Servers
- AlicenseBqualityBmaintenanceA Model Context Protocol server for Git repository interaction and automation. This server provides tools to read, search, and manipulate Git repositories via Large Language Models.1490,074 PyPI91,952MIT
- AlicenseBqualityDmaintenanceA Node.js server that allows browsing Git repositories through MCP, providing tools to view directory structures and read important files from repositories.25MIT
- AlicenseAqualityBmaintenanceA Model Context Protocol server that enables Large Language Models to interact with Git repositories through a robust API, supporting operations like repository initialization, cloning, file staging, committing, and branch management.284,360 npm245Apache 2.0
- AlicenseCqualityCmaintenanceNode.js server implementing Model Context Protocol for git operations, enabling AI assistants to manage git repositories through natural language commands.11147 npmMIT