# pyscn [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/ludo-technologies/pyscn  
**GitHub Stars:** 1116  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/pyscn

## Description
Python code analysis for AI agents: complexity, dead code, clones, coupling, and a health score.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "pyscn": {
    "command": "uvx",
    "args": ["pyscn-mcp"]
  }
}
```

## Documentation

## What pyscn does

pyscn MCP server gives coding agents access to structural analysis for Python projects. Its analyses cover several dimensions of maintainability:

- Complexity at function and executable class-suite level, including cyclomatic and cognitive measures
- Unreachable or otherwise dead code
- Copy-pasted and structurally similar code, including Type 1 through Type 4 clone detection
- Module and directory hotspots for prioritizing refactoring
- Circular imports, dependency relationships, layer-rule violations, and detected module communities
- Class coupling and cohesion through CBO and LCOM4 metrics

The analyzer combines these findings into a 0–100 health score with an A–F grade. The underlying pyscn CLI can also produce HTML and JSON reports, while its `check` command provides a faster quality gate for CI workflows.

## How it works

The MCP package is invoked as the `pyscn-mcp` command. A compatible client starts it over the standard input/output MCP transport, and the agent can then request the available analyses against a Python project. The server exposes the same analysis family used by the command-line application rather than introducing a separate ruleset.

pyscn is implemented with Go and tree-sitter. The command-line analyzer supports running all checks together or selecting areas such as complexity, dependencies, and dead code. Community detection can also be skipped when it is not needed.

## Setup and configuration

Install the command through `uvx` as part of the client configuration. For Claude Code, the direct setup is:

```bash
claude mcp add pyscn-mcp uvx -- pyscn-mcp
```

Claude Code also has a plugin installation path that configures the MCP server and the related Agent Skills together. Cursor and Claude Desktop use an MCP settings entry such as:

```json
{
  "mcpServers": {
    "pyscn-mcp": {
      "command": "uvx",
      "args": ["pyscn-mcp"],
      "env": {
        "PYSCN_CONFIG": "/path/to/.pyscn.toml"
      }
    }
  }
}
```

`PYSCN_CONFIG` points the server at a configuration file. pyscn can create a starter file with `pyscn init`; configuration may also live in `.pyscn.toml` or under `[tool.pyscn]` in `pyproject.toml`. Settings include complexity thresholds, dead-code severity, and report output directories.

## Tools and capabilities

Use the MCP server for agent-directed health checks, refactoring investigations, architecture reviews, and CI-oriented reporting. The companion Agent Skills package can teach supported agents when to run health, refactoring, architecture, and CI analyses, but the MCP server itself provides the analysis interface.

The underlying CLI supports JSON output, HTML output, combined JSON and HTML generation, selected analysis groups, and configurable checks such as maximum complexity and allowed dependency cycles. These capabilities make it possible to use the server for both exploratory code review and repeatable quality checks.

## Limitations and notes

pyscn focuses on Python. The related Polyscan project provides analysis for JavaScript, TypeScript, Go, Rust, and C++, but those languages are outside this server’s scope.

On Intel Macs, PyPI wheels are unavailable. Installation on macOS x86_64 requires Homebrew or building through `go install`; Apple Silicon installation can use the documented Python tooling. The project is released under the MIT License.

_Full upstream README: https://allmcps.com/mcp/pyscn/readme_

