Skip to main content
Glama

launchd-mcp

Manage macOS launchd jobs from MCP tools.

This project provides:

  • An MCP server (main.py) that wraps launchctl

  • Task management tools for Python-script jobs (link.igtm.launchd-mcp.*)

  • Per-task log management and retrieval

  • A reusable Agent Skill at skills/launchctl/SKILL.md for users who prefer raw CLI workflows (no MCP server implementation)

Features

  • Basic launchctl operations: list, print, kickstart, bootstrap, bootout, enable, disable

  • Managed task lifecycle:

    • create_or_update_python_task

    • list_python_tasks

    • get_python_task_logs

    • remove_python_task

  • Scheduling and event options:

    • StartInterval (seconds)

    • StartCalendarInterval

    • WatchPaths

    • QueueDirectories

  • Runtime tuning options:

    • KeepAlive, ThrottleInterval, ProcessType, Nice, Umask, HardResourceLimits

Related MCP server: agent-scheduler

Requirements

  • macOS (Darwin) for launchctl execution

  • Python 3.13+

  • uv

Install

git clone git@github.com:igtm/launchd-mcp.git
cd launchd-mcp
uv sync

Run MCP Server

uv run main.py

Claude Desktop Example

~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "launchd": {
      "command": "uv",
      "args": [
        "--directory",
        "/ABSOLUTE/PATH/TO/launchd-mcp",
        "run",
        "main.py"
      ]
    }
  }
}

Logs

Managed task logs are written to:

  • ~/.local/share/launchd-mcp/logs/{label}.out.log

  • ~/.local/share/launchd-mcp/logs/{label}.err.log

Tests

uv run pytest

Agent Skill (CLI-first)

If you prefer managing launchd directly with shell/launchctl/plist files (without MCP server implementation), use:

  • skills/launchctl/SKILL.md

This Skill follows the same label, task, and log conventions as this repository.

Safety Notes

  • For stdio MCP servers, never print to stdout except protocol messages.

  • Treat python_script input as untrusted unless validated.

  • Validate generated plist files (plutil -lint) before launchctl bootstrap.

Available Tools

12 tools
bootout_serviceC

Unload or remove a service/domain via launchctl bootout.

Args: target: Service or domain target accepted by launchctl bootout.

Inputs: target (required). Returns: result

bootstrap_serviceA

Load a launchd plist into a domain via launchctl bootstrap.

Args: domain_target: Domain like "system", "user/501", or "gui/501". plist_path: Absolute path to a LaunchAgent/LaunchDaemon plist.

Inputs: plist_path (required), domain_target (required). Returns: result

create_or_update_python_taskA

Create/update a LaunchAgent from a Python script string and load it.

Args: task_name: Human friendly task name. Will be sanitized for label suffix. python_script: Python source code to execute. label_prefix: Reverse-domain prefix (e.g. "link.igtm.launchd-mcp"). run_at_load: Whether to run immediately after load. start_interval_seconds: Optional StartInterval in seconds. start_calendar: Optional object/array for StartCalendarInterval. watch_paths_csv: Optional comma-separated list for WatchPaths. queue_directories_csv: Optional comma-separated list for QueueDirectories. working_directory: Optional WorkingDirectory. Defaults to task directory. python_bin: Optional python executable path. Defaults to python3 on PATH. extra_path_csv: Optional comma-separated PATH entries prepended in plist. keep_alive: Optional KeepAlive (bool or object). throttle_interval_seconds: Optional ThrottleInterval in seconds. process_type: Optional ProcessType (Background/Standard/Adaptive/Interactive). nice: Optional Nice value. umask: Optional octal umask like "022" or "0o022". hard_resource_limits: Optional HardResourceLimits object. replace_existing: If true, bootout existing service first.

Inputs: task_name (required), python_script (required), nice, umask, +14 more. Returns: result

disable_serviceA

Disable a service via launchctl disable.

Args: service_target: Service target like "system/com.example.daemon" or "gui/501/com.example.agent".

Inputs: service_target (required). Returns: result

enable_serviceC

Enable a service via launchctl enable.

Args: service_target: Service target like "system/com.example.daemon" or "gui/501/com.example.agent".

Inputs: service_target (required). Returns: result

get_python_task_logsA

Fetch per-task execution logs (stdout/stderr).

Args: task_name: Optional original task name. If omitted, return logs for all matching tasks. label_prefix: Reverse-domain prefix used for managed task labels. lines: Number of tail lines to return from each log file. include_stdout: Include stdout logs. include_stderr: Include stderr logs.

Inputs: lines, task_name, label_prefix, include_stderr, +1 more. Returns: result

kickstart_serviceA

Start or restart a service via launchctl kickstart.

Args: target: A launchd target, e.g. "gui/501/com.example.app". kill_existing: If true, pass -k to kill any running instance first.

Inputs: target (required), kill_existing. Returns: result

list_plistsB

List available launchd plist files from common locations.

Args: scope: "all", "system", or "user".

Inputs: scope. Returns: result

list_python_tasksA

List managed tasks matching {label_prefix}.*.

Args: label_prefix: Reverse-domain prefix used for managed task labels.

Inputs: label_prefix. Returns: result

list_servicesA

List launchd services from launchctl list.

Args: label_filter: Optional substring filter for the service label.

Inputs: label_filter. Returns: result

remove_python_taskA

Unload and remove a task created by create_or_update_python_task.

Args: task_name: The original task name. label_prefix: Reverse-domain prefix used for task label. delete_files: If true, remove script/plist/log files.

Inputs: task_name (required), delete_files, label_prefix. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 12 tools

    Disambiguation4/5

    The generic launchctl tools and the managed Python-task tools are clearly separated into distinct groups. There is minor potential confusion between bootstrap_service and create_or_update_python_task since both load a plist, but the descriptions clarify that one is a raw launchctl wrapper and the other is a higher-level task manager.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun snake_case pattern, such as list_services, kickstart_service, bootout_service, and create_or_update_python_task. The naming convention is uniform across both the generic launchctl operations and the managed Python-task operations.

    Tool Count5/5

    With 12 tools, the server is well-scoped for its launchd administration purpose. The generic service lifecycle tools and the higher-level Python-task management tools each earn their place without unnecessary redundancy or bloat.

    Completeness5/5

    The server covers the full launchd lifecycle: listing, inspecting, loading, unloading, starting, enabling, and disabling services. The Python-task workflow adds create/update/remove/list/logs, providing complete coverage for both the low-level and high-level use cases.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      A
      maintenance
      An MCP server that surfaces scheduled-job state and detects silent failures (exit 0 but no useful output) for cron, systemd timers, and OpenClaw schedulers, enabling AI agents to query job health and overdue status directly.
      6
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that lets AI agents manage cron jobs through natural language — adding, listing, pausing, removing, running, and viewing logs of scheduled jobs with plain-English schedule parsing, automatic log capture, missed-run detection, and failure alerts.
      MIT