trace-mcp
Local code graph of a repository, queried over MCP for impact, call paths and context
Structural quality checks for Python code: complexity, clones, dead code, coupling and a health score
By ludo-technologies Go Local · stdio Developer tools
45 popularity score ★ 1.1k ↓ 2.5k/mo
Opens the app, which asks before it adds the server.
claude mcp add pyscn -- uvx pyscn-mcp{
"mcpServers": {
"pyscn": {
"command": "uvx",
"args": [
"pyscn-mcp"
]
}
}
}{
"mcpServers": {
"pyscn": {
"command": "uvx",
"args": [
"pyscn-mcp"
]
}
}
}{
"servers": {
"pyscn": {
"type": "stdio",
"command": "uvx",
"args": [
"pyscn-mcp"
]
}
}
}[mcp_servers.pyscn]
command = "uvx"
args = ["pyscn-mcp"]gemini mcp add --scope user pyscn uvx -- pyscn-mcpPYSCN_CONFIG |
Optional: Path to a .pyscn.toml file. Without it, the server looks upward from its working directory for .pyscn.toml or pyproject.toml. |
|---|
pyscn is a Python code quality analyzer written in Go on tree-sitter, and pyscn-mcp is its MCP server. It gives an assistant the same analyses as the pyscn command line, so the assistant can check a file or directory it has just edited without a shell. You pass a path and get JSON back. The checks cover cyclomatic complexity, near-duplicate code (Type 1-4 clones), unreachable code, class coupling (CBO) and cohesion (LCOM4), dependency-injection anti-patterns, and an overall 0-100 health score with an A-F grade.
The broadest tool, analyze_code, runs every analysis by default, including module community detection. With output_mode set to "full", it also returns a context map that groups modules by their import structure, so an agent can see which files belong together in a review. The narrower tools return a summary by default and can return detailed or full output. max_results caps the findings, and 0 (the default) means no cap.
The server registers 8 tools in mcp/tools.go at v1.32.4, but the tool table in the MCP README lists only 6. It leaves out check_cohesion and detect_di_antipatterns, and the server's startup log also names only 6. Settings come from a .pyscn.toml file, or from a [tool.pyscn] section in pyproject.toml. The server finds that file by searching upward from its working directory, or loads the path given in PYSCN_CONFIG.
| Runtime | Python |
|---|
uv, for the uvx command its docs give. pipx or pip also install the pyscn-mcp package from PyPI. The Python code you want analysed must be on the same machine. The package ships a compiled binary, and the main README says pyscn's PyPI wheels have been built for Apple Silicon only since v1.5.1, so they do not install on Intel Macs (there it points to Homebrew or go install).
It analyses Python only. Its makers point to their separate polyscan tool for JavaScript, TypeScript, Go, Rust and C++. It reports problems but does not fix or edit code. If PYSCN_CONFIG names a file that fails to load, the server still starts with built-in defaults, but analyze_code then returns the configuration error instead of results. The README warns about this case. Without PYSCN_CONFIG, the configuration is looked up from the server's working directory, which may not be your project when a client starts it elsewhere.
It suits Python developers who want an assistant to measure structural quality (complexity, duplication, dead code, coupling) as it refactors, all on their own machine with no account. It reads files only and changes nothing. If your agent can already run shell commands, the makers recommend their Agent Skills, which call the pyscn CLI, and present the MCP server as optional. For codebases that are not Python, look elsewhere.
analyze_codecheck_complexitydetect_clonescheck_couplingcheck_cohesionfind_dead_codeget_health_scoredetect_di_antipatterns