SuperAPI AI Directory

lucidity-mcp

Improve AI-generated code quality with prompt-based analysis across 10 dimensions, from complexity to security vulnerabilities.

Open website

About this tool

Lucidity MCP is a Model Context Protocol (MCP) server designed specifically to improve the quality of AI-generated code. Through prompt-based intelligent analysis, it provides structured guidance to AI programming assistants, helping identify and fix common quality issues in code, ultimately producing cleaner, more maintainable, and more robust code.

Purpose

Lucidity's primary purpose is to perform quality review of git changes before code is committed. It is suitable for use with AI assistants that support the MCP protocol (such as Claude), enabling the AI to analyze code changes more effectively and avoid potential issues caused by "vibe-coding."

Main Capabilities

Lucidity covers analysis across 10 key quality dimensions:

  1. Unnecessary complexity: Identify overly complex algorithms, excessive abstraction, and convoluted logic.
  2. Poor abstraction: Detect leaky or inappropriate abstractions and unclear separation of concerns.
  3. Accidental code deletion: Catch accidental removal of critical functionality or validation logic.
  4. Hallucinated components: Find references to nonexistent functions, classes, or APIs.
  5. Style inconsistency: Discover deviations from project coding standards and conventions.
  6. Security vulnerabilities: Identify potential security issues in code changes.
  7. Performance issues: Detect inefficient algorithms or operations that may affect performance.
  8. Code duplication: Find duplicated logic or functionality that should be refactored.
  9. Incomplete error handling: Discover missing or inadequate exception handling.
  10. Test coverage gaps: Identify missing tests for critical functionality.

In addition, it also has the following features:

  • Contextual analysis: Compare changes against the original code to identify unintended modifications.
  • Language agnostic: Works with any programming language that the AI assistant can understand.
  • Focused analysis: Select specific issue types for analysis based on project needs.
  • Structured output: Guide the AI to provide actionable feedback and clear recommendations.
  • MCP integration: Seamlessly integrate 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 standard input/output (stdio) for terminal interaction, and Server-Sent Events (SSE) for network communication.
  • Git-aware analysis: Directly analyze changes in git diff, ideal for pre-commit review.

Usage

  1. Prerequisites: Python 3.13 or later, Git (for analyzing code changes), UV package manager (recommended for dependency management).
  2. Start the Lucidity server.
  3. Use with an AI assistant:
    • Start Lucidity in SSE mode:lucidity-mcp --transport sse
    • Connect the AI assistant using the MCP protocol URI:sse://localhost:6969/sse
    • The AI can now call the analyze_changes tool to get code quality feedback.

Available MCP tools:

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

Use Cases

  • Quality review before code commit.
  • Quality check after AI-generated code.
  • Development teams looking to improve code quality, security, and maintainability.
  • Scenarios that require focused analysis for specific issue types (such as security vulnerabilities, performance issues, etc.).

Limitations

  • Requires Python 3.13 or later.
  • Requires a Git environment.
  • The UV package manager is recommended for dependency management.
  • Requires use with an AI assistant that supports the MCP protocol.
  • Logging behavior varies by transport: SSE transport enables full console logging; with --log-file The stdio transport writes all logs to a file and disables the console; without --log-file the stdio transport outputs only warnings and errors to stderr, and informational logs are disabled.

The project is licensed under the Apache License 2.0 and was created by Stefanie Jane.