Pecorino MCP Server

Pecorino MCP Server

pecorino•bypecorino-mcp

An MCP server that lets AI assistants inspect codebases, compute design and complexity metrics, analyze Git history, and detect risk hotspots.

License: GNU Affero General Public License v3 (AGPL-3.0)•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Exposes MCP tools for browsing codebase structure, searching code with multiple modes, updating indexes, and setting the workspace root.
  • •Provides Git history analytics including commits, LOC growth, author contributions, activity patterns, and churn-based hotspot detection.
  • •Computes object-oriented design metrics such as coupling, instability, abstractness, and Distance-from-Main-Sequence, plus cyclomatic complexity.
  • •Combines SQLite3 full-text search, vector similarity search, and property-graph queries to support code analysis.

BEST FOR

  • •Having an AI assistant understand an unfamiliar repository's structure, dependencies, and important files.
  • •Triaging risky files by combining commit churn with code complexity.
  • •Evaluating maintainability and object-oriented design quality of a codebase.

ABOUT PECORINO

Pecorino MCP Server is cataloged as an MCP server attributed to pecorino-mcp. An MCP server that lets AI assistants inspect codebases, compute design and complexity metrics, analyze Git history, and detect risk hotspots. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: GNU Affero General Public License v3 (AGPL-3.0). Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Pecorino MCP Server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

How does Pecorino connect to an AI assistant?

It runs as a local stdio MCP server or as a network-accessible SSE server.

Can Pecorino be used without an AI assistant?

Yes, it can be run directly via a command-line interface for analysis reports, in addition to running as an MCP server.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 571ed5507bbd · 采集于 2026-11-13 12:16:43 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

Pecorino MCP Server

A Model Context Protocol (MCP) server for deep Git history statistics, repository health tracking, and Object-Oriented Design (OOD) metrics analysis.

Pecorino allows Large Language Models (LLMs) and dev tools (such as Claude Desktop or Cursor) to inspect codebases, analyze code structures, compute complexity/maintainability indexes, and detect risk hotspots.


Features

  • Model Context Protocol (MCP): Exposes 5 unified tools (browse, search, update_index, set_workspace, metrics) to your AI assistant.
  • Git History Analytics: Commits, LOC growth, author contributions, activity patterns, and team performance tracking.
  • Object-Oriented Design Metrics: Afferent/efferent coupling (Ca/Ce), instability (I), abstractness (A), and Distance-from-Main-Sequence (D) analysis.
  • Risk Hotspot Detection: Combines code churn (revision frequency) and complexity to pinpoint high-risk source files.
  • Fast SQLite3 Indexing: Leverages SQLite3 + c-fts-uring for robust metadata storage, hybrid vector search (HNSW), and BM25F full-text search, alongside Gorgonzola for property graph traversal.
  • Flexible CLI & HTTP SSE: Run as a standard CLI tool, start a local stdio MCP server, or deploy as a network-accessible SSE server.

Quick Start

1. System Prerequisites

Before setting up the environment, ensure you have the required build tools installed (needed to compile the native gorgonzola database module):

  • Fedora/RHEL: sudo dnf install cmake ninja-build gcc gcc-c++ ccache python3-devel
  • Ubuntu/Debian: sudo apt install cmake ninja-build build-essential ccache python3-dev
  • macOS: brew install cmake ninja ccache

2. Installation

Clone the repository recursively (to fetch the MCP SDK submodule) and set up the environment:

# Clone recursively
git clone --recursive https://github.com/pecorino-mcp/pecorino.git
cd pecorino

# Run the environment setup script
# This will initialize the .venv, install dependencies, and compile the gorgonzola module
./scripts/setup_env.sh

# Activate the virtual environment
source .venv/bin/activate

3. Configure Claude Desktop

Add Pecorino to your claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "pecorino": {
      "command": "/path/to/pecorino/.venv/bin/pecorino-mcp",
      "args": ["--transport", "stdio"],
      "env": {
        "PYTHONPATH": "/path/to/pecorino"
      }
    }
  }
}

(Replace /path/to/pecorino with your actual absolute path).


Exposed MCP Tools

Once connected, your AI assistant can use the following tools:

1. browse

Browse codebase structure (tree, deps, classes, functions, pagerank, summary) or retrieve specific lines of code with view="code". Use this for structural viewing and code retrieval.

Unified search and analysis tool with multiple modes:

  • hybrid (default) — Blended vector similarity + SQLite3 FTS with RRF and LTR scoring.
  • fts — Full-text keyword search across the codebase.
  • callers / callees — Call graph analysis. Who calls X? What does X call?
  • impact — Deep dependency trace from a file or directory.
  • usages — Combined search + callers in one call (find definition and all callers).
  • intent — Preset AST queries: all_classes, all_functions, entry_points, dead_code, files_by_language.
  • community — Semantic neighborhood and cluster discovery via Leiden community detection.
  • explain — Ranking explanation surfacing why a symbol scored highly.
  • snippet / trace — Contextual code snippet retrieval and deep path tracing.
  • cypher — Embedded Cypher query execution within search.
  • auto — Automatic natural language query intent routing.
  • dsl — Custom JSON DSL query against the codebase AST and graph.
  • functional-analysis — Functional purity analysis.

3. query_graph

Execute openCypher queries directly against the Kùzu/Gorgonzola knowledge graph for deep structural and similarity analysis.

4. update_index

Update the AST index for the codebase and return a structural summary. Call this once after cloning or after significant changes.

5. set_workspace

Change the server's workspace root directory at runtime.

6. metrics (Admin only)

Calculate OOP metrics, cyclomatic complexity, or hotspot risk analysis. Use what: ['hotspots'] for repo-level risk triage.

7. detect_changes

Detect modified files and git reflog changes to track incremental updates.

8. manage_adr

Create, list, and query Architecture Decision Records (ADRs) within the codebase.

9. manage_snapshot

Take structural snapshots of the codebase graph and index for historical comparison and diffing.


Architecture

Pecorino relies on a multi-stage Dual Index & Graph Architecture to extract, index, and analyze codebase structure:

  1. AST Parsing (src/parsers/): Uses py-tree-sitter to parse source files across multiple languages, extracting definitions for modules, classes, interfaces, functions, and imports.
  2. Graph Knowledge Base (src/mcp_server/gorgonzola_graph.py): Stores code structures, call graphs, dependencies, and caller/callee relationships as an openCypher property graph powered by the gorgonzola / Kùzu engine.
  3. Dual Search Engine (Relational, Vector & c-fts-uring) (src/mcp_server/index_db.py):
    • Bi-Encoder Embeddings (embedding.py): Dense vector representations stored in SQLite3 using HNSW vector extension for fast cosine similarity.
    • c-fts-uring FTS (index_db.py): Native SQLite3 C extension using Linux io_uring for fast asynchronous BM25F full-text search.
  4. AI Reranking & Learning-to-Rank (src/mcp_server/cross_encoder.py & ltr_ranker.py):
    • Cross-Encoder Reranking: Pairwise ONNX cross-encoder reranking the top candidate results.
    • LTR Model: Blends 20+ signals (PageRank, Betweenness Centrality, OOD metrics, Git churn/authorship entropy).
    • Naming Analysis: Uses a fallback local LLM for heuristic resolution.
  5. Git Analytics Engine (src/git/, src/core/): Parses reflogs and commit histories to build temporal coupling graphs and track code churn.
  6. MCP Transport Layer (src/transports/): Exposes index, vector, and graph databases over standard Model Context Protocol (stdio, SSE) to AI agents.

[!TIP] Models Used Highlight

  • Embedding Model: Xenova/all-MiniLM-L12-v2 (384-dim local embeddings)
  • Cross-Encoder Model: cross-encoder/ms-marco-MiniLM-L-12-v2
  • Fallback LLM: ollama/llama3 (for naming analyzer)

Core Functions (Python API)

Beyond the CLI and MCP Server, Pecorino can be used directly as a Python library. Key modules and functions exported via src/__init__.py include:

  • Metrics & Complexity:
    • calculate_maintainability_index(), calculate_mccabe_complexity(), calculate_halstead_metrics()
    • OOPMetricsAnalyzer (computes Ca, Ce, I, A, D)
  • Git Analytics:
    • GitDataCollector (harvests commit history and LOC metrics)
    • HotspotDetector, analyze_hotspots() (identifies churn vs. complexity risks)
  • AST Manipulation:
    • TreeSitterGrammarManager (manages language grammars)
    • ASTNode, ClassDef, FunctionDef, walk(), iter_child_nodes()
  • Export & Utilities:
    • MetricsExporter, export_to_json(), export_to_yaml()

Repository Layout

  • src/cli/ — Command-line interface and entry points.
  • src/core/ — Core data collectors and configuration.
  • src/git/ — Git history and commit log parsers.
  • src/mcp_server/ — MCP server endpoints and core logic.
    • src/mcp_server/index_pipeline.py — Unified AST extraction and indexing pipeline.
    • src/mcp_server/index_db.py — SQLite3 and c-fts-uring Full-Text Search (FTS) codebase index.
    • src/mcp_server/gorgonzola_graph.py — Gorgonzola graph database adapter.
    • src/mcp_server/ramdisk.py — /dev/shm RAM-disk staging for bulk indexing.
  • src/metrics/ — Maintainability, complexity, and OOP metrics analyzers.
  • src/parsers/ — AST parsing (using Tree-sitter).
  • src/transports/ — MCP Adapters (stdio, fastAPI).
  • src/utils/ — Export formats and helper utilities.
  • modules/ — Git submodules including gorgonzola, py-tree-sitter, and pecorino-utils.
  • docs/ — Architectural documentation (Search, Indexing, Observability & Security, Agent Skills, Evolution Timeline).
  • tests/ — Automated test suites.

Command Line Interface (CLI)

You can also run Pecorino directly via the terminal:

# Start the stdio MCP server manually
pecorino-mcp --transport stdio

# Start the SSE MCP server (requires Starlette & Uvicorn: pip install -e .[sse])
pecorino-mcp --transport sse --host 127.0.0.1 --port 8000

# Run a CLI analysis and save the report inside a directory
python pecorino.py /path/to/repo /path/to/output_dir

For comprehensive CLI flags, transport details, and configuration options, see the Local Server Deployment Guide.


License & Contributing

This project is licensed under the GNU Affero General Public License v3 (AGPL-3.0) - see the LICENSE file for details. Contributions, bug reports, and improvements are welcome! Open an issue or submit a pull request with small, focused changes.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Pecorino MCP Server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/pecorino)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools