返回 MCP 目录
public公开dns本地运行

ParasSolanki_github-mcp-server

Github MCP Server是一个基于Model Context Protocol的GitHub集成服务,允许LLM通过MCP与GitHub进行交互,提供搜索仓库、问题、提交、代码、用户、主题、标签等功能,并能获取特定问题和拉取请求的详细信息。

article

README

🚀 GitHub MCP 服务器

GitHub MCP 服务器是一个强大的工具,它提供了命令行接口,方便用户与 GitHub API 进行交互,可完成仓库搜索、问题管理和拉取请求等操作。

🚀 快速开始

你可以按照以下步骤快速使用 GitHub MCP 服务器:

  1. 安装服务器。
  2. 进行必要的配置。
  3. 依据需求使用相关命令。

📦 安装指南

方式一:使用 npm 安装

npm install -g github-mcp-server

方式二:从源码安装

  1. 克隆仓库:
git clone https://github.com/your-username/github-mcp-server.git
cd github-mcp-server
  1. 安装依赖:
npm install
  1. 构建并安装:
npm run build && npm install -g ./dist

🛠️ 配置

  1. 在环境中设置 GitHub 个人访问令牌:
export GITHUB_PERSONAL_ACCESS_TOKEN=your_token_here
  1. 更新配置文件 config.json,添加需要的仓库信息。

💻 使用示例

基本用法

github-mcp-server --owner your_owner --repo your_repo --token your_token

选项

  • --owner-o:指定仓库的所有者。
  • --repo-r:指定仓库的名称。
  • --token-t:指定 GitHub 的个人访问令牌。

工具使用示例

搜索仓库

github-mcp-server search-repositories --query your_query

参数

  • --query-q:要搜索的关键词或主题。

获取仓库信息

github-mcp-server get-repository --owner owner_name --repo repo_name

参数

  • --owner-o:仓库的所有者。
  • --repo-r:仓库的名称。

搜索问题

github-mcp-server search-issues --owner owner_name --repo repo_name --query your_query

参数

  • --owner-o:仓库的所有者。
  • --repo-r:仓库的名称。
  • --query-q:要搜索的问题关键字。

获取问题详情

github-mcp-server get-issue --owner owner_name --repo repo_name --issue_number issue_id

参数

  • --owner-o:仓库的所有者。
  • --repo-r:仓库的名称。
  • --issue_number-i:问题的编号。

实际使用示例

  1. 搜索包含 "modelcontextprotocol" 的仓库:
github-mcp-server search-repositories --query modelcontextprotocol
  1. 获取模型上下文协议服务器仓库的问题 739 信息:
github-mcp-server get-issue --owner modelcontextprotocol --repo servers --issue_number 739
  1. 获取模型上下文协议服务器仓库的拉取请求 717 信息:
github-mcp-server get-pull-request --owner modelcontextprotocol --repo servers --pull_request_number 717

🛠️ 开发指南

安装依赖

npm install

配置 GitHub 令牌

将你的 GitHub 个人访问令牌添加到 .env 文件中:

GITHUB_PERSONAL_ACCESS_TOKEN=your_token_here

启动调试模式

npm run dev

构建项目

npm run build

使用调试工具

npm run debug
help

运行方式说明

cloud

托管运行

托管运行通常表示这个 MCP Server 由服务方环境承载,用户一般按页面提供的连接方式或授权流程接入,不需要在本地长期启动一个 MCP 进程

  1. 打开服务方连接页
  2. 完成授权或复制端点
  3. 在 MCP 客户端中连接
terminal

本地运行 / 其它方式

本地运行通常需要用户在自己的电脑或服务器上安装依赖,把 server_config 复制到 MCP 客户端,并按 env_schema 补齐环境变量、密钥或其它配置

  1. 复制 server_config
  2. 安装所需依赖
  3. 补齐环境变量后重启客户端