GitHub集成工具

GitHub MCP Server是一个为Amazon Q CLI设计的GitHub集成工具,提供仓库管理、代码操作和问题跟踪等功能。

  • by msestero
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 msestero/github-mcp

使用说明

GitHub MCP服务器

一个全面的模型上下文协议(MCP)服务器,用于GitHub与Amazon Q CLI的集成。此服务器直接在Q CLI聊天界面中提供强大的GitHub功能。

🚀 特性

  • 库管理

    • 创建新存储库
    • 克隆现有存储库
    • 获取存储库信息
    • 列出您的存储库
  • 代码操作

    • 承诺并推动变革
    • 处理多个文件
    • 分行管理
  • 问题跟踪

    • 创建新问题
    • 添加标签和描述

🛠️ 可用工具

安装后,您将可以在Q CLI中访问这些工具:

工具 说明 示例用法
create_repo 创建一个新的GitHub存储库 “创建一个名为我的精彩项目的新存储库”
commit_and_push 提交更改并推送到GitHub “提交所有更改,并显示消息‘添加新功能’”
clone_repo 克隆GitHub存储库 “克隆存储库用户名/存储库名称”
create_issue 创建一个新问题 “创建一个标题为‘登录系统中的Bug’的问题”
list_repos 列出您的存储库 “显示我的存储库”
get_repo_info 获取存储库详细信息 “获取有关用户/存储库名称的信息”

📋 先决条件

  • Python 3.7+
  • 已安装并配置Amazon Q CLI
  • GitHub命令行界面(gh)已安装并经过身份验证,或者
  • GitHub个人访问令牌设置为 GITHUB_TOKEN 环境变量

🔧 安装

快速设置(推荐)

# Clone the repository
git clone https://github.com/msestero/github-mcp.git
cd github-mcp

# Run the setup script
./setup.sh

手动设置

# Clone the repository
git clone https://github.com/msestero/github-mcp.git
cd github-mcp

# Install dependencies
pip install -r requirements.txt

# Add to Q CLI (replace with your actual path)
q mcp add --name github-server --command python3 --args "/path/to/github_mcp_server.py" --scope global

🔐 认证

服务器支持两种身份验证方法:

选项1:GitHub CLI(推荐)

gh auth login

选项2:环境变量

export GITHUB_TOKEN="your_github_token_here"

💡 使用示例

启动新的Q CLI聊天会话并尝试以下命令:

创建存储库

"Create a new public repository called my-web-app with description 'My awesome web application'"

提交代码

"Commit all changes in /path/to/my/repo with message 'Add authentication feature'"

克隆存储库

"Clone the repository microsoft/vscode to my Projects folder"

管理问题

"Create an issue in my-user/my-repo titled 'Add dark mode' with labels bug and enhancement"

存储库信息

"Show me information about facebook/react"
"List my private repositories"

🔧 配置

MCP服务器已添加到您的全局Q CLI配置中:

  • ~/.aws/amazonq/mcp.json

您可以通过以下方式检查状态:

q mcp status --name github-server
q mcp list

🛡️ 安全

  • 服务器使用您现有的GitHub身份验证(gh-CLI或令牌)
  • MCP服务器中没有存储凭据
  • 所有操作都尊重您的GitHub权限
  • 私有存储库需要适当的访问令牌

🐛 故障排除

身份验证问题

# Check GitHub CLI status
gh auth status

# Re-authenticate if needed
gh auth login

MCP服务器问题

# Check server status
q mcp status --name github-server

# View MCP configuration
q mcp list

# Remove and re-add server
q mcp remove --name github-server
./setup.sh

Python依赖关系

# Reinstall dependencies
pip install -r requirements.txt --upgrade

🤝 贡献

  1. 分叉存储库
  2. 创建要素分支
  3. 进行更改
  4. 如果适用,添加测试
  5. 提交拉取请求

📄 许可证

MIT许可证-有关详细信息,请参阅许可证文件

🔗 链接


由以下材料制成❤️ Amazon Q CLI社区