# OctoCounts MCP Server

> OctoCounts MCP Server is an open-source MCP server for developer tools. Count code, comment and blank lines in public GitHub repos and compare two repos or refs. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, Web
- **Website:** https://octocounts.com
- **Repository:** https://github.com/huanglizhuo/octocounts/tree/HEAD/mcp
- **MCP Registry name:** io.github.huanglizhuo/octocounts-mcp
- **Categories:** developer tools, analytics and data
- **Listing updated:** 2026-11-16

## About

The server calls the OctoCounts API, whose Rust backend downloads a compressed archive of a public repository rather than cloning it, skips folders such as node_modules, vendor and .git, and counts with tokei. Branches and tags are resolved to a pinned commit hash, so a count is reproducible for the same commit, engine version and counting rules, and results are cached by those same keys.

Two tools are exposed. One analyzes a repository for files, lines, code, comments, blanks and languages; the other compares two repositories or two refs of one. Both take an optional respect_gitattributes flag that excludes repository-declared generated and vendored files, and compare output states whether the two counting policies are compatible. Requests use bounded retries, long polling and a five-minute deadline, and errors keep job IDs and recovery URLs.

It runs over stdio through npx, needs no account, and is MIT licensed. The OctoCounts site also offers README badges, a CLI, a browser extension and a pull-request comment integration.

## Features

- **Repo line counts:** Reports files, code, comments and blanks per language for a public GitHub repo.
- **Repo and ref comparison:** Compares two repositories or two refs with deltas.
- **Commit-pinned results:** Resolves branches and tags to a commit so counts are reproducible.
- **Gitattributes option:** Can exclude generated and vendored files declared in the repository.
- **No cloning:** Counts from a compressed archive, skipping dependency folders.
- **Cancellable requests:** Supports cancellation and recovery of long-running analyses.

## Good for

- Gauge the real size of a dependency before adopting it
- Estimate scope for a code review or audit
- See how far a fork has diverged from upstream
- Measure growth between two releases

## Install

### Claude Code (Terminal)

```sh
claude mcp add octocounts-mcp -- npx -y octocounts-mcp
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "octocounts-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "octocounts-mcp"
      ]
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "octocounts-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "octocounts-mcp"
      ]
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "octocounts-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "octocounts-mcp"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "octocounts-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "octocounts-mcp"
      ]
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "octocounts-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "octocounts-mcp"
      ]
    }
  }
}
```

## Tools

- `analyze_repo`: Count files, lines, code, comments, blanks and languages for a public GitHub repo.
- `compare_repos`: Compare two public GitHub repos or refs.

## FAQ

### Does it clone the repository?

No, it downloads a compressed archive and skips folders like node_modules and .git.

### Does it work on private repositories?

The site describes it for public GitHub repositories.

### Is it free?

The site calls it free with no sign-up, and the server is MIT licensed.

### Why might a live count change?

A branch or tag can move to a new commit, which changes the report.

### Is OctoCounts MCP Server free?

Yes. OctoCounts MCP Server is open source, so you can use and self-host it for free.

### How do I add OctoCounts MCP Server to Claude Code?

Run this command in your terminal: claude mcp add octocounts-mcp -- npx -y octocounts-mcp

### What are the best alternatives to OctoCounts MCP Server?

The closest alternatives to OctoCounts MCP Server are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Agent-Native Analytics](https://ai-powered.com/mcp/agent-native-analytics): Agent-Native Analytics is an open-source MCP server for analytics and data.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.

---
Source: https://ai-powered.com/mcp/octocounts-mcp-server
