### Run Development Server Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/README.md Execute this command to start the server in development mode with a web interface for testing. ```sh uv run fastmcp dev server.py ``` -------------------------------- ### Example Usage of get_project_settings_group Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Demonstrates how to use the get_project_settings_group function to create a settings group name from a project directory path. ```python group = get_project_settings_group("/home/user/my-app") # Returns: "my-app_a1b2c3d4" ``` -------------------------------- ### Install Dependencies with uv Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/README.md Installs all project dependencies using the uv package manager. This command also creates a virtual environment for the project. ```bash uv sync ``` -------------------------------- ### Example Command Execution Error Output Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/errors.md An example of the error message displayed when a command like 'nonexistent-command' fails due to the file not being found. ```text Error running command: [Errno 2] No such file or directory: 'nonexistent-command' ``` -------------------------------- ### FeedbackConfig Example Usage Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/types.md Demonstrates creating a FeedbackConfig dictionary. Explains the behavior when 'execute_automatically' is true upon UI launch. ```python config: FeedbackConfig = { "run_command": "npm test", "execute_automatically": True } # When UI launches with this config and execute_automatically is True, # it immediately runs "npm test" in the project directory ``` -------------------------------- ### Running feedback_ui.py Directly Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/errors.md Example of how to invoke the feedback_ui.py script from the command line. This is useful for users running the UI directly. ```bash python feedback_ui.py --project-directory /path --prompt "Summary" --output-file result.json ``` -------------------------------- ### Run the MCP Server Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/README.md Starts the Interactive Feedback MCP server using uv. Ensure you are in the project directory before running this command. ```bash uv run server.py ``` -------------------------------- ### Project Dependencies Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/INDEX.md Lists the required Python packages and their minimum version constraints for the project. Ensure these are installed before running the application. ```text fastmcp>=2.0.0 # MCP protocol pyside6>=6.8.2.1 # GUI framework psutil>=7.0.0 # Process management ``` -------------------------------- ### Project Settings Group Naming Example Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/configuration.md Illustrates how a project's settings group name is constructed by combining its directory's basename with a hash. This ensures unique and stable identification for each project's configuration. ```python hashlib.md5(project_dir.encode('utf-8')).hexdigest()[:8] ``` -------------------------------- ### Using MCP Tool from XML Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/README.md Example of how to invoke the `interactive_feedback` MCP tool using an XML configuration. This is typically used by clients like Cursor or Windsurf. ```xml interactive-feedback-mcp interactive_feedback { "project_directory": "/path/to/project", "summary": "I've implemented the authentication module." } ``` -------------------------------- ### Install uv package manager Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/README.md Installs the uv package manager using a curl command. This is a prerequisite for managing Python dependencies and running the server. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Configure Interactive Feedback MCP Server in Cursor Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/README.md Example JSON configuration for setting up the interactive-feedback-mcp server within Cursor. Remember to update the directory path to your local clone. ```json { "mcpServers": { "interactive-feedback-mcp": { "command": "uv", "args": [ "--directory", "/Users/fabioferreira/Dev/scripts/interactive-feedback-mcp", "run", "server.py" ], "timeout": 600, "autoApprove": [ "interactive_feedback" ] } } } ``` -------------------------------- ### Call interactive_feedback Tool Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/README.md Example of how the AI assistant would call the interactive_feedback tool. Specify the server name, tool name, and arguments including project directory and summary. ```xml interactive-feedback-mcp interactive_feedback { "project_directory": "/path/to/your/project", "summary": "I've implemented the changes you requested and refactored the main module." } ``` -------------------------------- ### Initialize FastMCP Server Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/server.md Initializes the FastMCP server instance with a specific name and log level. This setup is crucial for the server's operation and integration with AI tools. ```python mcp = FastMCP("Interactive Feedback MCP", log_level="ERROR") ``` -------------------------------- ### Invoke interactive_feedback Tool Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/server.md Example of how an AI assistant would invoke the 'interactive_feedback' tool. This demonstrates passing project directory and summary arguments and shows the expected return structure. ```python # Called by an AI assistant in an MCP-capable tool like Cursor result = await invoke_mcp_tool( server_name="interactive-feedback-mcp", tool_name="interactive_feedback", arguments={ "project_directory": "/path/to/my/project", "summary": "I've implemented the user authentication module." } ) # Returns: # { # "command_logs": "$ npm test\nPassing 42 tests...\n", # "interactive_feedback": "Looks good, but can you add error handling for invalid tokens?" # } ``` -------------------------------- ### FeedbackResult Example Usage Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/types.md Illustrates how to create a FeedbackResult dictionary and shows its JSON representation. Useful for understanding data structure. ```python result: FeedbackResult = { "command_logs": "$ npm test\n✓ 42 tests pass\n", "interactive_feedback": "Great! Can you also add error handling?" } # Serialized to JSON: # { # "command_logs": "$ npm test\n✓ 42 tests pass\n", # "interactive_feedback": "Great! Can you also add error handling?" # } ``` -------------------------------- ### Run FeedbackUI and Get Result Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Displays the UI window and enters the Qt event loop. Returns when the user closes the window or submits feedback. The result contains captured logs and user feedback. ```python ui = FeedbackUI("/path/to/project", "Changes made") result = ui.run() print(result["interactive_feedback"]) ``` -------------------------------- ### get_dark_mode_palette Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/INDEX.md Gets the dark mode color palette for a given QApplication instance. Returns a QPalette object. ```APIDOC ## get_dark_mode_palette ### Description Gets the dark mode color palette for a given QApplication instance. Returns a QPalette object. ### Signature `get_dark_mode_palette(app: QApplication) -> QPalette` ### Module feedback_ui.py ### Returns QPalette ``` -------------------------------- ### Configure Project Settings Programmatically Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/INDEX.md Illustrates how to programmatically set project-specific settings using `QSettings`. It shows how to begin and end a group for a project and set a specific value like 'run_command'. ```python from PySide6.QtCore import QSettings settings = QSettings("FabioFerreira", "InteractiveFeedbackMCP") settings.beginGroup("project_name_hash") settings.setValue("run_command", "npm test") settings.endGroup() ``` -------------------------------- ### FeedbackUI Constructor Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Initializes the FeedbackUI window. It requires the project directory and a prompt string to set up the interface. ```APIDOC ## Class: FeedbackUI ### Constructor ```python def __init__(self, project_directory: str, prompt: str) ``` #### Parameters - **project_directory** (str) - Required - The project directory for command execution - **prompt** (str) - Required - The summary to display above the feedback input ``` -------------------------------- ### FeedbackUI Constructor Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Initializes the FeedbackUI with a project directory and a prompt. The project directory is used for command execution, and the prompt is displayed to the user. ```python def __init__(self, project_directory: str, prompt: str) ``` -------------------------------- ### launch_feedback_ui Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/INDEX.md Launches the feedback UI for a specified project directory and summary. Returns a dictionary representing the feedback result. ```APIDOC ## launch_feedback_ui ### Description Launches the feedback UI for a specified project directory and summary. Returns a dictionary representing the feedback result. ### Signature `launch_feedback_ui(project_directory: str, summary: str) -> dict[str, str]` ### Module server.py ### Returns FeedbackResult (dict[str, str]) ``` -------------------------------- ### Call Interactive Feedback UI from Python Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/INDEX.md Demonstrates how to call the `feedback_ui` function from Python code. It shows the required import and parameters, including an optional output file. ```python from feedback_ui import feedback_ui result = feedback_ui( "/path/to/project", "Summary", output_file="/tmp/result.json" ) ``` -------------------------------- ### Handling UI Launch Failure in Python Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/errors.md Demonstrates how to use a try-except block to catch exceptions when calling the feedback_ui function. This is intended for developers using the API. ```python from feedback_ui import feedback_ui try: result = feedback_ui( "/path/to/project", "Summary", output_file="/tmp/result.json" ) except Exception as e: # Handle UI launch failure print(f"Failed to get feedback: {e}") # Implement fallback behavior ``` -------------------------------- ### Feedback UI Main Entry Point Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md The main entry point for the feedback UI. Use this function to initiate the feedback collection process. It handles application creation, styling, window instantiation, and returns the user's feedback. ```python def feedback_ui( project_directory: str, prompt: str, output_file: Optional[str] = None ) -> Optional[FeedbackResult]: ``` ```python result = feedback_ui( project_directory="/home/user/myproject", prompt="I've implemented user authentication", output_file="/tmp/feedback.json" ) # Result is saved to /tmp/feedback.json and None is returned ``` -------------------------------- ### Calling Feedback UI as Python Library Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/README.md Demonstrates how to use the `feedback_ui` function directly within a Python script. Specify the project directory, a prompt, and an output file. ```python from feedback_ui import feedback_ui result = feedback_ui( project_directory="/home/user/myproject", prompt="Review my changes", output_file="/tmp/feedback.json" ) ``` -------------------------------- ### run Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Displays the UI and enters the Qt event loop. The method returns after the user closes the window or submits feedback, providing the captured logs and user feedback. ```APIDOC ## Method: run ### Description Displays the UI window and enters the Qt event loop. Returns when the user closes the window or submits feedback. ### Signature ```python def run(self) -> FeedbackResult ``` ### Returns - `FeedbackResult` - A dictionary containing captured logs and user feedback. ### Example ```python ui = FeedbackUI("/path/to/project", "Changes made") result = ui.run() print(result["interactive_feedback"]) ``` ``` -------------------------------- ### feedback_ui (Command Line) Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/README.md The feedback_ui can also be executed directly from the command line, providing the same functionality as the Python library. ```APIDOC ## feedback_ui (Command Line) ### Description Execute the feedback UI directly from the command line. This interface allows users to specify the project directory, a prompt for feedback, and an output file. ### Method Command Line Execution ### Endpoint `python feedback_ui.py` ### Parameters #### Command Line Arguments - `--project-directory` (str) - Required - The path to the project directory. - `--prompt` (str) - Required - The prompt to guide the feedback generation. - `--output-file` (str) - Optional - The path to save the feedback results. ### Request Example ```bash python feedback_ui.py \ --project-directory /path/to/project \ --prompt "Summary of changes" \ --output-file result.json ``` ### Response #### Success Response Returns a dictionary containing command logs and interactive feedback. #### Response Example ```json { "command_logs": "string", "interactive_feedback": "string" } ``` ``` -------------------------------- ### Handle Errors when Launching Feedback UI Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/INDEX.md Shows how to handle potential exceptions when launching the feedback UI using `launch_feedback_ui`. It includes a try-except block to catch and print errors. ```python try: result = launch_feedback_ui("/path", "Summary") except Exception as e: print(f"Failed: {e}") ``` -------------------------------- ### Architecture Overview Diagram Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/INDEX.md Provides a high-level overview of the MCP tool's architecture, showing the flow from AI Tool to MCP Server and Feedback UI. ```text AI Tool (Cursor/Cline/Windsurf) ↓ (MCP Protocol) MCP Server (server.py) ↓ (subprocess) Feedback UI (feedback_ui.py) ↓ (JSON file) MCP Server returns result ``` -------------------------------- ### Typical Usage Pattern for Interactive Feedback Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/architecture.md Illustrates the sequential flow of invoking a tool, waiting for user interaction via the UI, and processing the submitted result. This pattern repeats until the task is complete. ```text Invoke tool ├─ Wait for UI (user interaction) ├─ UI submits result (< 1 minute typical) └─ Process feedback, possibly iterate (Repeat until task complete) ``` -------------------------------- ### QSettings Structure for Configuration Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/architecture.md Details the hierarchical structure used by QSettings to store application and project-specific configurations, including window geometry and command execution settings. ```text FabioFerreira/InteractiveFeedbackMCP/ ├─ MainWindow_General/ │ ├─ geometry: QByteArray (window position/size) │ └─ windowState: QByteArray (maximized/normal) │ └─ {project_name}_{hash}/ ├─ run_command: str ├─ execute_automatically: bool └─ commandSectionVisible: bool ``` -------------------------------- ### Clone the MCP Server Repository Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/README.md Clones the interactive-feedback-mcp repository from GitHub. This is the first step in obtaining the server's source code. ```bash git clone https://github.com/noopstudios/interactive-feedback-mcp.git ``` -------------------------------- ### feedback_ui Function Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md The main entry point for the feedback UI module. It initializes the application, displays the UI to the user, and collects feedback or command logs. ```APIDOC ## Function: feedback_ui ### Description Main entry point for the feedback UI. Creates the QApplication, applies dark mode styling, instantiates the FeedbackUI window, and returns the user's feedback. ### Parameters #### Path Parameters - **project_directory** (str) - Required - The project directory where commands will be executed - **prompt** (str) - Required - The summary/prompt to display to the user - **output_file** (Optional[str]) - Optional - Path to save the feedback result as JSON. When provided, result is saved to file and None is returned ### Return Type Optional[FeedbackResult] - A FeedbackResult TypedDict with `command_logs` and `interactive_feedback` fields, or None if output_file was provided ### Example ```python result = feedback_ui( project_directory="/home/user/myproject", prompt="I've implemented user authentication", output_file="/tmp/feedback.json" ) # Result is saved to /tmp/feedback.json and None is returned ``` ``` -------------------------------- ### Project Dependencies Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/README.md Lists the required dependencies for the interactive feedback MCP project, including version constraints. ```toml dependencies = [ "fastmcp>=2.0.0", # MCP protocol implementation "psutil>=7.0.0", # Process management "pyside6>=6.8.2.1", # GUI framework ] ``` -------------------------------- ### Invoke Feedback UI from Command Line Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Use this command to run the feedback UI script directly from your terminal. Specify the project directory, the prompt for feedback, and the desired output file path. ```bash python feedback_ui.py \ --project-directory /path/to/project \ --prompt "Summary of changes" \ --output-file /tmp/result.json ``` -------------------------------- ### Error Recovery: UI Process Launch Failure Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/architecture.md Illustrates the error propagation when the UI process fails to launch. The temporary file is cleaned up, and the exception is passed to the MCP server and client. ```text launch_feedback_ui() raises Exception ├─ Temporary file cleaned up ├─ Exception propagates to MCP server └─ MCP client (AI tool) receives error ``` -------------------------------- ### interactive_feedback Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/INDEX.md Initiates interactive feedback for a given project directory and summary. Returns a dictionary containing feedback results. ```APIDOC ## interactive_feedback ### Description Initiates interactive feedback for a given project directory and summary. Returns a dictionary containing feedback results. ### Signature `interactive_feedback(project_directory: str, summary: str) -> Dict[str, str]` ### Module server.py ### Returns FeedbackResult (Dict[str, str]) ``` -------------------------------- ### Handle Generic Exception During UI Launch Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/errors.md This snippet demonstrates how to catch a generic Exception that may occur when launching the feedback UI. It's useful for general error handling of the `launch_feedback_ui` function. ```python try: result = launch_feedback_ui("/path/to/project", "Summary") except Exception as e: print(f"UI launch failed: {e}") ``` -------------------------------- ### Project File Structure Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/INDEX.md This snippet shows the directory structure of the interactive-feedback-mcp project. It helps in understanding the location of different documentation files and modules. ```text /output/ ├── README.md # Start here: overview & quick reference ├── INDEX.md # This file ├── architecture.md # System design & data flow ├── types.md # Type definitions (FeedbackResult, etc) ├── configuration.md # Settings & options ├── errors.md # Exception handling └── api-reference/ ├── server.md # MCP server module (server.py) └── feedback_ui.md # UI module (feedback_ui.py) ``` -------------------------------- ### feedback_ui (Python Library) Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/README.md The feedback_ui function can be called directly as a Python library. It allows specifying the project directory, a prompt for feedback, and an output file. ```APIDOC ## feedback_ui (Python Library) ### Description This function serves as a Python library interface for generating feedback. It takes the project directory, a prompt for the feedback, and an optional output file path. ### Method Python Function Call ### Endpoint N/A (Python Function) ### Parameters #### Arguments - **project_directory** (str) - Required - The path to the project directory. - **prompt** (str) - Required - The prompt to guide the feedback generation. - **output_file** (str) - Optional - The path to save the feedback results. ### Request Example ```python from feedback_ui import feedback_ui result = feedback_ui( project_directory="/home/user/myproject", prompt="Review my changes", output_file="/tmp/feedback.json" ) ``` ### Response #### Success Response Returns a dictionary containing command logs and interactive feedback. #### Response Example ```json { "command_logs": "string", "interactive_feedback": "string" } ``` ``` -------------------------------- ### interactive_feedback Tool Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/server.md Requests interactive feedback from the user for a given project directory and summary. It launches the feedback UI as a separate process and blocks until the user provides feedback or closes the UI window. ```APIDOC ## Tool: interactive_feedback ### Description Requests interactive feedback from the user for a given project directory and summary. Launches the feedback UI as a separate process and blocks until the user provides feedback or closes the UI window. ### Method `interactive_feedback(project_directory: str, summary: str) -> Dict[str, str]` ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **project_directory** (str) - Required - Full path to the project directory where the command will be executed - **summary** (str) - Required - Short, one-line summary of the changes. Only the first line is used if multi-line input is provided ### Request Example ```python # Called by an AI assistant in an MCP-capable tool like Cursor result = await invoke_mcp_tool( server_name="interactive-feedback-mcp", tool_name="interactive_feedback", arguments={ "project_directory": "/path/to/my/project", "summary": "I've implemented the user authentication module." } ) ``` ### Response #### Success Response (200) - **command_logs** (str) - The captured output from any command executed in the feedback UI - **interactive_feedback** (str) - The text feedback provided by the user #### Response Example ```json { "command_logs": "$ npm test\nPassing 42 tests...\n", "interactive_feedback": "Looks good, but can you add error handling for invalid tokens?" } ``` ``` -------------------------------- ### MCP Tool Invocation Parameters Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/INDEX.md Defines the parameters for invoking the interactive_feedback tool. It specifies the project directory and change summary as inputs, and the expected return values. ```text Tool name: interactive_feedback Parameters: - project_directory (str): Project path - summary (str): Change summary Returns: { command_logs, interactive_feedback } ``` -------------------------------- ### Create UI Layout Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Constructs the complete UI layout for the FeedbackUI. This includes sections for command execution, console output, feedback input, and contact information. ```python def _create_ui(self) ``` -------------------------------- ### Persist Configuration Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Saves the current command and auto-execute checkbox state to QSettings. The settings are stored under the project's specific settings group. ```python def _save_config(self) ``` -------------------------------- ### Define launch_feedback_ui Function Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/server.md Defines the internal 'launch_feedback_ui' function responsible for spawning the feedback UI as a subprocess and managing its communication via temporary files. It handles process execution and result retrieval. ```python def launch_feedback_ui(project_directory: str, summary: str) -> dict[str, str]: """Internal function that spawns the feedback UI as a subprocess and manages the temporary file-based IPC mechanism.""" pass ``` -------------------------------- ### Threading Model Overview Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/architecture.md Illustrates the main thread's responsibilities and the roles of worker threads for reading subprocess output. Qt signals ensure thread-safe slot invocation. ```text Main Thread (Qt Event Loop) ├─ Window creation and rendering ├─ Button clicks and checkbox changes ├─ Text input handling ├─ Log display updates (via slots) └─ Timer callbacks (status polling) Worker Thread 1 (stdout reader) ├─ Reads from subprocess stdout ├─ Emits LogSignals for each line └─ Exits when pipe closes Worker Thread 2 (stderr reader) ├─ Reads from subprocess stderr ├─ Emits LogSignals for each line └─ Exits when pipe closes ``` -------------------------------- ### launch_feedback_ui Function Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/server.md Internal function that spawns the feedback UI as a subprocess and manages the temporary file-based IPC mechanism. It returns the JSON-parsed result from the feedback UI. ```APIDOC ## Function: launch_feedback_ui ### Description Internal function that spawns the feedback UI as a subprocess and manages the temporary file-based IPC mechanism. ### Method `launch_feedback_ui(project_directory: str, summary: str) -> dict[str, str]` ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **project_directory** (str) - Required - Full path to the project directory - **summary** (str) - Required - Short summary of changes to display in the UI ### Response #### Success Response (200) - **command_logs** (str) - JSON-parsed result from the feedback UI containing `command_logs` and `interactive_feedback` keys - **interactive_feedback** (str) - JSON-parsed result from the feedback UI containing `command_logs` and `interactive_feedback` keys ### Throws - `Exception`: If the feedback UI process fails to launch or returns a non-zero exit code ``` -------------------------------- ### feedback_ui Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/INDEX.md Provides a user interface for feedback within a project directory. Accepts an optional output file path. Returns FeedbackResult or None. ```APIDOC ## feedback_ui ### Description Provides a user interface for feedback within a project directory. Accepts an optional output file path. Returns FeedbackResult or None. ### Signature `feedback_ui(project_directory: str, prompt: str, output_file: Optional[str]) -> Optional[FeedbackResult]` ### Module feedback_ui.py ### Returns FeedbackResult or None ``` -------------------------------- ### Update and Save Feedback Configuration Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/configuration.md This snippet shows how to update the FeedbackConfig dictionary with user-defined values and then save these settings to QSettings. It's used internally to manage the tool's runtime behavior. ```python # Internal configuration in FeedbackUI config: FeedbackConfig = { "run_command": "npm test", "execute_automatically": False } # Update when user changes values config["run_command"] = self.command_entry.text() config["execute_automatically"] = self.auto_check.isChecked() # Save to QSettings self.settings.beginGroup(self.project_group_name) self.settings.setValue("run_command", config["run_command"]) self.settings.setValue("execute_automatically", config["execute_automatically"]) self.settings.endGroup() ``` -------------------------------- ### Cursor Configuration for Interactive Feedback MCP Server Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/configuration.md This JSON configuration is used within Cursor to set up and run the interactive feedback MCP server. It specifies the command to execute, arguments, timeout, and auto-approval settings. ```json { "mcpServers": { "interactive-feedback-mcp": { "command": "uv", "args": [ "--directory", "/path/to/interactive-feedback-mcp", "run", "server.py" ], "timeout": 600, "autoApprove": [ "interactive_feedback" ] } } } ``` -------------------------------- ### FeedbackTextEdit Constructor Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Initializes the FeedbackTextEdit widget. Accepts an optional parent widget. ```python def __init__(self, parent=None) ``` -------------------------------- ### Run MCP Server with StdIO Transport Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/server.md Configures and runs the MCP server using the standard input/output (stdio) transport. This enables seamless communication with AI-assisted development tools by reading from stdin and writing to stdout. ```python if __name__ == "__main__": mcp.run(transport="stdio") ``` -------------------------------- ### interactive_feedback (MCP Tool) Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/README.md The primary integration point as an MCP server. This tool takes a project directory and a summary of changes to generate feedback. ```APIDOC ## interactive_feedback (MCP Tool) ### Description This tool integrates with the MCP system to provide interactive feedback on project changes. It requires the project directory and a summary of the changes made. ### Method MCP Tool Invocation ### Endpoint N/A (MCP Tool) ### Parameters #### Arguments - **project_directory** (str) - Required - The path to the project directory. - **summary** (str) - Required - A summary of the changes made to the project. ### Request Example ```xml interactive-feedback-mcp interactive_feedback { "project_directory": "/path/to/project", "summary": "I've implemented the authentication module." } ``` ### Response #### Success Response Returns a dictionary containing command logs and interactive feedback. #### Response Example ```json { "command_logs": "string", "interactive_feedback": "string" } ``` ``` -------------------------------- ### get_user_environment Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Returns the current process environment. On Windows, retrieves the user's full environment from the registry via Windows API calls. On other platforms, returns a copy of os.environ. ```APIDOC ### get_user_environment ```python def get_user_environment() -> dict[str, str] ``` #### Return Type `dict[str, str]` — A copy of the current environment variables #### Description Returns the current process environment. On Windows, retrieves the user's full environment from the registry via Windows API calls. On other platforms, returns a copy of `os.environ`. ``` -------------------------------- ### MCP Server Tool Definition Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/README.md Defines the `interactive_feedback` tool for use with the MCP framework. It takes a project directory and a summary as input. ```python from typing import Dict from mcp import mcp from annotated import Annotated @mcp.tool() def interactive_feedback( project_directory: Annotated[str, ...], summary: Annotated[str, ...] ) -> Dict[str, str]: pass ``` -------------------------------- ### Run or Stop Command Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Executes the command entered in the command_entry field. If a process is already running, this method stops it instead. It manages subprocess creation, output capturing, and UI updates. ```python def _run_command(self) ``` -------------------------------- ### get_user_environment Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/INDEX.md Retrieves information about the user's environment. Returns a dictionary containing environment details. ```APIDOC ## get_user_environment ### Description Retrieves information about the user's environment. Returns a dictionary containing environment details. ### Signature `get_user_environment() -> dict[str, str]` ### Module feedback_ui.py ### Returns dict[str, str] ``` -------------------------------- ### FeedbackUI Class Definition Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Defines the main window class for the interactive feedback interface. It inherits from PySide6's QMainWindow. ```python class FeedbackUI(QMainWindow) ``` -------------------------------- ### get_project_settings_group Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Creates a unique, human-readable settings group name for a project directory. Uses the last component of the path plus a hash to ensure uniqueness. ```APIDOC ## Helper Functions ### get_project_settings_group ```python def get_project_settings_group(project_dir: str) -> str ``` #### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | project_dir | str | Yes | The project directory path | #### Return Type `str` — A unique settings group identifier combining the directory basename and an 8-character MD5 hash #### Description Creates a unique, human-readable settings group name for a project directory. Uses the last component of the path plus a hash to ensure uniqueness even if multiple projects have the same directory name. **Example:** ```python group = get_project_settings_group("/home/user/my-app") # Returns: "my-app_a1b2c3d4" ``` ``` -------------------------------- ### FeedbackConfig Data Structure Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/architecture.md Represents the internal state for command execution configuration, including the command to run and whether to execute automatically. ```python { "run_command": "npm test", "execute_automatically": False } ``` -------------------------------- ### Error Recovery: Process Termination Failure Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/architecture.md Explains the behavior when process termination fails. Errors during `kill_tree()` are ignored, but orphaned processes may remain on Windows. ```text psutil error during kill_tree() ├─ Error caught and silently ignored ├─ Function continues cleanup └─ Windows may have orphaned processes ``` -------------------------------- ### get_user_environment Function Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Retrieves the current process environment variables. On Windows, it fetches the user's full environment; otherwise, it returns a copy of os.environ. ```python def get_user_environment() -> dict[str, str] ``` -------------------------------- ### Feedback Result Structure Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/INDEX.md Illustrates the dictionary structure returned by feedback operations. It includes captured command output and user feedback text. ```python { "command_logs": str, # Captured command output "interactive_feedback": str # User feedback text } ``` -------------------------------- ### Define interactive_feedback Tool Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/server.md Defines the 'interactive_feedback' tool, which requests user input for a given project directory and summary. It's designed to be called by AI assistants within an MCP-capable environment. ```python import mcp from typing import Dict @mcp.tool() def interactive_feedback( project_directory: str, summary: str, ) -> Dict[str, str]: """Requests interactive feedback from the user for a given project directory and summary. Launches the feedback UI as a separate process and blocks until the user provides feedback or closes the UI window.""" pass ``` -------------------------------- ### get_project_settings_group Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/INDEX.md Retrieves the project settings group for a given project directory. Returns a string representing the settings group. ```APIDOC ## get_project_settings_group ### Description Retrieves the project settings group for a given project directory. Returns a string representing the settings group. ### Signature `get_project_settings_group(project_dir: str) -> str` ### Module feedback_ui.py ### Returns str ``` -------------------------------- ### get_project_settings_group Function Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Generates a unique settings group identifier for a project directory. It combines the directory's base name with an MD5 hash to ensure uniqueness. ```python def get_project_settings_group(project_dir: str) -> str ``` -------------------------------- ### Empty Command Error Message Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/errors.md This message is appended to the log when a user attempts to run a command with an empty or whitespace-only input. ```text Please enter a command to run ``` -------------------------------- ### Gracefully Kill Child Processes with psutil.Error Handling Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/errors.md This snippet shows a function `kill_tree` that attempts to kill a process and its children. It includes error handling for `psutil.Error` during process termination, ensuring that failures are silently ignored and execution continues. ```python def kill_tree(process: subprocess.Popen): parent = psutil.Process(process.pid) for proc in parent.children(recursive=True): try: proc.kill() except psutil.Error: # Silently ignored pass ``` -------------------------------- ### Toggle Command Section Visibility Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Toggles the visibility of the command execution section. The visibility state is immediately saved to QSettings for the current project. ```python def _toggle_command_section(self) ``` -------------------------------- ### FeedbackConfig TypedDict Definition Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/types.md Defines the configuration structure for the feedback UI, specifying the command to run and whether to execute it automatically. Used for storing and managing project settings. ```python class FeedbackConfig(TypedDict): run_command: str execute_automatically: bool ``` -------------------------------- ### FeedbackTextEdit Class Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md A custom QTextEdit subclass that overrides key press events to submit feedback when Ctrl+Enter is pressed, instead of inserting a newline. ```APIDOC ## Class: FeedbackTextEdit ```python class FeedbackTextEdit(QTextEdit) ``` Custom QTextEdit subclass that captures Ctrl+Enter to submit feedback instead of inserting a newline. ### Constructor ```python def __init__(self, parent=None) ``` | Parameter | Type | Required | Default | |-----------|------|----------|---------| | parent | QWidget | No | None | ### Methods #### keyPressEvent ```python def keyPressEvent(self, event: QKeyEvent) ``` Intercepts key presses. When Ctrl+Return is pressed, finds the parent FeedbackUI and calls `_submit_feedback()`. Otherwise, delegates to the parent class. ``` -------------------------------- ### LogSignals Class Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md A Qt QObject subclass that emits signals to append log text in a thread-safe manner. ```APIDOC ## Class: LogSignals ```python class LogSignals(QObject) ``` Qt QObject subclass that emits signals to append log text in a thread-safe manner. ### Signals #### append_log ```python append_log = Signal(str) ``` Emitted when new log text should be appended to the UI. ``` -------------------------------- ### Handle RuntimeError During Environment Retrieval (Windows) Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/errors.md This snippet shows how to catch a RuntimeError, specifically when retrieving user environment variables on Windows fails. It includes a fallback to `os.environ.copy()`. ```python try: env = get_user_environment() except RuntimeError as e: print(f"Environment retrieval failed: {e}") # Fallback to os.environ env = os.environ.copy() ``` -------------------------------- ### Graceful Degradation for Environment Retrieval Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/errors.md This code shows a fallback mechanism for retrieving user environment variables. If the primary method `get_user_environment()` fails with a RuntimeError, it gracefully degrades by using the current process's environment variables. ```python try: env = get_user_environment() except RuntimeError: # Fall back to current process environment env = os.environ.copy() ``` -------------------------------- ### LogSignals Class Definition Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md A Qt QObject subclass designed to emit signals for thread-safe log appending to the UI. ```python class LogSignals(QObject) ``` -------------------------------- ### Update Internal Configuration Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Updates the internal 'config' dictionary based on changes in the command input or the auto-execute checkbox. This update is not persisted to storage. ```python def _update_config(self) ``` -------------------------------- ### Error Recovery: User Closes UI Without Submission Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/architecture.md Describes the outcome when a user closes the UI without submitting feedback. The command logs are captured, and interactive feedback is an empty string. ```text FeedbackUI.run() returns empty FeedbackResult ├─ command_logs: captured command output └─ interactive_feedback: "" (empty string) ``` -------------------------------- ### File-Based IPC Error Handling with Cleanup Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/errors.md This snippet demonstrates error handling for file-based inter-process communication. It ensures that a temporary output file is cleaned up by unlinking it if it exists, even if an exception occurs during subprocess execution or result reading. ```python try: # Launch subprocess and read result ... except Exception as e: if os.path.exists(output_file): os.unlink(output_file) # Clean up temp file raise e ``` -------------------------------- ### Handle Window Close Event Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Qt event handler for when the user closes the window. It saves the window geometry, terminates any running process, and initiates the standard closing procedure. ```python def closeEvent(self, event) ``` -------------------------------- ### get_dark_mode_palette Function Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Creates and returns a QPalette object configured for dark mode. This palette defines custom colors for various UI elements across the application. ```python def get_dark_mode_palette(app: QApplication) ``` -------------------------------- ### Handle File and JSON Errors During Feedback Processing Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/errors.md This snippet demonstrates handling FileNotFoundError and json.JSONDecodeError that can occur when reading or processing the feedback result file. These errors indicate issues with the temporary file's existence or content. ```python try: result = launch_feedback_ui("/path/to/project", "Summary") except FileNotFoundError: print("Feedback result file not found") except json.JSONDecodeError: print("Feedback result file contains invalid JSON") ``` -------------------------------- ### Subprocess Popen Configuration Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/architecture.md Configures the subprocess.Popen call for command execution, specifying shell interpretation, working directory, output capturing, environment, and text mode. ```python subprocess.Popen( command, shell=True, # Full shell interpretation cwd=project_directory, # Working directory stdout=subprocess.PIPE, # Capture stdout stderr=subprocess.PIPE, # Capture stderr env=get_user_environment(), # User's environment text=True, # Text mode (str, not bytes) bufsize=1, # Line buffering encoding="utf-8", # Encoding errors="ignore", # Skip unencodable chars close_fds=True # Close parent's file descriptors ) ``` -------------------------------- ### LogSignals QObject Definition Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/types.md Defines a Qt QObject subclass used for type hinting signals, specifically for appending log text. Emits a string signal for log messages. ```python class LogSignals(QObject): append_log = Signal(str) ``` -------------------------------- ### Error Recovery: Subprocess Execution Failure Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/architecture.md Details the handling of subprocess execution failures. The exception is caught, an error message is logged, and the window remains open for retries. ```text Popen() raises exception ├─ Caught in _run_command() ├─ Error message appended to log └─ Window stays open for user to retry ``` -------------------------------- ### FeedbackTextEdit Class Definition Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md A custom QTextEdit subclass that overrides the key press event to submit feedback when Ctrl+Enter is pressed, instead of inserting a newline. ```python class FeedbackTextEdit(QTextEdit) ``` -------------------------------- ### FeedbackResult Data Structure Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/architecture.md Represents the return value of a command execution, including command logs and interactive feedback. ```python { "command_logs": "$ npm test\n✓ 42 tests\n", "interactive_feedback": "LGTM, but add error handling" } ``` -------------------------------- ### get_dark_mode_palette Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Creates and returns a dark-mode color palette that is applied to the entire application. ```APIDOC ### get_dark_mode_palette ```python def get_dark_mode_palette(app: QApplication) ``` #### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | app | QApplication | Yes | The QApplication instance | #### Return Type `QPalette` — A dark-themed palette with custom colors for all UI elements #### Description Creates and returns a dark-mode color palette that is applied to the entire application. Defines colors for windows, text, buttons, links, and various UI states. ``` -------------------------------- ### kill_tree Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/INDEX.md Terminates a process and its child processes. This function does not return any value. ```APIDOC ## kill_tree ### Description Terminates a process and its child processes. This function does not return any value. ### Signature `kill_tree(process: subprocess.Popen) -> None` ### Module feedback_ui.py ### Returns None ``` -------------------------------- ### Append Log Message Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Appends a given text string to both the internal log buffer and the UI's log display. This method is called via a Qt signal for thread-safe UI updates. ```python def _append_log(self, text: str) ``` -------------------------------- ### kill_tree Source: https://github.com/noopstudios/interactive-feedback-mcp/blob/main/_autodocs/api-reference/feedback_ui.md Terminates a process and all its child processes recursively. Used to cleanly shut down user-executed commands. ```APIDOC ### kill_tree ```python def kill_tree(process: subprocess.Popen) ``` #### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | process | subprocess.Popen | Yes | The process to terminate | #### Description Terminates a process and all its child processes recursively. Used to cleanly shut down user-executed commands. ```