Skip to content

jimyag/mcga

Repository files navigation

MCGA - My Clipboard Guard Assistant

Clipboard parser for macOS and Windows. MCGA watches the clipboard, runs built-in and custom parsers, then shows parsed results in a popover and an auto popup.

Features

  • macOS 15+ menu bar app, no Dock icon.
  • Windows notification area app with auto popup, settings, single-instance replacement, and optional start at login.
  • Clipboard auto-detection with hover-preserved popup.
  • Current result and history in the menu bar popover.
  • Copy parsed result content without copying parser titles.
  • Parser settings window with Chinese / English UI, light / dark theme, and per-parser toggles.
  • Built-in parsers for UUID, ObjectID, hash, CIDR, IPv4/IPv6, timestamp, HTTP status, number base, Cron, URL, JSON, JSON5, XML, TOML, YAML, HTML entity, Base64, DNS, and keyword generators.
  • Custom command parsers from local scripts.

Screenshots

Popover

MCGA popover

Settings

MCGA settings

Windows

MCGA Windows popup

MCGA Windows notification area

Installation

Download the latest DMG from the Releases page. Open the DMG and drag MCGA.app to your Applications folder.

Note: Because MCGA is an open-source tool and not signed with an Apple Developer certificate, macOS Gatekeeper may show a warning that the app "is damaged and can't be opened." You must manually remove the quarantine attribute before running it for the first time.

Open Terminal and run:

sudo xattr -rd com.apple.quarantine /Applications/MCGA.app

Enter your password when prompted. You can then open MCGA normally from Launchpad or your Applications folder.

Build

macOS

Requirements:

  • macOS 15+
  • Swift 6 / Xcode Command Line Tools

First, enter the macOS directory:

cd macos

Verify core parsers:

swift run MCGASmokeTests

Build the executable:

swift build --product MCGA

Package .build/MCGA.app:

bash scripts/build-macos-app.sh

Open the app:

open .build/MCGA.app

If an old version is running:

pkill MCGA
open .build/MCGA.app

After launch, click the MCGA menu bar item to view current results and history. Copy a supported value such as JSON, UUID, IP, timestamp, CIDR, HTTP status code, URL, HTML entities, XML, TOML, Base64, Cron, YAML, or a domain to trigger parsing.

Windows

Requirements:

  • Windows 10/11
  • .NET 8 SDK

Build and publish a self-contained single-file executable:

dotnet publish windows\MCGA.csproj -c Release -r win-x64 --self-contained true

The published executable is generated at:

windows\bin\Release\net8.0-windows\win-x64\publish\MCGA.exe

MCGA runs in the Windows notification area. If the icon is hidden under ^, pin it from Windows taskbar settings or drag it next to the other system tray icons. Start-at-login writes the current executable path to the current user's HKCU\Software\Microsoft\Windows\CurrentVersion\Run registry key.

Windows behavior:

  • Closing MCGA panels hides the window; it does not quit the app.
  • To quit MCGA, use Quit from the notification area icon menu.
  • Starting a new MCGA process replaces the old running process.
  • Enabling start at login registers the exact executable path currently running.

Custom Command Parsers

Custom parsers are loaded from:

~/.config/mcga/custom_parsers.json

Only command parsers are supported. MCGA executes the configured command, writes the clipboard text to stdin, and reads stdout:

  • exit code 0 means success
  • empty stdout means no result
  • the first stdout line is shown as the parsed value
  • multi-line stdout is preserved as result details
  • stderr is ignored
  • command paths support absolute paths, ~, $HOME, and ${HOME}
  • commands must be executable files
  • timeoutMs is clamped to 50-3000 ms, default 500 ms

Example:

{
  "parsers": [
    {
      "name": "Demo Command",
      "kind": "command",
      "description": {
        "zh": "执行本地命令解析 demo: 开头的剪切板内容。",
        "en": "Runs a local command for clipboard text starting with demo:."
      },
      "examples": [
        {
          "input": "demo:123",
          "expected": {
            "zh": "命令 stdout 的第一行会显示为解析结果。",
            "en": "The first stdout line is shown as the parsed result."
          }
        }
      ],
      "match": "^demo:",
      "command": "$HOME/.config/mcga/parsers/demo.sh",
      "args": [],
      "timeoutMs": 500,
      "enabled": true
    }
  ]
}

Example script:

#!/usr/bin/env bash
set -euo pipefail
input="$(cat)"
printf 'Parsed %s\n' "$input"
printf 'Original clipboard: %s\n' "$input"

License

MIT

About

Clipboard parser for macOS and Windows with menu bar / notification area popups.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors