An MCP (Model Context Protocol) server that executes shell commands for code review. This server provides a tool that can be used by AI assistants to review code or plans by executing the cursor-tools repo command.
- Provides a code review tool that can be used by AI assistants
- Implements the Model Context Protocol for seamless integration with AI assistants
- Uses cursor-tools to perform code reviews
- Enhanced error handling and logging with Winston
- Configurable cursor-tools path
- Input validation and sanitization
- Bun - JavaScript runtime and package manager
- cursor-tools - Command-line tool for code review
- Install dependencies:
bun install- Ensure cursor-tools is installed and available in your PATH or configure its location (see Configuration section)
To run the MCP server:
bun run index.tsOr use the provided launch script:
./launch-mcp.shThe server can be configured using environment variables:
| Variable | Description | Default |
|---|---|---|
| CURSOR_TOOLS_PATH | Path to the cursor-tools executable | "cursor-tools" |
Example:
CURSOR_TOOLS_PATH=/usr/local/bin/cursor-tools bun run index.tsThe server includes comprehensive error handling:
- Input validation: Empty or invalid inputs are rejected with appropriate error messages
- Command execution errors: Errors during command execution are logged and returned with descriptive messages
- Server startup errors: Issues during server startup are logged with detailed information
All errors are logged to:
- Console output
error.log(error level messages)combined.log(all messages)
This server executes shell commands based on input received from AI assistants. While basic input sanitization is implemented, be aware of the following:
- The server is designed to be used in a trusted environment
- Input is sanitized to prevent basic command injection, but additional security measures may be needed for production use
- The cursor-tools command should be properly secured and have appropriate permissions
{
"mcpServers": {
"code-review-server": {
"autoApprove": [],
"disabled": false,
"timeout": 60,
"command": "bun",
"args": [
"run",
"index.ts"
],
"env": {},
"transportType": "stdio",
"alwaysAllow": [
"review_code"
]
}
}
}
To run the test suite:
bun run test.tsThe test suite includes:
- Basic code review functionality
- Complex code review scenarios
- Error handling tests
Logs are stored in:
error.log- Contains error-level messagescombined.log- Contains all log messages (info, warn, error)