A Model Context Protocol (MCP) server that provides code review capabilities for GitHub pull requests using Elementor's coding guidelines. This tool integrates with Cursor IDE to analyze PRs and suggest improvements based on predefined rules.
- ✅ Fetch and analyze GitHub pull request content
- ✅ Apply coding rules based on file types (JS, TS, PHP, etc.)
- ✅ LLM-powered code analysis using configurable rules
- ✅ Generate review comments with line-specific feedback
- ✅ Post comments directly to GitHub PRs (optional)
- ✅ Support for both stdio and HTTP SSE transports
cd /Users/janvanvlastuin1981/Local\ Sites/elementor/app/public/wp-content/elementor-cursor-review-mcp
npm installCreate a .env file (this is the only place you need to configure your token):
cp env.example .env
# Edit .env and add your GitHub token:
GITHUB_TOKEN=ghp_your_actual_token_herenpm run buildOption A: Stdio Transport (Recommended)
Add to your ~/.cursor/mcp.json:
{
"mcpServers": {
"elementor-code-review": {
"command": "/opt/homebrew/bin/node",
"args": [
"/Users/janvanvlastuin1981/Local Sites/elementor/app/public/wp-content/elementor-cursor-review-mcp/dist/cli.js",
"--stdio"
],
"cwd": "/Users/janvanvlastuin1981/Local Sites/elementor/app/public/wp-content/elementor-cursor-review-mcp"
}
}
}Option B: HTTP SSE Transport
- Start the HTTP server (defaults to port 3335; override with
PORT):
npm run build
PORT=3335 npm run start:http- Add to
~/.cursor/mcp.json:
{
"mcpServers": {
"elementor-code-review-sse": {
"url": "http://localhost:3335/sse"
}
}
}Restart Cursor completely to load the new MCP server.
Note: The GitHub token is automatically loaded from the
.envfile using dotenv. You don't need to set it in the MCP configuration.
Can you review this PR using our coding guidelines?
PR: https://github.com/elementor/hello-commerce/pull/203
The MCP will:
- ✅ Fetch PR content and file changes
- ✅ Apply coding rules based on file types
- ✅ Analyze code using LLM (simulated)
- ✅ Show findings with line numbers
- ✅ Optionally post comments to GitHub (with dryRun: false)
What coding rules are available?
Review this PR and actually post the comments:
PR: https://github.com/elementor/hello-commerce/pull/203
Use LLM analysis: true
Dry run: false
- prUrl (required): GitHub PR URL (e.g.,
https://github.com/owner/repo/pull/123) - dryRun (optional, default: true): Whether to post comments to GitHub
- useLLM (optional, default: false): Use LLM analysis in addition to heuristics
- Shows all loaded coding rules from the
rules/directory
Add your .md rule files to the ./rules/ directory. Each rule file should have YAML frontmatter with metadata and Markdown content for the rule description.
avoid-todo.md- Avoid TODO comments, create tickets insteaddescriptive-naming.md- Use clear, descriptive names for variables and functionsgeneral-quality.md- General code quality and best practices
---
title: "Rule Title"
severity: "warning" # error, warning, info
category: "naming" # naming, structure, performance, etc.
filePatterns: ["*.ts", "*.js", "*.php"]
examples:
- bad: "const x = getData();"
good: "const userData = getUserData();"
---
Your rule description in Markdown format...npm run build- Compile TypeScript to JavaScriptnpm run start:cli- Start stdio MCP servernpm run start:http- Start HTTP/Streamable MCP server (SSE at/sse) on port 3335 (override withPORT)npm run dev- Run CLI version for testing
- Check Node.js path: Ensure
/opt/homebrew/bin/nodeexists or update path in config - Check dependencies: Run
npm install - Check GitHub token: Verify
GITHUB_TOKENis set in.envfile - Check Cursor logs: Open Cursor Developer Tools for MCP connection logs
- Restart Cursor completely (known issue with MCP detection)
- Try SSE transport if stdio fails
- Clear npm cache:
rm -rf ~/.npm/_npx && rm -rf node_modules && npm install - Check server startup: Run
npm run start:climanually to see error messages
- Ensure
rules/directory exists with.mdfiles - Check rule file format (YAML frontmatter + Markdown content)
- Verify file patterns match your target files
- Token scope: Verify your GitHub token in
.envhasreposcope - Private repos: Ensure token has access to target repositories
- Rate limits: Check GitHub API response headers for rate limit status
- Network: Verify connectivity to
api.github.com
# Test CLI version
npm run dev https://github.com/elementor/hello-commerce/pull/203
# Test stdio MCP server
npm run start:cli
# Test HTTP/SSE server
PORT=3335 npm run start:http
curl http://localhost:3335/health# 1) Initialize a session (no session header on first call)
curl -i -X POST http://localhost:3335/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"id":"1",
"method":"initialize",
"params":{
"protocolVersion":"2024-11-05",
"capabilities":{}
}
}'
# Note the `mcp-session-id` header from the response, then use it below
# 2) List tools using the session
curl -X POST http://localhost:3335/mcp \
-H "Content-Type: application/json" \
-H "mcp-session-id: <SESSION_ID_FROM_STEP_1>" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":"2"}'
# 3) Call a tool
curl -X POST http://localhost:3335/mcp \
-H "Content-Type: application/json" \
-H "mcp-session-id: <SESSION_ID_FROM_STEP_1>" \
-d '{
"jsonrpc":"2.0",
"method":"tools/call",
"id":"3",
"params":{
"name":"show_coding_rules",
"arguments":{}
}
}'elementor-cursor-review-mcp/
├── src/
│ ├── cli.ts # Entry point; selects stdio or HTTP based on flags/env
│ ├── mcp.ts # MCP server definition and tools
│ ├── server.ts # HTTP + SSE transports and routes
│ ├── github.ts # GitHub API integration
│ ├── rules.ts # Rule loading and matching
│ ├── analyze.ts # Heuristic code analysis
│ ├── llm.ts # LLM prompt building
│ ├── post-comments.ts # GitHub comment posting
│ └── types.ts # TypeScript type definitions
├── rules/ # Coding rule definitions
├── dist/ # Compiled JavaScript output
└── README.md # This file
- Cursor v1.3+ may have MCP detection issues - try restarting or using SSE transport
- Some GitHub Enterprise setups may require additional authentication
- Large PRs may hit GitHub API rate limits
- Add new rules to the
rules/directory - Test with
npm run dev <pr-url> - Update rule patterns and examples
- Submit PRs with rule improvements
This project is part of the Elementor development toolchain.