python-mcp

python-mcp

This MCP server provides direct access to ruff linting, formatting checks, and ty type-checking for Python projects, with token-efficient, structured output.

Category
Visit Server

README

python-mcp

A Model Context Protocol (MCP) server for running ruff and ty with token-efficient output.

Overview

python-mcp gives LLMs direct access to lint, format-check, and type-check Python projects. Tool output is parsed structurally and reduced to compact diagnostics before it reaches the model.

Features

  • ruff_check - Lint files, glob patterns, or everything; changed_only checks just the files touched in git
  • ruff_format - Verify formatting without modifying files
  • ty_check - Type-check with concise output and an optional error/warning severity filter
  • Structured parsing - ruff JSON and ty GitLab code-quality output avoid fragile parsing of human-readable text
  • Adaptive aggregation - large result sets include rule/file rollups before flat diagnostics, reducing repeated context
  • changed_only - Check only staged, unstaged, and untracked Python files (*.py, *.pyi)

How It Works

python-mcp implements the Model Context Protocol to expose ruff and ty through three read-only tools. All tools return a CheckResult with token-efficient output text and the underlying exit_code.

Tools

  • ruff_check(paths?, changed_only?) - Run ruff linting
  • ruff_format(paths?, changed_only?) - Run ruff format --check
  • ty_check(paths?, level?, changed_only?) - Run ty check --output-format concise, filtering by all / error / warning

Output Processing

Command Input format Output
ruff check JSON Compact grouped output; large runs get rule/file rollups
ruff format --check Concise text One line per unformatted file
ty check GitLab JSON Compact grouped output; severity filter applied

Small and medium result sets use the plugin-compatible grouped layout because it has lower overhead. Large result sets switch to an rtk-like layout with Top rules, Top files, and flat diagnostic lines. This addresses rtk's large-result advantage without adding an external runtime dependency.

Usage

To start the server:

uvx python-mcp

Or from a checkout:

uv run python-mcp

Configure an MCP client to launch the server in the project directory to check, e.g. for opencode:

{
  "mcp": {
    "python-mcp": {
      "type": "stdio",
      "command": "uvx",
      "args": ["python-mcp"]
    }
  }
}

The server checks the project in its working directory. To target another directory, set PYTHON_MCP_PROJECT_DIR.

Agent Skill

Install the bundled python-mcp skill in a project when the agent client discovers skills from .agents/skills:

uvx python-mcp skill install python-mcp --target .

The skill directs agents to the server's three read-only tools: ruff_check, ruff_format, and ty_check. It does not describe uv package or environment management.

Configuration

Environment variables, all optional:

  • PYTHON_MCP_LOG_LEVEL - Logging level, default INFO
  • PYTHON_MCP_PROJECT_DIR - Project directory to check, default: server working directory
  • PYTHON_MCP_COMMAND_PREFIX - Prefix for native ruff/ty invocations, default uv run; set to empty to use binaries from PATH
  • PYTHON_MCP_COMMAND_TIMEOUT - Optional command timeout in seconds

Development

This project is built with FastMCP and uv.

uv sync --extra dev
uv run ruff check
uv run ty check
uv run pytest

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured