MC

manojred22/codebase-patterns-mcp

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

5 stars 3 forks Качество 55 Тренд 13

MCP server that gives Claude Code semantic access to your team's codebase patterns — so generated code follows your internal standards from day one.

Обзор

MCP server that gives Claude Code semantic access to your team's codebase patterns — so generated code follows your internal standards from day one. When you ask Claude to "add telemetry tracing", it generates generic code pointing to localhost with no compliance fields. Your team already has an internal telemetry library with specific endpoints, required fields, and conventions. Claude doesn't know about it. This MCP server indexes your repositories and exposes a search_code tool. When Claude needs to write code for common concerns (auth, telemetry, database, HTTP clients), it searches your codebase first and generates code that follows your team's actual patterns. Evaluated against 8 ground-truth queries across telemetry, auth, HTTP clients, database repos, and error handling: Every query finds a relevant result at rank 1. All expected results appear within the top 5.

README

Показан фрагмент оригинального README. Открыть оригинал.

Codebase Patterns MCP Server

MCP server that gives Claude Code semantic access to your team’s codebase patterns — so generated code follows your internal standards from day one.

The Problem

When you ask Claude to “add telemetry tracing”, it generates generic code pointing to localhost with no compliance fields. Your team already has an internal telemetry library with specific endpoints, required fields, and conventions. Claude doesn’t know about it.

The Solution

This MCP server indexes your repositories and exposes a search_code tool. When Claude needs to write code for common concerns (auth, telemetry, database, HTTP clients), it searches your codebase first and generates code that follows your team’s actual patterns.

Same prompt, completely different output:

Without MCP With MCP
jaeger.New(jaeger.WithEndpoint("localhost:14268")) telemetry.NewTracer(AcmeTracerConfig{TeamLabel: "platform", CostCenter: "CC-1234"})
Generic Jaeger exporter Team’s OTLP exporter to telemetry.internal.acme.com
No compliance fields TeamLabel + CostCenter required for billing

Search Quality

Evaluated against 8 ground-truth queries across telemetry, auth, HTTP clients, database repos, and error handling:

Metric Score Target
Recall@5 100% 80%
Precision@3 95.8% 80%
MRR 100% 85%
Recall@3 82.7% 90%

Every query finds a relevant result at rank 1. All expected results appear within the top 5.

Key Features

  • Semantic Code Search — find code by meaning, not keywords
  • Multi-Language Support — Go, Java, Python, JavaScript, TypeScript
  • Pattern Detection — factory, singleton, builder, strategy, decorator, observer, repository
  • Framework Detection — Spring Boot, Flask, Express, NestJS, Django, FastAPI, and more
  • Function-Level Indexing — each function indexed with rich metadata
  • Request Logging — structured JSONL logs for every MCP tool call
  • Eval Framework — ground truth queries, metrics, and automated reporting

Quick Start

# 1. Clone and setup
git clone https://github.com/Manojred22/codebase-patterns-mcp.git
cd codebase-patterns-mcp
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

# 2. Configure
cp .env.template .env
# Edit .env and add your OPENAI_API_KEY

# 3. Add your repositories to ./repos/

# 4. Index your code
python index_repos.py

# 5. Test the search
python search_cli.py "authentication handler"

# 6. Configure MCP server for Claude Code
cp .mcp.json.template .mcp.json
# Edit .mcp.json with your absolute paths

For detailed step-by-step instructions, see docs/setup-guide.md.

Try the Demo

Run the full demo with the included sample repos (Acme-branded code across 5 languages):

bash demo/setup_demo.sh
Открыть полный README на GitHub

Установка

This server does not publish a one-line install command.

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →