Git Repo Browser MCP
MCP Git Repo 浏览器 (Node.js)
使用模型上下文协议 (MCP) 的 Git 存储库浏览器的 Node.js 实现。
安装
NPM(推荐)
npm install -g git-commands-mcp手动安装
git clone https://github.com/bsreeram08/git-commands-mcp.git
cd git-commands-mcp
npm installRelated MCP server: MCP Git Repo Browser
配置
将其添加到您的 MCP 设置配置文件中:
{
"mcpServers": {
"git-commands-mcp": {
"command": "git-commands-mcp"
}
}
}对于手动安装,请使用:
{
"mcpServers": {
"git-commands-mcp": {
"command": "node",
"args": ["/path/to/git-commands-mcp/src/index.js"]
}
}
}特征
该服务器提供以下工具:
基本存储库操作
git_directory_structure:返回存储库目录结构的树状表示输入:存储库 URL
输出:存储库结构的 ASCII 树表示
git_read_files:读取并返回存储库中指定文件的内容输入:存储库 URL 和文件路径列表
输出:将文件路径映射到其内容的字典
git_search_code:在存储库代码中搜索模式输入:存储库 URL、搜索模式、可选文件模式、区分大小写和上下文行
输出:包含匹配行和上下文的搜索结果的 JSON
分支机构运营
git_branch_diff:比较两个分支并显示它们之间更改的文件输入:存储库 URL、源分支、目标分支和可选的 show_patch 标志
输出:包含提交计数和差异摘要的 JSON
提交操作
git_commit_history:获取带有可选过滤的分支的提交历史记录输入:存储库 URL、分支名称、最大数量、作者过滤器、起始日期、终止日期和消息 grep
输出:包含提交详细信息的 JSON
git_commits_details:获取有关提交的详细信息,包括完整消息和差异输入:存储库 URL、分支名称、最大计数、include_diff 标志、作者过滤器、起始日期、终止日期和消息 grep
输出:包含详细提交信息的 JSON
git_local_changes:获取工作目录中未提交的更改输入:本地存储库路径
输出:包含状态信息和差异的 JSON
项目结构
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实现细节
使用 Node.js 原生模块(crypto、path、os)实现核心功能
利用 fs-extra 增强文件操作
使用 simple-git 进行 Git 存储库操作
实现干净的错误处理和资源清理
根据存储库 URL 哈希创建确定性临时目录
尽可能重复使用克隆的存储库以提高效率
模块化代码结构,可维护性更好
要求
Node.js 14.x 或更高版本
系统上安装的 Git
用法
如果通过 npm 全局安装:
git-commands-mcp如果手动安装:
node src/index.js服务器在 stdio 上运行,使其与 MCP 客户端兼容。
持续集成/持续交付
该项目使用 GitHub Actions 进行持续集成和部署:
自动 NPM 发布
该存储库配置了 GitHub Actions 工作流,当更改推送到主分支时,会自动将包发布到 npm。
设置 NPM_AUTOMATION_TOKEN
要启用自动发布,您需要添加一个 npm Automation 令牌作为 GitHub 机密(即使启用了 2FA 的帐户也可以使用):
生成 npm Automation 令牌:
在npmjs.com上登录你的 npm 帐户
转到您的个人资料设置
选择“访问令牌”
点击“生成新令牌”
选择“自动化”令牌类型
设置适当的权限(需要对包进行“读写”)
复制生成的token
将令牌添加到您的 GitHub 存储库:
前往你的 GitHub 仓库
导航至“设置”>“机密和变量”>“操作”
点击“新建存储库秘密”
名称:
NPM_AUTOMATION_TOKEN值:粘贴您的 npm Automation 令牌
点击“添加秘密”
配置完成后,任何对主分支的推送都会触发工作流将包发布到 npm。
执照
MIT 许可证 - 有关详细信息,请参阅LICENSE文件。
链接
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityAmaintenanceA 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.1289,748MIT
- AlicenseBqualityDmaintenanceA Node.js server that allows browsing Git repositories through MCP, providing tools to view directory structures and read important files from repositories.25MIT
- AlicenseAqualityCmaintenanceA 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.283,703232Apache 2.0
- AlicenseCqualityCmaintenanceNode.js server implementing Model Context Protocol for git operations, enabling AI assistants to manage git repositories through natural language commands.11159MIT
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
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.…
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/bsreeram08/git-commands-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server