# pyscn

> pyscn is an open-source MCP server for developer tools. Python code health analysis for AI agents: complexity, dead code, clones, coupling. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, self-hosted, macOS, Linux
- **Website:** https://pyscn.ludo-tech.org
- **Repository:** https://github.com/ludo-technologies/pyscn
- **MCP Registry name:** io.github.ludo-technologies/pyscn
- **Categories:** developer tools
- **Listing updated:** 2026-11-14

## About

pyscn scores a whole Python codebase from 0 to 100 with an A-F grade and writes an HTML report that points at what to fix first. It looks at the code from six angles: dead code, duplicate code (clone types 1 to 4), cyclomatic and cognitive complexity, per-file and per-directory hotspots, architecture (circular imports and layer rules for clean, layered, hexagonal and MVC presets) and class design measured by CBO coupling and LCOM4 cohesion.

The analyzer is written in Go on tree-sitter and the README quotes more than 100,000 lines per second. The bundled pyscn-mcp server hands the same analyses to Claude Code, Cursor, ChatGPT and other clients, and the project also ships Agent Skills that teach coding agents when to run each check. A PYSCN_CONFIG variable can point to a .pyscn.toml file.

It runs locally through uvx or pipx. The same team makes polyscan for JavaScript, TypeScript, Go, Rust and C++, and a GitHub app that files a weekly audit as an issue.

## Features

- **Health score:** Gives a 0-100 score and A-F grade for the whole codebase with an HTML report.
- **Clone detection:** Finds Type 1-4 duplicate code worth merging.
- **Complexity measures:** Reports cyclomatic and cognitive complexity for hard-to-test functions.
- **Architecture checks:** Flags circular imports and layer rule violations against preset layouts.
- **Class design metrics:** Measures coupling (CBO) and cohesion (LCOM4) to find classes doing too much.
- **Agent skills:** Ships skills that tell coding agents when to run each analysis.

## Good for

- Ask an agent to rate the quality of an app directory
- Find copy-pasted code and plan a refactor
- Spot circular imports before they spread
- Keep AI-generated Python maintainable in CI reports

## Install

### Claude Code (Terminal)

```sh
claude mcp add pyscn -- uvx pyscn-mcp
```

### Claude Desktop (claude_desktop_config.json)

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

### Cursor (~/.cursor/mcp.json)

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

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "pyscn": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "pyscn-mcp"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

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

### Other clients (your client's MCP settings (most use this shape))

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

## FAQ

### How do I run it without installing?

Use uvx pyscn@latest analyze . or pipx run pyscn analyze .

### How do I add the MCP server to Claude Code?

Run claude mcp add pyscn-mcp uvx -- pyscn-mcp.

### Does it support other languages?

pyscn is Python only; polyscan covers JavaScript, TypeScript, Go, Rust and C++.

### Can I configure it?

Yes. Set PYSCN_CONFIG to a .pyscn.toml path, or let it discover .pyscn.toml or pyproject.toml.

### Is pyscn free?

Yes. pyscn is open source, so you can use and self-host it for free.

### How do I add pyscn to Claude Code?

Run this command in your terminal: claude mcp add pyscn -- uvx pyscn-mcp

### What are the best alternatives to pyscn?

The closest alternatives to pyscn are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Concord MCP](https://ai-powered.com/mcp/concord-mcp): Concord MCP is a freemium MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/pyscn
