代码审查插件

MCP CodeReview是一个基于Model Context Protocol (MCP)的Cursor/VS Code插件,通过标准化的MCP接口将AI代码审查流程化,并将Review意见以原生评论的形式直接渲染在IDE的Diff视图中。

  • by Groos-dev
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 Groos-dev/codereview-mcp

使用说明

MCP CodeReview

MCP CodeReview It is based on Model Context Protocol (MCP) The cursor/VS code plugin. It streamlines the AI code review process through a standardized MCP interface and renders review comments directly in the diff view of the IDE in the form of native comments.

Core conceptUpgrade Code Review from "casual chat" to "structured workflow".

✨ Core Features

  • **Protocol driven (MCP Native)**Define review logic through MCP Server, decouple from IDE, and support hot plugging of different LLM backends.

  • **Native experience (In Diff Rendering)**Say goodbye to the text stuffing in the Chat window. Review comments are directly mounted to the code line using VS Code CommentController API implements native interaction.

  • Workflow orchestrationSupport multiple review modes and targeted problem-solving:

    • 🛡️ Security AuditFocus on vulnerability scanning and permission verification.

    • 🚀 PerformanceFocus on algorithm complexity and resource leakage.

    • 💎 IdiomaticFocus on code style, type safety, and readability.

  • structured outputForce LLM to output strict JSON format to ensure zero illusion in UI rendering.

🏗️ Architecture Overview

Adopting a Client Server hybrid architecture:

graph TD
    A[Cursor / VS Code] -->|MCP Protocol| B(MCP Server)
    B -->|Prompt Engineering| C[LLM Provider]
    C -->|Structured JSON| B
    B -->|Review Data| A
    A -->|VS Code API| D[Diff View Decorations]
  • **Extension (Client)**Responsible for obtaining Diff context and processing UI rendering(vscode.comments).

  • MCP ServerResponsible for Prompt management, context assembly, and Zod schema validation.

🛠️ tech stack

  • Runtime: Node.js v20 LTS

  • Language: TypeScript v5.4 (Strict Mode)

  • Schema ValidationZod (used to ensure LLM output conforms to UI rendering structure)

  • Linter: Biome

  • Package Manager: pnpm (Monorepo support)

🚀 Quick Start

Pre requirements

  • Node.js >= 20

  • Cursor or VS code

Installation and operation

  1. Building MCP Server

    pnpm install
    pnpm run build --filter=@mcp-codereview/server
    
  2. Configure cursor MCP

    At the cursor MCP Add local server in the settings:

    {
      "mcpServers": {
        "code-review": {
          "command": "node",
          "args": ["/path/to/packages/server/dist/index.js"]
        }
      }
    }
    
  3. Debugging plugins

    press F5 Start VS Code Extension Host.

⚙️ Configuration

in .vscode/settings.json Define default process in:

{
  "mcpCodeReview.defaultWorkflow": "idiomatic",
  "mcpCodeReview.severityLevel": "warning"
}

📝 Contribution Guide

This project strictly follows Conventional Commits and Semantic VersioningPlease run before submitting the code pnpm biome check.