# Code Lens [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/j0hanz/code-lens  
**GitHub Stars:** 0  
**npm Downloads (last month):** 260  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/code-lens

## Description
Gemini-powered MCP server for code analysis.

## Tools
Capabilities this server exposes over MCP:

- **generate_diff** — Capture git diff (unstaged/staged) and cache server-side
- **analyze_pr_impact** — Assess severity, categories, breaking changes, rollback complexity
- **generate_review_summary** — PR summary, risk rating, merge recommendation
- **generate_test_plan** — Prioritized test cases and coverage guidance
- **analyze_time_space_complexity** — Big-O complexity analysis and degradation detection
- **detect_api_breaking_changes** — Detect breaking API/interface changes
- **load_file** — Cache a source file for analysis tools
- **refactor_code** — Complexity, duplication, naming, grouping suggestions
- **detect_code_smells** — Structural code smells (Fowler taxonomy)
- **generate_documentation** — JSDoc/TSDoc/docstring stubs for public exports
- **ask_about_code** — Natural-language Q&A about a cached file
- **verify_logic** — Verify algorithms via Gemini code execution sandbox
- **web_search** — Google Search with Grounding

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "code-lens": {
    "command": "npx",
    "args": ["-y","@j0hanz/code-lens-mcp@latest"],
    "env": {
      "GEMINI_API_KEY": "",
      "GOOGLE_API_KEY": ""
    }
  }
}
```

**Requires environment variables:** `GEMINI_API_KEY`, `GOOGLE_API_KEY` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## 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`:

```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.

_Full upstream README: https://allmcps.com/mcp/code-lens/readme_

