代码变更上下文引擎

GitWhy MCP Server是一个用于捕获、搜索和共享代码变更背后原因的AI上下文引擎,适用于AI编码代理如Claude、Cursor和VS Code Copilot。

  • by gitwhy-cli
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 gitwhy-cli/gitwhy-mcp

使用说明

GitWhy MCP服务器

git的共享AI上下文引擎——保存、搜索和共享代码更改背后的推理。

GitWhy捕获 为什么 每次提交的背后:推理、决策和权衡。这个MCP服务器使GitWhy的工具可供Claude、Cursor、Windsurf和VS Code Copilot等AI编码代理使用。

安装

npm(推荐给MCP客户端)

npm install -g gitwhy-mcp

自制(macOS/Linux)

brew install gitwhy-cli/tap/git-why

大铲(Windows)

scoop bucket add gitwhy https://github.com/quanng28/gitwhy-scoop-bucket
scoop install git-why

MCP配置

克劳德桌面/克劳德代码

添加到MCP配置(~/.claude/settings.json 或克劳德桌面设置):

{
  "mcpServers": {
    "gitwhy": {
      "command": "gitwhy-mcp",
      "args": []
    }
  }
}

光标

添加 .cursor/mcp.json:

{
  "mcpServers": {
    "gitwhy": {
      "command": "npx",
      "args": ["-y", "gitwhy-mcp"]
    }
  }
}

VS Code

添加 .vscode/mcp.json:

{
  "servers": {
    "gitwhy": {
      "command": "npx",
      "args": ["-y", "gitwhy-mcp"]
    }
  }
}

工具

工具 说明
gitwhy_save 为当前会话保存开发上下文(推理、决策、权衡)
gitwhy_get 通过ID检索已保存的上下文
gitwhy_search 按关键字或自然语言查询搜索已保存的上下文
gitwhy_list 按域/主题层次结构浏览已保存的上下文
gitwhy_status 检查安装状态、待定提交和同步状态
gitwhy_sync 将本地上下文上传到云端(私有)
gitwhy_publish 与您的团队共享已同步的上下文
gitwhy_post_pr 将上下文摘要作为GitHub PR评论发布

认证

对于云功能(同步、发布、PR评论),您需要一个GitWhy API密钥:

  1. 注册地址: app.gitwhy.dev
  2. 获取API密钥: app.gitwhy.dev/dashboard/api-keys
  3. 对于本地CLI:运行 git why setup 鉴定
  4. 对于远程(Smithery/Glama):提示时粘贴API密钥

链接

许可证

麻省理工学院