loading…
Search for a command to run...
loading…
Analyzes React component changes by performing structural analysis and generating visual diffs to identify pixel-level differences. It integrates with Figma to
Analyzes 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.
An MCP (Model Context Protocol) server for reviewing React component changes. Analyzes structural differences, generates visual diffs, and validates implementations against Figma designs.
git clone https://github.com/yourusername/mcp-component-review.git
cd mcp-component-review
npm install
npm run build
Add to your claude_desktop_config.json:
{
"mcpServers": {
"component-review": {
"command": "node",
"args": ["/path/to/mcp-component-review/dist/index.js"]
}
}
}
claude mcp add component-review node /path/to/mcp-component-review/dist/index.js
analyze_componentAnalyze a single React component file.
analyze_component({
file: "/path/to/Button.tsx"
})
Output:
compare_componentsCompare two component files and get a structured diff.
compare_components({
oldFile: "/path/to/Button.old.tsx",
newFile: "/path/to/Button.new.tsx"
})
Output:
visual_diff_componentsGenerate visual diff screenshots.
visual_diff_components({
oldFile: "/path/to/Button.old.tsx",
newFile: "/path/to/Button.new.tsx",
outputDir: "/path/to/output"
})
Output:
get_figma_specsExtract design specifications from Figma.
get_figma_specs({
figmaUrl: "https://www.figma.com/file/ABC123/Design?node-id=1:2",
figmaToken: "figd_xxxxx"
})
Output:
validate_design_implementationCompare Figma specs with implementation.
validate_design_implementation({
figmaUrl: "https://www.figma.com/file/ABC123/Design?node-id=1:2",
figmaToken: "figd_xxxxx",
componentFile: "/path/to/Button.tsx",
tolerance: 2
})
Output:
# Design Validation Report: Button
## Summary ⚠️
- **Score**: 75%
- **Matches**: 6/8
- **Mismatches**: 2
## Validation Details
| Property | Figma | Implementation | Status |
|---------------|-----------|----------------------|------------|
| padding-top | 8px | 8px (p-2) | ✅ match |
| background | #22C55E | #16A34A (bg-green-600)| ❌ mismatch|
| font-size | 16px | 18px (text-lg) | ❌ mismatch|
review_branchReview all changed components in a git branch.
review_branch({
repoPath: "/path/to/repo",
baseBranch: "main",
targetBranch: "feature/new-button",
figmaToken: "figd_xxxxx",
figmaFileKey: "ABC123",
figmaMapping: {
"src/components/Button.tsx": "1:234",
"src/components/Card.tsx": "1:567"
},
outputDir: "/path/to/visual-diffs"
})
Output:
validate_and_fixValidate a component and get auto-fix instructions. If the component doesn't match Figma, returns exact Tailwind/CSS changes needed.
validate_and_fix({
figmaUrl: "https://www.figma.com/file/ABC123/Design?node-id=1:2",
figmaToken: "figd_xxxxx",
componentFile: "/path/to/Button.tsx"
})
Output (when fixes needed):
🔧 **AUTO-FIX REQUIRED** for `src/Button.tsx`
Current design compliance: **62%**
## Required Changes
### 🔴 Missing (High Priority)
- **gap**: Add `gap-2`
- Expected: `8px`
### 🟡 Mismatches (Medium Priority)
- **background**: Change to `bg-green-500`
- Current: `bg-green-600`
- Expected: `#22C55E`
- **font-size**: Change to `text-base`
- Current: `text-lg`
- Expected: `16px`
## Instructions
1. Open `src/Button.tsx`
2. Find the className or styled-components styles
3. Apply the following Tailwind class changes:
Add/Replace: gap-2 bg-green-500 text-base
4. Save the file
5. Run validation again to confirm compliance
This output is designed to be directly actionable by an AI agent to automatically fix the issues.
figd_)// 1. Get the Figma specs for a component
const specs = await get_figma_specs({
figmaUrl: "https://www.figma.com/file/ABC/Design?node-id=1:2",
figmaToken: process.env.FIGMA_TOKEN
});
// 2. Validate the implementation
const validation = await validate_design_implementation({
figmaUrl: "https://www.figma.com/file/ABC/Design?node-id=1:2",
figmaToken: process.env.FIGMA_TOKEN,
componentFile: "src/components/Button.tsx"
});
// 3. If there are visual changes, generate a diff
const visualDiff = await visual_diff_components({
oldFile: "src/components/Button.old.tsx",
newFile: "src/components/Button.tsx",
outputDir: "./review-output"
});
// Review all components changed in a PR
const review = await review_branch({
repoPath: ".",
baseBranch: "main",
targetBranch: "HEAD",
figmaToken: process.env.FIGMA_TOKEN,
figmaFileKey: "ABC123",
figmaMapping: {
"src/components/Button.tsx": "1:234"
}
});
# Install dependencies
npm install
# Build
npm run build
# Run in development mode
npm run dev
MIT
Contributions are welcome! Please read the contributing guidelines before submitting a PR.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"mcp-component-review": {
"command": "npx",
"args": []
}
}
}