Code Analyzer MCP server

Integrates with open source projects to analyze codebases, detect patterns, and generate intelligent merge strategies for streamlined integration and refactoring.
Back to servers
Provider
kivo360
Release date
Feb 05, 2025
Language
TypeScript
Stats
5 stars

The Anthropic MCP Code Analyzer is a server that helps you analyze open source projects and integrate them with your existing codebase. It uses Claude to analyze code patterns, architecture, and documentation to provide intelligent merge strategies between repositories.

Installation

To get started with the MCP Code Analyzer, follow these steps:

  1. Clone the repository:

    git clone https://github.com/kivo360/anthropic-mcp-code-analyzer.git
    cd anthropic-mcp-code-analyzer
    
  2. Install dependencies:

    npm install
    
  3. Set up environment variables:

    export ANTHROPIC_API_KEY=your_api_key
    export PORT=3000  # Optional, defaults to 3000
    

Usage

Starting the Server

Once installed, you can start the server with:

npm start

Analyzing Repositories

To analyze repositories and get merge strategies, send a POST request to the analyze endpoint:

curl -X POST http://localhost:3000/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "sourceRepo": "https://github.com/user/source-repo.git",
    "targetRepo": "https://github.com/user/target-repo.git"
  }'

The server will return a comprehensive analysis including:

  • Source repository analysis
  • Target repository analysis
  • Recommended merge strategy
  • Potential conflicts and solutions

API Endpoints

Analyze Endpoint

The main endpoint for repository analysis:

POST /analyze

Request body:

{
  "sourceRepo": "string",
  "targetRepo": "string"
}

Health Check

Verify the server is running properly:

GET /health

How It Works

Repository Analysis

The service analyzes both repositories by:

  • Cloning the source and target repositories
  • Analyzing code structure using AST parsing
  • Extracting patterns and dependencies
  • Processing documentation

Pattern Detection

The tool identifies:

  • Common coding patterns
  • Dependencies and relationships
  • Architectural decisions

Merge Strategy Generation

Using Claude, the service:

  • Analyzes compatibility between codebases
  • Generates a step-by-step integration plan
  • Identifies potential conflicts
  • Suggests refactoring steps

Documentation Processing

The analyzer also:

  • Extracts and analyzes documentation
  • Maps knowledge between codebases
  • Provides context for decisions

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later