1.0.0 • Published 8 months ago

@peifeng07/github-search-mcp v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

GitHub Search MCP

一个用于搜索GitHub仓库、获取README和Release信息的MCP(Model Context Protocol)工具。

🚀 功能特性

  • 🔍 仓库搜索: 根据关键词搜索GitHub仓库(返回前5个最相关的结果)
  • 📖 README获取: 获取指定仓库的README内容
  • 📦 Release信息: 获取仓库的发布版本信息和下载链接

📋 工具列表

1. search_repositories

搜索GitHub仓库

参数:

  • query (必需): 搜索关键词
  • sort (可选): 排序方式 - best-match (默认), stars, forks, updated
  • language (可选): 编程语言过滤

2. get_repository_readme

获取仓库README内容

参数:

  • owner (必需): 仓库所有者用户名
  • repo (必需): 仓库名称

3. get_repository_releases

获取仓库发布版本信息

参数:

  • owner (必需): 仓库所有者用户名
  • repo (必需): 仓库名称
  • latest_only (可选): 仅返回最新版本 (默认: true)
  • limit (可选): 返回版本数量限制 (默认: 5, 最大: 10)

🛠️ 安装和使用

前置要求

  • Node.js 18+
  • GitHub Personal Access Token (可选,用于提高API限制)

1. 克隆仓库

```bash git clone https://github.com/your-username/github-search-mcp.git cd github-search-mcp ```

2. 安装依赖

```bash npm install ```

3. 构建项目

```bash npm run build ```

4. 配置环境变量 (可选)

复制环境变量示例文件: ```bash cp env.example .env ```

编辑 .env 文件,设置你的GitHub token: ``` GITHUB_TOKEN=your_github_token_here ```

5. 运行服务器

```bash npm start ```

🔧 MCP客户端配置

Cursor IDE

在Cursor的设置中添加MCP服务器配置:

```json { "mcpServers": { "github-search": { "command": "node", "args": "/path/to/github-search-mcp/dist/index.js", "env": { "GITHUB_TOKEN": "your_github_token_here" } } } } ```

Claude Desktop

在Claude Desktop的配置文件中添加:

Windows: %APPDATA%\\Claude\\claude_desktop_config.json macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

```json { "mcpServers": { "github-search": { "command": "node", "args": "/path/to/github-search-mcp/dist/index.js", "env": { "GITHUB_TOKEN": "your_github_token_here" } } } } ```

🐳 Docker部署

构建Docker镜像

```bash docker build -t github-search-mcp . ```

使用Docker Compose

```bash

设置环境变量

export GITHUB_TOKEN=your_github_token_here

启动服务

docker-compose up -d ```

📝 开发

开发模式运行

```bash npm run dev ```

代码检查

```bash

TypeScript类型检查

npm run type-check

ESLint检查

npm run lint

自动修复ESLint问题

npm run lint:fix ```

测试

```bash

运行测试

npm test

监视模式运行测试

npm run test:watch

生成覆盖率报告

npm run test:coverage ```

🔑 GitHub Token设置

  1. 访问 GitHub Settings > Developer settings > Personal access tokens
  2. 点击 "Generate new token (classic)"
  3. 选择适当的权限(对于公共仓库,不需要特殊权限)
  4. 复制生成的token并设置为环境变量

📚 文档和提示词

📖 技术文档

🤖 AI提示词

🤝 贡献

欢迎贡献代码!请查看 开发指南 了解如何参与项目开发。

📄 许可证

本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。

🔗 相关链接