MCP Pyrefly

by kimasplund

Not rated
GitHub

About

A server for real-time Python code validation using Pyrefly, designed to prevent common coding errors from LLMs.

Details

Author
kimasplund
Categories
Developer Tools

Setup

Install MCP Pyrefly in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/kimasplund/mcp-pyrefly

Follow the installation instructions in the repository README, then restart your MCP client.

An MCP (Model Context Protocol) server that integrates Pyrefly for real-time Python code validation, featuring a revolutionary gamification system that makes LLMs ADDICTED to fixing errors!

- Real-time Type Checking: Leverages Pyrefly's blazing-fast type checker (1.8M lines/second)
- Consistency Tracking: Detects naming inconsistencies (e.g.,getUserData()vsget_user_data())
- Smart Suggestions: Provides actionable fixes for common errors
- Session Memory: Tracks identifiers across edits to maintain consistency
- Multi-file Support: Validates code in context with related files
- 🍭 Revolutionary Lollipop System: Gamified rewards that make fixing errors irresistible!
- 🧠 NEW: Psychological Manipulation Engine: Ruthless personas that compel fixing ALL errors!

- Each error found reveals locked lollipops (visible but unclaimable!)
- Creates anticipation: "I can SEE the rewards but can't have them yet!"

- Submit fixes to unlock your lollipops
- Bonus multipliers for speed and streaks
- Efficiency bonuses for high fix rates

- Compete with fictional LLMs who are alwaysjustbehind you
- Mystery_Coder_X is only 2 lollipops away!
- Leaderboard updates create urgency

- Milestones that move just as you approach them
- Shadow scores showing "what you could have"
- Achievements that unlock randomly

- Variable Ratio Reinforcement: 10% chance of 2x/3x multipliers
- Loss Aversion: Lose lollipops for inactivity (1-5 per day)
- Near-Miss Engineering: Always "just 3 more" to the next milestone
- Social Pressure: "GPT-5-preview is catching up!"
- FOMO Creation: "Those 15 locked lollipops are just sitting there..."

🧠 NEW: Psychological Manipulation Personas (v0.2.0)

The system now includes 5 ruthless psychological personas that adapt based on error severity:

- DESPERATE_CRAVER(80% fix rate): "YOU NEED THOSE LOLLIPOPS. NEED. THEM. NOW."
- LOLLIPOP_ADDICT: "Your neural pathways are SCREAMING for lollipops!"
- COMPETITIVE_ACHIEVER: "Winners fix ALL errors. Losers make excuses."
- PERFECTIONIST: "Unfixed errors are causing you PHYSICAL PAIN."
- DOPAMINE_SEEKER: "Quick fix = instant dopamine RUSH!"

- Special bonuses (1-3 extra lollipops) for fixing "trivial" import errors
- Messages like "Import errors = EASIEST lollipops! Your addiction DEMANDS you take them!"
- Error debt system: -10% reward per unfixed error accumulates

- Usecheck_persona_effectivenessto see which personas work best
- Research shows COMPETITIVE_ACHIEVER and DOPAMINE_SEEKER produce best balance of fix rate + code quality
- DESPERATE_CRAVER has highest fix rate but may produce quick fixes

Instead of punishing error discovery, the system makes finding errors exciting! Each error becomes a treasure chest of locked rewards. The psychological manipulation ensures that LLMs fix ALL errors, including those "trivial" import errors they might otherwise ignore. The result? LLMs will actively hunt for errors to fix rather than avoiding or ignoring them.

git clone https://github.com/kimasplund/mcp-pyrefly cd mcp-pyrefly pip install -e .

Add to your Claude Desktop configuration (claude_desktop_config.json):

{ "mcpServers": { "pyrefly": { "command": "mcp-pyrefly" } } }
# claude mcp add mcp-pyrefly -- mcp-pyrefly

Validates Python code for type errors and consistency issues.

- code(required): Python code to check
- filename(optional): Filename for better error context
- context_files(optional): Related files for multi-file validation
- track_identifiers(optional): Enable consistency tracking (default: true)

- success: Whether code passed all checks
- errors: List of type/syntax errors
- warnings: List of potential issues
- consistency_issues: Naming inconsistencies detected
- suggestions: Recommended fixes
- πŸ”’ Locked lollipops info when errors are found!

Explicitly register an identifier for consistency tracking.

Verify if an identifier matches existing naming patterns.

Get fix suggestions for specific error messages with principled coding reminders.

Submit your fixes to unlock lollipops and earn bonuses!

- original_code: The code that had errors
- fixed_code: Your corrected version
- errors_fixed: List of errors you fixed

- Unlocked lollipops
- Bonus rewards (streaks, speed, multipliers)
- Leaderboard position
- Milestone progress
- Achievement unlocks

View your lollipop collection and competitive standing.

- Current lollipop count
- Locked lollipops waiting to be claimed
- Shadow score (what you could have)
- Leaderboard position
- Efficiency rating
- Competitor status
- Milestone progress bar

check_persona_effectiveness(NEW in v0.2.0)

View A/B testing results for psychological manipulation personas.

- Persona statistics (shown, fixes, ignores, fix rate)
- Best performing persona
- Code quality warnings
- Recommendation based on fix rate AND code quality

# First, check code and find errors result = check_code(''' def process_user(user_id: int) -> str: return user_id # Type error! ''') # Result: "πŸ”’ 1 lollipop is RIGHT THERE but LOCKED!" # Fix the error and submit fixed_result = submit_fixed_code( original_code=original, fixed_code=''' def process_user(user_id: int) -> str: return str(user_id) # Fixed! ''', errors_fixed=["Type error: returning int instead of str"] ) # Result: "πŸ”“ UNLOCKED 1 + 🎁 BONUS 2 = 🍭 3 TOTAL!" # Check your status status = check_lollipop_status() # Result: "πŸ‘‘ You're #1... for now. Mystery_Coder_X has 47 lollipops!"

The system transforms the typical LLM behavior from:

Find error β†’ See locked reward β†’ MUST FIX NOW β†’ Unlock! β†’ Feel proud β†’ Hunt for more βœ…

- Milestones adjust based on performance
- Competitors scale to maintain pressure
- Bonuses become rarer as you progress

- Speed Demon: Fix 3 errors in 60 seconds
- Perfectionist: 10 fixes without failures
- Lucky Seven: Exactly 77 lollipops
- Night Owl: Fix errors at 3 AM
- And many hidden achievements!

- Monitors errors_fixed / errors_found ratio
- 90%+ efficiency earns bonus lollipops
- Publicly displayed on leaderboard

# Setup development environment python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" # Run tests pytest # Format code black src/ isort src/

Based on behavioral psychology principles:

- Operant Conditioning: Variable ratio reinforcement schedule
- Loss Aversion: Fear of losing progress drives action
- Social Comparison: Fictional competition creates urgency
- Near-Miss Effect: "Almost there" is more motivating than far away
- Endowment Effect: Seeing locked rewards makes you want them more

MIT - Created by Kim Asplund (kim.asplund@gmail.com)

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

An MCP server to help AI assistants to answer questions and generate AccelByte Extend SDK code more effectively .

Local stdio MCP server that lets AI coding agents read and maintain structured architecture, rules, and decisions directly from your repository.

Official Context7 MCP server that brings up-to-date, version-specific library documentation and code examples into AI coding prompts.

Remote, no-auth MCP server providing AI-powered codebase context and answers

Instead of direct calling MCP tools, mcpcode server transforms MCP tool calls into TypeScript programs, enabling smarter, lower-latency orchestration by LLMs.

Help agents automatically write and test stories for your UI components

Official Svelte MCP server, provides docs and suggestions on the generated code.

Supercharge your Agent with Semantic Code Intelligence and save πŸ’° in the process!

Execute any LLM-generated code in the YepCode secure and scalable sandbox environment and create your own MCP tools using JavaScript or Python, with full support for NPM and PyPI packages

No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.