by MarcusJellinghaus
Provides code quality checking operations (pylint, pytest, mypy) with LLM‑friendly prompts, enabling AI assistants to analyze Python projects and suggest improvements.
MCP Tools Py offers a Model Context Protocol (MCP) server that runs static analysis, testing, and type‑checking tools on a Python codebase and formats the results as smart prompts for large language models. It limits execution to the specified project directory, logs operations in structured JSON, and presents output in a concise, AI‑ready form.
pip install git+https://github.com/MarcusJellinghaus/mcp-tools-py.git
mcp-tools-py --project-dir /path/to/your/project [options]
Common options include --venv-path or --python-executable to select the environment where pylint, pytest, and mypy are installed, --log-level to control verbosity, and --log-file to write structured logs.mcp-tools-py command with the same arguments. The client can then request specific tools such as run_pylint_check, run_pytest_check, or run_mypy_check.pyproject.toml for configuration, and returns LLM‑ready prompts.pyproject.toml when not supplied.project_dir.Q: Which Python interpreter should I point to?
A: Use --venv-path to specify the virtual environment that contains pytest, pylint, and mypy. If omitted, the server falls back to the interpreter used for installing the package.
Q: What if the required tools are not installed? A: The server will raise a “No module named …” error. Install the missing tools in the selected environment and restart the server.
Q: Can I analyze a project with a custom folder layout?
A: Yes. Provide target_directories (for pylint/mypy) or test-folder (for pytest) to override the auto‑detected defaults.
Q: How are logs stored?
A: By default logs are written to project_dir/logs/mcp_tools_py_<timestamp>.log in JSON format. Use --console-only to suppress file logging.
Q: Is parallel test execution safe?
A: Parallelism is enabled via pytest‑xdist (-n auto). Ensure your tests are written to be thread‑/process‑safe.
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 on Python projects. The tools provided are:
Scope: This server covers Python projects only. Further Python-specific extensions are planned, including architecture and layering checks (vulture, tach, import-linter) and refactoring tools. 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:
project_dir.run_pylint_check: Run pylint on the project code and generate smart prompts for LLMsrun_pytest_check: Run pytest on the project code and generate smart prompts for LLMsrun_mypy_check: Run mypy type checking on the project codeThe 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 |
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.
When target_directories is not specified, all checker tools (pylint, mypy, vulture)
auto-detect directories from pyproject.toml:
[tool.setuptools.packages.find] where (fallback: ["src"])[tool.pytest.ini_options] testpaths (fallback: ["tests"])Only directories that exist on disk are included. You can override auto-detection by passing an explicit list:
["src"] - Analyze only source code directory["src", "tests"] - Analyze both source and test directories["mypackage", "tests"] - For projects with different package structures["."] - Analyze entire project directory (may be slow for large projects)run_pytest_check exposes the following parameters for customization:
| Parameter | Type | Default | Description |
|---|---|---|---|
markers |
list | None | Optional list of pytest markers to filter tests |
verbosity |
integer | 2 | Pytest verbosity level (0-3) |
extra_args |
list | None | Optional list of additional pytest arguments |
env_vars |
dictionary | None | Optional environment variables for the subprocess |
Note: Parallel test execution is enabled by default using pytest-xdist (-n auto).
The mypy tools expose the following parameters for customization:
| Parameter | Type | Default | Description |
|---|---|---|---|
strict |
boolean | True | Use strict mode settings |
disable_error_codes |
list | None | List of mypy error codes to ignore |
target_directories |
list | None (auto-detected) | Directories to check relative to project_dir. Auto-detected from pyproject.toml when omitted |
follow_imports |
string | 'normal' | How to handle imports during type checking |
mcp-tools-py --project-dir /path/to/project [options]
| Parameter | Type | Description |
|---|---|---|
--project-dir |
string | Required. Base directory for code checking operations |
| Parameter | Type | Default | Description |
|---|---|---|---|
--python-executable |
string | sys.executable | Path to Python interpreter for running pytest, pylint, and mypy. Should point to the environment where these tools are installed (the tool's own venv), not the project's runtime venv |
--venv-path |
string | None | Path to the virtual environment where pytest, pylint, and mypy are installed. When specified, this venv's Python will be used instead of --python-executable. This should be the tool's own venv, not the project's runtime venv |
| Parameter | Type | Default | Description |
|---|---|---|---|
--test-folder |
string | "tests" | Path to the test folder (relative to project-dir) |
--keep-temp-files |
flag | False | Keep temporary files after test execution. Useful for debugging when tests fail |
| Parameter | Type | Default | Description |
|---|---|---|---|
--log-level |
string | "INFO" | Set logging level. Choices: DEBUG, INFO, WARNING, ERROR, CRITICAL |
--log-file |
string | None | Path for structured JSON logs. If not specified, logs only to console |
--console-only |
flag | False | Log only to console, ignore --log-file parameter |
--venv-path is specified, it takes precedence over --python-executable--console-only flag is useful during development to avoid creating log files--keep-temp-files is specifiedThe --python-executable and --venv-path options must point to the environment where pytest, pylint, and mypy are installed — this is typically the tool's own virtual environment, not your project's runtime venv.
Point to the venv where mcp-tools-py and its tools are installed:
{
"mcpServers": {
"mcp-tools-py": {
"command": "mcp-tools-py",
"args": [
"--project-dir", "/path/to/your/project",
"--venv-path", "${VIRTUAL_ENV}"
]
}
}
}
Do not point to your project's runtime venv if it doesn't have pytest/pylint/mypy installed:
{
"mcpServers": {
"mcp-tools-py": {
"command": "mcp-tools-py",
"args": [
"--project-dir", "/path/to/your/project",
"--venv-path", "/path/to/your/project/.venv"
]
}
}
}
This will fail if your project's .venv doesn't have the required tools installed.
--python-executable or --venv-path points to an environment that doesn't have the required tools installed. Update the configuration to point to the correct environment.See INSTALL.md for detailed installation instructions.
Quick install:
# Install from GitHub (recommended)
pip install git+https://github.com/MarcusJellinghaus/mcp-tools-py.git
# Verify installation
mcp-tools-py --help
Development install:
# Clone and install for development
git clone https://github.com/MarcusJellinghaus/mcp-tools-py.git
cd mcp-tools-py
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -e ".[dev]"
mcp-tools-py --help
This server can be easily configured using the mcp-config Python tool. The mcp-config tool provides:
Prerequisites: Install Python and the mcp-config tool.
Note: While other MCP clients like Windsurf and Cursor support MCP servers, they may require manual configuration.
Add this line to your requirements.txt:
mcp-tools-py @ git+https://github.com/MarcusJellinghaus/mcp-tools-py.git
Add to your project dependencies:
[project]
dependencies = [
"mcp-tools-py @ git+https://github.com/MarcusJellinghaus/mcp-tools-py.git",
# ... other dependencies
]
# Or as an optional dependency
[project.optional-dependencies]
dev = [
"mcp-tools-py @ git+https://github.com/MarcusJellinghaus/mcp-tools-py.git",
]
After adding to requirements.txt or pyproject.toml:
# Install from requirements.txt
pip install -r requirements.txt
# Install from pyproject.toml
pip install .
# Or with optional dependencies
pip install ".[dev]"
After installation, you can run the server using the mcp-tools-py command:
mcp-tools-py --project-dir /path/to/project [options]
You can also run the server as a Python module:
python -m mcp_tools_py --project-dir /path/to/project [options]
# Or for development (from source directory)
python -m src.main --project-dir /path/to/project [options]
For detailed information about all available command-line options, see the CLI section.
The server automatically detects and analyzes Python code in standard project structures:
Default Analysis:
src/ directory (if present) - Main source codetests/ directory (if present) - Test filesCustom Project Structures:
Use the target_directories parameter to specify different directories:
# For a package-based structure
target_directories = ["mypackage", "tests"]
# For a simple project with code in root
target_directories = ["."]
# For complex multi-module projects
target_directories = ["module1", "module2", "shared", "tests"]
The server provides comprehensive logging capabilities:
project_dir/logs/mcp_tools_py_{timestamp}.logExample structured log entries:
{
"timestamp": "2025-08-05 14:30:15",
"level": "info",
"event": "Starting pylint check",
"project_dir": "/path/to/project",
"disable_codes": ["C0114", "C0116"],
"target_directories": ["src", "tests"]
}
Use --console-only to disable file logging for simple development scenarios.
First install the server:
pip install git+https://github.com/MarcusJellinghaus/mcp-tools-py.git
Configure with mcp-config:
mcp-config
Then select "Add New" and search for this server, or run directly:
mcp-config mcp-tools-py
This will prompt you for your project directory and automatically configure your MCP client.
If you prefer manual configuration, edit your MCP configuration file:
Claude Desktop (%APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"mcp-tools-py": {
"command": "mcp-tools-py",
"args": ["--project-dir", "/path/to/your/project"]
}
}
}
For development mode:
{
"mcpServers": {
"mcp-tools-py": {
"command": "python",
"args": [
"-m",
"src.main",
"--project-dir",
"/path/to/your/project"
],
"env": {
"PYTHONPATH": "/path/to/mcp-tools-py"
}
}
}
}
VSCode (.vscode/mcp.json):
{
"servers": {
"mcp-tools-py": {
"command": "mcp-tools-py",
"args": ["--project-dir", "."]
}
}
}
VSCode development mode:
{
"servers": {
"mcp-tools-py": {
"command": "python",
"args": ["-m", "src.main", "--project-dir", "."],
"env": {
"PYTHONPATH": "/path/to/mcp-tools-py"
}
}
}
}
npx @modelcontextprotocol/inspector mcp-tools-py --project-dir /path/to/project
The server exposes the following MCP tools:
target_directories parameter# Clone the repository
git clone https://github.com/MarcusJellinghaus/mcp-tools-py.git
cd mcp-tools-py
# Create and activate a virtual environment
python -m venv .venv
# On Windows:
.venv\Scripts\activate
# On Unix/MacOS:
source .venv/bin/activate
# Install dependencies
pip install -e .
# Install development dependencies
pip install -e ".[dev]"
# Set the PYTHONPATH and run the server module using mcp dev
set PYTHONPATH=. && mcp dev src/server.py
This project is licensed under the MIT License - see the LICENSE file for details.
The MIT License is a permissive license that allows reuse with minimal restrictions. It permits use, copying, modification, and distribution with proper attribution.
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by modelcontextprotocol
A Model Context Protocol server for Git repository interaction and automation.
by zed-industries
A high‑performance, multiplayer code editor designed for speed and collaboration.
by modelcontextprotocol
Model Context Protocol Servers
by modelcontextprotocol
A Model Context Protocol server that provides time and timezone conversion capabilities.
by cline
An autonomous coding assistant that can create and edit files, execute terminal commands, and interact with a browser directly from your IDE, operating step‑by‑step with explicit user permission.
by upstash
Provides up-to-date, version‑specific library documentation and code examples directly inside LLM prompts, eliminating outdated information and hallucinated APIs.
by daytonaio
Provides a secure, elastic infrastructure that creates isolated sandboxes for running AI‑generated code with sub‑90 ms startup, unlimited persistence, and OCI/Docker compatibility.
by continuedev
Enables faster shipping of code by integrating continuous AI agents across IDEs, terminals, and CI pipelines, offering chat, edit, autocomplete, and customizable agent workflows.
by github
Connects AI tools directly to GitHub, enabling natural‑language interactions for repository browsing, issue and pull‑request management, CI/CD monitoring, code‑security analysis, and team collaboration.