Skip to main content
Glama
cbunting99

MCP Code Analysis & Quality Server

by cbunting99
README.md
# MCP Code Analysis & Quality Server

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Node.js Version](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen)](https://nodejs.org/)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)

> **Note**: This project was recently completed and has not undergone extensive testing. Use with caution and report any issues you encounter.

**Developed by**: Chris Bunting

A suite of MCP (Model Context Protocol) servers providing code analysis, dependency management, complexity analysis, and intelligent prioritization capabilities.

## Overview

This project provides three MCP servers and one intelligent prioritization library that deliver comprehensive code quality analysis:

- **Static Analysis Server**: Code quality and security analysis
- **Dependency Analysis Server**: Dependency management and analysis
- **Complexity Analyzer Server**: Code complexity assessment
- **Intelligent Prioritizer**: AI-powered prioritization library (used by other servers)

## Features

### Static Analysis Server
- Code quality analysis
- Security vulnerability detection
- Best practices validation
- Multi-language support (JavaScript, TypeScript, Python, Java, C++, Go, Rust)

### Dependency Analysis Server
- Dependency analysis and management
- Package compatibility checking
- Security vulnerability scanning
- Version resolution and conflict detection

### Complexity Analyzer Server
- Code complexity measurement
- Maintainability assessment
- Code structure analysis
- AST-based processing

### Intelligent Prioritizer
- AI-powered prioritization library
- Context-aware analysis engine
- Learning-based recommendations
- Impact assessment and scoring (used internally by other servers)

## Quick Start

### Prerequisites

- Node.js 18.0 or higher
- npm 8.0 or higher
- Git

### Development Installation

Clone the repository and install dependencies:

```bash
# Clone the repository
git clone <repository-url>
cd mcp-code-analysis-server

# Install all dependencies
npm install

# Build all packages
npm run build
```

### MCP Configuration

After building, add the following to your MCP client's configuration file (usually `mcp.json` or similar):

```json
{
  "mcpServers": {
    "static-analysis-server": {
      "command": "node",
      "args": ["/path/to/mcp-code-analysis-server/packages/static-analysis-server/dist/index.js"],
      "env": {
        "NODE_ENV": "development"
      }
    },
    "dependency-analysis-server": {
      "command": "node",
      "args": ["/path/to/mcp-code-analysis-server/packages/dependency-analysis-server/dist/index.js"],
      "env": {
        "NODE_ENV": "development"
      }
    },
    "complexity-analyzer-server": {
      "command": "node",
      "args": ["/path/to/mcp-code-analysis-server/packages/complexity-analyzer-server/dist/index.js"],
      "env": {
        "NODE_ENV": "development"
      }
    }
  }
}
```

**Note**: Replace `/path/to/mcp-code-analysis-server` with the actual path to your cloned repository.

### Development Workflow

For development and testing:

```bash
# Run tests
npm test

# Run linting
npm run lint

# Run type checking
npm run type-check

# Start individual servers for testing
cd packages/static-analysis-server
npm start

cd ../dependency-analysis-server
npm start

cd ../complexity-analyzer-server
npm start
```

### Usage

Once configured, the MCP servers will be automatically available in your MCP client. Each server provides specific tools:

- **Static Analysis Server**: Code quality analysis, security checks, best practices validation
- **Dependency Analysis Server**: Package dependency analysis, compatibility checking, security scanning
- **Complexity Analyzer Server**: Code complexity measurement, maintainability assessment
- **Intelligent Prioritizer**: AI-powered prioritization library (integrated into other servers)

## Development

### Available Scripts

```bash
# Build all packages
npm run build

# Build shared packages first, then servers
npm run build:shared
npm run build:servers

# Run tests across all packages
npm test

# Run linting
npm run lint

# Run type checking
npm run type-check

# Clean all packages
npm run clean
```

### Project Structure

```
mcp-code-analysis-server/
├── packages/
│   ├── static-analysis-server/          # Static code analysis MCP server
│   │   ├── src/
│   │   ├── dist/
│   │   ├── package.json
│   │   └── tsconfig.json
│   ├── dependency-analysis-server/      # Dependency analysis MCP server
│   │   ├── src/
│   │   ├── dist/
│   │   ├── package.json
│   │   └── tsconfig.json
│   ├── complexity-analyzer-server/      # Complexity analysis MCP server
│   │   ├── src/
│   │   ├── dist/
│   │   ├── package.json
│   │   └── tsconfig.json
│   ├── intelligent-prioritizer/         # AI prioritization library
│   │   ├── src/
│   │   ├── dist/
│   │   ├── package.json
│   │   └── tsconfig.json
│   ├── combined-reporting/              # Combined analysis reporting
│   │   └── src/
│   ├── context-aware-analysis/          # Context-aware analysis engine
│   │   └── src/
│   ├── knowledge-base/                  # Knowledge base service
│   │   └── src/
│   ├── progressive-disclosure/          # Progressive disclosure service
│   │   └── src/
│   ├── quality-dashboard/               # Quality dashboard service
│   │   └── src/
│   ├── team-preference-learning/        # Team preference learning
│   │   └── src/
│   ├── shared-cache/                    # Shared caching utilities
│   │   ├── src/
│   │   ├── package.json
│   │   └── tsconfig.json
│   ├── shared-communication/            # Shared communication utilities
│   │   ├── src/
│   │   ├── package.json
│   │   └── tsconfig.json
│   ├── shared-config/                   # Shared configuration utilities
│   │   ├── src/
│   │   ├── package.json
│   │   └── tsconfig.json
│   ├── shared-logger/                   # Shared logging utilities
│   │   ├── src/
│   │   ├── package.json
│   │   └── tsconfig.json
│   ├── shared-plugins/                  # Shared plugin system
│   │   ├── src/
│   │   ├── package.json
│   │   └── tsconfig.json
│   └── shared-types/                    # Shared type definitions
│       ├── src/
│       ├── package.json
│       └── tsconfig.json
├── docker/                              # Docker configurations
│   ├── complexity-analyzer.Dockerfile
│   ├── dependency-analysis.Dockerfile
│   └── static-analysis.Dockerfile
├── docker-compose.yml
├── jest.config.js                       # Test configuration
├── tsconfig.json                        # TypeScript configuration
├── package.json                         # Workspace configuration
├── mcp.json                             # MCP configuration
├── README.md
├── LICENSE
├── CHANGELOG.md
└── mcp_instructions.md
```

### Architecture

The project uses a monorepo structure with shared packages:

- **Shared Packages**: Common utilities, types, and configurations
- **Server Packages**: Individual MCP servers with specific functionality
- **Library Packages**: Reusable libraries (e.g., intelligent-prioritizer)
- **Analysis Packages**: Specialized analysis components
```

## Development

### Available Scripts

```bash
# Build all packages
npm run build

# Run all tests
npm run test

# Run linting
npm run lint

# Type checking
npm run type-check

# Development mode
npm run dev

# Clean build artifacts
npm run clean
```

### Testing

Run all tests:
```bash
npm test
```

### Code Quality

This project uses several tools to maintain code quality:

- **ESLint**: JavaScript/TypeScript linting
- **Prettier**: Code formatting
- **Jest**: Unit testing
- **TypeScript**: Type checking

## Docker

Build and run with Docker:

```bash
# Build images
docker build -t mcp-code-analysis/static-analysis-server -f docker/static-analysis.Dockerfile .
docker build -t mcp-code-analysis/dependency-analysis-server -f docker/dependency-analysis.Dockerfile .
docker build -t mcp-code-analysis/complexity-analyzer-server -f docker/complexity-analyzer.Dockerfile .
docker build -t mcp-code-analysis/intelligent-prioritizer -f docker/intelligent-prioritizer.Dockerfile .

# Run containers
docker run mcp-code-analysis/static-analysis-server
docker run mcp-code-analysis/dependency-analysis-server
docker run mcp-code-analysis/complexity-analyzer-server
docker run mcp-code-analysis/intelligent-prioritizer
```

Or use docker-compose:

```bash
docker-compose up
```

## Release Notes

### Version 1.0.1 (2025-09-10)

**🎉 Initial Production Release**

This is the first production-ready release of the MCP Code Analysis & Quality Server, providing comprehensive code analysis capabilities through three integrated MCP servers.

#### What's New
- **Static Analysis Server**: Multi-language code quality and security analysis
- **Dependency Analysis Server**: Complete dependency management and security scanning
- **Complexity Analyzer Server**: Advanced code complexity assessment
- **Intelligent Prioritizer**: Smart issue prioritization with team learning
- **Shared Infrastructure**: Robust caching, communication, and configuration systems

#### Key Features
- ✅ Full TypeScript implementation with strict typing
- ✅ Multi-language support (JavaScript, TypeScript, Python, Java, C++, Go, Rust)
- ✅ Docker containerization for all servers
- ✅ MCP Protocol compliance
- ✅ Comprehensive testing framework setup
- ✅ ESLint configuration with auto-fix capabilities

#### Known Items
- Some ESLint warnings remain (to be addressed in future patches)
- Test coverage to be expanded in upcoming releases
- Documentation examples to be enhanced

#### Development Setup
```bash
git clone <repository-url>
cd mcp-code-analysis-server
npm install
npm run build
```

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Acknowledgments

- [Model Context Protocol](https://modelcontextprotocol.io/) for the underlying protocol