Skip to main content

Add your description here

Project description

Code Analysis MCP Server

A Model Context Protocol (MCP) server that enables AI models to understand and analyze codebases through natural language conversations.

✨ Highlights

  • Natural Code Exploration: Ask high-level questions about your codebase

    "What are all the different payment providers integrated in the system?"
    
  • Deep Code Understanding: Extract insights about data models and system architecture

    "How does the user authentication flow work from frontend to database?"
    
  • Dynamic Analysis: Trace data flows and understand system relationships

    "Show me all the places where we calculate transaction fees"
    

Limitations

This tool is a simpler alternative to more sophisticated code analysis tools / copilot like Aider. While it lacks the advanced code analysis capabilities and robustness of tools like Aider, it offers a lightweight solution for codebase exploration if you already have a Claude Pro subscription. The main advantages are:

  • Cost-Effective: Using your existing Claude Pro subscription means no additional API costs, unlike tools that can get expensive when analyzing large codebases
  • Simple Setup: Quick to get started with minimal configuration
  • Basic Analysis: Good for high-level code understanding and exploration

Note that due to its simpler approach to code analysis, it may make more errors or provide less detailed insights compared to more specialized tools.

🚀 Quick Start

  1. Install the server:
git clone https://github.com/saiprashanths/code-analysis-mcp.git
cd code-analysis-mcp
  1. Install Claude Desktop App. For more instructions on setting up an MCP Server with Claude Desktop app, see docs

  2. Configure the server in Claude Desktop's configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "code-analysis": {
      "command": "uv",
      "args": [
        "--directory",
        "/PATH/TO/YOUR/REPO",
        "run",
        "code_analysis.py"
      ]
    }
  }
}
  1. Restart Claude Desktop and start analyzing your code!

  2. Ensure the tool is correctly setup

  • Clicking the tools icon should display the code-analysis tools
  • Clicking the integrations button should display the analyze_code_repository prompt

💡 Example Usage

Here's how you might use the tool to understand a complex codebase:

Start by clicking on the analyze_code_repository prompt shown below. That will guide you through the process to initialize the repo and get started.

You: How does the transaction processing work in this system?

Claude: Let me analyze the data flow for transactions. 
Looking at the codebase, I can see that transaction processing happens through several key components:

1. Raw transaction data is captured in the `TransactionEvent` model with fields for:
   - Payment status
   - Amount
   - Fee calculations
   - Processing timestamps

2. This data is then processed through the PaymentSummary model, which:
   - Validates payment provider responses
   - Calculates processing fees
   - Records transaction status

Would you like me to explain any part of this in more detail?

You: What are the key database tables involved?

Claude: The main tables in the transaction processing pipeline are:

1. transaction_events: Stores raw payment events
2. payment_summary: Processed transaction records
3. payment_providers: Provider configuration
4. merchant_accounts: Account-specific settings

Let me know if you'd like to see the schema for any of these tables!

🔧 Available Tools

initialize_repository

Initialize a code repository for analysis:

initialize_repository("/path/to/repo")
# Output: Successfully initialized code repository at: /path/to/repo

get_repo_info

Retrieve information about the initialized repository:

get_repo_info()
# Output:
# Code Repository Information:
# Path: /path/to/repo
# Exists: True
# Is Directory: True
# Found .gitignore file

get_repo_structure

Examine repository file structure:

get_repo_structure(depth=2)
# Output:
# 📁 src/
#   📁 api/
#     📄 routes.py
#     📄 models.py
#   📁 utils/
#     📄 helpers.py
#   📄 main.py

read_file

Read and analyze specific files:

read_file("src/api/models.py")
# Output:
# File: src/api/models.py
# Language: python
# Size: 2.3 KB
# 
# [File contents...]

⚙️ Technical Details

  • Default scanning depth: 3 levels
  • Maximum file size: 1MB
  • Maximum lines per file: 1000
  • Ignores paths listed in .gitignore
  • Local file system access only
  • Validates file paths to prevent directory traversal

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

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

iflow_mcp_code_analysis_mcp-0.1.1.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

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

iflow_mcp_code_analysis_mcp-0.1.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file iflow_mcp_code_analysis_mcp-0.1.1.tar.gz.

File metadata

File hashes

Hashes for iflow_mcp_code_analysis_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bbba9ae7e7b47798cc52305f8d813d122319ae9324ad4202b2c770f27e42b0e5
MD5 21830b17bff8bc286f63748e3f649ac4
BLAKE2b-256 450a2c407443411d3b9e78c52cf8e4ac825c24ff232b57844b7ef7c3cf58c357

See more details on using hashes here.

File details

Details for the file iflow_mcp_code_analysis_mcp-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for iflow_mcp_code_analysis_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c7346b216b23e1a3d5faa628a9b088876139809de2d08d4ab9bae46811ed66fc
MD5 4b1a8cc1e0018cd35ea50f8e6278571a
BLAKE2b-256 46bdce4ac7c9cf22a760d92906ad0155a4352ec6477ba5f072951a594f1f8a4d

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