Sponsored by Deepsite.site

MCP Code Checker

Created By
MarcusJellinghaus9 months ago
MCP server providing code quality checks (pylint and pytest) with smart LLM-friendly prompts for analysis and fixes. Enables Claude and other AI assistants to analyze your code and suggest improvements.
Content

MCP Code Checker

A Model Context Protocol (MCP) server providing code quality checking operations. This server offers a 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) or other MCP-compatible systems to perform quality checks on your code. With these capabilities, AI assistants can:

  • Run pylint checks to identify code quality issues
  • Execute pytest to identify failing tests
  • Generate smart prompts for LLMs to explain issues and suggest fixes
  • Combine multiple checks for comprehensive code quality analysis

All operations are securely contained within your specified project directory, giving you control while enabling powerful AI collaboration for code quality improvement.

By connecting your AI assistant to your code checking tools, you can transform your debugging workflow - describe what you need in natural language and let the AI identify and fix issues directly in your project files.

Features

  • run_pylint_check: Run pylint on the project code and generate smart prompts for LLMs
  • run_pytest_check: Run pytest on the project code and generate smart prompts for LLMs
  • run_all_checks: Run all code checks (pylint and pytest) and generate combined results

Installation

# Clone the repository
git clone https://github.com/yourusername/mcp-code-checker.git
cd mcp-code-checker

# Create and activate a virtual environment (optional but recommended)
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
pip install -e .

Running the Server

python -m src.main --project-dir /path/to/project

The server uses FastMCP for operation. The project directory parameter (--project-dir) is required for security reasons. All code checking operations will be restricted to this directory.

Using with Claude Desktop App

To enable Claude to use this code checking server for analyzing files in your local environment:

  1. Create or modify the Claude configuration file:

    • Location: %APPDATA%\Claude\claude_desktop_config.json (on Windows)
    • On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  2. Add the MCP server configuration to the file:

{
    "mcpServers": {
        "code_checker": {
            "command": "C:\\path\\to\\mcp_code_checker\\.venv\\Scripts\\python.exe",
            "args": [                
                "C:\\path\\to\\mcp_code_checker\\src\\main.py",
                "--project-dir",
                "C:\\path\\to\\your\\project"
            ],
            "env": {
                "PYTHONPATH": "C:\\path\\to\\mcp_code_checker\\"
            }
        }
    }
}
  1. Replace all C:\\path\\to\\ instances with your actual paths:

    • Point to your Python virtual environment
    • Set the project directory to the folder you want Claude to check
    • Make sure the PYTHONPATH points to the mcp_code_checker root folder
  2. Restart the Claude desktop app to apply changes

Claude will now be able to analyze code in your specified project directory.

  1. Log files location:
    • Windows: %APPDATA%\Claude\logs
    • These logs can be helpful for troubleshooting issues with the MCP server connection

For more information on logging and troubleshooting, see the MCP Documentation.

Using MCP Inspector

MCP Inspector allows you to debug and test your MCP server:

  1. Start MCP Inspector by running:
npx @modelcontextprotocol/inspector \
  uv \
  --directory C:\path\to\mcp_code_checker \
  run \
  src\main.py
  1. In the MCP Inspector web UI, configure with the following:

    • Python interpreter: C:\path\to\mcp_code_checker\.venv\Scripts\python.exe
    • Arguments: C:\path\to\mcp_code_checker\src\main.py --project-dir C:\path\to\your\project
    • Environment variables:
      • Name: PYTHONPATH
      • Value: C:\path\to\mcp_code_checker\
  2. This will launch the server and provide a debug interface for testing the available tools.

Available Tools

The server exposes the following MCP tools:

Run Pylint Check

  • Runs pylint on the project code and generates smart prompts for LLMs
  • Returns: A string containing either pylint results or a prompt for an LLM to interpret
  • Helps identify code quality issues, style problems, and potential bugs

Run Pytest Check

  • Runs pytest on the project code and generates smart prompts for LLMs
  • Returns: A string containing either pytest results or a prompt for an LLM to interpret
  • Identifies failing tests and provides detailed information about test failures

Run All Checks

  • Runs all code checks (pylint and pytest) and generates combined results
  • Returns: A string containing results from all checks and/or LLM prompts
  • Provides a comprehensive analysis of code quality in a single operation

Security Features

  • All checks are performed within the specified project directory
  • Code execution is limited to the Python test files within the project
  • Results are formatted for easy interpretation by both humans and LLMs

Development

Setting Up Development Environment

# Clone the repository
git clone https://github.com/yourusername/mcp-code-checker.git
cd mcp-code-checker

# Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
pip install -e .

# For development dependencies
pip install -e ".[dev]"

Running with MCP Dev Tools

# Set the PYTHONPATH and run the server module using mcp dev
set PYTHONPATH=. && mcp dev src/server.py

License

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.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Amap Maps高德地图官方 MCP Server
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
DeepChatYour AI Partner on Desktop
WindsurfThe new purpose-built IDE to harness magic
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
CursorThe AI Code Editor
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
ChatWiseThe second fastest AI chatbot™
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Playwright McpPlaywright MCP server
Tavily Mcp
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Serper MCP ServerA Serper MCP Server
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.