mcp_code_analyzer
by: emiryasar
A Model Context Protocol (MCP) server implementation for comprehensive code analysis. This tool integrates with Claude Desktop to provide code analysis capabilities through natural language interactions.
📌Overview
Purpose: The MCP Code Analyzer aims to intelligently adapt changes within a project to ensure that related usages are updated accordingly, enhancing code management and analysis.
Overview: The Model Context Protocol (MCP) Code Analyzer is a detailed code analysis and management tool designed to integrate seamlessly with Claude Desktop. It delivers insights at both the project and file levels, facilitating a deeper understanding of code structures and necessary changes.
Key Features:
-
Project Analysis: Enables comprehensive project evaluation through various analyses such as project structure and statistics, helping users understand the overall organization and technology of their codebase.
-
Code Analysis: Offers tools to analyze imports, individual files, and find references, streamlining the identification of dependencies and enhancing code clarity.
MCP Code Analyzer
The main purpose of the MCP tool is to intelligently adapt changes to the project. When code modification or structural adjustment is needed, it aims to ensure that other related usages are also updated accordingly.
Currently, the project has many bugs and the tools sometimes do not function as expected. Due to work commitments, development time is limited, but efforts will be made to fix issues when possible.
⚠️ WARNING: BACKUP RECOMMENDED
This tool performs file operations that could potentially modify or delete files. Always backup your codebase before using any modification features.
Overview
The Model Context Protocol (MCP) Code Analyzer is a comprehensive code analysis and management tool that integrates with Claude Desktop. It analyzes code at both project and file levels, providing insights for needed changes and overall project understanding.
Prerequisites
- Python 3.10 or later
- Windows (Linux/MacOS support not yet tested)
Installation
# Clone the repository
git clone https://github.com/[your-username]/mcp-code-analyzer.git
cd mcp-code-analyzer
# Install dependencies and package
pip install -e .
Claude Desktop Integration
Configuration
- Access Claude Desktop config:
Win + R → %AppData%\Claude\
- Create or edit
claude_desktop_config.json
:
{
"globalShortcut": "Ctrl+Space",
"mcpServers": {
"code-analyzer": {
"command": "python",
"args": [
"-m",
"mcp_code_analyzer",
"--analyze-paths",
"C:\\Projects\\path1"
],
"type": "module"
}
}
}
Path Configuration
- Multiple project paths can be specified in the configuration
- Additional paths or files can be analyzed via chat messages
- No limit on the number of analyzable paths/files
🛠️ Tools and Status
Working Tools
-
✅ Project Analysis
- analyze_project_structure (XML tree format)
- analyze_project_statistics
- analyze_project_technology
- analyze_code_structure
-
✅ Code Analysis
- analyze_imports
- analyze_file
- find_references
-
⚠️🔄 File Operations (Always backup before use)
- file_operations
- version_control (Creates dated backups)
-
⚠️🔄 Code Modify (Always backup before use)
- code_modifier (Performs modifying code line by line) (Currently has major issues)
Testing Phase Tools
- 🔄 check_syntax
- 🔄 find_code_patterns
- 🔄 find_pattern_usages
- 🔄 search_content
- 🔄 search_files
- 🔄 validate_code
Known Issues
- Chat context limitations may interrupt large file modifications.
- AI-generated documentation comments can affect code operation in large files.
Demo Video
Watch demonstration of MCP tool used with building Mario game:
https://youtu.be/MQtZCKNg13I
Note: This is a demonstration of the tool's capabilities, not a complete game tutorial. The game isn't fully playable due to Claude's message limits, but this video shows how the MCP tool works and what can be achieved with it.
Contributing
Contributions are welcome! Whether it's bug reports, feature requests, documentation improvements, or code contributions—every contribution helps. Simply fork the repository and submit a pull request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Note: This project is under active development. Features and documentation may change frequently.