An intelligent MCP Server that automatically analyzes your project and generates Cursor Rules tailored to your project's characteristics.
- โ Smart Project Analysis: Automatically scans project files and identifies tech stack and dependencies
- โ Tech Stack Detection: Supports 20+ mainstream tech stacks including Node.js, Python, Go, Rust, Java
- โ Multi-Module Support: Automatically detects monorepo, microservices, and other multi-module architectures
- โ Code Feature Analysis: Identifies component structures, API routes, state management patterns
- โ Consistency Checking: Compares project documentation with actual implementation
- โ Best Practices Integration: Generates rules based on framework best practices
- โ
Automatic Rule Generation: Generates
.mdcformat rule files in.cursor/rules/directory - โ Modular Rules: Supports global rules + module-specific rules
- โ Dependency-Driven Rules: Automatically generates rules based on project dependencies (routing, state management, etc.)
- โ Rule Requirements Analysis: Intelligently analyzes which rule files are needed and explains why
- โ Generation Location Confirmation: Automatically detects rule file generation locations to match project structure
- โ Structured Output: Provides detailed generation summaries and explanations
Recommended: Use npx (automatically downloads and runs, no manual installation needed)
Find your Cursor MCP configuration file:
- macOS/Linux:
~/Library/Application Support/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json - Windows:
%APPDATA%\Cursor\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
Add this configuration:
{
"mcpServers": {
"cursor-rules-generators": {
"command": "npx",
"args": ["-y", "cursor-rules-generators"]
}
}
}Completely quit and restart Cursor to apply the configuration.
In Cursor's AI chat window, simply say:
Please generate Cursor Rules for the current project
Or specify a project path:
Please generate Cursor Rules for /Users/myname/projects/my-app
That's it! The tool will automatically:
- Scan your project files
- Detect your tech stack
- Analyze code features
- Generate appropriate rules
- Save them to
.cursor/rules/directory
If you prefer to install globally:
npm install -g cursor-rules-generatorsThen configure:
{
"mcpServers": {
"cursor-rules-generators": {
"command": "cursor-rules-generators",
"disabled": false,
"alwaysAllow": []
}
}
}For local installation in a project:
npm install cursor-rules-generatorsThen configure with the full path:
{
"mcpServers": {
"cursor-rules-generators": {
"command": "node",
"args": ["/project/path/node_modules/cursor-rules-generators/dist/index.js"],
"disabled": false,
"alwaysAllow": []
}
}
}Analyzes the project and generates complete Cursor Rules.
Parameters:
projectPath(required): Absolute path to project root directoryupdateDescription(optional): Whether to automatically update description files, defaultfalseincludeModuleRules(optional): Whether to generate module-specific rules, defaulttrue
Example:
Please generate Cursor Rules for /Users/myname/projects/my-app
Analyzes the project only, without generating rules. Returns detailed project information.
Parameters:
projectPath(required): Absolute path to project root directory
Example:
Please analyze the project structure and tech stack
Checks consistency between project documentation and actual code.
Parameters:
projectPath(required): Absolute path to project root directory
Example:
Please check if the project documentation matches the actual code
Updates project description documents based on actual code.
Parameters:
projectPath(required): Absolute path to project root directorydescriptionFile(optional): File to update, defaultREADME.md
Example:
Please update the README based on the actual code
Validates the format and content of Cursor Rules files.
Parameters:
projectPath(required): Absolute path to project root directoryvalidateModules(optional): Whether to validate rule files in module directories, defaulttrue
Example:
Please validate the Cursor Rules files in the current project
Previews the rule generation process, listing all tasks, analysis results, and decision points without actually generating files.
Parameters:
projectPath(required): Absolute path to project root directory
Example:
Please preview what rules would be generated
Displays MCP tool information, including version, log configuration status, environment variables, and any detected configuration issues.
Parameters: None
Example:
Show tool information
1. Collect project files (max 10 levels deep)
โ
2. Detect tech stack and dependencies
โ
3. Identify multi-module structure
โ
4. Analyze code features
โ
5. Identify routing systems (from dependencies and file structure)
โ
6. Get best practices (via Context7 if configured)
โ
7. Analyze rule requirements (determine which rules are needed)
โ
8. Check documentation consistency
โ
9. (Optional) Prompt user to update description files
โ
10. Confirm generation locations (check directory structure)
โ
11. Generate global + module rules (based on requirements analysis)
โ
12. Write .cursor/rules/*.mdc files
โ
13. Return structured summary
- React, Vue, Angular, Svelte
- Next.js, Nuxt, SvelteKit
- Express, Fastify, NestJS, Koa, Hapi
- Django, Flask, FastAPI
- JavaScript, TypeScript
- Python, Go, Rust, Java
- PHP, Ruby
- npm / yarn / pnpm
- pip / pipenv
- cargo
- go modules
- maven / gradle
your-project/
โโโ .cursor/
โ โโโ rules/
โ โโโ global-rules.mdc # Global rules
โ โโโ code-style.mdc # Code style rules
โ โโโ architecture.mdc # Architecture rules
โโโ src/
โโโ package.json
โโโ README.md
your-multi-module-project/
โโโ .cursor/
โ โโโ rules/
โ โโโ global-rules.mdc # Global rules
โโโ frontend/
โ โโโ .cursor/
โ โ โโโ rules/
โ โ โโโ frontend-rules.mdc # Frontend module rules
โ โโโ src/
โโโ backend/
โ โโโ .cursor/
โ โ โโโ rules/
โ โ โโโ backend-rules.mdc # Backend module rules
โ โโโ src/
โโโ shared/
โโโ .cursor/
โ โโโ rules/
โ โโโ shared-rules.mdc # Shared module rules
โโโ src/
Smart Features:
- โ Global rules in project root affect the entire project
- โ Module rules in their respective directories affect only that module
- โ Cursor automatically loads relevant rules based on current file location
- โ Module rules can override global rule configurations
Generated rules include:
- Project Overview: Tech stack, languages, frameworks
- Project Structure: Module organization and responsibilities
- Core Features: Components, APIs, state management, etc.
- Development Guidelines: Framework-specific development guides
- Code Style: Naming conventions, formatting, best practices
- File Organization: Directory structure and file naming conventions
- Important Notes: Common pitfalls and important reminders
If you have Context7 MCP Server configured in your environment, this tool will automatically fetch official documentation and best practices for your dependencies.
If Context7 is not configured, the tool will use built-in best practice templates.
Configuring Context7 (Optional):
Refer to Context7 MCP Server documentation for setup instructions.
The following directories are automatically excluded:
node_modules,.gitdist,build,out.next,.nuxtcoverage,.cache.vscode,.idea__pycache__,.pytest_cachevenv,envtarget,bin,obj
Control log verbosity:
# Set log level (DEBUG, INFO, WARN, ERROR, NONE)
export CURSOR_RULES_GENERATOR_LOG_LEVEL=DEBUGOr in Cursor configuration:
{
"mcpServers": {
"cursor-rules-generators": {
"command": "npx",
"args": ["-y", "cursor-rules-generators"],
"env": {
"CURSOR_RULES_GENERATOR_LOG_LEVEL": "INFO"
}
}
}
}export CURSOR_RULES_GENERATOR_LOG_FILE=/path/to/your/logfile.log# Enable debug mode (automatically sets log level to DEBUG)
export CURSOR_RULES_GENERATOR_DEBUG=trueLog Levels:
DEBUG: All logs including detailed debugging informationINFO: Informational logs (default)WARN: Warnings and errors onlyERROR: Errors onlyNONE: No logs
Logs are written to files (not stdout/stderr) to avoid interfering with MCP protocol communication.
Default log locations:
- macOS:
~/Library/Logs/cursor-rules-generators.log - Windows:
%USERPROFILE%\AppData\Local\cursor-rules-generators.log - Linux/Unix:
~/.local/log/cursor-rules-generators.log
View logs:
# macOS/Linux
tail -f ~/Library/Logs/cursor-rules-generators.log
# Windows
Get-Content $env:USERPROFILE\AppData\Local\cursor-rules-generators.log -Tail 100Or use the info tool to see the log file path:
Show tool information
- First Generation: First generation may take a few seconds depending on project size
- Large Projects: Very large projects (10,000+ files) may take longer
- Rule Overwriting: Regenerating will overwrite existing rule files
- Manual Editing: Consider placing custom rules in separate files to avoid overwriting
- Context7: Context7 integration is optional; basic functionality works without it
- Logs: Logs are written to files, not displayed in the console
MIT
Contributions are welcome! Please feel free to submit Issues and Pull Requests.
# Clone the repository
git clone https://github.com/ALvinCode/cursor-rules-generators.git
cd cursor-rules-generators
# Install dependencies
pnpm install
# Development mode (auto-recompile)
pnpm run watch
# Build
pnpm run build
# Test
pnpm test- GitHub Issues: Report Issues
- Repository: GitHub Repository
If this tool helps you, please give us a โญ๏ธ!