AI-powered code quality analysis using MCP to help AI assistants review code more effectively. Analyze git changes for complexity, security issues, and more through structured prompts.
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 Lucidity to analyze the changes instead of vibe-coding yourself into a nightmare hellscape! 😱 💥 🚫
# Clone the repository
git clone https://github.com/hyperbliss/lucidity-mcp.git
cd lucidity-mcp
# Set up a virtual environment with UV
uv venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies with UV
uv sync
# Start with stdio transport (for terminal use)
lucidity-mcp
# Start with SSE transport (for network use)
lucidity-mcp --transport sse --host 127.0.0.1 --port 6969
# Run with debug logging
lucidity-mcp --debug
# Run with file logging
lucidity-mcp --log-file lucidity.log
Start Lucidity in SSE mode:
lucidity-mcp --transport sse
Connect your AI assistant using the MCP protocol URI:
sse://localhost:6969/sse
The AI can now invoke the analyze_changes
tool to get code quality feedback!
Lucidity analyzes code across 10 critical quality dimensions:
With an AI assistant connected to Lucidity, try these queries:
analyze_changes
- Prepares git changes for analysis through MCP
workspace_root
: The root directory of the workspace/git repositorypath
: Optional specific file path to analyzeLucidity uses UV for dependency management and development workflows. UV is a fast, reliable Python package manager and resolver.
# Update dependencies
uv sync
# Run tests
pytest
# Run linting
ruff check .
# Run type checking
mypy .
Lucidity handles logging differently depending on the transport:
This ensures that stdio communication isn't broken by logs appearing on stdout.
usage: lucidity-mcp [-h] [--debug] [--host HOST] [--port PORT] [--transport {stdio,sse}]
[--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [--verbose]
[--log-file LOG_FILE]
options:
-h, --help show this help message and exit
--debug Enable debug logging
--host HOST Host to bind the server to (use 0.0.0.0 for all interfaces)
--port PORT Port to listen on for network connections
--transport {stdio,sse}
Transport type to use (stdio for terminal, sse for network)
--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
Set the logging level
--verbose Enable verbose logging for HTTP requests
--log-file LOG_FILE Path to log file (required for stdio transport if logs enabled)
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Created by Stefanie Jane 🌠
If you find Lucidity useful, buy me a Monster Ultra Violet ⚡️