JM

johannhartmann/mcpcodeanalysis

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

10 stars 3 forks 质量 57 趋势 18MIT

A code understanding MCP server. Let's see if we can use it to refactor code.

概览

An intelligent MCP (Model Context Protocol) server that provides advanced code analysis and search capabilities for large codebases. Built with pure FastMCP implementation, it uses TreeSitter for parsing, PostgreSQL with pgvector for vector storage, and OpenAI embeddings for semantic search. - 🔍 : Natural language queries to find relevant code - 🏛️ : Extract business entities and bounded contexts using LLM - 📊 : Hierarchical understanding of modules, classes, and functions - 🔄 : Git-based change tracking for efficient re-indexing - 🎯 : AI-powered explanations with context aggregation - 🔗 : Understand code relationships and dependencies - 🌐 : Build semantic graphs with community detection (Leiden algorithm) - 💡 : Domain-Driven Design suggestions and improvements - 🚀 : Handles codebases with millions of lines of code - 🐍 : Full support for Python with more languages coming - search_code - Search for code using natural language queries with semantic understanding -...

README

以下为原文 README 节选,完整内容请查看原文。

MCP Code Analysis Server

An intelligent MCP (Model Context Protocol) server that provides advanced code analysis and search capabilities for large codebases. Built with pure FastMCP implementation, it uses TreeSitter for parsing, PostgreSQL with pgvector for vector storage, and OpenAI embeddings for semantic search.

Features

  • 🔍 Semantic Code Search: Natural language queries to find relevant code
  • 🏛️ Domain-Driven Analysis: Extract business entities and bounded contexts using LLM
  • 📊 Code Structure Analysis: Hierarchical understanding of modules, classes, and functions
  • 🔄 Incremental Updates: Git-based change tracking for efficient re-indexing
  • 🎯 Smart Code Explanations: AI-powered explanations with context aggregation
  • 🔗 Dependency Analysis: Understand code relationships and dependencies
  • 🌐 Knowledge Graph: Build semantic graphs with community detection (Leiden algorithm)
  • 💡 DDD Refactoring: Domain-Driven Design suggestions and improvements
  • 🚀 High Performance: Handles codebases with millions of lines of code
  • 🐍 Python Support: Full support for Python with more languages coming

MCP Tools Available

Core Search Tools

  • search_code - Search for code using natural language queries with semantic understanding
  • find_definition - Find where symbols (functions, classes, modules) are defined
  • find_similar_code - Find code patterns similar to a given snippet using vector similarity
  • get_code_structure - Get the hierarchical structure of a code file

Code Analysis Tools

  • explain_code - Get hierarchical explanations of code elements (modules, classes, functions)
  • suggest_refactoring - Get AI-powered refactoring suggestions for code improvements
  • analyze_dependencies - Analyze dependencies and relationships between code entities

Repository Management Tools

  • sync_repository - Manually trigger synchronization for a specific repository

Domain-Driven Design Analysis Tools

  • extract_domain_model - Extract domain entities and relationships using LLM analysis
  • find_aggregate_roots - Find aggregate roots in the codebase using domain analysis
  • analyze_bounded_context - Analyze a bounded context and its relationships
  • suggest_ddd_refactoring - Suggest Domain-Driven Design refactoring improvements
在 GitHub 查看完整 README

安装

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

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "code-analysis": { "command": "python", "args": ["-m", "src.mcp_server"], "cwd": "/path/to/mcp-code-analysis-server", "env": { "OPENAI_API_KEY": "your-api-key" } } } }