GitHub-MCP代码分析工具
一种MCP服务器,它通过GitHub聊天API启用对GitHub存储库的分析和查询,允许用户对存储库进行索引并对其代码、架构和技术堆栈提出问题。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"github-chat": {
"args": [
"github-chat-mcp"
],
"command": "uvx",
"env": {}
}
}
}
可用工具 (2 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
index_repository 1 个参数 需填 1 项
Index a GitHub repository to analyze its codebase. This must be done before asking questions about the repository.
必填参数:repo_url
query_repository 3 个参数 需填 2 项
Ask questions about a GitHub repository and receive detailed AI responses. The repository must be indexed first.
必填参数:repo_url、question
服务介绍
GitHub Chat MCP
一个用于通过 GitHub Chat API 分析和查询 GitHub 仓库的模型上下文协议 (MCP)。官方网站: https://github-chat.com
安装
# Install with pip
pip install github-chat-mcp
# Or install with the newer uv package manager
uv install github-chat-mcp
- 开始使用 Claude!
示例提示:
- "使用 github-chat-mcp 分析 React 仓库"
- "用 github-chat-mcp 索引 TypeScript 仓库并询问其架构"
GitHub Chat MCP 服务器
设置说明
在开始之前,请确保您拥有 GitHub Chat API 密钥。这是使用该服务所必需的。
首先安装 uv。
MacOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
Windows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
使用 Cursor 设置(推荐)
在 mcp.json 中:
{
"mcpServers": {
"github-chat": {
"command": "uvx",
"args": [
"github-chat-mcp"
]
}
}
}
如上所述,由于是免费版本,因此不需要环境变量。
使用 Claude Desktop 设置
# claude_desktop_config.json
# Can find location through:
# Hamburger Menu -> File -> Settings -> Developer -> Edit Config
# Must perform: brew install uv
{
"mcpServers": {
"github-chat": {
"command": "uvx",
"args": ["github-chat-mcp"],
"env": {
}
}
}
}
通过 Smithery 安装
您可以自动通过 Smithery 安装适用于 Claude Desktop 的 GitHub Chat:
npx -y @smithery/cli install github-chat-mcp --client claude
使用 Claude 进行 GitHub Chat
-
首先索引一个 GitHub 仓库:
"索引位于 https://github.com/username/repo 的 GitHub 仓库" -
然后询问关于该仓库的问题:
"这个仓库中使用的核心技术栈是什么?"
调试
运行:
npx @modelcontextprotocol/inspector uvx github-chat-mcp
本地/开发设置说明
克隆仓库
git clone https://github.com/yourusername/github-chat-mcp.git
安装依赖项
首先安装 uv。
MacOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
Windows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
然后安装 MCP 服务器依赖项:
cd github-chat-mcp
# Create virtual environment and activate it
uv venv
source .venv/bin/activate # MacOS/Linux
# OR
.venv/Scripts/activate # Windows
# Install dependencies
uv sync
使用 Claude Desktop 设置
使用 MCP CLI SDK
# `pip install mcp[cli]` if you haven't
mcp install /ABSOLUTE/PATH/TO/PARENT/FOLDER/github-chat-mcp/src/github_chat_mcp/server.py -v "GITHUB_API_KEY=API_KEY_HERE"
手动设置
# claude_desktop_config.json
# Can find location through:
# Hamburger Menu -> File -> Settings -> Developer -> Edit Config
{
"mcpServers": {
"github-chat": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/PARENT/FOLDER/github-chat-mcp",
"run",
"github-chat-mcp"
],
"env": {
}
}
}
}
使用 Claude 进行 GitHub Chat
-
首先索引一个 GitHub 仓库:
"索引位于 https://github.com/username/repo 的 GitHub 仓库" -
然后询问关于该仓库的问题:
"这个仓库中使用的核心技术栈是什么?"
调试
运行:
# If mcp cli installed (`pip install mcp[cli]`)
mcp dev /ABSOLUTE/PATH/TO/PARENT/FOLDER/github-chat-mcp/src/github_chat_mcp/server.py
# If not
npx @modelcontextprotocol/inspector \
uv \
--directory /ABSOLUTE/PATH/TO/PARENT/FOLDER/github-chat-mcp \
run \
github-chat-mcp
然后访问 http://localhost:5173 上的 MCP 检查器。您可能需要在检查器中的环境变量下添加您的 GitHub API 密钥,键名为 GITHUB_API_KEY。
注意事项
- 日志级别可以通过
FASTMCP_LOG_LEVEL环境变量进行调整(例如FASTMCP_LOG_LEVEL="ERROR") - 该 MCP 服务器提供了两个主要工具:
- 仓库索引 - 索引并分析一个 GitHub 仓库
- 仓库查询 - 对已索引的仓库提问