클로드-코드-리뷰-MCP
OpenAI, Google, Anthropic 모델을 사용하여 코드 검토 기능을 제공하는 MCP(Model Context Protocol) 서버입니다. Claude Code, Claude Desktop, Cursor, Windsurf를 포함한 모든 MCP 클라이언트에서 사용할 수 있는 코드 검토를 위한 "제2의 의견" 도구 역할을 합니다.
특징
- 다중 공급자 지원 : 코드 검토를 위해 OpenAI, Google의 Gemini 및 Anthropic의 Claude 모델을 활용합니다.
- 두 가지 검토 유형 : 분류된 피드백이 포함된 구조화된 검토 또는 자유형 서술 검토 중에서 선택하세요
- 컨텍스트 인식 : 더욱 관련성 있는 리뷰를 위해 프로젝트 구조, 관련 파일, 커밋 메시지 및 종속성을 포함합니다.
- 지능형 코드 처리 : 프로그래밍 언어를 자동으로 감지하고, 대용량 파일을 처리하고, 출력을 적절하게 포맷합니다.
- 강력한 오류 처리 : API 실패에 대한 재시도 논리와 우아한 오류 복구가 포함됩니다.
- MCP 호환 : 모든 MCP 클라이언트(Claude Code, Claude Desktop, Cursor, Windsurf)와 호환됩니다.
- 간편한 설정 : 환경 변수를 통한 간단한 구성
설치
글로벌 설치
지엑스피1
npx 사용(설치 불필요)
# Set environment variables separately
export OPENAI_API_KEY=<key>
npx -y claude-code-review-mcp
# Or use inline environment setting
OPENAI_API_KEY=<key> npx -y claude-code-review-mcp
# Or with Google API key
GOOGLE_API_KEY=<key> npx -y claude-code-review-mcp
# Or with Anthropic API key
ANTHROPIC_API_KEY=<key> npx -y claude-code-review-mcp
# Or use multiple API keys for more model options
OPENAI_API_KEY=<key> GOOGLE_API_KEY=<key> ANTHROPIC_API_KEY=<key> npx -y claude-code-review-mcp
구성
서버에는 다음 API 키 중 하나 이상이 필요합니다.
OPENAI_API_KEY
: OpenAI API 키GOOGLE_API_KEY
: Google Gemini API 키ANTHROPIC_API_KEY
: Anthropic API 키
선택 구성:
PORT
: 서버 포트(기본값: 동적 - 사용 가능한 포트가 선택됨)HOST
: 서버 호스트(기본값: 127.0.0.1)LOG_LEVEL
: 로그 레벨(0=디버그, 1=정보, 2=경고, 3=오류; 기본값: 1)
사용 가능한 모델
OpenAI 모델(OPENAI_API_KEY 필요)
gpt-4.1
- OpenAI GPT-4.1o4-mini
- OpenAI O4 Minio3-mini
- OpenAI O3 Mini
Google 모델(GOOGLE_API_KEY 필요)
gemini-2.5-pro-preview-05-06
- Google Gemini 2.5 Progemini-2.5-flash-preview-04-17
- Google Gemini 2.5 Flash
인류 모델(ANTHROPIC_API_KEY 필요)
claude-3-opus-20240229
- 인간주의 클로드 3작품claude-3-sonnet-20240229
- 인간주의적 클로드 3 소네트claude-3-haiku-20240307
- 인간 중심적인 클로드 3 하이쿠
사용 가능한 도구
MCP 서버는 세 가지 도구를 제공합니다.
1. 코드 구조화 검토
다음 섹션을 통해 자세하고 체계적인 코드 검토를 제공합니다.
- 전체 요약
- 코드 품질(강점 및 약점)
- 버그(심각도 및 제안된 수정 사항 포함)
- 개선 제안
- 보안 문제(있는 경우)
2. 코드프리폼 리뷰
일반적인 인상과 대화형 피드백에 적합한 자유형 텍스트 형식으로 서술형 코드 리뷰를 제공합니다.
3. 리스트모델
제공된 API 키를 기반으로 사용 가능한 모든 모델을 나열합니다. 여기에는 모델 ID와 사람이 읽을 수 있는 이름이 포함됩니다.
Claude Code와의 통합
Claude Code에 이 MCP 서버를 추가하려면:
# Use environment variables properly (recommended approach)
claude mcp add code-review -s user -e OPENAI_API_KEY=<key> -e GOOGLE_API_KEY=<key> -e ANTHROPIC_API_KEY=<key> -- npx -y claude-code-review-mcp
# Alternative: Export the variables before adding the MCP
export OPENAI_API_KEY=<key>
export GOOGLE_API_KEY=<key>
export ANTHROPIC_API_KEY=<key>
claude mcp add code-review -s user -- npx -y claude-code-review-mcp
.claude/commands/review-with.md
에 파일을 만들어 사용자 정의 슬래시 명령을 만들 수도 있습니다.
I'll review your code using alternative LLM models. Model to use: $ARGUMENTS
Claude Code는 MCP 서버와 쉽게 상호 작용할 수 있도록 사용자 지정 슬래시 명령을 지원합니다. 프로젝트 내 .claude/commands/
디렉터리에 이러한 명령을 생성하여 강력한 코드 검토 워크플로를 구현하세요.
기본 설정
먼저, 명령 디렉터리가 없으면 만듭니다.
mkdir -p .claude/commands
모델 목록 명령
사용 가능한 모델을 나열하는 명령을 만듭니다.
# Create the list-review-models.md file
cat > .claude/commands/list-review-models.md << 'EOF'
I'll check which alternative code review models are available through our MCP server.
First, I'll use the MCP server to list all available models for code review.
After that, I'll present the models in a clear table format with:
- Model ID (what you'll use when requesting a review)
- Provider (OpenAI or Google)
- Description (size and capabilities)
- Speed (relative performance)
This will help you choose the right model for your code review needs.
EOF
기본 코드 검토 명령
모델 이름을 허용하는 간단한 검토 명령을 만듭니다.
# Create the review-with.md file
cat > .claude/commands/review-with.md << 'EOF'
I'll review the code I've just worked on using an alternative LLM model to provide a second opinion.
First, I'll identify the code changes or file you want reviewed. If you don't specify a file, I'll look at recent changes.
Then, I'll send this code to be reviewed by the specified model through our MCP server.
Available models (run /project:list-review-models to see all options):
- OpenAI models (if configured): "gpt-4.1", "o4-mini", "o3-mini"
- Google models (if configured): "gemini-2.5-pro-preview-05-06", "gemini-2.5-flash-preview-04-17"
Model to use (leave blank for default): $ARGUMENTS
EOF
구조화된 검토 명령
구조화된 리뷰에 대한 명령을 특별히 만듭니다.
# Create the structured-review.md file
cat > .claude/commands/structured-review.md << 'EOF'
I'll perform a structured code review using an alternative LLM model.
This review will be organized into clear sections:
1. Overall summary
2. Code quality assessment (strengths and weaknesses)
3. Potential bugs with severity ratings (Low/Medium/High)
4. Specific improvement suggestions
5. Security considerations (if applicable)
If you don't specify a model, I'll use the default available model.
Model to use (optional): $ARGUMENTS
EOF
자유형 검토 명령
내러티브 스타일 리뷰에 대한 명령을 만듭니다.
# Create the freeform-review.md file
cat > .claude/commands/freeform-review.md << 'EOF'
I'll provide a conversational, narrative-style code review using an alternative LLM model.
This will be a more holistic assessment of your code with flowing paragraphs rather than structured categories. This style works well for:
- General impressions
- High-level feedback
- More nuanced commentary on code style and approach
If you don't specify a model, I'll use the default available model.
Model to use (optional): $ARGUMENTS
EOF
특정 파일 명령 검토
특정 파일을 검토하는 명령을 만듭니다.
# Create the review-file.md file
cat > .claude/commands/review-file.md << 'EOF'
I'll review a specific file using an alternative LLM model.
Please provide the file path to review and optionally the model to use.
Format: [file_path] [model_name]
For example:
- "src/utils.js gemini-2.5-pro-preview-05-06" - Reviews utils.js with Gemini Pro
- "lib/auth.ts" - Reviews auth.ts with the default model
Input: $ARGUMENTS
EOF
초점별 검토 명령
특수 리뷰에 대한 명령을 만듭니다.
# Create security review command
cat > .claude/commands/security-review.md << 'EOF'
I'll perform a security-focused code review using an alternative LLM model.
This review will specifically examine:
- Potential security vulnerabilities
- Input validation issues
- Authentication/authorization flaws
- Data protection concerns
- Injection vulnerabilities
- Secure coding best practices
If you don't specify a model, I'll use a model recommended for security analysis.
Model to use (optional): $ARGUMENTS
EOF
# Create performance review command
cat > .claude/commands/performance-review.md << 'EOF'
I'll perform a performance-focused code review using an alternative LLM model.
This review will specifically examine:
- Algorithm efficiency
- Memory usage
- Unnecessary computations
- Loop optimizations
- Data structure choices
- Caching opportunities
- Async/parallel processing considerations
If you don't specify a model, I'll use a model that's good at performance analysis.
Model to use (optional): $ARGUMENTS
EOF
종합 프로젝트 검토 사령부
전체 프로젝트 컨텍스트로 코드를 검토하기 위한 명령을 만듭니다.
# Create the project-review.md file
cat > .claude/commands/project-review.md << 'EOF'
I'll perform a comprehensive code review with full project context using an alternative LLM model.
This review will:
1. Analyze the code structure and organization
2. Consider related files and dependencies
3. Evaluate consistency with project patterns
4. Assess integration with existing components
5. Check alignment with project architecture
I'll gather project context, including directory structure and related files, to ensure a thorough, context-aware review.
Format: [file_to_review] [model_name]
Example: "src/components/Button.jsx gemini-2.5-pro-preview-05-06"
Input: $ARGUMENTS
EOF
검토 명령 전후
코드 변경 사항을 비교하는 명령을 만듭니다.
# Create the diff-review.md file
cat > .claude/commands/diff-review.md << 'EOF'
I'll review the changes you've made to a file using an alternative LLM model.
This will:
1. Identify what was changed between versions
2. Evaluate if the changes address the intended purpose
3. Check for any new issues introduced
4. Suggest potential improvements to the changes
I'll need to know which file to examine. If you've been working on a file with Claude Code, I'll automatically find the changes.
Model to use (optional): $ARGUMENTS
EOF
사용자 정의 슬래시 명령 사용
이러한 명령을 생성한 후에는 Claude Code에서 /project:
다음에 명령 이름을 입력하여 사용할 수 있습니다. 예:
/project:list-review-models
/project:review-with gemini-2.5-pro-preview-05-06
/project:structured-review o4-mini
/project:security-review
/project:review-file src/utils.js gemini-2.5-flash-preview-04-17
사용자 정의 명령에 대한 팁
- 명령 검색 : Claude Code에
/project:
를 입력하여 사용 가능한 명령 목록을 확인하세요. - 기본 모델 : 모델을 지정하지 않으면 명령은 기본 모델(일반적으로 사용 가능한 경우 o4-mini)을 사용합니다.
- 다중 리뷰 : 다양한 모델로 리뷰를 실행하여 다양한 관점을 얻을 수 있습니다.
- 프로젝트 컨텍스트 : 가장 관련성 있는 리뷰를 위해 프로젝트 컨텍스트를 포함하는 명령을 사용하세요.
- 특수 초점 : 보안, 성능 등에 대해 특별한 우려가 있는 경우 초점별 명령을 사용하세요.
워크플로 예시
일반적인 작업 흐름은 다음과 같습니다.
- Claude Code로 코드 작업하기
- 사용 가능한 옵션을 보려면
/project:list-review-models
실행하세요. - Google 모델에서 구조화된 리뷰를 얻으려면
/project:structured-review gemini-2.5-pro-preview-05-06
실행하세요. - Claude의 제안과 비교해보세요
- 두 가지 관점을 모두 고려하여 개선을 진행하세요.
/project:diff-review
실행하여 변경 사항을 검토합니다.
이러한 사용자 정의 명령을 사용하면 Claude Code와 claude-code-review-mcp 서버 간의 원활한 통합이 가능해져 코드에 대한 귀중한 "추가 의견"을 얻을 수 있습니다.
사용 예
MCP 서버 시작
# Start with OpenAI API key (using exports, recommended)
export OPENAI_API_KEY=<key>
npx -y claude-code-review-mcp
# Or with inline environment variables
OPENAI_API_KEY=<key> npx -y claude-code-review-mcp
# Start with Google Gemini API key
export GOOGLE_API_KEY=<key>
npx -y claude-code-review-mcp
# Start with Anthropic Claude API key
export ANTHROPIC_API_KEY=<key>
npx -y claude-code-review-mcp
# Use multiple API keys for more model options
export OPENAI_API_KEY=<key>
export GOOGLE_API_KEY=<key>
export ANTHROPIC_API_KEY=<key>
npx -y claude-code-review-mcp
# Use custom port and host
export OPENAI_API_KEY=<key>
export PORT=8080
export HOST=0.0.0.0
npx -y claude-code-review-mcp
MCP 클라이언트와 함께 사용
서버가 실행되면 Claude Code, Claude Desktop, Cursor 또는 Windsurf와 같은 모든 MCP 클라이언트에서 서버의 URL을 사용하여 서버에 연결할 수 있습니다. 서버는 충돌을 방지하기 위해 동적으로 할당된 포트를 사용하여 시작 로그에 실제 URL과 포트를 표시합니다.
입력 스키마
모든 검토 도구는 다음 입력을 허용합니다.
{
code: string; // Required: The code to review
filename?: string; // Optional: The filename with extension
language?: string; // Optional: Programming language
model: string; // Required: Model ID to use for review
projectContext?: { // Optional: Additional context
projectStructure?: string; // Directory structure
relatedFiles?: Array<{ // Related code files
name: string; // Filename with path
language?: string; // File language
content: string; // File content
}>;
commitMessage?: string; // Purpose of changes
dependencies?: Record<string, string>; // Project dependencies
}
}
출력 스키마
구조화된 검토 출력
{
review?: { // Present on success
summary: string; // Overall assessment
quality: {
strengths: string[]; // Good aspects
weaknesses: string[]; // Areas for improvement
};
bugs: Array<{
description: string; // Issue description
severity: "Low" | "Medium" | "High"; // Impact level
suggestion: string; // How to fix
}>;
improvements: string[]; // Enhancement suggestions
securityIssues?: string[]; // Security concerns if any
};
modelUsed: string; // Human-readable model name
error?: string; // Present on error
availableModels?: Record<string, string>; // Present on error or listModels
}
자유형 검토 출력
{
reviewText?: string; // Present on success
modelUsed: string; // Human-readable model name
error?: string; // Present on error
availableModels?: Record<string, string>; // Present on error or listModels
}
모델 출력 목록
{
availableModels: Record<string, string>; // Model ID to name mapping
modelUsed: string; // Always "None" for this tool
}
MCP 클라이언트 통합
클로드 코드
- MCP 서버를 추가합니다.
claude mcp add code-review -s user npx -y claude-code-review-mcp
- 클로드 코드에서의 사용:
/code-review:reviewCodeStructured --model o4-mini
클로드 데스크탑
Claude Desktop 설정에서 MCP를 다음과 같이 구성합니다.
"claude-code-review-mcp": {
"command": "npx",
"args": ["-y", "claude-code-review-mcp"],
"env": {
"OPENAI_API_KEY": "your-openai-key",
"GOOGLE_API_KEY": "your-google-key",
"ANTHROPIC_API_KEY": "your-anthropic-key"
}
}
이 서버는 Claude Desktop을 포함한 모든 MCP 클라이언트와의 완벽한 호환성을 위해 고급 JSON 출력 정리 기술을 사용합니다.
커서와 윈드서핑
동일한 명령과 환경 변수를 사용하여 클라이언트에 맞는 특정 MCP 구성 지침을 따르세요.
문제 해결
API 키 문제
- "모델 X를 사용할 수 없습니다" : 모델에 적합한 API 키를 제공했는지 확인하세요.
- API 키가 제공되지 않았습니다 . OPENAI_API_KEY, GOOGLE_API_KEY 또는 ANTHROPIC_API_KEY 중 하나 이상을 제공해야 합니다.
- 제안 모델 : 요청한 모델을 사용할 수 없는 경우 서버에서 대체 모델을 제안합니다.
속도 제한 및 API 오류
- 속도 제한이나 API 오류가 발생하면 오류 메시지에 문제가 표시됩니다.
- 한 공급업체에서 문제가 발생하는 경우 다른 모델을 사용하는 것을 고려하세요.
보안 고려 사항
- API 키는 기록되거나 노출되지 않습니다.
- 개인 정보 보호를 위해 코드 내용은 최소한으로 기록됩니다.
- 보안 표면을 줄이기 위해 종속성을 최소한으로 유지합니다.
- 요청 처리에는 입력 검증 및 정리가 포함됩니다.
- 오류 메시지는 민감한 정보가 유출되는 것을 방지하기 위해 설계되었습니다.
호환성
- Node.js 18.0.0 이상이 필요합니다.
- Linux, macOS 및 Windows에서 작동합니다(필요한 경우 WSL을 통해)
- 모든 MCP 클라이언트(Claude Code, Claude Desktop, Cursor, Windsurf)와 호환 가능
- 대용량 코드 파일 및 프로젝트 컨텍스트의 우아한 처리
- 일시적인 API 오류에 대한 자동 재시도 메커니즘
개발
# Install dependencies
npm install
# Start in development mode
npm run dev
# Build for production
npm run build
# Start in production mode
npm run start
특허
MIT
기여자