OctoCounts MCP Server MCP Server
io.github.huanglizhuo/octocounts-mcp
Analyze public GitHub repository line counts (SLOC) and language breakdowns via MCP.
What is the OctoCounts MCP Server MCP server?
OctoCounts MCP Server provides access to GitHub source line of code (SLOC) analysis for public repositories. It downloads repo archives, runs tokei for accurate line counting, and caches results by commit—enabling AI agents to query file counts, code/comment/blank line breakdowns, and language composition without cloning.
OctoCounts gives Claude and other MCP clients the ability to analyze public GitHub repositories and retrieve detailed SLOC reports. Instead of cloning repos, it downloads archives and uses tokei to count files, lines of code, comments, and blanks per language. Results are cached by commit SHA, making repeated queries instant. Useful for code audits, repository comparisons, and understanding project scale.
How to install OctoCounts MCP Server
Copy-paste configuration for popular MCP clients.
Tools & capabilities
Tools this server exposes to the agent.
analyze_repository— Analyze a public GitHub repository and retrieve SLOC report (file count, total lines, code, comments, blanks, language breakdown)get_job_status— Check the status of an ongoing analysis jobget_report— Retrieve a cached SLOC report by report IDget_stats— Fetch aggregate statistics across analyzed repositories
Use cases
- Compare the size and language composition of multiple public GitHub repositories
- Generate SLOC reports for code audits or technical due diligence
- Track how a repository's line count and language mix change across commits or branches
- Retrieve statistics on popular or trending repositories without cloning
- Embed SLOC data in automated code review or pull request analysis workflows
OctoCounts MCP Server MCP server FAQ
It's an MCP server that gives AI agents access to GitHub SLOC (source line of code) analysis. It analyzes public repositories by downloading their archive, running tokei to count lines, and caching results by commit.
Yes. The web app and MCP server analyze public GitHub repositories at no cost. Results are cached, so repeat queries are instant.
Install via npm: `npm install octocounts-mcp`. Then configure your MCP client to run the server. See the repository for detailed setup instructions.
No GitHub token is required to analyze public repositories. The server downloads public repo archives and runs analysis without authentication.
OctoCounts uses tokei, which supports 100+ programming languages. It provides per-language breakdowns of files, code lines, comments, and blank lines.
No. OctoCounts only analyzes public GitHub repositories. It downloads the public archive tarball, not private repos.
README (reference)
Source of truth, from the repository.
OctoCounts – GitHub SLOC Counter
GitHub shows language bars. OctoCounts shows the actual line counts.
GitHub's sidebar shows language percentages, but misses actual file and line counts. OctoCounts adds this missing SLOC (Source Lines of Code) view to public repos without cloning.
Install the extension for instant stats directly on GitHub, or use the web app for public GitHub repositories. It downloads the repo archive, runs tokei, and caches the results—delivering a breakdown faster than git clone.
Use OctoCounts
| Surface | Use it for |
|---|---|
| Web app | Analyze any public GitHub repository and share a permanent report. |
| Browser extension | Show SLOC directly inside GitHub's repository sidebar in Chrome, Edge, or Firefox. |
| Public stats | See aggregate report totals, largest repos, language coverage, and source breakdown. |
| GitHub Action | Comment SLOC changes on pull requests. |
| CLI | Run npx octocounts https://github.com/owner/repo --json. |
| MCP server | Give agents and developer assistants access to SLOC reports. |
| README badges | Add a live SLOC badge that links to a permanent report page. |
| Launch kit | Copy product descriptions, launch posts, links, screenshots, and badges. |
| Research | Original research: a pilot study on how test/doc/generated file filtering affects SLOC counts. |
Preview
<p align="center"> <img src="images/preview.png" alt="OctoCounts extension preview"> </p>Why?
Sometimes you just want to know whether a repo is 2k lines, 200k lines, or a weekend-devouring monolith. GitHub already has the repo, the language stats, and the sidebar. OctoCounts fills in the missing numbers.
What it does
- Adds a browser extension card to GitHub repo pages with files, total lines, code, comments, blanks, and language count
- Provides a web app where you can paste any public GitHub repo URL
- Resolves any branch, tag, or commit SHA — pins results to an exact commit so the cache is actually meaningful
- Downloads the GitHub archive tarball instead of cloning (much faster, no git history overhead)
- Counts files, lines, code, comments, and blanks per language via tokei
- Caches reports by
owner + repo + commit + tokei version— repeat runs are instant - Queues analysis jobs so concurrent requests don't bring the server to its knees
- Exports reports as plain text, JSON, or a shareable PNG card
Stack
| Layer | Tech |
|---|---|
| Backend | Rust · Axum · Tokio · SQLx · Postgres · tokei |
| Frontend | React · TypeScript · Vite · TanStack Query |
| Infra | Cloudflare Pages (Pages Functions SSR) · GHCR image + sloc-infra dual VPS (VPS-A/VPS-B) + Cloudflare Tunnel · Postgres on VPS-B (Neon frozen snapshot as fallback) · Docker Compose (local dev only) |
Badges
Drop a live SLOC badge into any README:
<!-- Default branch — full SLOC summary -->
[](https://octocounts.com/github/:owner/:repo)
<!-- Specific branch -->
[](https://octocounts.com/github/:owner/:repo/tree/:branch)
<!-- Specific tag (immutable, cached forever) -->
[](https://octocounts.com/github/:owner/:repo/tree/:tag)
<!-- Specific commit SHA (immutable, cached forever) -->
[](https://octocounts.com/github/:owner/:repo/commit/:sha)
Add ?lang=<language> to any of the above to get a per-language badge instead:
<!-- Lines of code for a single language -->
[](https://octocounts.com/github/:owner/:repo)
[](https://octocounts.com/github/:owner/:repo/tree/:branch)
Language names are case-insensitive (rust, Rust, and RUST all work). If a language is not found in the report the badge shows —. While a fresh analysis is running the badge shows ··· — most badge CDNs will retry automatically.
| Cache behaviour | Header |
|---|---|
| Default branch / branch | s-maxage=3600, stale-while-revalidate=86400 |
| Tag / commit | max-age=31536000, immutable |
API
POST /api/analyze { "repoUrl": "...", "refName": "main" }
GET /api/jobs/:id
GET /api/reports/:id
GET /api/stats
GET /badge/:owner/:repo
GET /badge/:owner/:repo/branch/:branch
GET /badge/:owner/:repo/tag/:tag
GET /badge/:owner/:repo/commit/:sha
All badge routes accept an optional ?lang=<language> query parameter that switches the response from the full SLOC summary badge to a per-language shields.io-style badge.
Running it
See how-to-run-and-deploy.md for local development setup, host-native instructions, GitHub token configuration, and production deployment.
Growth report inventory
Popular public repositories are listed in data/popular-repos.txt. The scheduled workflow seed-popular-repos.yml refreshes that curated inventory weekly.
refresh-github-trending.yml discovers GitHub's daily Trending repositories, validates and publishes the current snapshot to /trending, and pre-generates their stable /github/:owner/:repo SLOC reports. Trending provenance stays separate from real /popular access counts; no date-stamped archive pages are generated.
License
Related MCP servers
Social video URL to direct media links & metadata (TikTok, YouTube, Instagram, X) for AI workflows.

HelioSPICE
Spacecraft ephemeris made easy — auto-managed SPICE kernels for heliophysics

XHelio-SPICE
Spacecraft ephemeris made easy — auto-managed SPICE kernels for heliophysics
Read-only IELTS and CELPIP question banks, learner practice, progress, scores, and feedback.
Run Playwright tests and surface structured results for AI agents doing test failure analysis.
Scrape Google Maps business leads (phones, websites, emails, socials) with Hubertino.
View repository →
