PyCheckMCP is a Model Context Protocol (MCP) server that bundles popular Python formatting and linting tools behind a single FastMCP endpoint. It can be run as a standalone server for MCP-compatible clients or imported as a regular Python module.
- Unified pipeline that optionally reforms code with Black and isort before running Ruff and Pylint.
- FastMCP HTTP server exposing a
check_python_codetool that works with any MCP-compatible client. - Typed request/response models built with Pydantic for predictable integration.
- Scriptable helper (
check_code) for direct use inside automation, CI jobs, or notebooks.
- Python 3.10+
- uv for dependency management and virtualenv handling
- Clone the repository and move into it:
git clone <your-fork-url> cd PyCheckMCP
- Install dependencies with uv:
uv sync
Start the FastMCP HTTP transport (defaults to 127.0.0.1:8000):
uv run python main.pyOptional flags:
--host 0.0.0.0to listen on every interface--port 9000(or any free port) to customise the binding--testto execute the built-in demonstration instead of starting the server
When running, the MCP server exposes the check_python_code tool. Clients following the MCP spec can invoke it over the Streamable HTTP transport implemented by FastMCP.
Input parameters:
code(str, required) – Python source text to analysestyle_fixes(bool, default: true) – Run Black and isort before lintingtype_check(bool, default: false) – Reserved for future type-checking support
Typical JSON response (values vary depending on the supplied code):
{
"formatted_code": "def greet():\n print('Hello, World!')\n",
"issues": [
{
"code": "W0612",
"message": "Unused variable 'unused_var'",
"line": 3,
"column": 5,
"severity": "warning"
}
],
"error_count": 0,
"warning_count": 1,
"success": true,
"error": null
}The underlying pipeline can be imported directly:
from pycheckmcp.core import check_code
sample = """
def bad_function():
unused_var = 1
print('hi')
"""
result = check_code(sample)
print(result["formatted_code"])
print(result["issues"]) # list of dictionaries with code, message, severity, etc.- Run the local demo:
uv run python main.py --test - Format code:
uv run black .anduv run isort . - Lint quickly:
uv run ruff check . - Run static analysis:
uv run pylint pycheckmcp - Execute tests:
uv run pytest
PyCheckMCP/
├── main.py # CLI entry point that launches the FastMCP server
├── pycheckmcp/
│ ├── core.py # Formatting and linting pipeline
│ └── server.py # FastMCP tool registration
├── pyproject.toml # Project metadata and dependency definitions
└── tests/ # Test scaffolding
MIT License