Code Lens logo

Code Lens

Gemini-backed MCP tools for reviewing diffs, analyzing source files, checking complexity, and generating code documentation.

Install Code Lens

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "code-lens": {
      "command": "npx",
      "args": [
        "-y",
        "@j0hanz/code-lens-mcp@latest"
      ],
      "env": {
        "GEMINI_API_KEY": "YOUR_VALUE_HERE",
        "GOOGLE_API_KEY": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

Install not yet sandbox-tested— we haven't run this command through our automated sandbox yet. Not a red flag; we're working through the catalog.

Overview

Code Lens MCP server connects MCP clients to Google Gemini for code review, source analysis, documentation generation, and logic verification. It captures diffs or caches source files, then exposes focused tools for impact assessment, refactoring advice, code-smell detection, API compatibility checks, and test planning. The server runs over stdio and returns validated JSON; reach for it when an agent needs structured review or analysis of local code.

Use cases

  • Review a staged or unstaged Git diff
  • Assess pull-request risk and breaking changes
  • Generate prioritized test cases
  • Inspect cached files for code smells and refactoring opportunities
  • Verify algorithm logic with code execution

Key features

  • Gemini-backed code review and analysis
  • Git diff capture with server-side caching
  • Pull-request impact and API compatibility checks
  • Complexity, code-smell, and refactoring analysis
  • Documentation stub and test-plan generation
  • Google Search with Grounding

Tools13

What Code Lens lets your agent do. Expand a tool for its parameters.

Self-reported~205 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 1d ago

Recent health check succeeded.

7/7 checks healthy over the last 42d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 15d ago via OSV.dev · @j0hanz/code-lens-mcp@latest (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

npm downloads260Package downloads in the last 30 days.
Last commit7mo agoMost recent push to the default branch.
Tools exposed13Callable tools this server registers over MCP.

How Code Lens works

What Code Lens MCP server does

Code Lens MCP server adds Gemini-backed code analysis tools to an MCP client. It can inspect a staged or unstaged Git diff, evaluate the likely impact of a pull request, identify potentially breaking API changes, and produce a review summary with risk and merge guidance. It also accepts individual source files for more focused analysis.

File-oriented capabilities include refactoring suggestions, Fowler-style structural code-smell detection, documentation stub generation for public exports, and natural-language questions about a cached file. The server can also examine algorithmic time and space complexity, flag likely degradation, and use Gemini’s code execution sandbox to verify logic. A web-search tool uses Google Search with Grounding for current information retrieval.

How it works

The server communicates with MCP clients through stdio. generate_diff captures the current staged or unstaged Git changes and keeps the result in server-side cache. load_file similarly caches a source file so later analysis tools can work against it. This cache-based flow supports separate review and file-analysis steps rather than requiring the complete input on every request.

The analysis is performed with Google Gemini. Tool results use validated JSON output schemas, which makes the responses suitable for agents or other software that needs structured fields. Except for load_file, tools can use MCP task behavior with polling, cancellation, and progress updates.

Setup and configuration

The documented runtime requirement is Node.js 24 or newer. Authentication requires a Gemini API key supplied through either GEMINI_API_KEY or GOOGLE_API_KEY. A typical stdio configuration runs the npm package with npx:

config.json
{
  "mcpServers": {
    "code-lens": {
      "command": "npx",
      "args": ["-y", "@j0hanz/code-lens-mcp@latest"],
      "env": {
        "GEMINI_API_KEY": "your-api-key"
      }
    }
  }
}

The project also documents a Docker image, ghcr.io/j0hanz/code-lens, which accepts the API key through the container environment. Configuration examples are provided for Claude Desktop, Claude Code, Cursor, VS Code, VS Code Insiders, Visual Studio, Goose, LM Studio, and Windsurf.

Tools and capabilities

The Code Lens MCP server exposes tools for:

  • Capturing staged or unstaged diffs and assessing pull-request impact.
  • Producing review summaries, risk ratings, merge recommendations, and prioritized test plans.
  • Detecting breaking API or interface changes.
  • Loading files for questions, refactoring advice, code-smell analysis, and documentation stubs.
  • Reviewing Big-O time and space complexity and possible performance degradation.
  • Verifying algorithm logic through Gemini’s code execution sandbox.
  • Searching the web through Google Search with Grounding.

Limitations and notes

The server depends on Google Gemini, so a supported API key is required. Analysis tools that operate on cached files require those files to be loaded first, while diff-oriented workflows depend on the Git changes captured by generate_diff. The documentation specifies stdio transport; it does not describe a remote HTTP deployment mode. Generated reviews, tests, documentation, and refactoring suggestions should therefore be treated as analysis output for developer evaluation rather than automatic changes.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Code Lens

Code Lens is an MCP server that connects MCP clients to Google Gemini for code analysis. Its main tools capture Git diffs, review pull-request impact, inspect cached source files, detect code smells and breaking APIs, analyze complexity, generate documentation and test plans, answer code questions, verify logic, and perform grounded web searches.

Install it by configuring your MCP client to run `npx -y @j0hanz/code-lens-mcp@latest` over stdio. Set `GEMINI_API_KEY` or `GOOGLE_API_KEY` in the server environment, and use Node.js 24 or newer. Docker is also supported through the published `ghcr.io/j0hanz/code-lens` image.

Code Lens requires a Google Gemini API key. Provide it in the `GEMINI_API_KEY` or `GOOGLE_API_KEY` environment variable before starting the server.

Yes, Code Lens works with Cursor through a standard stdio MCP configuration. Add the server command and npm package to Cursor’s `~/.cursor/mcp.json`, then provide `GEMINI_API_KEY` or `GOOGLE_API_KEY`.

Yes, Code Lens can analyze a local source file after it is provided to the `load_file` tool. The cached file can then be used for refactoring suggestions, code-smell detection, documentation generation, natural-language questions, and related analysis.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewCode Lens AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/code-lens?style=directory)](https://allmcps.com/mcp/code-lens)
HTML Embed
<a href="https://allmcps.com/mcp/code-lens"><img src="https://allmcps.com/api/badge/code-lens?style=directory" alt="Code Lens on AllMCPs" /></a>