Token导航 LogoToken导航TokenDH.com
MCP Review logo
开发工具未说明官方级别未说明来源级核验

MCP Review

MCP Server

mcp-git-reviewer 是一款基于AI的代码审查工具,能够在提交级别提供上下文感知的智能审查,无需拉取请求。

工具数

4

提示词数

0

GitHub Stars

0

资源数

0
开发工具TypeScriptClaudeClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

ethanasm

提供方

ethanasm

最后核验

2026/5/17 20:20

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

mcp git评审员

在提交级别进行上下文感知、人工智能驱动的代码审查。使用本地git历史记录-不需要PR。

作为MCP主机构建,它协调工具服务器从代码库中收集上下文,并将其提供给LLM进行智能的、特定于项目的审查。

盒子里有什么

src/
  cli.ts                  CLI entry point (commander)
  config.ts               YAML/JSON config loader (zod validated)
  reviewer.ts             Review orchestration + watch mode
  output.ts               Terminal rendering (chalk, boxen)
  cache.ts                Hash-based review caching
  usage.ts                Token usage tracking and cost estimation
  errors.ts               Typed error hierarchy (ToolServerError, ApiError, etc.)
  git/
    resolver.ts           Translates user input to git revision ranges
    commands.ts           simple-git wrappers (diff, blame, log)
  host/
    mcp-host.ts           MCP host lifecycle — spawns tool servers
    transport.ts          Stdio JSON-RPC transport
    tool-registry.ts      Tool capability discovery and call routing
    conversation.ts       LLM conversation loop with usage tracking
  llm/
    provider.ts           Shared LLMProvider interface and types
    anthropic.ts          Anthropic SDK provider with rate-limit retry
    openai.ts             OpenAI-compatible provider (OpenRouter, DeepSeek, Kimi, etc.)
    index.ts              Provider factory + model alias resolution
  tools/
    git-diff/             Diff, stats, commit messages
    file-context/         File reading with line numbers, directory listing
    conventions/          Lint config scanning, pattern search, project conventions
    related-files/        Import graph, exports, test file discovery, type references
  prompts/
    system.ts             System prompt with review instructions
    templates.ts          Security and performance review templates

技术栈

类别工具
语言TypeScript 5(严格)
运行时Node.js 20+/Bun
包管理器Bun
AIAnthropic SDK、OpenAI兼容API、MCP SDK
Git简单Git
CLI指挥官,粉笔,拳击手
配置zod、yaml、dotenv
棉绒和格式生物特征
测试Vitest
CIGitHub Actions,SonarCloud

设置

# Install bun (if not already installed)
curl -fsSL https://bun.sh/install | bash

# Install dependencies
bun install

# Build the project
bun run build

# Copy environment template and add your API key
cp .env.example .env

必填项 .env (取决于供应商):

ANTHROPIC_API_KEY=sk-ant-...   # For Anthropic (default)
OPENROUTER_API_KEY=sk-or-...   # For OpenRouter models (qwen3-coder, etc.)
DEEPSEEK_API_KEY=sk-...        # For DeepSeek
MOONSHOT_API_KEY=sk-...        # For Kimi / Moonshot

全局安装

链接CLI以便运行 mcp-review 从任何git仓库:

npm link

在另一个项目中使用

导航到任何git repo并运行 mcp-review 直接:

cd /path/to/your-project
mcp-review --staged

(可选)创建 .mcp-review.yml 在该项目的根目录中自定义审核行为:

model: qwen3-coder
focus:
  - security
  - performance
ignore:
  - "*.test.ts"
  - dist
conventions:
  - "Use named exports"
  - "Error messages should be user-facing"

配置 所有可用选项。

发展

# Run in dev mode
bun run dev

# Type check
bun run typecheck

# Lint and format
bun run lint
bun run format

# Run tests
bun run test
bun run test:watch
bun run test:coverage

验证

在本地运行完整的CI管道:

bun run verify

这将运行lint、格式检查、类型检查、构建和测试,并在最后显示通过/失败摘要。

用法

# Review the last commit
mcp-review HEAD~1..HEAD

# Review staged changes (pre-commit)
mcp-review --staged

# Review a specific commit
mcp-review abc123

# Review last N commits
mcp-review --last 3

# Review everything since yesterday
mcp-review --since yesterday

# Focus on specific areas
mcp-review --staged --focus security,performance

# Watch mode — auto-review each new commit
mcp-review --watch

# Skip cache for a fresh review
mcp-review HEAD~1..HEAD --no-cache

# JSON output for CI pipelines (exit code 1 on critical findings)
mcp-review HEAD~1..HEAD --output json

# Verbose mode — show token usage and cost
mcp-review HEAD~1..HEAD --verbose

# Use a specific model
mcp-review HEAD~1 --model qwen3-coder

# Use a custom OpenAI-compatible endpoint
mcp-review HEAD~1 --provider openai --base-url https://openrouter.ai/api/v1 --model qwen/qwen3-coder:free --api-key-env OPENROUTER_API_KEY

多提供商支持

mcp review通过摘要支持多个LLM提供者 LLMProvider 界面。

模型别名

自动配置提供程序、基本URL和API密钥的短名称:

别名模型提供商API关键环境
qwen3-coderqwen/qwen3-coder:free 通过OpenRouteropenaiOPENROUTER_API_KEY
deepseekdeepseek-chat 通过DeepSeek APIopenaiDEEPSEEK_API_KEY
kimikimi-k2.5 通过Moonshot APIopenaiMOONSHOT_API_KEY

使用别名 --model 或者在您的配置文件中:

mcp-review HEAD~1 --model qwen3-coder

提供商

  • Anthropic (默认)--使用Anthropic SDK。模型: claude-sonnet-4-20250514, claude-opus-4-20250514, claude-haiku-3-5-20241022
  • OpenAI兼容 -适用于实现OpenAI聊天完成API的任何端点:OpenRouter、DeepSeek、Kimi/Moonshot和其他

配置

创建 .mcp-review.yml 在项目根目录中:

model: qwen3-coder
focus:
  - security
  - performance
ignore:
  - "*.test.ts"
  - dist
conventions:
  - "Use named exports"
  - "Error messages should be user-facing"

所有配置字段:

字段类型默认值描述
model字符串claude-sonnet-4-20250514型号名称或别名
provideranthropicopenaianthropicLLM提供程序(由别名自动设置)
base_urlstring-与OpenAI兼容的API的基本URL
api_key_envstring-API键的环境变量名称
focusstring\[\][]重点领域:安全性、性能、一致性
ignorestring\[\][]要跳过的文件的全局模式
conventionsstring\[\][]执行项目惯例
max_files编号20要查看的最大文件数
context_lines编号5围绕变化的背景线
no_cache布尔值false跳过审阅缓存

CI集成

该仓库包括GitHub Actions工作流:

  • .github/workflows/ci.yml --在push/PR上运行lint、类型检查、构建和测试
  • .github/workflows/sonarqube.yml --将覆盖范围上传到SonarCloud

CI的退出代码:

  • 0 --审查通过(无关键发现)
  • 1 --检测到关键发现
  • 2 --运行时错误

建筑

mcp评论是 MCP主机 将工具服务器作为子进程生成:

CLI → MCPHost.initialize()
        ├── git-diff server      (diff, stats, commit messages)
        ├── file-context server  (read files, list directories)
        ├── conventions server   (lint configs, pattern search)
        └── related-files server (imports, exports, test files, types)
              ↓
         LLMProvider (Anthropic or OpenAI-compatible)
              ↓
         Structured ReviewResult → terminal output

每个工具服务器都是一个使用stdio传输的独立MCP服务器。主机通过以下方式发现工具 tools/list 并通过以下方式将LLM工具调用路由到正确的服务器 tools/call.

评论按内容哈希缓存。对同一个diff的重复审查完全跳过API调用。

许可证

麻省理工学院

目录标签

目录标签

开发工具TypeScriptClaudeAI代码审查本地部署Git集成LLM自动化审查

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

api-key

工具数量(toolCount,工具数)

4

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明api-key部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP