GitHub Repository Analyzer

by jar285
Verified

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Supports environment variable management for storing GitHub API tokens securely using .env files.

  • Provides tools for analyzing GitHub repositories, including retrieving repository metadata, analyzing issues, accessing documentation, viewing commit history, calculating activity metrics, and creating visualizations of repository activity.

GitHub 存储库分析器 MCP 服务器

模型上下文协议 (MCP) 服务器,支持大型语言模型实时分析 GitHub 代码库。该服务器提供检索代码库信息、分析问题、访问文档以及可视化活动的工具。

特征

  • 存储库信息工具:检索有关 GitHub 存储库的基本元数据
  • 问题分析工具:列出并分类存储库问题
  • README 访问资源:访问存储库文档
  • 提交历史工具:分析最近的代码更改
  • 活动分析工具:计算存储库活动指标
  • 可视化工具:创建存储库活动的可视化图表

先决条件

  • Python 3.10 或更高版本
  • GitHub 帐户和个人访问令牌

安装

  1. 克隆此存储库:
git clone <repository-url> cd github-repo-analyzer
  1. 创建并激活虚拟环境:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
  1. 安装依赖项:
pip install -r requirements.txt
  1. 使用您的 GitHub API 令牌创建一个.env文件:
cp .env.example .env

编辑.env文件并将your_github_token_here替换为您的实际 GitHub 个人访问令牌。

用法

运行服务器

要使用 MCP Inspector 以开发模式启动服务器:

mcp dev src/server.py

这将在您的浏览器中打开一个 Web 界面,您可以在其中测试服务器的工具。

在 Claude Desktop 注册

要使用 Claude Desktop 注册服务器:

mcp install src/server.py

注册后,重新启动 Claude Desktop。然后,您可以通过向 Claude 询问有关 GitHub 存储库的问题来与 GitHub 存储库分析器进行交互。

克劳德的示例提示

  • “您能分析一下 GitHub 存储库‘modelcontextprotocol/python-sdk’并告诉我它的用途和活跃程度吗?”
  • “openai/openai-python”存储库中排名前 5 的未解决问题是什么?”
  • “过去 30 天内‘anthropics/anthropic-sdk-python’存储库的活跃程度如何?”
  • “请阅读‘microsoft/TypeScript’存储库的自述文件并解释其主要功能。”
  • “生成一个图表,显示过去 60 天内‘facebook/react’的提交活动。”

发展

项目结构

github-repo-analyzer/ ├── src/ │ ├── github_tools.py # GitHub API client implementation │ └── server.py # MCP server implementation ├── requirements.txt # Dependencies ├── .env.example # Example environment variables ├── .gitignore # Git ignore file └── README.md # Project documentation

添加新工具

要向服务器添加新工具,请按照以下步骤操作:

  1. github_tools.py中的GitHubAPIClient类中添加必要的功能
  2. 使用@server.tool装饰器在server.py中向 MCP 服务器注册该工具
  3. 使用 MCP Inspector 测试该工具

测试

要测试服务器,请使用 MCP 检查器,如“使用方法”部分所述。您还可以为 GitHub API 客户端功能编写单元测试。

安全注意事项

  • 永远不要将你的 GitHub API 令牌提交到版本控制
  • 使用 GitHub 令牌所需的最小范围
  • 注意 GitHub API 速率限制

执照

MIT 许可证

-
security - not tested
F
license - not found
-
quality - not tested

使大型语言模型能够实时分析 GitHub 存储库,提供检索存储库信息、分析问题、访问文档和可视化活动的工具。

  1. Features
    1. Prerequisites
      1. Installation
        1. Usage
          1. Running the Server
          2. Registering with Claude Desktop
          3. Example Prompts for Claude
        2. Development
          1. Project Structure
          2. Adding New Tools
        3. Testing
          1. Security Considerations
            1. License
              ID: ywjzhd62p8