LGTMCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone https://msrl.dev/lgtmcp.git
cd lgtmcp
make build
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add lgtmcp -- node "<FULL_PATH_TO_LGTMCP>/dist/index.js"

Replace <FULL_PATH_TO_LGTMCP>/dist/index.js with the actual folder you prepared in step 1.

README.md

Gemini-powered code review with integrated Gitleaks security scanning.

LGTMCP

A Model Context Protocol (MCP) server that provides AI-powered code review using Google Gemini 3.1 Pro. LGTMCP reviews your code changes and either commits them automatically (if approved) or provides detailed feedback for improvements.

In my usage, the median review takes 1.9 minutes and costs $0.20, with an acceptance rate around 45%. You should decide whether that is slow and expensive or fast and cheap.

Features

  • AI Code Review: Leverages Google Gemini 3.1 Pro for intelligent code analysis
  • Automatic Commit: Commits changes when code passes review (optional)
  • Security Scanning: Built-in secret detection using Gitleaks
  • Gitignore Protection: Prevents access to gitignored files during review
  • MCP Integration: Works seamlessly with Claude Desktop and other MCP clients
  • Review-Only Mode: Option to get feedback without automatic commits

Installation

Build from source

git clone https://msrl.dev/lgtmcp.git
cd lgtmcp
make build

Install to ~/bin

make install

This installs the binary to ~/bin by default. You can customize the installation directory:

make install INSTALL_PATH=/usr/local/bin

Note: Ensure ~/bin is in your shell's PATH. Add this to your shell configuration file if needed:

# For bash/zsh
export PATH="$HOME/bin:$PATH"

Configuration

  1. Get a Google API key from Google AI Studio.

  2. Create configuration directory:

    mkdir -p ~/.config/lgtmcp
    
  3. Create configuration file from example:

    cp config.example.yaml ~/.config/lgtmcp/config.yaml
    
  4. Edit the configuration file with your settings:

    google:
      api_key: "your-gemini-api-key-here"
    gemini:
      model: "gemini-3.1-pro-preview"
      fallback_model: "gemini-2.5-pro" # Default; set to "none" to disable
    logging:
      level: "info"
    

The fallback_model is use when we run into quota exhaustion on the primary model. While Gemini 3.1 Pro is in preview, it has very low daily rate limits.

Claude Code configuration

  1. Set up configuration file as described above

  2. Configure LGTMCP with Claude Code:

claude mcp add lgtmcp -- lgtmcp

Usage

Basic Usage

The MCP server exposes two tools:

`review_only`

Reviews code changes and returns feedback without committing.

Parameters:

  • directory: Path to the git repository
`review_and_commit`

Reviews code changes and commits if approved. This is a separate tool so that you can set tool permissions on it differently from review.

Parameters:

  • directory: Path to the git repository
  • commit_message: Message for the commit if approved

Example Workflows

Review only (no commit):

review_only("/path/to/repo")

Review and commit if approved:

review_and_commit("/path/to/repo", "Add new feature")

What Happens

  1. Security check: Scans files for secrets using Gitleaks
  2. Diff generation: Creates diff of all staged and unstaged changes
  3. AI review: Sends diff to Gemini 3.1 Pro for analysis
    • Gemini can request file contents for context
    • Gitignored files are automatically blocked from access
  4. Decision:
    • If approved (LGTM): Returns approval message (review_only) or commits changes (review_and_commit)
    • If not approved: Returns detailed feedback

Configuration

All configuration is managed through the YAML configuration file located at:

  • $XDG_CONFIG_HOME/lgtmcp/config.yaml (if XDG_CONFIG_HOME is set)
  • ~/.config/lgtmcp/config.yaml (default)

See config.example.yaml for all available configuration options.

Logging

LGTMCP logs are written to platform-specific default locations:

  • macOS: ~/Library/Logs/lgtmcp/lgtmcp.log
  • Linux: ~/.local/share/lgtmcp/logs/lgtmcp.log (or $XDG_DATA_HOME/lgtmcp/logs/lgtmcp.log)
  • Windows: %LOCALAPPDATA%\lgtmcp\logs\lgtmcp.log

You can configure logging in your config.yaml:

logging:
  output: "directory" # Options: none, stdout, stderr, directory, mcp
  level: "info" # Options: debug, info, warn, error
  # directory: "/custom/log/path"  # Optional custom directory

To view logs on macOS:

# View the log file
tail -f ~/Library/Logs/lgtmcp/lgtmcp.log

# Or open in Console.app
open ~/Library/Logs/lgtmcp/lgtmcp.log

Development

Tools (2)

review_onlyReviews code changes and returns feedback without committing.
review_and_commitReviews code changes and commits if approved.

Environment Variables

XDG_CONFIG_HOMEBase directory for user-specific configuration files

Configuration

claude_desktop_config.json
{"mcpServers": {"lgtmcp": {"command": "lgtmcp"}}}

Try it

Review the changes in my current repository and provide feedback.
Perform a security scan and code review on the project in /path/to/repo.
Review the code in /path/to/repo and commit the changes with the message 'Refactor authentication logic' if approved.

Frequently Asked Questions

What are the key features of LGTMCP?

AI-powered code analysis using Google Gemini 3.1 Pro. Automatic commit functionality for approved code changes. Built-in secret detection using Gitleaks. Gitignore protection to prevent access to sensitive files. Review-only mode for feedback without automatic commits.

What can I use LGTMCP for?

Automating routine code reviews to catch bugs before manual human review. Scanning repositories for accidentally committed secrets or API keys. Streamlining the development workflow by auto-committing verified code improvements.

How do I install LGTMCP?

Install LGTMCP by running: git clone https://msrl.dev/lgtmcp.git && cd lgtmcp && make build

What MCP clients work with LGTMCP?

LGTMCP works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep LGTMCP docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare