
MCP server providing code quality checks (pylint and pytest) with smart LLM-friendly prompts for analysis and fixes.
概览
A Model Context Protocol (MCP) server providing code quality checking operations with easy client configuration. This server offers an API for performing code quality checks within a specified project directory, following the MCP protocol design. This MCP server enables AI assistants like Claude (via Claude Desktop), VSCode with GitHub Copilot, or other MCP-compatible clients to run code quality checks, formatting and refactoring on Python projects. See Available Tools for the full list. This server covers Python projects only. Support for other languages can be provided through separate, dedicated MCP servers with similar functionality. A general-purpose bash MCP tool allows more flexibility, but at the expense of less control. This server takes a more focused approach: - : Only a defined set of tools can be executed — see Available Tools. All operations are scoped to the specified project_dir. - : Results are formatted and size-limited to reduce context load on the AI assistant.
README
以下为原文 README 节选,完整内容请查看原文。
MCP Tools Py
A Model Context Protocol (MCP) server providing code quality checking operations with easy client configuration. This server offers an API for performing code quality checks within a specified project directory, following the MCP protocol design.
Overview
This MCP server enables AI assistants like Claude (via Claude Desktop), VSCode with GitHub Copilot, or other MCP-compatible clients to run code quality checks, formatting and refactoring on Python projects. See Available Tools for the full list.
Scope: This server covers Python projects only. Support for other languages can be provided through separate, dedicated MCP servers with similar functionality.
Why a dedicated MCP server instead of bash access?
A general-purpose bash MCP tool allows more flexibility, but at the expense of less control. This server takes a more focused approach:
- Security: Only a defined set of tools can be executed — see Available Tools. All operations are scoped to the specified
project_dir. - Context management: Results are formatted and size-limited to reduce context load on the AI assistant. Output is structured as actionable prompts rather than raw tool output.
- Transparency: The server is open source, and detailed structured logging records every tool call with parameters, timing, and results.
Features
All tools are listed under Available Tools. The sections below document the parameters of the most-used ones.
Pylint Parameters
The pylint tools expose the following parameters for customization:
| Parameter | Type | Default | Description |
|---|---|---|---|
extra_args |
list | None | Optional list of additional pylint CLI arguments (e.g. ["--disable=W0611"]) |
target_directories |
list | None (auto-detected) | Directories to analyze relative to project_dir. Auto-detected from pyproject.toml when omitted |
max_issues |
integer | 1 | Number of issue types shown in detail; the rest are summarised as counts. 0 = counts only (per-rule count and directory split) |
Pylint Configuration
Pylint reads your project’s pyproject.toml automatically. Control which issues
are reported by configuring [tool.pylint.messages_control] in your pyproject.toml.
See docs/pyproject-configuration.md for examples
and migration guidance.
Target Directory Auto-Detection
When target_directories is not specified, the tools that accept it (pylint, mypy, ruff
check, ruff fix, bandit, vulture, and run_format_code) auto-detect directories from
pyproject.toml:
- Source dirs from
[tool.setuptools.packages.find] where(fallback:["src"]) - Test dirs from
[tool.pytest.ini_options] testpaths(fallback:["tests"])
run_deptry_check auto-detects source directories only, excluding test paths.
安装
npx @modelcontextprotocol/inspector mcp-tools-py --project-dir /path/to/project配置
{
"mcpServers": {
"mcp-tools-py": {
"command": "mcp-tools-py",
"args": [
"--project-dir", "/path/to/your/project",
"--python-executable", "${VIRTUAL_ENV}\\Scripts\\python.exe"
]
}
}
}