Labsco
MCP SERVER

Code Summarizer

by nicobailon

Walks a codebase and summarizes each file with Gemini Flash 2.0, respecting .gitignore — available both as a CLI and as an MCP server your assistant can query.

Codebase Context Packing & Compression
Summary
Summaries cost model calls, so the retry logic matters.

Every file summarized is a Gemini call on your key, which is why the backoff and rate limiting are more than boilerplate on a large repository. Worth noting that the summaries come from Gemini regardless of which assistant is asking — this is a second model doing the reading, and your assistant gets its output.

What it is

A summarizer that reads a directory recursively and produces a short explanation of what each code file does, using Gemini Flash 2.0. It started as a command-line tool and also runs as an MCP server, so an assistant can ask for a summary rather than having code pasted into the conversation.

What you get
  • A summary per file, with the detail level and length configurable rather than fixed
  • Directory traversal that honours `.gitignore` and skips the usual noise — `node_modules`, `dist` and similar
  • Summaries written out to a text file when run from the command line
  • The same capability over MCP: file summaries, directory browsing, batch summarization of many files, and configuration changes through the interface
  • A retry mechanism with exponential backoff around the model calls, plus rate limiting
  • Authentication on the MCP endpoints via an `x-api-key` header
Requirements

A Google API key for Gemini, set as `GOOGLE_API_KEY`. Node.js 18+. Clone the repository, `npm install`, build, then start the server with `npm start -- server`. It listens on port 24312 by default and speaks SSE, so Cursor and Cline point at `http://localhost:24312/sse` with the key in an `x-api-key` header; change the port with `npm start -- config set --port`. Claude Desktop instead launches `bin/code-summarizer.js server` with `GOOGLE_API_KEY` in the env block. Package `code-summarizer` at 1.0.0.