Skip to main content

MCP server for analyzing Git repositories - extracts code structure, patterns, and documentation

Project description

MCP Git Analyzer

Git 저장소를 분석하여 코드 구조, 알고리즘 패턴, 문서를 추출하고 DB에 저장하는 MCP 서버입니다.

Features

  • 저장소 클론 및 관리: Git URL로 저장소 클론, 브랜치 지정 가능
  • 다중 언어 파싱: Python, JavaScript, TypeScript 지원 (tree-sitter 기반)
  • 코드 분석: 함수, 클래스, import, docstring 추출
  • 알고리즘 추출: 핵심 알고리즘 자동 감지 및 복잡도 분석
  • 패턴 감지: 알고리즘 패턴 (재귀, DP, 정렬 등) 식별
  • 전문 검색: SQLite FTS5 기반 키워드 검색
  • 임베딩 유사도 검색: 의미적으로 유사한 알고리즘 찾기
  • ANN 최적화: FAISS 기반 고속 벡터 유사도 검색 (O(log n))
  • 차원 축소: PCA를 통한 임베딩 차원 축소 및 저장 공간 절약
  • 호출 그래프: 함수 호출 관계 분석 (JSON/Mermaid)
  • 보고서 생성: 다양한 형식의 분석 보고서 (JSON/Markdown/HTML)
  • LLM 친화적: 구조화된 JSON 응답

Installation

기본 설치

uv pip install -e .

ANN 최적화 기능 포함 설치

대규모 저장소 분석 시 권장:

uv pip install -e ".[ann]"

이 명령어는 다음 패키지를 추가로 설치합니다:

  • faiss-cpu - 고속 벡터 유사도 검색
  • numpy - 수치 연산
  • scikit-learn - PCA 차원 축소

자세한 내용은 ANN 최적화 가이드를 참조하세요.

Configuration

환경변수로 저장 경로를 설정합니다:

환경변수 설명 기본값
GIT_ANALYZER_REPOS_PATH 클론된 저장소 저장 경로 ~/.mcp-git-analyzer/repos
GIT_ANALYZER_DB_PATH SQLite DB 파일 경로 ~/.mcp-git-analyzer/analysis.db

Claude Desktop 설정

claude_desktop_config.json:

{
  "mcpServers": {
    "git-analyzer": {
      "command": "uv",
      "args": ["run", "mcp-git-analyzer"],
      "env": {
        "GIT_ANALYZER_REPOS_PATH": "C:/repos",
        "GIT_ANALYZER_DB_PATH": "C:/repos/analysis.db"
      }
    }
  }
}

Available Tools

Git 관리 (4 tools)

  • clone_repo(url, branch?) - 저장소 클론
  • list_repos() - 등록된 저장소 목록
  • get_repo_tree(repo_id, max_depth) - 저장소 파일 구조
  • delete_repo(repo_id, delete_files?) - 저장소 삭제

분석 (3 tools)

  • analyze_repo(repo_id, force_reanalyze?) - 전체 저장소 분석
  • get_file_analysis(repo_id, file_path) - 파일 상세 분석
  • get_symbol_info(symbol_name, repo_id?) - 심볼 정보 및 패턴

검색 (4 tools)

  • search_symbols(query, symbol_type?, repo_id?, limit) - 심볼 전문 검색
  • find_patterns(pattern_type, pattern_name?, repo_id?, limit) - 패턴 검색
  • search_imports(module_name, repo_id?, limit) - import 검색
  • list_symbols(repo_id, symbol_type?, limit) - 심볼 목록

호출 그래프 (3 tools)

  • get_call_graph(repo_id, symbol_name?, format) - 호출 그래프 생성
  • get_function_callers(repo_id, function_name) - 함수 호출자 찾기
  • get_function_calls(repo_id, function_name) - 함수가 호출하는 함수 찾기

알고리즘 분석 (10 tools)

  • extract_algorithms(repo_id, min_lines?, force_reextract?) - 알고리즘 추출
  • get_algorithm_analysis_prompt(algorithm_id) - LLM 분석용 프롬프트 생성
  • save_algorithm_llm_analysis(algorithm_id, analysis_json) - LLM 분석 결과 저장
  • save_algorithm_embedding(algorithm_id, embedding) - 임베딩 저장
  • find_similar_algorithms(algorithm_id, method, threshold?, limit?) - 유사 알고리즘 검색
  • get_algorithm(algorithm_id) - 알고리즘 상세 정보
  • list_algorithms(repo_id, category?, category_type?, min_complexity?, limit?) - 알고리즘 목록
  • search_algorithms(query, repo_id?, limit?) - 알고리즘 전문 검색
  • build_similarity_index(repo_id?, index_type) - NEW ANN 인덱스 구축
  • reduce_embedding_dimensions(target_dimension, repo_id?, method) - NEW 차원 축소

보고서 (1 tool)

  • generate_report(repo_id, report_type, format, options?) - 분석 보고서 생성

총 32개 도구 지원 (2개 신규 추가)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_git_analyzer-0.1.4.tar.gz (116.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_git_analyzer-0.1.4-py3-none-any.whl (134.9 kB view details)

Uploaded Python 3

File details

Details for the file mcp_git_analyzer-0.1.4.tar.gz.

File metadata

  • Download URL: mcp_git_analyzer-0.1.4.tar.gz
  • Upload date:
  • Size: 116.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.26

File hashes

Hashes for mcp_git_analyzer-0.1.4.tar.gz
Algorithm Hash digest
SHA256 4f15e98b1dee3db16826d3c88b2bb839ab0939336d1325aae2ca03e4fb9f4c1e
MD5 f8d6cff59f7c881cf9e7ad57e4e032a4
BLAKE2b-256 d44482d0970005cee5927f4cda796b1e2f3a1d9fed09707b14b910935938a04a

See more details on using hashes here.

File details

Details for the file mcp_git_analyzer-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_git_analyzer-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 63e689b67a07f6ef34a45925cf508526d1ac37afc166ca0516246ad1ca755008
MD5 e646e319af15298be85785a4afc38e9b
BLAKE2b-256 07fc7cd1ee0a2787e31eda85f337ec3aa5a9644fa1b0e1174ee66eebb358f913

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page