Skip to content
Skillpedia
βœ“ Official Β· ludo-technologies● Free and open sourceπŸ’» LocalπŸ”“ No API keyProgramming

pyscn

Lets your AI agent analyze Python code for dead code, duplicates, complexity, bad structure and an overall health score.

1.1k stars on GitHubby ludo-technologiesLicense MITUpdated 21 days ago

How to install

This MCP is local: it runs on your computer.

It works in apps installed on your PC (Claude Desktop, Claude Code, Cursor, VS Code…). Choose your app:

Paste in the terminal:

claude mcp add pyscn -- uvx pyscn-mcp

What to fill in

NameWhat it isRequired
PYSCN_CONFIGPath to a .pyscn.toml configuration file. Defaults to the usual config discovery (.pyscn.toml, then pyproject.toml) starting from the analyzed directory.No

Ready! Now test it

Restart the app and paste one of these requests in the chat:

Analyze the code quality of the app/ directory.
Find duplicate code and help me refactor it.

What it is

pyscn is a code quality analyzer for Python. One command scores the whole codebase from 0 to 100 with an A-F grade and builds an HTML report showing what to fix first. The bundled pyscn-mcp server gives AI agents the same analyses as MCP tools.

What it can do

  • Find dead code you can safely delete
  • Detect duplicate and similar code (clone types 1-4)
  • Measure cyclomatic and cognitive complexity
  • Spot circular imports and layer rule violations
  • Check class design with coupling and cohesion measures
  • pyscn check: a fast pass or fail check for CI

When to use

  • β€ΊWhen you use AI to write Python and want to keep the code maintainable
  • β€ΊWhen you want to know which duplicate code to merge first
  • β€ΊWhen you want a quality gate that fails the build on high complexity

What you need

You need uv (uvx) or pipx to run it. On an Intel Mac, use Homebrew or go install, since PyPI wheels are built for Apple Silicon only.

Skills that pair well

⭐ Skillpedia MCP Β· freeYour agent finds the right skill on its ownInstall our MCP and your agent searches 15,000+ skills whenever it needs one.Install for free β†’

Frequently asked questions

Is it free and open source?

Yes. It is released under the MIT License.

Does it only check Python?

pyscn is the Python analyzer of polyscan. For JavaScript, TypeScript, Go, Rust and C++, the readme says to run npx polyscan analyze.

How fast is it?

The readme says it handles 100,000+ lines per second and is built with Go and tree-sitter.

Is the MCP server required?

No. The readme calls the MCP server optional and recommends Agent Skills as the main way to use it with an agent.

How do I set thresholds?

Create a .pyscn.toml file with pyscn init, or add [tool.pyscn] to pyproject.toml.

Can I use it in CI?

Yes. pyscn check is a CI-friendly gate with flags such as --max-complexity and --max-cycles.

If it does not work

  • β€ΊOn an Intel Mac, install with brew install pyscn or go install, since uvx and pipx cannot install it there.
  • β€ΊCheck that uvx is installed, because the MCP server starts with uvx pyscn-mcp.
  • β€ΊSet PYSCN_CONFIG to your .pyscn.toml path if the server ignores your settings.

5 new skills a week. 1 minute to read.