Frontend Test Generation & Code Review MCP Server
fe-testgen-mcp
AI 분석 및 코드 생성 기능에 중점을 둔 MCP 프로토콜 기반 프론트엔드 단위 테스트 생성 서비스입니다. HTTP Streaming을 통해 MCP 도구를 노출하며, n8n, Cursor, Claude 등의 클라이언트와 통합할 수 있습니다.
핵심 기능
테스트 매트릭스 분석: 코드 변경 사항을 분석하여 기능 목록 및 테스트 시나리오 생성
테스트 코드 생성: 매트릭스를 기반으로 완전한 단위 테스트 코드 생성
다중 프레임워크 지원: Vitest 및 Jest 지원
다양한 시나리오 커버리지: happy-path, edge-case, error-path, state-change
Related MCP server: Phabricator MCP Server
빠른 시작
# 安装依赖
pnpm install
# 构建
pnpm build
# 启动服务
pnpm start서비스는 기본적으로 http://localhost:3000/mcp에서 수신 대기합니다.
환경 설정
env.example을 .env로 복사하고 필요한 설정을 입력하세요:
# 必需:OpenAI API 密钥
OPENAI_API_KEY=your_api_key
# 可选:自定义模型
OPENAI_MODEL=gpt-4
# 可选:服务配置
HTTP_PORT=3000
HTTP_HOST=0.0.0.0 # 允许外部访问MCP 도구
analyze-test-matrix
코드 변경 사항을 분석하여 테스트 매트릭스를 생성합니다.
매개변수:
매개변수 | 타입 | 필수 | 설명 |
rawDiff | string | ✅ | Unified diff 형식 텍스트 |
identifier | string | 고유 식별자(MR ID, commit hash) | |
rules | string | test-strategy.md 내용 | |
framework | string | 테스트 프레임워크(vitest/jest) |
반환값: 기능 목록, 테스트 시나리오, 통계 정보
generate-tests
단위 테스트 코드를 생성합니다.
매개변수:
매개변수 | 타입 | 필수 | 설명 |
rawDiff | string | ✅ | Unified diff 형식 텍스트 |
identifier | string | 고유 식별자 | |
rules | string | test-strategy.md 내용 | |
framework | string | 테스트 프레임워크 | |
scenarios | string[] | 지정된 시나리오 유형 | |
maxTests | number | 최대 테스트 개수 |
반환값: 테스트 케이스 배열(파일 경로, 코드, 시나리오 유형 포함)
n8n 통합
워크플로우 예시
GitLab/Phabricator Webhook
│
▼
读取 diff + rules 文件
│
▼
调用 MCP generate-tests
│
▼
写入测试文件 + 创建 MR
│
▼
发送通知(企微/飞书)HTTP 호출 예시
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "generate-tests",
"arguments": {
"rawDiff": "diff --git a/src/utils.ts ...",
"framework": "vitest"
}
}
}'rules 파일 형식
프로젝트에 .cursor/rules/test-strategy.md를 생성하세요:
# 测试生成规则
## 测试框架配置
- **测试框架**:vitest
- **测试文件模式**:**/*.{test,spec}.{ts,tsx}
## Mock 策略
- 使用 vi.fn() 进行函数 mock
- HTTP 请求优先 mock fetch/axiosn8n은 이 파일 내용을 읽어 rules 매개변수로 MCP에 전달합니다.
Docker 배포
docker build -t fe-testgen-mcp .
docker run -d -p 3000:3000 \
-e OPENAI_API_KEY=xxx \
fe-testgen-mcp자주 묻는 질문
Q: 생성 결과의 일관성을 높이려면 어떻게 해야 하나요?
A: 서비스는 기본적으로 temperature=0 및 고정된 seed=42를 사용하며, 응답 캐싱이 활성화되어 있습니다.
Q: 테스트 프레임워크를 지정하려면 어떻게 하나요?
A: 우선순위: framework 매개변수 > rules에서 파싱 > 기본값 vitest
Q: 필요한 Node.js 버전은 무엇인가요?
A: Node.js 18+ (20+ 권장)
This server cannot be deployed
Maintenance
Related MCP Connectors
Approved test intent, reviewed Playwright automation and run evidence, inside your editor.
Code review that knows what depends on your change — before commit or on every PR.
Direct access to Cypress tests results and accessibility reports in your AI workflow.
Risk-scan a diff, flag AI-generated-code tells, find secrets. 5 of 7 tools need no account.
Related MCP Servers
- AlicenseDqualityDmaintenanceProvides tools for frontend testing including code analysis, test generation, test execution, and React component testing for Jest and Cypress frameworks.426MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Phabricator for task management and code review workflows, including viewing and commenting on tasks, managing differential revisions, and providing intelligent review analysis with code context.7MIT
- AlicenseNot gradedqualityDmaintenanceAnalyzes React component changes by performing structural analysis and generating visual diffs to identify pixel-level differences. It integrates with Figma to validate implementation compliance against design specifications and automates component reviews across git branches.MIT
- FlicenseAqualityDmaintenanceProvides AI assistants with frontend development tools including component scaffolding, bundle analysis, accessibility checks, and responsive design guidance. Enables automated generation of React components with tests and stories, bundle optimization recommendations, and WCAG compliance fixes.6-