
该项目实现了一个用于GitHub API访问的模型上下文协议(MCP)服务器。它提供了一套工具,使LLM代理能够与GitHub仓库、问题、拉取请求等交互。
概览
该项目实现了一个用于GitHub API访问的模型上下文协议(MCP)服务器。它提供了一套工具,使LLM代理能够与GitHub仓库、问题、拉取请求及其他GitHub资源交互。 该服务器提供以下GitHub操作: - - 为认证用户列出仓库 - 获取仓库详情 - 搜索仓库 - - 通过筛选选项列出问题 - 获取问题详细信息 - 创建新问题 - 添加问题评论 - 搜索问题 - - 列出带有过滤选项的拉取请求 - 获取拉取请求的详细信息 - 为拉取请求创建注释 - 合并拉取请求 - - 在仓库中列出分支- 创建新分支 - - 获取提交的详细信息 - 列出带有过滤选项的提交 - 通过消息搜索提交 - - 从仓库获取文件内容 - 列表目录内容 - 创建或更新文件 - 在仓库中搜索代码
概述(AI 翻译)
该项目实现了一个用于GitHub API访问的模型上下文协议(MCP)服务器。它提供了一套工具,使LLM代理能够与GitHub仓库、问题、拉取请求及其他GitHub资源交互。
特色
该服务器提供以下GitHub操作:
-
仓库管理
-
为认证用户列出仓库
-
获取仓库详情
-
搜索仓库
-
议题管理
-
列表筛选选项的问题
-
获取有关问题的详细信息
-
创建新问题
-
对议题添加评论
-
寻找问题
-
拉取请求管理
-
列出带有过滤选项的拉取请求
-
获取关于拉取请求的详细信息
-
在拉取请求上创建评论
-
合并拉取请求
-
分行管理
-
在仓库中列出分支
-
创建新分支
-
提交管理
-
获取提交的详细信息
-
带有过滤选项的列表提交
-
通过消息搜索提交
-
内容管理
-
从仓库获取文件内容
-
列表目录内容
-
创建或更新文件
-
在仓库中搜索代码
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
GitHub MCP Server
This project implements a Model Context Protocol (MCP) server for GitHub API access. It provides a set of tools that allow LLM agents to interact with GitHub repositories, issues, pull requests, and other GitHub resources.
Features
The server provides the following GitHub operations:
-
Repository Management
- List repositories for the authenticated user
- Get repository details
- Search for repositories
-
Issue Management
- List issues with filtering options
- Get detailed information about issues
- Create new issues
- Add comments to issues
- Search for issues
-
Pull Request Management
- List pull requests with filtering options
- Get detailed information about pull requests
- Create comments on pull requests
- Merge pull requests
-
Branch Management
- List branches in a repository
- Create new branches
-
Commit Management
- Get detailed information about commits
- List commits with filtering options
- Search for commits by message
-
Content Management
- Get file contents from repositories
- List directory contents
- Create or update files
- Search for code within repositories
These operations are exposed as tools for Large Language Models using the Model Context Protocol (MCP), allowing AI systems to safely interact with GitHub through its API.
Claude Desktop
DevoxxGenie IDEA plugin
Getting Started
Prerequisites
- Java 17 or higher
- Maven 3.6+
- Spring Boot 3.3.6
- Spring AI MCP Server components
- A GitHub account and personal access token
Building the Project
Build the project using Maven:
mvn clean package
Running the Server
Run the server using the following command:
java -jar target/GitHubMCP-1.0-SNAPSHOT.jar
The server can use STDIO for communication with MCP clients or can be run as a web server.
Environment Variables
The GitHub MCP server supports the following environment variables for authentication:
GITHUB_TOKENorGITHUB_PERSONAL_ACCESS_TOKEN: Your GitHub personal access tokenGITHUB_HOST: The base URL of your GitHub instance (e.g.,github.comorgithub.mycompany.comfor GitHub Enterprise)GITHUB_REPOSITORY: Default repository to use if not specified in API calls (e.g.,owner/repo)
You can set these environment variables when launching the MCP server, and the GitHub services will use them as default values. This allows you to avoid having to provide authentication details with every API call.
Usage with MCP Clients
Using with Claude Desktop
Edit your claude_desktop_config.json file with the following:
{
"mcpServers": {
"github": {
"command": "java",
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"github": {
"command": "java",
"args": [
"-Dspring.ai.mcp.server.stdio=true",
"-Dspring.main.web-application-type=none",
"-Dlogging.pattern.console=",
"-jar",
"/path/to/GitHubMCP/target/GitHubMCP-1.0-SNAPSHOT.jar"
],
"env": {
"GITHUB_TOKEN": "your-github-token-here",
"GITHUB_HOST": "github.com",
"GITHUB_REPOSITORY": "your-username/your-repository"
}
}
}
}