Code Analysis Server

Code Analysis Server

The server facilitates natural language interactions for exploring and understanding codebases, providing insights into data models and system architecture using a cost-effective, simple setup with support for existing Claude Pro subscriptions.

saiprashanths

Advanced AI Reasoning
Programming Docs Access
Database Interaction
AI Integration Systems
Data & App Analysis
Visit Server

Tools

initialize_repository

Initialize the repository path for future code analysis operations. Args: path: Path to the repository root directory that contains the code to analyze

get_repo_info

Get information about the currently initialized code repository.

get_repo_structure

Get the structure of files and directories in the repository. Args: sub_path: Optional subdirectory path relative to repository root depth: Optional maximum depth to traverse (default is 3)

read_file

Read and display the contents of a file from the repository. Args: file_path: Path to the file relative to repository root

README

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 <img src="./docs/images/tools.png" width="500"> <img src="./docs/images/mcptools.png" width="500">

  • Clicking the integrations button should display the analyze_code_repository prompt <img src="./docs/images/integrations.png" width="500"> <img src="./docs/images/prompt.png" width="500">

💡 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.

<img src="./docs/images/prompt.png" width="500">

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.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
AIO-MCP Server

AIO-MCP Server

🚀 All-in-one MCP server with AI search, RAG, and multi-service integrations (GitLab/Jira/Confluence/YouTube) for AI-enhanced development workflows. Folk from

Featured
Local
Persistent Knowledge Graph

Persistent Knowledge Graph

An implementation of persistent memory for Claude using a local knowledge graph, allowing the AI to remember information about users across conversations with customizable storage location.

Featured
Local
Hyperbrowser MCP Server

Hyperbrowser MCP Server

Welcome to Hyperbrowser, the Internet for AI. Hyperbrowser is the next-generation platform empowering AI agents and enabling effortless, scalable browser automation. Built specifically for AI developers, it eliminates the headaches of local infrastructure and performance bottlenecks, allowing you to

Featured
Local
React MCP

React MCP

react-mcp integrates with Claude Desktop, enabling the creation and modification of React apps based on user prompts

Featured
Local