Pyscn logo

Pyscn

Exposes Python code quality analysis through MCP, covering complexity, dead code, clones, dependencies, architecture, and health scores.

Install Pyscn

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "pyscn": {
      "command": "uvx",
      "args": [
        "pyscn-mcp"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Install not yet sandbox-tested— we haven't run this command through our automated sandbox yet. Not a red flag; we're working through the catalog.

Overview

pyscn MCP server exposes pyscn’s Python code analysis through MCP tools for Claude Code, Cursor, Claude Desktop, and other MCP clients. It covers complexity, dead code, duplicate-code detection, dependency and architecture checks, class design, hotspots, and overall health scoring. Run it through `uvx pyscn-mcp` and optionally point it at a `.pyscn.toml` configuration file. Reach for it when an agent needs structured code-quality analysis while reviewing, refactoring, or checking a Python repository.

Use cases

  • Review a Python repository’s overall health before a refactor
  • Find duplicate code and identify consolidation targets
  • Locate complex functions and classes for simplification
  • Inspect circular imports and architecture-layer violations
  • Check a codebase against complexity and dependency thresholds

Key features

  • MCP access to Python code analysis
  • Cyclomatic and cognitive complexity checks
  • Type 1–4 duplicate-code detection
  • Dead-code and dependency analysis
  • Architecture, hotspot, and class-design metrics
  • 0–100 health score with A–F grade

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked Today

Recent health check succeeded.

18/18 checks healthy over the last 43d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 15d ago via OSV.dev · pyscn-mcp (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars1.1kStargazers on the source repository.
Last commit1d agoMost recent push to the default branch.
Directory activity1 viewsConfig copies, upvotes, and views on AllMCPs.

How Pyscn works

What pyscn MCP server does

pyscn MCP server brings structural analysis of Python repositories into MCP-compatible coding agents. Its analyses cover five broad areas: code complexity, unused or unreachable code, duplicate and structurally similar code, dependency and architecture relationships, and class design. Results contribute to a repository health score from 0 to 100 with an A–F grade.

The server exposes the same analysis family available through the pyscn command-line tool. Agents can use it to inspect a codebase, identify refactoring targets, review architectural structure, or produce quality information suitable for development and CI workflows.

How it works

The server runs as a local stdio MCP process. A client starts pyscn-mcp, and the process makes pyscn analyses available as MCP operations. The underlying analyzer is implemented with Go and tree-sitter and is intended for Python source code.

Analysis can examine function and executable-class complexity, including cyclomatic and cognitive complexity. It can detect dead code, Type 1–4 clones, circular imports, architecture-layer violations, module communities, coupling, and low class cohesion. File and directory hotspots help an agent prioritize areas for review rather than treating every finding equally.

pyscn also supports a separate command-line workflow. The CLI can generate HTML or JSON reports, run selected analyses, and perform fast quality checks with configurable thresholds. The MCP server is useful when those decisions need to happen inside an agent conversation instead of as a manually invoked command.

Setup and configuration

The documented launch command uses uvx:

Terminal
claude mcp add pyscn-mcp uvx -- pyscn-mcp

For Cursor or Claude Desktop, add a server entry whose command is uvx and whose argument is pyscn-mcp. A configuration file can be supplied through the PYSCN_CONFIG environment variable:

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

The configuration file may be .pyscn.toml, or the settings can be placed under [tool.pyscn] in pyproject.toml. Supported examples include a maximum complexity threshold, a minimum dead-code severity, and an output directory. pyscn init can generate a complete configuration file when using the CLI.

Claude Code also has a plugin installation path that sets up the MCP server together with the project’s Agent Skills. The MCP setup is optional; the skills provide a separate way to guide agents on when to run health checks, refactoring analysis, architecture reviews, and CI-oriented reports.

Tools and capabilities

  • Analyze Python complexity using cyclomatic and cognitive measures.
  • Find dead or unreachable code.
  • Detect copied and structurally similar code, including Type 1–4 clones.
  • Inspect circular imports, dependency relationships, and architecture-layer violations.
  • Identify module communities and file or directory hotspots.
  • Evaluate class coupling with CBO and cohesion with LCOM4.
  • Produce an overall 0–100 health score with an A–F grade.
  • Use configured thresholds and project settings through pyscn configuration.

Limitations and notes

pyscn is the Python analyzer in the broader polyscan project; JavaScript, TypeScript, Go, Rust, and C++ analysis uses the separate polyscan command rather than this server. The MCP package is intended for MCP clients, while HTML and JSON report generation and fast pass/fail checks are described as CLI capabilities.

On Intel Macs, the PyPI wheels are not available for the package. The documented alternatives are Homebrew or installing the command from source with Go. This limitation concerns package installation rather than the analysis model itself.

The project is released under the MIT License.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Pyscn

pyscn is an MCP server that connects AI coding clients to Python code analysis for complexity, dead code, duplicate code, dependencies, architecture, hotspots, and class design. Its tools expose pyscn’s structural checks and health scoring so agents can review repositories, suggest refactor targets, and inspect quality issues during development.

Install it for Claude Code with `claude mcp add pyscn-mcp uvx -- pyscn-mcp`, or configure `uvx` with the `pyscn-mcp` argument in Cursor or Claude Desktop. Claude Code also provides a pyscn plugin that installs the MCP server and Agent Skills together.

Yes, pyscn works with Cursor through its MCP settings. Add a server named `pyscn-mcp`, use `uvx` as the command, pass `pyscn-mcp` as the argument, and optionally set `PYSCN_CONFIG` to the path of a `.pyscn.toml` file.

Configure pyscn with `.pyscn.toml` or a `[tool.pyscn]` section in `pyproject.toml`. Settings can define values such as maximum complexity, minimum dead-code severity, and the report directory; `pyscn init` generates a full configuration file for CLI use.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewPyscn AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/pyscn?style=directory)](https://allmcps.com/mcp/pyscn)
HTML Embed
<a href="https://allmcps.com/mcp/pyscn"><img src="https://allmcps.com/api/badge/pyscn?style=directory" alt="Pyscn on AllMCPs" /></a>