Code Lens MCP Server

Gemini-powered MCP server for code analysis.

Local serverstdio

What is the Code Lens MCP server?

If you already use Code Lens, the code lens mcp server is the piece that lets your assistant work with it directly. Gemini-powered MCP server for code analysis.

What the server does

Gemini-powered MCP server for automated code review, analysis, and documentation.

Code Lens is a Model Context Protocol server that uses Google Gemini to analyze diffs, review pull requests, detect code smells, generate documentation, and verify logic. It exposes 13 tools, 7 resources, and 5 prompts over stdio transport.

  • PR review pipeline — — generate diffs, assess impact, detect breaking API changes, and produce review summaries with merge recommendations
  • File analysis — — load any source file for refactoring suggestions, code smell detection, documentation generation, and natural-language Q&A
  • Logic verification — — verify algorithms using Gemini's code execution sandbox
  • Structured outputs — — all tools return validated JSON via Zod v4 output schemas
  • Web search — — Google Search with Grounding for up-to-date information retrieval
  • Task lifecycle support — — every tool except load_file can run via MCP tasks with polling, cancellation, and progress updates

Available tools

The toolset is worth reading before you wire it up, because it tells you what the integration is really for:

  • 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

Credentials and setup notes

Configuration is passed through the environment: GEMINI_API_KEY, GOOGLE_API_KEY. Treat anything key-shaped as a real credential — scope it to the minimum the server needs, and rotate it if it ever lands in a shared config.

Installation

Installation goes through your MCP client rather than a global install: point it at @j0hanz/code-lens-mcp on npm and it is fetched when the client starts. The copy-paste blocks for Claude Desktop, Claude Code and Cursor are further down this page.

Where it fits

Among the developer tooling options, the useful question is rarely "what can it do" but "what does it cost you to run" — permissions, credentials, and how much of your context its toolset consumes. Code Lens's toolset — generate_diff, analyze_pr_impact, generate_review_summary and 11 more — is a fair guide to whether it matches your workflow. It is maintained by j0hanz; worth a glance at recent repository activity before you build anything load-bearing on it.

SyncDev reviews every entry in this directory against the project's own documentation before publishing, and revisits them as servers change.

Worth knowing first

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • With 14 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch Code Lens.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

Available tools

ToolWhat it does
generate_diffCapture git diff (unstaged/staged) and cache server-side
analyze_pr_impactAssess severity, categories, breaking changes, rollback complexity
generate_review_summaryPR summary, risk rating, merge recommendation
generate_test_planPrioritized test cases and coverage guidance
analyze_time_space_complexityBig-O complexity analysis and degradation detection
detect_api_breaking_changesDetect breaking API/interface changes
load_fileCache a source file for analysis tools
refactor_codeComplexity, duplication, naming, grouping suggestions
detect_code_smellsStructural code smells (Fowler taxonomy)
generate_documentationJSDoc/TSDoc/docstring stubs for public exports
ask_about_codeNatural-language Q&A about a cached file
verify_logicVerify algorithms via Gemini code execution sandbox
web_searchGoogle Search with Grounding
ResearchThe Research tool exposed by this server.

How to install the Code Lens MCP server

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

Configuration as documented by the project. Restart the client after saving.

Configuration

VariableDescriptionRequired
GEMINI_API_KEYCredential the server authenticates with.Yes
GOOGLE_API_KEYCredential the server authenticates with.Yes

Example prompts to try

  • Use Code Lens to generate diff.
  • Use Code Lens to analyze pr impact.
  • Use Code Lens to generate review summary.

Frequently asked questions

It connects Code Lens to MCP-compatible AI assistants such as Claude and Cursor, exposing 14 tools (generate_diff, analyze_pr_impact, generate_review_summary, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Code Lens directly.