{
  "markdown": "<!-- mcp-name: io.github.j0hanz/code-lens -->\n\n# Code Lens MCP Server\n\n[![npm version](https://img.shields.io/npm/v/%40j0hanz%2Fcode-lens?style=flat-square&logo=npm)](https://www.npmjs.com/package/%40j0hanz%2Fcode-lens) [![License: MIT](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](#contributing-and-license)\n\n[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=code-lens&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Fcode-lens%40latest%22%5D%7D) [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=code-lens&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Fcode-lens%40latest%22%5D%7D&quality=insiders) [![Install in Visual Studio](https://img.shields.io/badge/Visual_Studio-Install_Server-C16FDE?logo=visualstudio&logoColor=white)](https://vs-open.link/mcp-install?%7B%22code-lens%22%3A%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Fcode-lens%40latest%22%5D%7D%7D)\n\n[![Add to LM Studio](https://files.lmstudio.ai/deeplink/mcp-install-light.svg)](https://lmstudio.ai/install-mcp?name=code-lens&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovY29kZS1sZW5zQGxhdGVzdCJdfQ==) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=code-lens&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovY29kZS1sZW5zQGxhdGVzdCJdfQ==) [![Install in Goose](https://block.github.io/goose/img/extension-install-dark.svg)](https://block.github.io/goose/extension?cmd=npx&arg=-y&arg=%40j0hanz%2Fcode-lens%40latest&id=%40j0hanz%2Fcode-lens&name=code-lens&description=Gemini-powered%20MCP%20server%20for%20code%20analysis.)\n\nGemini-powered MCP server for automated code review, analysis, and documentation.\n\n## Overview\n\nCode Lens is a [Model Context Protocol](https://modelcontextprotocol.io/) 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.\n\n## Key Features\n\n- **PR review pipeline** — generate diffs, assess impact, detect breaking API changes, and produce review summaries with merge recommendations\n- **File analysis** — load any source file for refactoring suggestions, code smell detection, documentation generation, and natural-language Q&A\n- **Logic verification** — verify algorithms using Gemini's code execution sandbox\n- **Structured outputs** — all tools return validated JSON via Zod v4 output schemas\n- **Web search** — Google Search with Grounding for up-to-date information retrieval\n- **Task lifecycle support** — every tool except `load_file` can run via MCP tasks with polling, cancellation, and progress updates\n\n## Requirements\n\n- Node.js >= 24\n- A [Gemini API key](https://aistudio.google.com/apikey) (`GEMINI_API_KEY` or `GOOGLE_API_KEY`)\n\n## Quick Start\n\n```json\n{\n  \"mcpServers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\n### Docker\n\n```bash\ndocker run -i --rm -e GEMINI_API_KEY=\"your-api-key\" ghcr.io/j0hanz/code-lens\n```\n\nOr with Docker Compose:\n\n```bash\nGEMINI_API_KEY=your-api-key docker compose up\n```\n\n## Client Configuration\n\n<details>\n<summary><b>Install in VS Code</b></summary>\n\n[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=code-lens&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Fcode-lens%40latest%22%5D%7D)\n\nAdd to `.vscode/mcp.json`:\n\n```json\n{\n  \"servers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nOr install via CLI:\n\n```sh\ncode --add-mcp '{\"name\":\"code-lens\",\"command\":\"npx\",\"args\":[\"-y\",\"@j0hanz/code-lens-mcp@latest\"]}'\n```\n\nFor more info, see [VS Code MCP docs](https://code.visualstudio.com/docs/copilot/chat/mcp-servers).\n\n</details>\n\n<details>\n<summary><b>Install in VS Code Insiders</b></summary>\n\n[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=code-lens&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Fcode-lens%40latest%22%5D%7D&quality=insiders)\n\nAdd to `.vscode/mcp.json`:\n\n```json\n{\n  \"servers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nOr install via CLI:\n\n```sh\ncode-insiders --add-mcp '{\"name\":\"code-lens\",\"command\":\"npx\",\"args\":[\"-y\",\"@j0hanz/code-lens-mcp@latest\"]}'\n```\n\nFor more info, see [VS Code Insiders MCP docs](https://code.visualstudio.com/docs/copilot/chat/mcp-servers).\n\n</details>\n\n<details>\n<summary><b>Install in Cursor</b></summary>\n\n[![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=code-lens&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovY29kZS1sZW5zQGxhdGVzdCJdfQ==)\n\nAdd to `~/.cursor/mcp.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nFor more info, see [Cursor MCP docs](https://docs.cursor.com/context/model-context-protocol).\n\n</details>\n\n<details>\n<summary><b>Install in Visual Studio</b></summary>\n\n[![Install in Visual Studio](https://img.shields.io/badge/Visual_Studio-Install_Server-C16FDE?logo=visualstudio&logoColor=white)](https://vs-open.link/mcp-install?%7B%22code-lens%22%3A%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Fcode-lens%40latest%22%5D%7D%7D)\n\nAdd to `mcp.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nFor more info, see [Visual Studio MCP docs](https://learn.microsoft.com/en-us/visualstudio/ide/mcp-servers).\n\n</details>\n\n<details>\n<summary><b>Install in Goose</b></summary>\n\n[![Install in Goose](https://block.github.io/goose/img/extension-install-dark.svg)](https://block.github.io/goose/extension?cmd=npx&arg=-y&arg=%40j0hanz%2Fcode-lens%40latest&id=%40j0hanz%2Fcode-lens&name=code-lens&description=Gemini-powered%20MCP%20server%20for%20code%20analysis.)\n\n```json\n{\n  \"mcpServers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nFor more info, see [Goose MCP docs](https://block.github.io/goose/docs/getting-started/using-extensions).\n\n</details>\n\n<details>\n<summary><b>Install in LM Studio</b></summary>\n\n[![Add to LM Studio](https://files.lmstudio.ai/deeplink/mcp-install-light.svg)](https://lmstudio.ai/install-mcp?name=code-lens&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovY29kZS1sZW5zQGxhdGVzdCJdfQ==)\n\n```json\n{\n  \"mcpServers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nFor more info, see [LM Studio MCP docs](https://lmstudio.ai/docs/basics/mcp).\n\n</details>\n\n<details>\n<summary><b>Install in Claude Desktop</b></summary>\n\nAdd to `claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nFor more info, see [Claude Desktop MCP docs](https://modelcontextprotocol.io/quickstart/user).\n\n</details>\n\n<details>\n<summary><b>Install in Claude Code</b></summary>\n\n```sh\nclaude mcp add code-lens -- npx -y @j0hanz/code-lens-mcp@latest\n```\n\nOr add to config:\n\n```json\n{\n  \"mcpServers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nFor more info, see [Claude Code MCP docs](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp).\n\n</details>\n\n<details>\n<summary><b>Install in Windsurf</b></summary>\n\nAdd to `~/.codeium/windsurf/mcp_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nFor more info, see [Windsurf MCP docs](https://docs.windsurf.com/windsurf/mcp).\n\n</details>\n\n<details>\n<summary><b>Install in Amp</b></summary>\n\n```sh\namp mcp add code-lens -- npx -y @j0hanz/code-lens-mcp@latest\n```\n\nOr add to config:\n\n```json\n{\n  \"mcpServers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nFor more info, see [Amp MCP docs](https://docs.amp.dev).\n\n</details>\n\n<details>\n<summary><b>Install in Cline</b></summary>\n\nAdd to `cline_mcp_settings.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nFor more info, see [Cline MCP docs](https://docs.cline.bot/mcp-servers/configuring-mcp-servers).\n\n</details>\n\n<details>\n<summary><b>Install in Codex CLI</b></summary>\n\nAdd to `~/.codex/config.yaml`:\n\n```json\n{\n  \"mcpServers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nFor more info, see [Codex CLI MCP docs](https://github.com/openai/codex).\n\n</details>\n\n<details>\n<summary><b>Install in GitHub Copilot</b></summary>\n\nAdd to `.vscode/mcp.json`:\n\n```json\n{\n  \"servers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nFor more info, see [GitHub Copilot MCP docs](https://code.visualstudio.com/docs/copilot/chat/mcp-servers).\n\n</details>\n\n<details>\n<summary><b>Install in Warp</b></summary>\n\n```json\n{\n  \"mcpServers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nFor more info, see [Warp MCP docs](https://docs.warp.dev/features/mcp-model-context-protocol).\n\n</details>\n\n<details>\n<summary><b>Install in Kiro</b></summary>\n\nAdd to `.kiro/settings/mcp.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nFor more info, see [Kiro MCP docs](https://kiro.dev/docs/mcp/overview/).\n\n</details>\n\n<details>\n<summary><b>Install in Gemini CLI</b></summary>\n\nAdd to `~/.gemini/settings.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nFor more info, see [Gemini CLI MCP docs](https://github.com/google-gemini/gemini-cli).\n\n</details>\n\n<details>\n<summary><b>Install in Zed</b></summary>\n\nAdd to `~/.config/zed/settings.json`:\n\n```json\n{\n  \"context_servers\": {\n    \"code-lens\": {\n      \"settings\": {\n        \"command\": \"npx\",\n        \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"]\n      }\n    }\n  }\n}\n```\n\nFor more info, see [Zed MCP docs](https://zed.dev/docs/assistant/model-context-protocol).\n\n</details>\n\n<details>\n<summary><b>Install in Augment</b></summary>\n\nAdd to your VS Code `settings.json` under `augment.advanced`:\n\n```json\n{\n  \"augment.advanced\": {\n    \"mcpServers\": [\n      {\n        \"id\": \"code-lens\",\n        \"command\": \"npx\",\n        \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n        \"env\": {\n          \"GEMINI_API_KEY\": \"your-api-key\"\n        }\n      }\n    ]\n  }\n}\n```\n\nFor more info, see [Augment MCP docs](https://docs.augmentcode.com/setup-mcp-servers).\n\n</details>\n\n<details>\n<summary><b>Install in Roo Code</b></summary>\n\n```json\n{\n  \"mcpServers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nFor more info, see [Roo Code MCP docs](https://docs.roocode.com/features/mcp/using-mcp-in-roo).\n\n</details>\n\n<details>\n<summary><b>Install in Kilo Code</b></summary>\n\n```json\n{\n  \"mcpServers\": {\n    \"code-lens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@j0hanz/code-lens-mcp@latest\"],\n      \"env\": {\n        \"GEMINI_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nFor more info, see [Kilo Code MCP docs](https://kilocode.ai/docs/features/mcp/using-mcp-servers).\n\n</details>\n\n## Use Cases\n\n### PR Review Pipeline\n\n1. Call `generate_diff` to capture unstaged or staged changes\n2. Run `analyze_pr_impact` to assess severity and breaking changes\n3. Run `generate_review_summary` for a risk rating and merge recommendation\n4. Run `detect_api_breaking_changes` to check for public API breakage\n5. Run `generate_test_plan` to produce prioritized test cases\n\n### Single-File Analysis\n\n1. Call `load_file` to cache a source file\n2. Run `refactor_code` for structural improvement suggestions\n3. Run `detect_code_smells` for Fowler-taxonomy anti-patterns\n4. Run `generate_documentation` to generate JSDoc/TSDoc stubs\n5. Use `ask_about_code` for natural-language Q&A about the file\n6. Use `verify_logic` to verify algorithms with code execution\n\n### Performance Audit\n\n1. Call `generate_diff` on a performance-sensitive change\n2. Run `analyze_time_space_complexity` to detect Big-O degradation\n\n### Research\n\n- Use `web_search` for up-to-date documentation or API references via Google Search with Grounding\n\n## Architecture\n\n```text\n[MCP Client]\n    │\n    │ Transport: stdio\n    ▼\n[MCP Server: code-lens]\n    │ Entry: src/index.ts → src/server.ts\n    │\n    ├── initialize / initialized (lifecycle handshake)\n    │\n    ├── tools/call ──────────────────────────────────────────────\n    │   │\n    │   │ Diff-based tools (require generate_diff first):\n    │   ├── [generate_diff]              Sync — capture git diff\n    │   ├── [analyze_pr_impact]          Flash — severity & impact\n    │   ├── [generate_review_summary]    Flash — risk & merge rec\n    │   ├── [generate_test_plan]         Flash — test cases\n    │   ├── [analyze_time_space_complexity] Flash — Big-O analysis\n    │   ├── [detect_api_breaking_changes]  Flash — API breakage\n    │   │\n    │   │ File-based tools (require load_file first):\n    │   ├── [load_file]                  Sync — cache source file\n    │   ├── [refactor_code]              Flash — refactoring\n    │   ├── [detect_code_smells]         Flash — smell detection\n    │   ├── [generate_documentation]     Flash — doc stubs\n    │   ├── [ask_about_code]             Flash — Q&A\n    │   ├── [verify_logic]               Flash — code execution\n    │   │\n    │   │ Standalone:\n    │   └── [web_search]                 Flash — Google Search\n    │\n    ├── resources/read ──────────────────────────────────────────\n    │   ├── [internal://instructions]        Server usage guide\n    │   ├── [internal://tool-catalog]        Tool reference\n    │   ├── [internal://workflows]           Workflow sequences\n    │   ├── [internal://server-config]       Runtime config\n    │   ├── [internal://tool-info/{name}]    Per-tool details\n    │   ├── [internal://diff/current]        Cached diff (text/x-patch)\n    │   └── [internal://file/current]        Cached source file\n    │\n    ├── prompts/get ─────────────────────────────────────────────\n    │   ├── [get-help]           Full server instructions\n    │   ├── [review-guide]       Tool + focus area workflow\n    │   ├── [select-workflow]    Pipeline by change type\n    │   ├── [analyze-file]       File analysis pipeline\n    │   └── [tool-chain]         Tool prerequisite chain\n    │\n    └── Capabilities: structured output, tool annotations, notifications\n```\n\n### Request Lifecycle\n\n```text\n[Client] -- initialize {protocolVersion, capabilities} --> [Server]\n[Server] -- {protocolVersion, capabilities, serverInfo} --> [Client]\n[Client] -- notifications/initialized --> [Server]\n[Client] -- tools/call {name, arguments} --> [Server]\n[Server] -- notifications/progress {token, progress, total} --> [Client]\n[Server] -- {content, structuredContent, isError?} --> [Client]\n```\n\n### Task Lifecycle\n\n- `generate_diff` and `load_file` are sync-only. All other tools advertise `taskSupport: optional`.\n- Requestors may supply a task TTL. The server uses that value up to `MAX_TASK_TTL_MS`, or falls back to `TASK_TTL_MS` when omitted.\n- Cancelled tasks remain terminal as `cancelled`, and `tasks/result` returns a cancellation-shaped tool result.\n\n## MCP Surface\n\n### Tools\n\n| Tool                            | Description                                                        | Prerequisite    | Model |\n| ------------------------------- | ------------------------------------------------------------------ | --------------- | ----- |\n| `generate_diff`                 | Capture git diff (unstaged/staged) and cache server-side           | —               | Sync  |\n| `analyze_pr_impact`             | Assess severity, categories, breaking changes, rollback complexity | `generate_diff` | Flash |\n| `generate_review_summary`       | PR summary, risk rating, merge recommendation                      | `generate_diff` | Flash |\n| `generate_test_plan`            | Prioritized test cases and coverage guidance                       | `generate_diff` | Flash |\n| `analyze_time_space_complexity` | Big-O complexity analysis and degradation detection                | `generate_diff` | Flash |\n| `detect_api_breaking_changes`   | Detect breaking API/interface changes                              | `generate_diff` | Flash |\n| `load_file`                     | Cache a source file for analysis tools                             | —               | Sync  |\n| `refactor_code`                 | Complexity, duplication, naming, grouping suggestions              | `load_file`     | Flash |\n| `detect_code_smells`            | Structural code smells (Fowler taxonomy)                           | `load_file`     | Flash |\n| `generate_documentation`        | JSDoc/TSDoc/docstring stubs for public exports                     | `load_file`     | Flash |\n| `ask_about_code`                | Natural-language Q&A about a cached file                           | `load_file`     | Flash |\n| `verify_logic`                  | Verify algorithms via Gemini code execution sandbox                | `load_file`     | Flash |\n| `web_search`                    | Google Search with Grounding                                       | —               | Flash |\n\n### Resources\n\n| URI                               | Description                                        | MIME            |\n| --------------------------------- | -------------------------------------------------- | --------------- |\n| `internal://instructions`         | Complete server usage instructions                 | `text/markdown` |\n| `internal://tool-catalog`         | Tool reference: models, params, outputs, data flow | `text/markdown` |\n| `internal://workflows`            | Recommended workflows and tool sequences           | `text/markdown` |\n| `internal://server-config`        | Runtime configuration and limits                   | `text/markdown` |\n| `internal://tool-info/{toolName}` | Per-tool details (parameterized)                   | `text/markdown` |\n| `internal://diff/current`         | Most recently generated diff                       | `text/x-patch`  |\n| `internal://file/current`         | Most recently loaded source file                   | `text/plain`    |\n\n### Prompts\n\n| Prompt            | Description                                                           |\n| ----------------- | --------------------------------------------------------------------- |\n| `get-help`        | Full server instructions: capabilities, tools, resources, constraints |\n| `review-guide`    | Workflow guide for a specific tool and focus area                     |\n| `select-workflow` | Recommended tool pipeline based on change type                        |\n| `analyze-file`    | Goal-based tool pipeline for single-file analysis                     |\n| `tool-chain`      | Full prerequisite chain for a given tool                              |\n\n## MCP Capabilities\n\n### Tool Annotations\n\nAll tools expose MCP tool annotations:\n\n| Annotation        | Used |\n| ----------------- | ---- |\n| `readOnlyHint`    | Yes  |\n| `destructiveHint` | Yes  |\n| `idempotentHint`  | Yes  |\n| `openWorldHint`   | Yes  |\n\n### Structured Output\n\nAll Gemini-powered tools return validated `structuredContent` alongside text `content`, using Zod v4 output schemas.\n\n## Configuration\n\n| Variable                       | Default                  | Description                                                                                                 |\n| ------------------------------ | ------------------------ | ----------------------------------------------------------------------------------------------------------- |\n| `GEMINI_API_KEY`               | —                        | **Required.** Gemini API key. Falls back to `GOOGLE_API_KEY`.                                               |\n| `GEMINI_MODEL`                 | `gemini-3-flash-preview` | Override the default Gemini model for all tools.                                                            |\n| `MAX_DIFF_CHARS`               | `120000`                 | Maximum diff size in characters.                                                                            |\n| `MAX_CONCURRENT_CALLS`         | `10`                     | Maximum concurrent Gemini API calls.                                                                        |\n| `MAX_CONCURRENT_BATCH_CALLS`   | `2`                      | Maximum concurrent batch Gemini calls.                                                                      |\n| `MAX_CONCURRENT_CALLS_WAIT_MS` | `2000`                   | Wait timeout for concurrency semaphore.                                                                     |\n| `TASK_TTL_MS`                  | `300000`                 | Default task result retention in milliseconds when the request does not specify `task.ttl`.                 |\n| `MAX_TASK_TTL_MS`              | `3600000`                | Upper bound for request-provided task TTL. Set to `0` to remove the cap.                                    |\n| `GEMINI_BATCH_MODE`            | `off`                    | Enable Gemini batch mode.                                                                                   |\n| `GEMINI_HARM_BLOCK_THRESHOLD`  | `BLOCK_NONE`             | Safety filter threshold (`BLOCK_NONE`, `BLOCK_ONLY_HIGH`, `BLOCK_MEDIUM_AND_ABOVE`, `BLOCK_LOW_AND_ABOVE`). |\n| `GEMINI_DIFF_CACHE_ENABLED`    | `false`                  | Enable Gemini context caching for large diffs.                                                              |\n| `GEMINI_DIFF_CACHE_TTL_S`      | `3600`                   | Cache TTL in seconds (when caching is enabled).                                                             |\n\n### CLI Flags\n\n```bash\nnpx @j0hanz/code-lens-mcp@latest --model gemini-2.5-flash --max-diff-chars 200000\n```\n\n| Flag               | Env Equivalent   |\n| ------------------ | ---------------- |\n| `--model`, `-m`    | `GEMINI_MODEL`   |\n| `--max-diff-chars` | `MAX_DIFF_CHARS` |\n\n## Security\n\n| Control            | Status                                           |\n| ------------------ | ------------------------------------------------ |\n| Input validation   | Zod v4 schema validation on all tool inputs      |\n| Path safety        | `load_file` restricts paths to workspace root    |\n| Stdout safety      | Logs to stderr; stdout reserved for MCP protocol |\n| Non-root container | Docker runs as dedicated `mcp` user              |\n\n## Development\n\n```bash\nnpm install          # Install dependencies\nnpm run build        # Compile TypeScript\nnpm run dev          # Watch mode\nnpm run dev:run      # Run with --watch and .env\nnpm run start        # Run compiled server\nnpm run type-check   # Type-check src + tests\nnpm run lint         # ESLint\nnpm run test         # Run test suite\nnpm run format       # Prettier\nnpm run inspector    # MCP Inspector\nnpm run knip         # Dead code detection\n```\n\n## Build and Release\n\n- CI: `.github/workflows/release.yml`\n- Docker: Multi-stage build (`Dockerfile`) with `node:24-alpine`\n- Docker Compose: `docker-compose.yml`\n- npm: Published as [`@j0hanz/code-lens-mcp`](https://www.npmjs.com/package/@j0hanz/code-lens-mcp)\n\n## Troubleshooting\n\n- **Missing API key**: Set `GEMINI_API_KEY` or `GOOGLE_API_KEY` in your environment or client config `env` block.\n- **\"E_NO_DIFF\" errors**: Call `generate_diff` before running any diff-based review tool.\n- **\"E_NO_FILE\" errors**: Call `load_file` before running any file analysis tool.\n- **Large diffs truncated**: Increase `MAX_DIFF_CHARS` (default: 120,000 characters).\n- **Stdout noise**: Ensure no other processes write to stdout; the server uses stdio transport.\n\n## Credits\n\n- [Google Gemini](https://ai.google.dev/) — LLM backend (`@google/genai`)\n- [Model Context Protocol SDK](https://github.com/modelcontextprotocol/typescript-sdk) — MCP framework (`@modelcontextprotocol/sdk`)\n- [Zod](https://zod.dev/) — Schema validation (`zod` v4)\n- [parse-diff](https://www.npmjs.com/package/parse-diff) — Diff parsing\n\n## Contributing and License\n\nMIT License. See [LICENSE](LICENSE) for details.\n\nContributions welcome via [pull requests](https://github.com/j0hanz/code-lens/pulls).\n",
  "bytes": 26611,
  "sha": "4cd57a9e8cf04054061fefeeb53d60a0faf8e6d1f511aea354a1f664dede333a",
  "repo_slug": "j0hanz/code-lens",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_j0hanz_code_lens_16944c08/readme"
}