Introduction
I recently released pyscn, a Python code quality analyzer. The response has been incredible - we reached 850 stars on GitHub within just two weeks, and PyPI statistics show it's being actively used by many developers. I'm deeply grateful to everyone who uses pyscn and to all the contributors.
Today, I'm excited to announce pyscn version 1.2.0, which introduces MCP (Model Context Protocol) support - a highly requested feature. This integration allows AI assistants to analyze Python code quality directly. (Special thanks to qinsehm1128 for implementing this feature!)
Setup
Setting up pyscn MCP is straightforward.
For Claude Code users, you can add the MCP server with a single command:
claude mcp add pyscn-mcp uvx -- pyscn-mcp
For other MCP clients like Cursor, add the following to your config file (e.g., ~/.config/claude-desktop/config.json
):
{
"mcpServers": {
"pyscn-mcp": {
"command": "uvx",
"args": ["pyscn-mcp"],
"env": {
"PYSCN_CONFIG": "/path/to/.pyscn.toml"
}
}
}
}
Usage
Once configured, simply ask your AI assistant things like:
- "Analyze the code quality of the app/ directory"
- "Find duplicate code and help me refactor it"
Claude or ChatGPT will invoke the MCP tools to analyze and help refactor your code.
Features
pyscn MCP currently provides the following tools:
- analyze_code - Comprehensive code quality analysis (all analyses at once)
- check_complexity - Cyclomatic complexity analysis (McCabe complexity, nesting depth)
- detect_clones - Code clone detection (APTED + LSH, Type 1-4 clones)
- check_coupling - Class coupling analysis (CBO metrics)
- find_dead_code - Dead code detection (CFG-based, unreachable code)
- get_health_score - Code health score (0-100 points, grades A-F)
Conclusion
Give pyscn MCP a try and integrate code quality analysis into your development workflow. Clean code design makes AI-assisted coding far more efficient.
If you have feedback, please share it via comments, X (Twitter), or GitHub issues. Real-world usage feedback is invaluable for improving the product.
Links:
Top comments (0)