A Node.js implementation that enables browsing Git repositories through the Model Context Protocol, providing features like displaying directory structures, reading files, searching code, comparing branches, and viewing commit history.
A Node.js implementation of a Git repository browser using the Model Context Protocol (MCP).
npm install -g git-commands-mcp
git clone https://github.com/bsreeram08/git-commands-mcp.git cd git-commands-mcp npm install
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"] } } }
The server provides the following tools:
git_directory_structure
: Returns a tree-like representation of a repository's directory structure
git_read_files
: Reads and returns the contents of specified files in a repository
git_search_code
: Searches for patterns in repository code
git_branch_diff
: Compare two branches and show files changed between them
git_commit_history
: Get commit history for a branch with optional filtering
git_commits_details
: Get detailed information about commits including full messages and diffs
git_local_changes
: Get uncommitted changes in the working directory
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.md
If installed globally via npm:
git-commands-mcp
If installed manually:
node src/index.js
The server runs on stdio, making it compatible with MCP clients.
This project uses GitHub Actions for continuous integration and deployment:
The repository is configured with a GitHub Actions workflow that automatically publishes the package to npm when changes are pushed to the master branch.
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:
Add the token to your GitHub repository:
NPM_AUTOMATION_TOKEN
Once configured, any push to the master branch will trigger the workflow to publish the package to npm.
MIT License - see the LICENSE file for details.
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!