This MCP server allows you to analyze React components and generate documentation using Claude AI. It extracts information about components and their props from JSX/TSX files, making it easier to understand and document your React codebase.
To set up the React Analyzer MCP server:
# Clone the repository
git clone https://github.com/azer/react-analyzer-mcp.git
cd react-analyzer-mcp
# Install dependencies
npm install
# Update PROJECT_ROOT in the index.ts file
vim src/index.ts
# Build the project
npm run build
Add the MCP server configuration to your Claude Desktop config:
{
"react-analyzer-mcp": {
"command": "node",
"args": [
"/Users/yourname/path/to/react-analyzer-mcp/build/index.js"
]
}
}
Make sure to update the path to match your actual installation location.
Once configured, connect Claude to your MCP server using the Claude Shell. The server provides several tools that can be accessed directly in your Claude conversations.
The React Analyzer MCP provides three main tools:
You can ask Claude to analyze components in a specific folder:
Can you analyze the components in my "foobar" folder?
Claude will return documentation for all React components found in that folder, including details about their props, types, and default values:
# Components
## Button
### Props
| Prop | Type | Optional | Default |
|------|------|----------|---------|
| `variant` | `string` | ✓ | `primary` |
| `size` | `string` | ✓ | `md` |
| `onClick` | `function` | ✓ | |
You can ask Claude to show what React components are in your project:
What React components do I have in my project?
This will use the list-projects tool to show all available React projects under your configured root folder.
To analyze just one component, you can ask Claude about it specifically:
Can you analyze the Button component for me?
This will provide detailed information about that specific component's props and structure.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.