Back to MCP directory
publicPublicdnsLocal runtime

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

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client