Clarity in Code, Confidence in Creation Lucidity is a Model Context Protocol (MCP) server designed to enhance the quality of AI-generated code through intelligent, prompt-based analysis. By providing structured guidance to AI coding assistants, Lucidity helps identify and address common quality issues, resulting in cleaner, more maintainable, and more robust code. Before you commit, just ask Lucid
Add this skill
npx mdskills install hyperb1iss/lucidity-mcpGit-aware code quality analysis MCP server with 10 quality dimensions and flexible transport options
1# โจ Lucidity MCP ๐23<div align="center">45[](https://www.python.org/downloads/)6[](LICENSE)7[](docs/plan.md)8[](https://github.com/astral-sh/ruff)9[](https://mypy.readthedocs.io/en/stable/)1011**Clarity in Code, Confidence in Creation**1213</div>1415Lucidity is a Model Context Protocol (MCP) server designed to enhance the quality of AI-generated code through intelligent, prompt-based analysis. By providing structured guidance to AI coding assistants, Lucidity helps identify and address common quality issues, resulting in cleaner, more maintainable, and more robust code.1617Before you commit, just ask Lucidity to analyze the changes instead of vibe-coding yourself into a nightmare hellscape! ๐ฑ ๐ฅ ๐ซ1819## ๐ซ Features2021- ๐ฎ **Comprehensive Issue Detection** - Covers 10 critical quality dimensions from complexity to security vulnerabilities22- ๐ **Contextual Analysis** - Compares changes against original code to identify unintended modifications23- ๐ **Language Agnostic** - Works with any programming language the AI assistant understands24- ๐ฏ **Focused Analysis** - Option to target specific issue types based on project needs25- ๐ **Structured Outputs** - Guides AI to provide actionable feedback with clear recommendations26- ๐ค **MCP Integration** - Seamless integration with Claude and other MCP-compatible AI assistants27- ๐ชถ **Lightweight Implementation** - Simple server design with minimal dependencies28- ๐งฉ **Extensible Framework** - Easy to add new issue types or refine analysis criteria29- ๐ **Flexible Transport** - Supports both stdio for terminal-based interaction and SSE for network-based communication30- ๐ **Git-Aware Analysis** - Analyzes changes directly from git diff, making it ideal for pre-commit reviews3132## ๐ Installation3334```bash35# Clone the repository36git clone https://github.com/hyperbliss/lucidity-mcp.git37cd lucidity-mcp3839# Set up a virtual environment with UV40uv venv .venv41source .venv/bin/activate # On Windows: .venv\Scripts\activate4243# Install dependencies with UV44uv sync45```4647## ๐ Prerequisites4849- Python 3.13 or higher50- Git (for analyzing code changes)51- UV package manager (recommended for dependency management)5253## ๐ฎ Quick Start5455### Run the Lucidity server5657```bash58# Start with stdio transport (for terminal use)59lucidity-mcp6061# Start with SSE transport (for network use)62lucidity-mcp --transport sse --host 127.0.0.1 --port 69696364# Run with debug logging65lucidity-mcp --debug6667# Run with file logging68lucidity-mcp --log-file lucidity.log69```7071### Using with AI Assistants72731. Start Lucidity in SSE mode:7475 ```bash76 lucidity-mcp --transport sse77 ```78792. Connect your AI assistant using the MCP protocol URI:8081 ```82 sse://localhost:6969/sse83 ```84853. The AI can now invoke the `analyze_changes` tool to get code quality feedback!8687## ๐ง Analysis Dimensions8889Lucidity analyzes code across 10 critical quality dimensions:90911. **Unnecessary Complexity** - Identifies overly complex algorithms, excessive abstractions, and convoluted logic922. **Poor Abstractions** - Detects leaky or inappropriate abstractions and unclear separation of concerns933. **Unintended Code Deletion** - Catches accidental removal of critical functionality or validation944. **Hallucinated Components** - Finds references to non-existent functions, classes, or APIs955. **Style Inconsistencies** - Spots deviations from project coding standards and conventions966. **Security Vulnerabilities** - Identifies potential security issues in code changes977. **Performance Issues** - Detects inefficient algorithms or operations that could impact performance988. **Code Duplication** - Finds repeated logic or functionality that should be refactored999. **Incomplete Error Handling** - Spots missing or inadequate exception handling10010. **Test Coverage Gaps** - Identifies missing tests for critical functionality101102## ๐ Example AI Assistant Queries103104With an AI assistant connected to Lucidity, try these queries:105106- "Analyze the code quality in my latest git changes"107- "Check for security vulnerabilities in my JavaScript changes"108- "Make sure my Python code follows best practices"109- "Identify any performance issues in my recent code changes"110- "Are there any unintended side effects in my recent refactoring?"111- "Help me improve the abstractions in my code"112- "Check if I've accidentally removed any important validation"113- "Find any hallucinated API calls in my latest commit"114- "Is my error handling complete and robust?"115- "Are there any test coverage gaps in my new feature?"116117## ๐ ๏ธ Available MCP Tools118119### Tools120121- `analyze_changes` - Prepares git changes for analysis through MCP122 - Parameters:123 - `workspace_root`: The root directory of the workspace/git repository124 - `path`: Optional specific file path to analyze125126## ๐ป Development127128Lucidity uses UV for dependency management and development workflows. UV is a fast, reliable Python package manager and resolver.129130```bash131# Update dependencies132uv sync133134# Run tests135pytest136137# Run linting138ruff check .139140# Run type checking141mypy .142```143144## ๐ง Logging Behavior145146Lucidity handles logging differently depending on the transport:147148- **SSE transport**: Full console logging is enabled149- **Stdio transport with --log-file**: All logs go to the file, console is disabled150- **Stdio transport without --log-file**: Only warnings and errors go to stderr, info logs are disabled151152This ensures that stdio communication isn't broken by logs appearing on stdout.153154## ๐๏ธ Command-line Options155156```157usage: lucidity-mcp [-h] [--debug] [--host HOST] [--port PORT] [--transport {stdio,sse}]158 [--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [--verbose]159 [--log-file LOG_FILE]160161options:162 -h, --help show this help message and exit163 --debug Enable debug logging164 --host HOST Host to bind the server to (use 0.0.0.0 for all interfaces)165 --port PORT Port to listen on for network connections166 --transport {stdio,sse}167 Transport type to use (stdio for terminal, sse for network)168 --log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}169 Set the logging level170 --verbose Enable verbose logging for HTTP requests171 --log-file LOG_FILE Path to log file (required for stdio transport if logs enabled)172```173174## ๐ค Contributing175176Contributions are welcome! Please feel free to submit a Pull Request.1771781. Fork the repository1792. Create your feature branch (`git checkout -b feature/amazing-feature`)1803. Set up your development environment with UV1814. Make your changes1825. Run tests and linting1836. Commit your changes (`git commit -m 'Add some amazing feature'`)1847. Push to the branch (`git push origin feature/amazing-feature`)1858. Open a Pull Request186187## ๐ License188189This project is licensed under the Apache License 2.0 - see the LICENSE file for details.190191---192193<div align="center">194195Created by [Stefanie Jane ๐ ](https://github.com/hyperb1iss)196197If you find Lucidity useful, [buy me a Monster Ultra Violet โก๏ธ](https://ko-fi.com/hyperb1iss)198199</div>200
Full transparency โ inspect the skill content before installing.