MCP HubMCP Hub
emiryasar

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.

31created 02/12/2024
Visit
analysis
Claude

πŸ“Œ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 MCP Code Analyzer is designed to intelligently adapt changes in your project. It aims to ensure related usages are updated when code modifications or structural adjustments are made.

⚠️ 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 tool for code analysis and management. It integrates with Claude Desktop and analyzes code at both project and file levels, offering insights for necessary changes and 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

  1. Access Claude Desktop config:
    Win + R β†’ %AppData%\Claude\
    
  2. Create/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

  • You can specify multiple project paths in the configuration.
  • Additional paths or files can be analyzed via chat messages.

πŸ› οΈ Tools and Status

Working Tools

  • βœ… Project Analysis

    • analyze_project_structure
    • analyze_project_statistics
    • analyze_project_technology
    • analyze_code_structure
  • βœ… Code Analysis

    • analyze_imports
    • analyze_file
    • find_references
  • βš οΈπŸ”„ File Operations (Backup recommended)

    • file_operations
    • version_control (Creates dated backups)
  • βš οΈπŸ”„ Code Modification (Backup recommended)

    • code_modifier (Currently has significant issues)

Testing Phase

  • πŸ”„ check_syntax
  • πŸ”„ find_code_patterns
  • πŸ”„ find_pattern_usages
  • πŸ”„ search_content
  • πŸ”„ search_files
  • πŸ”„ validate_code

Known Issues

  1. Chat context limitations may disrupt large file modifications.
  2. AI-generated documentation comments can impact code operation in large files.

Contributing

Contributions are welcomed! Bug reports, feature requests, documentation improvements, or code contributions are all appreciated. 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, and features and documentation may change frequently.