โœจ Lucidity MCP ๐Ÿ”

โœจ Lucidity MCP ๐Ÿ”

A Model Context Protocol server that enhances AI-generated code quality through comprehensive analysis across 10 critical dimensions, helping identify issues before they become problems.

hyperb1iss

Developer Tools
Visit Server

README

โœจ Lucidity MCP ๐Ÿ”

<div align="center">

Python 3.13+ License Status Code Style Type Check

Clarity in Code, Confidence in Creation

</div>

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! ๐Ÿ˜ฑ ๐Ÿ’ฅ ๐Ÿšซ

๐Ÿ’ซ Features

  • ๐Ÿ”ฎ Comprehensive Issue Detection - Covers 10 critical quality dimensions from complexity to security vulnerabilities
  • ๐Ÿ”„ Contextual Analysis - Compares changes against original code to identify unintended modifications
  • ๐ŸŒ Language Agnostic - Works with any programming language the AI assistant understands
  • ๐ŸŽฏ Focused Analysis - Option to target specific issue types based on project needs
  • ๐Ÿ“ Structured Outputs - Guides AI to provide actionable feedback with clear recommendations
  • ๐Ÿค– MCP Integration - Seamless integration with Claude and other MCP-compatible AI assistants
  • ๐Ÿชถ Lightweight Implementation - Simple server design with minimal dependencies
  • ๐Ÿงฉ Extensible Framework - Easy to add new issue types or refine analysis criteria
  • ๐Ÿ”€ Flexible Transport - Supports both stdio for terminal-based interaction and SSE for network-based communication
  • ๐Ÿ”„ Git-Aware Analysis - Analyzes changes directly from git diff, making it ideal for pre-commit reviews

๐Ÿš€ Installation

# 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

๐Ÿ“‹ Prerequisites

  • Python 3.13 or higher
  • Git (for analyzing code changes)
  • UV package manager (recommended for dependency management)

๐Ÿ”ฎ Quick Start

Run the Lucidity server

# 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

Using with AI Assistants

  1. Start Lucidity in SSE mode:

    lucidity-mcp --transport sse
    
  2. Connect your AI assistant using the MCP protocol URI:

    sse://localhost:6969/sse
    
  3. The AI can now invoke the analyze_changes tool to get code quality feedback!

๐Ÿง  Analysis Dimensions

Lucidity analyzes code across 10 critical quality dimensions:

  1. Unnecessary Complexity - Identifies overly complex algorithms, excessive abstractions, and convoluted logic
  2. Poor Abstractions - Detects leaky or inappropriate abstractions and unclear separation of concerns
  3. Unintended Code Deletion - Catches accidental removal of critical functionality or validation
  4. Hallucinated Components - Finds references to non-existent functions, classes, or APIs
  5. Style Inconsistencies - Spots deviations from project coding standards and conventions
  6. Security Vulnerabilities - Identifies potential security issues in code changes
  7. Performance Issues - Detects inefficient algorithms or operations that could impact performance
  8. Code Duplication - Finds repeated logic or functionality that should be refactored
  9. Incomplete Error Handling - Spots missing or inadequate exception handling
  10. Test Coverage Gaps - Identifies missing tests for critical functionality

๐Ÿ“Š Example AI Assistant Queries

With an AI assistant connected to Lucidity, try these queries:

  • "Analyze the code quality in my latest git changes"
  • "Check for security vulnerabilities in my JavaScript changes"
  • "Make sure my Python code follows best practices"
  • "Identify any performance issues in my recent code changes"
  • "Are there any unintended side effects in my recent refactoring?"
  • "Help me improve the abstractions in my code"
  • "Check if I've accidentally removed any important validation"
  • "Find any hallucinated API calls in my latest commit"
  • "Is my error handling complete and robust?"
  • "Are there any test coverage gaps in my new feature?"

๐Ÿ› ๏ธ Available MCP Tools

Tools

  • analyze_changes - Prepares git changes for analysis through MCP
    • Parameters:
      • workspace_root: The root directory of the workspace/git repository
      • path: Optional specific file path to analyze

๐Ÿ’ป Development

Lucidity 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 .

๐Ÿ”ง Logging Behavior

Lucidity handles logging differently depending on the transport:

  • SSE transport: Full console logging is enabled
  • Stdio transport with --log-file: All logs go to the file, console is disabled
  • Stdio transport without --log-file: Only warnings and errors go to stderr, info logs are disabled

This ensures that stdio communication isn't broken by logs appearing on stdout.

๐ŸŽ›๏ธ Command-line Options

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)

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Set up your development environment with UV
  4. Make your changes
  5. Run tests and linting
  6. Commit your changes (git commit -m 'Add some amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

๐Ÿ“ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.


<div align="center">

Created by Stefanie Jane ๐ŸŒ 

If you find Lucidity useful, buy me a Monster Ultra Violet โšก๏ธ

</div>

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
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

Linear MCP Server

A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Featured
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python