Code Review Workflow MCP Server

Code Review Workflow MCP Server

Enables automated code review by reading code files, checking for style issues like console.log and TODOs, and generating formatted reports.

Category
Visit Server

README

Code Review Workflow — MCP 端到端代码审查流水线

基于 MCP(Model Context Protocol)协议的代码审查工作流,演示如何用标准化协议构建 AI 工具流水线。

架构

用户请求 "检查代码" 
    │
    ▼
┌──────────────┐     ┌──────────────────────────┐
│ code_reader  │     │ code_checker             │
│ MCP Server   │     │ MCP Server               │
├──────────────┤     ├──────────────────────────┤
│ read_code    │ →  │ check_style   检查规范    │
│ 读取代码文件  │     │ generate_report 生成报告  │
└──────────────┘     └──────────────────────────┘
    │                        │
    └────────┬───────────────┘
             ▼
      端到端流水线:读文件 → 检查 → 报告

项目结构

code-review-workflow/
├── shared/                    # 共享 MCP 协议栈
│   ├── jsonrpc.js             # JSON-RPC 2.0 编解码
│   ├── dispatcher.js          # 消息路由
│   ├── framing.js             # stdio 字节流分帧
│   ├── session.js             # 生命周期状态机
│   ├── registry.js            # 工具注册表
│   └── errors.js              # 统一错误处理
│
├── code_reader/               # MCP Server 1:代码读取
│   └── server.js
│       └── read_code          接收文件路径 → 返回文件内容
│
├── code_checker/              # MCP Server 2:代码检查
│   └── server.js
│       ├── check_style        接收代码文本 → 检查规范问题
│       └── generate_report    接收检查结果 → 生成格式化报告
│
└── README.md

快速开始

环境要求

  • Node.js 20+

测试 Server 1:code_reader

cd code-review-workflow
node -e "
import { spawn } from 'child_process';
import { createFramer } from './shared/framing.js';
import { encodeRequest, encodeNotification, decode, MessageType } from './shared/jsonrpc.js';
import { Session, PROTOCOL_VERSION } from './shared/session.js';
import { fileURLToPath } from 'url';

// ... (完整测试代码见 examples/end_to_end_test.js)
"

检查规则

规则 说明
console.log 检测 生产代码不应保留调试输出
TODO/FIXME 检测 待完成事项需要跟踪
行长检测 超过 100 字符的行影响可读性

技术栈

  • 协议: MCP (Model Context Protocol) + JSON-RPC 2.0
  • 传输: stdio (stdin/stdout)
  • 运行时: Node.js (纯 JavaScript,零依赖)
  • 协议栈: 基于 mcp-from-scratch 的 6 层架构

面试要点

这个项目展示了:

  1. 标准化: 两个 MCP Server 通过统一的 JSON-RPC 协议通信
  2. 端到端: 读文件 → 检查规范 → 生成报告,完整流水线
  3. 工具开发: 手写 MCP 工具定义(inputSchema)+ 执行函数(handler)
  4. 协议理解: 底层掌握 handshake / tools/list / tools/call 全流程

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured