Cover image
Try Now
2025-04-14

用于构建自定义工具提供商的Python MCP服务器模板

3 years

Works with Finder

0

Github Watches

0

Github Forks

0

Github Stars

GitHub Code Review MCP

An MCP (Model Context Protocol) service that enables AI-powered code reviews of GitHub repositories using Claude.

What is MCP?

The Model Context Protocol (MCP) is an open protocol that enables seamless integration between LLM applications and external data sources and tools. Whether you're building an AI-powered IDE, enhancing a chat interface, or creating custom AI workflows, MCP provides a standardized way to connect LLMs with the context they need.

Overview

This service provides a set of tools that allow users to:

  1. Submit GitHub repositories for code review
  2. Get detailed feedback and suggestions on their codebase
  3. Focus reviews on specific areas of interest (e.g., security, performance, best practices)
  4. Track review history and access previous reviews

Features

  • Repository Analysis: Analyze GitHub repositories by simply providing the URL
  • Focused Reviews: Specify areas to focus the code review on
  • Improvement Suggestions: Get specific suggestions for improving the codebase
  • File-Level Analysis: Get detailed feedback for specific files
  • Security Scanning: Identify security vulnerabilities and get remediation advice
  • Dependency Analysis: Analyze project dependencies for outdated packages and vulnerabilities
  • Code Quality Metrics: Get insights into code complexity, duplication, and maintainability
  • Performance Analysis: Identify performance bottlenecks and optimization opportunities
  • Best Practices Comparison: Compare code against industry best practices for your framework
  • PR Description Generator: Automatically generate comprehensive pull request descriptions
  • Cascade Prompt Generation: Create ready-to-use prompts for implementing improvements with Cascade

MCP Tools

This MCP server provides the following tools:

Repository Review Tools

  • review_repository(repo_url: str, focus_areas: Optional[str] = None): Review a GitHub repository by providing the URL. You can optionally specify areas to focus on (e.g., "security, performance, best practices").

  • list_reviewed_repos(): List all repositories that have been reviewed, including review dates and focus areas.

  • get_review_details(repo_key: str): Get detailed review results for a specific repository using its key in the format "owner/repo".

Improvement and Analysis Tools

  • suggest_improvements(repo_key: str, file_path: Optional[str] = None): Get specific improvement suggestions for an entire repository or a specific file.

  • analyze_dependencies(repo_key: str): Analyze repository dependencies to identify outdated packages, potential vulnerabilities, and provide recommendations.

  • scan_security_vulnerabilities(repo_key: str): Scan a repository for security vulnerabilities and provide remediation steps.

  • analyze_code_quality(repo_key: str): Get code quality metrics including complexity, duplication, and maintainability scores.

  • analyze_performance(repo_key: str): Identify performance bottlenecks and get optimization suggestions.

  • compare_with_best_practices(repo_key: str, framework: Optional[str] = None): Compare code against industry best practices, with optional framework-specific comparisons.

Code Generation Tools

  • generate_pull_request_description(repo_key: str, review_id: str): Generate a comprehensive pull request description based on code review results.

  • generate_cascade_prompt(repo_key: str): Create a Cascade-specific prompt that can be used to implement the suggested improvements.

  • generate_improved_code(repo_key: str, file_path: str): Generate improved code for a specific file based on the review results.

Installation

Prerequisites

  • Python 3.12 or higher
  • MCP 1.6.0 or higher

Setup

  1. Clone this repository:

    git clone https://github.com/kl63/Mcp-Server-Demo.git
    cd Mcp-Server-Demo
    
  2. Set up a virtual environment:

    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    
  3. Install the dependencies:

    pip install -e .
    
  4. (Optional) Set up GitHub API token:

    To avoid GitHub API rate limiting, it's recommended to set up a GitHub API token:

    • Create a Personal Access Token on GitHub (Settings > Developer settings > Personal access tokens)
    • Set the token as an environment variable:
      export GITHUB_API_TOKEN=your_github_token  # On Windows: set GITHUB_API_TOKEN=your_github_token
      

    Without a token, you'll be limited to 60 requests per hour, which may not be enough for analyzing larger repositories.

Usage

Starting the MCP Server

Run the following command to start the MCP server:

python main.py

Using the Service with Claude

Once the MCP server is running, you can interact with it through Claude by using commands like:

  1. Review a repository:

    Please review the GitHub repository at https://github.com/username/repo-name
    
  2. Focus on specific areas:

    Review https://github.com/username/repo-name with focus on security and performance
    
  3. Get improvement suggestions:

    Suggest improvements for the repository https://github.com/username/repo-name
    
  4. List previously reviewed repositories:

    Show me all the repositories that have been reviewed
    
  5. Generate a Cascade prompt for implementing improvements:

    Generate a Cascade prompt for the improvements to https://github.com/username/repo-name
    
  6. Get improved code for a specific file:

    Show me improved code for the file src/components/Button.js in https://github.com/username/repo-name
    

License

MIT

References

相关推荐

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • 1Panel-dev
  • 🔥1Panel提供了直观的Web接口和MCP服务器,用于在Linux服务器上管理网站,文件,容器,数据库和LLMS。

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • Byaidu
  • PDF科学纸翻译带有保留格式的pdf -基于ai完整保留排版的pdf文档全文双语翻译

  • rulego
  • ⛓️Rulego是一种轻巧,高性能,嵌入式,下一代组件编排规则引擎框架。

  • sigoden
  • 使用普通的bash/javascript/python函数轻松创建LLM工具和代理。

  • hkr04
  • 轻巧的C ++ MCP(模型上下文协议)SDK

  • RockChinQ
  • 😎简单易用、🧩丰富生态 -大模型原生即时通信机器人平台| 适配QQ / 微信(企业微信、个人微信) /飞书 /钉钉 / discord / telegram / slack等平台| 支持chatgpt,deepseek,dify,claude,基于LLM的即时消息机器人平台,支持Discord,Telegram,微信,Lark,Dingtalk,QQ,Slack

  • dmayboroda
  • 带有可配置容器的本地对话抹布

  • paulwing
  • 使用MCP服务创建的测试存储库

    Reviews

    2 (1)
    Avatar
    user_dabb7NnN
    2025-04-24

    I've been using the Mcp-Server-Demo by kl63 and it's truly impressive. The setup is seamless, and the performance is robust, making it perfect for developers. Highly recommend for anyone looking to enhance their server solutions!