
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 understandingfind_definition- Find where symbols (functions, classes, modules) are definedfind_similar_code- Find code patterns similar to a given snippet using vector similarityget_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 improvementsanalyze_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 analysisfind_aggregate_roots- Find aggregate roots in the codebase using domain analysisanalyze_bounded_context- Analyze a bounded context and its relationshipssuggest_ddd_refactoring- Suggest Domain-Driven Design refactoring improvements
安装
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"
}
}
}
}