pyscn
Python code health analysis for AI agents: complexity, dead code, clones, coupling
- Pricing
- Open source
- Platforms
- CLI, self-hosted, macOS
- Runs
- Locally
- Version
- 1.33.2
- Listing updated
- 3 days ago
About pyscn
pyscn is an open-source MCP server for developer tools. It runs locally on your machine and is started by your AI client.
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.
Install
Run in a terminal
claude mcp add pyscn -- uvx pyscn-mcpAdd to claude_desktop_config.json
{
"mcpServers": {
"pyscn": {
"command": "uvx",
"args": [
"pyscn-mcp"
]
}
}
}Add to ~/.cursor/mcp.json
{
"mcpServers": {
"pyscn": {
"command": "uvx",
"args": [
"pyscn-mcp"
]
}
}
}Add to .vscode/mcp.json
{
"servers": {
"pyscn": {
"type": "stdio",
"command": "uvx",
"args": [
"pyscn-mcp"
]
}
}
}Add to ~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"pyscn": {
"command": "uvx",
"args": [
"pyscn-mcp"
]
}
}
}Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"pyscn": {
"command": "uvx",
"args": [
"pyscn-mcp"
]
}
}
}Configuration
PYSCN_CONFIGPath to a .pyscn.toml configuration file. Defaults to the usual config discovery (.pyscn.toml, then pyproject.toml) starting from the analyzed directory.
What it does
- 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
Pricing
Open source
Free to run locally; the separate Polyscan GitHub app is free for public repos
Prices change. Check pyscn.ludo-tech.org before you buy.
pyscn 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 to pyscn

REA
MCP serverCLI and MCP server that lets coding agents reverse engineer apps and binaries
Runs locally- Open source
- 464K GitHub stars
- Developer tools

Codebase Memory
MCP serverLocal MCP server that builds a code knowledge graph for AI coding agents
Runs locally- Open source
- 48.7K GitHub stars
- Knowledge and memory

GitHub
MCP serverOfficial MCP server connecting AI assistants to GitHub repos, issues and workflows
Not checked yet- Remote
- Open source
- 34.5K GitHub stars
- Developer tools

Serena MCP: the IDE for your agent
MCP serverMCP toolkit giving coding agents symbol-level code retrieval and editing
Runs locally- Open source
- 31.5K GitHub stars
- Developer tools

XERJ
MCP serverLocal search engine for AI agents with cited answers over your code and docs
Runs locally- Open source
- 19.2K GitHub stars
- Knowledge and memory

Ouroboros
MCP serverSpec-first layer that pins requirements and verifies results of AI coding agent work
Runs locally- Open source
- 6.4K GitHub stars
- Developer tools