github-repo-summarizer

github-repo-summarizer

An MCP server that turns any public GitHub repository into a PDF report containing a codebase summary, the most recent commits, and suggested improvements — generated locally by an Ollama model.

Category
访问服务器

README

github-repo-summarizer

An MCP server that turns any public GitHub repository into a PDF report containing a codebase summary, the most recent commits, and suggested improvements — generated locally by an Ollama model.

What it does

The server exposes a single MCP tool:

summarize_github_repo(repo_url: str, output_dir: str = ".") -> str

Given a GitHub URL (e.g. https://github.com/owner/repo, owner/repo shorthand, or a git@github.com:owner/repo.git SSH URL), it:

  1. Fetches repository metadata, the latest 25 commits, and the recursive file tree from the public GitHub API.
  2. Picks a representative set of source files (up to 25 files, each ≤ 40 KB, total ≤ 400 KB), prioritising entry points and manifests (README, pyproject.toml, package.json, Dockerfile, etc.) and skipping noise (node_modules, dist, lockfiles, snapshot folders).
  3. Sends that corpus to a local Ollama model in two passes — one for the codebase summary, one for improvement suggestions.
  4. Renders a PDF (via ReportLab) and returns the absolute path.

The PDF contains

Section What's in it
Title block Repo full name, generation timestamp (UTC), link to the repo
Metadata table Description, primary language, default branch, stars, forks, open issues, license, created/last-pushed dates
Codebase Summary 250–400 word LLM-written prose summary of architecture, modules, tech stack
Recent Commits Table of the latest 25 commits (SHA, author, date, message)
Suggested Improvements Numbered list of 5–10 actionable items grounded in the actual code

Requirements

  • Python ≥ 3.11
  • uv for dependency management
  • Ollama running locally with at least one model pulled
  • An MCP-aware client (e.g. Claude Desktop)

Installation

# 1. Clone or copy this folder
cd github-repo-summarizer

# 2. Install dependencies into a project-local .venv
uv sync

# 3. Configure environment
cp .env.example .env
# then edit .env to taste (see "Configuration" below)

# 4. Pull at least one Ollama model
ollama pull llama3.2          # small, fast
# or
ollama pull qwen2.5-coder:7b  # better for code analysis, ~4.7 GB

Make sure the Ollama server is running:

ollama serve          # in a terminal
# or just launch the Ollama.app — it starts the server automatically

Configuration

All settings come from environment variables, which can live in a .env file next to main.py (loaded automatically at startup).

Variable Default Purpose
OLLAMA_MODEL llama3.2 Tag of the Ollama model to use. Must be pulled.
OLLAMA_HOST http://localhost:11434 Ollama HTTP endpoint.
OLLAMA_NUM_CTX 16384 Context window in tokens. Bump for larger repos; lower if memory-constrained.

Example .env:

OLLAMA_MODEL=qwen2.5-coder:7b
OLLAMA_HOST=http://localhost:11434
OLLAMA_NUM_CTX=32768

Choosing a model

Local LLMs vary widely in code-comprehension quality. Suggestions:

  • llama3.2 — 3 B parameters, fast, decent general summaries.
  • llama3.1:8b — bigger, better narrative quality.
  • qwen2.5-coder:7b — recommended for code-heavy repos; trained for code.
  • codellama:13b — older but solid for code review-style output.

Make sure the model's native context window is ≥ OLLAMA_NUM_CTX; otherwise the corpus will be silently truncated.

Using it with Claude Desktop

Add the server to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) — adjust the absolute paths to wherever you cloned the project:

{
  "mcpServers": {
    "github-repo-summarizer": {
      "command": "/absolute/path/to/uv",
      "args": [
        "run",
        "--directory",
        "/absolute/path/to/github-repo-summarizer",
        "--frozen",
        "--with",
        "mcp[cli]",
        "mcp",
        "run",
        "/absolute/path/to/github-repo-summarizer/main.py"
      ]
    }
  }
}

Notes:

  • Use the absolute path to uv (which uv). Claude Desktop is a GUI app and doesn't inherit your shell's PATH.
  • --directory must point at the project directory, not the script itself. uv chdirs into it.
  • Fully quit Claude Desktop (⌘Q on macOS) and reopen it after editing config. Just closing the window won't reload MCP servers.

Once connected, ask Claude to use it:

Use github-repo-summarizer to summarize https://github.com/anthropics/anthropic-sdk-python and save the PDF to my Desktop.

Claude will call summarize_github_repo(repo_url=..., output_dir=...) and return the path to the generated PDF.

Using it from any other MCP client

The server speaks MCP over stdio. Any client that can launch a subprocess and exchange JSON-RPC over stdin/stdout will work. The launch command is:

uv run --directory /path/to/github-repo-summarizer --frozen \
       --with mcp[cli] mcp run /path/to/github-repo-summarizer/main.py

For quick local testing:

uv run python main.py

…and pipe an MCP initialize request to stdin to confirm it responds.

Output

PDFs are written to <output_dir>/<owner>-<repo>-summary.pdf. output_dir defaults to the current working directory of the server process (which, when launched by Claude Desktop, may not be where you expect — pass an explicit path when invoking the tool).

Limitations

  • Public repos only. Private repos would need authenticated GitHub access; this server doesn't ship that.
  • File budget. The server reads up to 25 files (≤ 40 KB each, ≤ 400 KB total). Very large monorepos will be sampled, not exhaustively analysed.
  • LLM quality is bounded by the model. A 3 B parameter model will produce shallower summaries than an 8 B+ model. Pick accordingly.
  • No streaming. PDFs are produced after both LLM calls complete; expect tens of seconds to a couple of minutes per repo, dominated by the model's generation speed.
  • PDF only. No HTML/Markdown output mode (yet).

Troubleshooting

Server shows "failed" in Claude Desktop developer settings. Check ~/Library/Logs/Claude/mcp-server-github-repo-summarizer.log for the real error. The two most common causes:

  • --directory value missing or pointing at a file → uv exits with Not a directory. Fix the path in claude_desktop_config.json.
  • uv not found → use the absolute path to uv in command.

Could not connect to Ollama at http://localhost:11434. Run ollama serve (or open Ollama.app).

Ollama model 'X' is not pulled. Run ollama pull X.

Truncated or empty summary. The corpus exceeded the model's context window. Lower OLLAMA_NUM_CTX only hurts; instead, switch to a model with a larger native context, or shrink MAX_TOTAL_BYTES in main.py.

Project layout

github-repo-summarizer/
├── main.py            # MCP server + GitHub/Ollama/PDF logic
├── pyproject.toml     # Project metadata and dependencies
├── .env               # Local config (gitignored)
├── .env.example       # Template
└── README.md

License

Not specified. Add one before redistributing.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选