Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

Code Review MCP Server

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.

Features

  • 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

Prerequisites

  • Bun - JavaScript runtime and package manager
  • cursor-tools - Command-line tool for code review

Installation

  1. Install dependencies:
bun install
  1. Ensure cursor-tools is installed and available in your PATH or configure its location (see Configuration section)

Usage

To run the MCP server:

bun run index.ts

Or use the provided launch script:

./launch-mcp.sh

Configuration

The 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.ts

Error Handling

The 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)

Security Considerations

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

Integration with Roo

{
  "mcpServers": {
    "code-review-server": {
      "autoApprove": [],
      "disabled": false,
      "timeout": 60,
      "command": "bun",
      "args": [
        "run",
        "index.ts"
      ],
      "env": {},
      "transportType": "stdio",
      "alwaysAllow": [
        "review_code"
      ]
    }
  }
}

Testing

To run the test suite:

bun run test.ts

The test suite includes:

  • Basic code review functionality
  • Complex code review scenarios
  • Error handling tests

Logging

Logs are stored in:

  • error.log - Contains error-level messages
  • combined.log - Contains all log messages (info, warn, error)

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages