Skip to main content

MCP server for Python code analysis with Ruff linting, ty type checking, and Vulture dead code detection

Project description

MCP Server Analyzer for Python 🐍🔍

SafeSkill 92/100

CI/CD Pipeline PyPI version Python 3.13+ Docker License: MIT Code Coverage AgentSeal MCP Docs

A powerful Model Context Protocol (MCP) server that provides comprehensive Python code analysis using Ruff for linting, ty for type checking, and Vulture for dead code detection. Perfect for AI assistants, IDEs, and automated code review workflows.

🚀 Quick Start

VS Code Integration (One-Click Install)

For quick installation, use one of the one-click install buttons below...

Install with UV in VS Code Install with UV in VS Code Insiders

Install with Docker in VS Code Install with Docker in VS Code Insiders

For manual installation, add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing Ctrl + Shift + P and typing Preferences: Open User Settings (JSON).

Optionally, you can add it to a file called .vscode/mcp.json in your workspace. This will allow you to share the configuration with others.

Note that the mcp key is needed when using the mcp.json file.

Using uvx (recommended):

{
  "mcp": {
    "servers": {
      "analyzer": {
        "command": "uvx",
        "args": ["mcp-server-analyzer"]
      }
    }
  }
}

Using Docker:

{
  "mcp": {
    "servers": {
      "analyzer": {
        "command": "docker",
        "args": ["run", "-i", "--rm", "ghcr.io/anselmoo/mcp-server-analyzer"]
      }
    }
  }
}

Universal Installation

# Install with uvx (recommended)
uvx install mcp-server-analyzer

# Install with pip
pip install mcp-server-analyzer

# Run with Docker
docker run ghcr.io/anselmoo/mcp-server-analyzer:latest

# Install from source
git clone https://github.com/anselmoo/mcp-server-analyzer.git
cd mcp-server-analyzer
uv sync --dev
uv run mcp-server-analyzer

📋 Features

  • 🔍 RUFF Analysis: Comprehensive Python linting with auto-fixes
  • 🧠 ty Type Checking: Fast Python type analysis with rule-based diagnostics
  • 🧹 Dead Code Detection: Find unused imports, functions, and variables with VULTURE
  • 📊 Quality Scoring: Combined analysis with quality metrics
  • 🚀 FastMCP Framework: High-performance MCP server implementation
  • 🐳 Docker Ready: Multi-architecture containers with security signing
  • 🔒 Secure: All releases signed with Sigstore for supply chain security

📈 Analysis Examples

RUFF Linting Preview

See comprehensive linting analysis examples: 📋 RUFF Analysis Preview

VULTURE Dead Code Detection Preview

Explore dead code detection capabilities: 🧹 VULTURE Analysis Preview

🛠️ Available Tools

Tool Description Use Case
ruff-check Lint Python code with RUFF Style violations, potential errors
ruff-format Format Python code with RUFF Code formatting and consistency
ruff-check-ci CI/CD optimized RUFF output GitHub Actions, GitLab CI
ty-check Type-check Python code with ty Type safety, incorrect return values
vulture-scan Dead code detection Unused imports, functions, variables
analyze-code Combined Ruff + ty + Vulture analysis Complete code quality assessment

🔧 Configuration

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "analyzer": {
      "command": "uvx",
      "args": ["mcp-server-analyzer"]
    }
  }
}

Zed

Add to your Zed settings.json:

"context_servers": {
  "analyzer": {
    "command": "uvx",
    "args": ["mcp-server-analyzer"]
  }
}

Claude Code (project-level)

Place .mcp.json at your project root:

{
  "mcpServers": {
    "analyzer": {
      "command": "uvx",
      "args": ["mcp-server-analyzer"]
    }
  }
}

🧪 Development

Prerequisites

  • Python 3.10+
  • uv (recommended) or pip
  • Docker (optional)

Setup

# Clone repository
git clone https://github.com/anselmoo/mcp-server-analyzer.git
cd mcp-server-analyzer

# Install dependencies
uv sync --dev

# Run tests
uv run pytest

# Run type checks
uv run ty check src tests

# Run pre-commit hooks
uv tool run pre-commit run --all-files

# Build Docker image
docker build -t mcp-server-analyzer .

Testing

# Run all tests
uv run pytest tests/ -v

# Run with coverage
uv run pytest --cov=src/mcp_server_analyzer --cov-report=html

# Test specific functionality
uv run pytest tests/test_server.py::TestAnalyzers::test_ruff_with_sample_code

📊 Quality Metrics

The server provides quality scoring based on:

  • Ruff Issues: Style violations, potential bugs, complexity metrics
  • ty Diagnostics: Static typing errors and warnings
  • Dead Code Detection: Unused imports, functions, variables
  • Combined Score: Weighted quality assessment (0-100)

🔒 Security

  • Signed Releases: All releases signed with Sigstore
  • Container Signing: Docker images signed with Cosign
  • Trusted Publishing: PyPI releases use GitHub OIDC trusted publishing
  • Vulnerability Scanning: Automated security scanning in CI/CD
  • Supply Chain Security: SLSA Build Level 3 compliance
  • Security Policy: See SECURITY.md for vulnerability reporting

🔍 Data Handling & Transparency

  • In-memory only: Code passed to tools is written to a temporary file, analyzed, and the file is deleted immediately — nothing is persisted between calls.
  • No network calls: The server makes no outbound network connections during analysis.
  • No telemetry: No usage data, analytics, or crash reports are collected.
  • Subprocess isolation: ruff, ty, and vulture are invoked with fixed argument lists — no shell expansion or arbitrary command execution.

📚 Documentation

🤝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes using Conventional Commits
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📝 License

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

🙏 Acknowledgments


Made with ❤️ for better Python code quality

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

mcp_server_analyzer-0.2.2.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

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

mcp_server_analyzer-0.2.2-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file mcp_server_analyzer-0.2.2.tar.gz.

File metadata

  • Download URL: mcp_server_analyzer-0.2.2.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcp_server_analyzer-0.2.2.tar.gz
Algorithm Hash digest
SHA256 b0fefdaf7ffaa1925ee603edfe5ed5a75308184560e9a6d700c489e30449dca7
MD5 9e7719debdaf5482b6813f21497a9d74
BLAKE2b-256 27ed6c37b11e9216eef08ac5cd9d1953c23e640e0921a2decbfff00d48b0ceb7

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_server_analyzer-0.2.2.tar.gz:

Publisher: ci-cd.yml on Anselmoo/mcp-server-analyzer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_server_analyzer-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_server_analyzer-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b133fae955f891d5707af4d442aeea49ae9fa7be67416ea7632f3e7733217a8e
MD5 8e635b7f9cb464a07322a8005b958a67
BLAKE2b-256 91ff1c68d9ce55c3d5ba23685735aa2b21bc681d18866de2f86e76bb19486886

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_server_analyzer-0.2.2-py3-none-any.whl:

Publisher: ci-cd.yml on Anselmoo/mcp-server-analyzer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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