MCP Pyrefly is an MCP server that integrates Pyrefly's high-speed type checker to provide real-time Python code validation and consistency analysis for LLM-driven coding workflows. It connects AI assistants like Claude to Python linting, type-checking, and naming consistency engines, allowing developers and automated agents to catch code defects immediately upon generation. Pyrefly evaluates source files, identifies syntax and typing errors, checks naming patterns such as camelCase versus snake_case, and suggests actionable corrections across multiple files. The server introduces an experimental gamification and reinforcement mechanism—termed the Lollipop System—designed to prompt AI models to actively fix discovered issues rather than simply identifying them. By providing dedicated tools for error detection, identifier tracking, and fix verification, MCP Pyrefly helps software engineers and AI agents maintain code quality, eliminate import issues, and ensure strict consistency across Python codebases.
Category: Developer Tools & Code Intelligence
Tags: code analysis, linting, python, validation
pip install mcp-pyrefly (or clone the repository and run pip install -e .). 2. Open your Claude Desktop configuration file (claude_desktop_config.json). 3. Add the server under the mcpServers object: json { "mcpServers": { "pyrefly": { "command": "mcp-pyrefly" } } } 4. Alternatively, register it with Claude Code by running claude mcp add mcp-pyrefly -- mcp-pyrefly. 5. Restart your MCP client to start validating Python code.Part of MCP Servers
MCP Pyrefly is a Model Context Protocol server that integrates the Pyrefly type checker. It validates Python code for type errors, syntax issues, and naming inconsistencies, returning error reports and fix suggestions directly to AI coding assistants.
You can install it directly from PyPI by running pip install mcp-pyrefly, or by cloning the repository and running pip install -e . in the source directory. Then add the mcp-pyrefly command to your MCP client configuration.
MCP Pyrefly works with any client supporting standard Model Context Protocol servers over stdio, including Claude Desktop and Claude Code using the command-line integration.
It provides validation tools including check_code, track_identifier, check_consistency, and suggest_fix, along with gamification tools like submit_fixed_code, check_lollipop_status, and check_persona_effectiveness to prompt models to resolve detected errors.
Yes, MCP Pyrefly is open source and distributed under the MIT license on GitHub by Kim Asplund.