https://github.com/anselmoo/mcp-server-analyzer
MCP server for Python code analysis with RUFF linting and VULTURE dead code detection
https://github.com/anselmoo/mcp-server-analyzer
code-quality copilot linting llm mcp mcp-server python ruff vibe-coding vscode-extension vulture
Last synced: 21 days ago
JSON representation
MCP server for Python code analysis with RUFF linting and VULTURE dead code detection
- Host: GitHub
- URL: https://github.com/anselmoo/mcp-server-analyzer
- Owner: Anselmoo
- License: mit
- Created: 2025-07-29T21:22:32.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2026-05-23T12:03:36.000Z (22 days ago)
- Last Synced: 2026-05-23T12:14:08.134Z (22 days ago)
- Topics: code-quality, copilot, linting, llm, mcp, mcp-server, python, ruff, vibe-coding, vscode-extension, vulture
- Language: Python
- Homepage:
- Size: 284 KB
- Stars: 9
- Watchers: 0
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# MCP Server Analyzer for Python ๐๐
[](https://safeskill.dev/scan/anselmoo-mcp-server-analyzer)
[](https://github.com/anselmoo/mcp-server-analyzer/actions/workflows/ci-cd.yml)
[](https://badge.fury.io/py/mcp-server-analyzer)
[](https://www.python.org/downloads/)
[](https://github.com/anselmoo/mcp-server-analyzer/pkgs/container/mcp-server-analyzer)
[](https://opensource.org/licenses/MIT)
[](https://codecov.io/gh/anselmoo/mcp-server-analyzer)
[](https://agentseal.org/mcp/mcp-server-analyzer)
[](https://anselmoo.github.io/mcp-server-analyzer/)
A powerful [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that provides comprehensive Python code analysis using [**Ruff**](https://docs.astral.sh/ruff/) for linting, [**ty**](https://docs.astral.sh/ty/) for type checking, and [**Vulture**](https://github.com/jendrikseipp/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...
[](https://insiders.vscode.dev/redirect/mcp/install?name=analyzer&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22mcp-server-analyzer%22%5D%7D) [](https://insiders.vscode.dev/redirect/mcp/install?name=analyzer&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22mcp-server-analyzer%22%5D%7D&quality=insiders)
[](https://insiders.vscode.dev/redirect/mcp/install?name=analyzer&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22ghcr.io%2Fanselmoo%2Fmcp-server-analyzer%22%5D%7D) [](https://insiders.vscode.dev/redirect/mcp/install?name=analyzer&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22ghcr.io%2Fanselmoo%2Fmcp-server-analyzer%22%5D%7D&quality=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):**
```json
{
"mcp": {
"servers": {
"analyzer": {
"command": "uvx",
"args": ["mcp-server-analyzer"]
}
}
}
}
```
**Using Docker:**
```json
{
"mcp": {
"servers": {
"analyzer": {
"command": "docker",
"args": ["run", "-i", "--rm", "ghcr.io/anselmoo/mcp-server-analyzer"]
}
}
}
}
```
### Universal Installation
```bash
# 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](examples/preview-ruff.md)**
### VULTURE Dead Code Detection Preview
Explore dead code detection capabilities: **[๐งน VULTURE Analysis Preview](examples/preview-vulture.md)**
## ๐ ๏ธ 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`:
```json
{
"mcpServers": {
"analyzer": {
"command": "uvx",
"args": ["mcp-server-analyzer"]
}
}
}
```
### Zed
Add to your Zed settings.json:
```json
"context_servers": {
"analyzer": {
"command": "uvx",
"args": ["mcp-server-analyzer"]
}
}
```
### Claude Code (project-level)
Place `.mcp.json` at your project root:
```json
{
"mcpServers": {
"analyzer": {
"command": "uvx",
"args": ["mcp-server-analyzer"]
}
}
}
```
## ๐งช Development
### Prerequisites
- Python 3.10+
- [uv](https://docs.astral.sh/uv/) (recommended) or pip
- [Docker](https://docker.com) (optional)
### Setup
```bash
# 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
```bash
# 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](https://sigstore.dev/)
- **Container Signing**: Docker images signed with [Cosign](https://docs.sigstore.dev/cosign/overview/)
- **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](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
- **[Full Documentation](https://anselmoo.github.io/mcp-server-analyzer/)** - GitHub Pages docs
- **[Tools Reference](https://anselmoo.github.io/mcp-server-analyzer/tools/)** - Detailed tool parameters and return types
- **[MCP Specification](https://modelcontextprotocol.io/)** - Learn about Model Context Protocol
- **[FastMCP Framework](https://gofastmcp.com/)** - High-performance MCP implementation
- **[Ruff Documentation](https://docs.astral.sh/ruff/)** - Python linter and formatter
- **[ty Documentation](https://docs.astral.sh/ty/)** - Python type checker and language server
- **[Vulture Documentation](https://github.com/jendrikseipp/vulture)** - Dead code finder
## ๐ค Contributing
Contributions are welcome! Please see [CONTRIBUTING.md](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](https://www.conventionalcommits.org/)
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](LICENSE) file for details.
## ๐ Acknowledgments
- [Astral](https://astral.sh/) for RUFF and uv
- [Jendrik Seipp](https://github.com/jendrikseipp) for VULTURE
- [Model Context Protocol](https://modelcontextprotocol.io/) team
- [FastMCP](https://gofastmcp.com/) framework
---
**Made with โค๏ธ for better Python code quality**