Skip to main content
Glama
Keyboard Maestro MCP Server

Keyboard Maestro MCP Server

by akari2600

Keyboard Maestro MCP Server

An MCP (Model Context Protocol) server that connects AI assistants like Claude to Keyboard Maestro, enabling them to trigger macros and retrieve clipboard results from your Mac.

What It Does

This MCP server lets AI assistants:

  • Trigger macros on one or multiple Macs

  • Capture clipboard contents (text and images) from macros

  • Take screenshots and analyze them

  • Run OCR and extract text

  • Control multiple machines from a single configuration

When you run a macro that copies something to the clipboard (like a screenshot), the AI can retrieve and see that content directly.

Related MCP server: Playwright MCP for macOS

Requirements

  • macOS with Keyboard Maestro 11+ installed

  • Keyboard Maestro Web Server enabled

  • Node.js 18+

Quick Start

1. Add the MCP Server

Add to your MCP client configuration:

Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "keyboard-maestro": {
      "command": "npx",
      "args": ["-y", "keyboard-maestro-mcp"]
    }
  }
}

Claude Code (~/.claude/mcp.json):

{
  "keyboard-maestro": {
    "command": "npx",
    "args": ["-y", "keyboard-maestro-mcp"]
  }
}

2. Run the Config Tool

After adding the server and restarting your MCP client, ask the AI:

Open the Keyboard Maestro config tool

The config tool will guide you through:

  1. Enable Web Server - Instructions for Keyboard Maestro's Web Server settings

  2. Add Machine(s) - Enter connection details and test the connection

  3. Update Config - Automatically update your MCP config file (or copy JSON)

  4. Install Macros - Generate and import the required Keyboard Maestro macros

Configuration Reference

Environment Variables

When machines are configured, the server uses these environment variables:

Variable

Description

KM_MACHINES

JSON array of machine configurations

Or for a single machine:

Variable

Required

Default

Description

KM_HOST

Yes

-

Hostname or IP address

KM_PORT

No

4490

Web server port

KM_USERNAME

Yes

-

Web server username

KM_PASSWORD

Yes

-

Web server password

KM_SECURE

No

false

Use HTTPS instead of HTTP

KM_NAME

No

Host value

Friendly name for the machine

KM_OUTPUT_DIR

Yes

-

Folder where clipboard files are saved

Machine Configuration Object

Each machine in KM_MACHINES supports:

Field

Required

Default

Description

name

Yes

-

Friendly name for the machine

host

Yes

-

Hostname or IP address

port

No

4490

Web server HTTP port

username

Yes

-

Web server username

password

Yes

-

Web server password

secure

No

false

Use HTTPS instead of HTTP

outputDir

Yes

-

Folder where clipboard files are saved

Port Spacing: Keyboard Maestro uses two consecutive ports (HTTP and HTTPS on port + 1). When configuring multiple machines, space ports by at least 2 (e.g., 4490, 4492, 4494).

Available Tools

interactive_config

Visual configuration tool with interactive UI (for Claude Desktop and other MCP Apps-supporting clients). Provides:

  • Machine management (add, edit, remove, test)

  • MCP config file updates

  • Macro group generation and installation

config

Text-based configuration tool (for Claude Code and other CLI clients).

list_machines

List all configured Keyboard Maestro machines.

list_macros

List available macros from a machine.

trigger_macro

Trigger a macro by name or UUID.

trigger_macro_on_all

Trigger a macro on all configured machines simultaneously.

get_clipboard_result

Retrieve the current clipboard contents from a machine.

trigger_and_capture

Trigger a macro and automatically capture the clipboard result.

Example Workflows

Screenshot Analysis

Take a screenshot of the active window and describe what you see

OCR Text Extraction

Run OCR on my clipboard image and read the text

Multi-Machine Control

Mute audio on all my machines

Keyboard Maestro Setup

The config tool will guide you, but here's a summary:

Enable Web Server

  1. Open Keyboard Maestro

  2. Go to Keyboard Maestro → Preferences (⌘,)

  3. Click the Web Server tab

  4. Check Web Server Enabled

  5. Set a Username and Password

  6. Note the HTTP Port (default: 4490)

Import Macros

After generating macros with the config tool:

  1. Go to File → Import → Import Macros Safely...

  2. Select the downloaded keyboard-maestro-mcp.kmmacros file

  3. The "Keyboard Maestro MCP" group will appear

Security Considerations

  • Credentials are passed via environment variables

  • Use HTTPS (secure: true) when connecting over untrusted networks

  • The web server uses HTTP Basic Authentication

  • Consider firewall rules to restrict access to the web server port

  • Clipboard files are stored in your configured folder

Troubleshooting

"Connection refused" errors

  • Verify Keyboard Maestro's web server is enabled

  • Check the port number matches your configuration

  • Ensure no firewall is blocking the connection

Macros not appearing in list

  • The macro must be enabled

  • The macro group must be enabled

  • The macro must have a name

Clipboard capture returns nothing

  • Run the config tool to verify macros are installed

  • Check that outputDir points to the same folder configured in the macros

  • Ensure the folder exists and is writable

License

MIT

Available Tools

12 tools
configKeyboard Maestro MCP ConfigC

Configuration tool for Keyboard Maestro MCP.

This tool helps you:

  • Add and manage Keyboard Maestro machines

  • Test connections to machines

  • Update your MCP client configuration

  • Generate and install the required macros

Inputs: no named parameters.

generate_macros_contentB

Generate Keyboard Maestro macros file, save to Downloads, and create the storage directory

Inputs: path (required).

get_clipboard_resultA

Retrieve the current clipboard contents from a remote machine. Returns text directly or displays images.

This is the companion tool to trigger_macro - use it to retrieve results after triggering macros that:

  • Take screenshots (the image will be on the clipboard)

  • Copy text or data to clipboard

  • Perform OCR or text extraction

  • Any operation that puts results on the system clipboard

The tool works by triggering a helper macro that saves the clipboard to a file, then reading that file. Requires the "Save Clipboard to File" macro to be installed (see error message for setup instructions if not configured).

Inputs: machine.

get_config_stateB

Get the current configuration state for Keyboard Maestro MCP

Inputs: no named parameters.

list_machinesB

List all configured Keyboard Maestro machines

Inputs: no named parameters.

list_macrosB

List available macros from a Keyboard Maestro machine's web server

Inputs: machine.

test_machine_connectionC

Test connection to a Keyboard Maestro machine

Inputs: host (required), password (required), username (required), port, +1 more.

trigger_and_captureA

Trigger a macro and automatically capture the clipboard result. This is a convenience tool that combines trigger_macro + get_clipboard_result.

Use this when you want to:

  • Take a screenshot and see it immediately

  • Run a macro that copies something to clipboard and retrieve it

  • Perform OCR and get the extracted text

The macro runs first, then after a short delay the clipboard is captured and returned.

Inputs: macro (required), delay, value, machine.

trigger_macroA

Trigger a Keyboard Maestro macro by name or UUID. The macro runs on the remote machine.

IMPORTANT: Keyboard Maestro's web server does not return macro output directly. If you need to retrieve results from a macro:

  • For macros that capture screenshots or copy data to clipboard: call get_clipboard_result afterward to retrieve the clipboard contents

  • For macros that write to files: the files are saved on the remote machine

Common patterns:

  • Screenshot workflow: trigger_macro("Take Screenshot...") → get_clipboard_result() to see the image

  • Text capture: trigger_macro("Copy Selection") → get_clipboard_result() to get the text

Inputs: macro (required), value, machine.

trigger_macro_on_allB

Trigger a Keyboard Maestro macro on all configured machines

Inputs: macro (required), value.

update_mcp_configC

Update an MCP client config file with Keyboard Maestro machine definitions

Inputs: machines (required), configPath (required), storagePath (required).

verify_macros_installedB

Check if the Keyboard Maestro MCP macros are installed on configured machines

Inputs: machineName.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 12 tools

    Disambiguation3/5

    The broad 'config' tool overlaps substantially with get_config_state, test_machine_connection, update_mcp_config, generate_macros_content, and verify_macros_installed, creating fuzzy boundaries in the setup cluster. trigger_and_capture also overlaps with trigger_macro plus get_clipboard_result, though its description clearly frames it as a convenience wrapper.

    Naming Consistency4/5

    Most tools follow a snake_case verb_noun pattern (list_machines, trigger_macro, get_clipboard_result), which is predictable. Minor deviations are the bare noun 'config' and 'trigger_and_capture' using 'and' rather than a single verb_noun form.

    Tool Count4/5

    Twelve tools is a reasonable size for a server covering machine configuration, macro discovery, triggering, and clipboard capture. There is some redundancy from the broad config tool and the convenience trigger_and_capture tool, but the count itself is not excessive.

    Completeness4/5

    The core workflow is well covered: configure/test/list machines, list/trigger macros, trigger across all machines, retrieve clipboard results, and generate/verify helper macros. Gaps exist around explicit machine removal and macro inspection/update, but these are minor for the primary execution-focused purpose.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Connect AI with any macOS app. Deep integration with native apps like Calendar, Mail, Notes, plus UI control for all applications. Works with Claude, Cursor, Raycast, and any MCP-compatible AI.
      46
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Gives AI assistants direct access to macOS clipboard - letting Claude copy generated code, text, or files straight to your clipboard for pasting anywhere on Mac.
      253
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables high-speed native macOS automation for Claude by interacting directly with the Accessibility API, AppleScript, and UI trees instead of using screenshots. It allows users to read app states, click elements, and type text semantically across any macOS application.
      12 npm
      13
      MIT