npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

yl-mcp-git-server

v1.1.4

Published

MCP server for automated git operations

Readme

YL MCP Git Server

npm version License: MIT

一个基于 MCP (Model Context Protocol) 的 Git 操作服务器,提供智能化的 Git 工作流自动化功能。通过与 AI 助手集成,实现代码变更的智能分析和自动化 Git 操作。

功能特性

  • 🚀 智能提交: AI 自动分析代码变更并生成规范的 commit 信息
  • 📊 状态查看: 快速查看 Git 仓库状态和变更内容
  • 🔧 自动化操作: 一键完成 add、commit、push 流程
  • 🎯 仓库初始化: 支持快速初始化 Git 仓库并配置远程地址

快速开始

安装

方式一:通过 npx 使用(推荐)

无需安装,直接在 Windsurf 或其他支持 MCP 的 AI 客户端中配置(注意:必须添加 -y 参数):

{
  "mcpServers": {
    "yl-git-server": {
      "command": "npx",
      "args": ["-y", "yl-mcp-git-server"]
    }
  }
}

方式二:全局安装

npm install -g yl-mcp-git-server

然后在配置中使用:

{
  "mcpServers": {
    "yl-git-server": {
      "command": "yl-mcp-git-server"
    }
  }
}

方式三:本地开发

git clone <repository-url>
cd yl-git-server
npm install

在 AI 客户端中配置:

{
  "mcpServers": {
    "yl-git-server": {
      "command": "node",
      "args": ["/path/to/yl-git-server/src/index.js"]
    }
  }
}

配置步骤(以 Windsurf 为例)

  1. 打开 Windsurf 设置 (⌘ + ,Ctrl + ,)
  2. 找到 "MCP Servers" 配置项
  3. 添加上述配置
  4. 重启 Windsurf
  5. 现在可以与 AI 助手对话使用 Git 功能了

功能说明

🛠️ 可用工具

| 工具名称 | 功能描述 | 参数 | |---------|---------|------| | git_init | 初始化 Git 仓库 | remote_url (可选), branch (可选) | | git_status | 查看仓库状态 | 无 | | git_diff | 查看代码变更 | 无 | | git_add | 添加文件到暂存区 | files (可选,默认 ".") | | git_smart_commit | 智能提交并推送 | message (必填) |

📝 使用示例

初始化仓库

"帮我初始化一个 Git 仓库,远程地址是 [email protected]:username/repo.git"

查看状态和变更

"查看当前 Git 状态"
"显示我的代码改动"

智能提交

"帮我智能提交代码"
"分析我的改动并自动提交"

添加文件

"添加所有文件到暂存区"
"只添加 src/ 目录下的文件"

🚀 智能提交工作流

自动化流程

  1. 触发:对 AI 说 "帮我智能提交代码"
  2. 分析:AI 自动调用 git_diff 查看代码变更
  3. 生成:AI 分析改动内容,生成符合规范的 commit 信息
  4. 提交:AI 调用 git_smart_commit 完成提交和推送

Commit 信息规范

生成的 commit 信息遵循约定式提交规范:

  • feat: 新功能
  • fix: 修复 bug
  • docs: 文档更新
  • style: 代码格式调整
  • refactor: 代码重构
  • test: 测试相关
  • chore: 构建过程或辅助工具的变动

示例对话

用户:"我修改了登录功能,帮我提交代码"
AI:"我来帮你分析代码变更并智能提交..."
     [自动生成] feat(auth): 优化登录验证逻辑和错误处理
     [自动提交并推送]

项目结构

yl-git-server/
├── src/
│   ├── index.js           # 服务器入口文件
│   ├── server.js          # MCP 服务器实现
│   ├── config.js          # 服务器配置
│   ├── tool-definitions.js # 工具定义
│   └── tool-handlers.js   # 工具处理器
├── package.json
└── README.md

开发

启动服务器

npm start

测试服务器

npm test

依赖

  • @modelcontextprotocol/sdk: MCP SDK 用于构建 MCP 服务器

📋 系统要求

  • Node.js >= 16.0.0
  • Git >= 2.0.0
  • 支持 MCP 的 AI 客户端(如 Windsurf、Claude Desktop 等)

🔧 故障排除

常见问题

Q: MCP 服务器无法启动 A: 检查 Node.js 版本,确保 >= 16.0.0

Q: npx 连接失败或卡住 A: 确保在 npx 命令中添加 -y 参数,如 ["npx", "-y", "yl-mcp-git-server"],这样可以自动确认包的安装而不需要交互式确认

Q: Git 命令执行失败或找不到 .git 目录 A: 确保当前目录是 Git 仓库,且有适当的权限。v1.0.1+ 版本已修复通过 npx 调用时工作目录不正确的问题

Q: 推送失败 A: 检查 Git 远程仓库配置和认证信息

🤝 贡献

欢迎提交 Issue 和 Pull Request!

  1. Fork 本仓库
  2. 创建特性分支 (git checkout -b feature/AmazingFeature)
  3. 提交更改 (git commit -m 'Add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 开启 Pull Request

📄 许可证

本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情

📞 支持

🔗 相关链接


版本: 1.0.1 | 更新时间: 2025-11-12