Skip to main content
Glama
BetterTouchTool MCP Server

BetterTouchTool MCP Server

BetterTouchTool MCP Server

A Model Context Protocol (MCP) server that enables AI assistants like Claude to control and interact with BetterTouchTool on macOS.

What is this?

This MCP server acts as a bridge between Claude (or other MCP-compatible AI assistants) and BetterTouchTool, allowing you to:

  • Query your BTT configuration - Understand what triggers, shortcuts, and automations you have set up

  • Execute triggers and actions - Run named triggers, keyboard shortcuts, or any BTT action

  • Manage variables - Get and set BTT variables for dynamic workflows

  • Update widgets - Modify Touch Bar, Menu Bar, or Stream Deck widgets in real-time

  • Control presets - Export, import, and manage BTT presets

  • Access clipboard - Read and write clipboard contents programmatically

Related MCP server: Keyboard Maestro MCP Server

Prerequisites

  • macOS (BetterTouchTool is macOS-only)

  • BetterTouchTool installed with a valid license

  • Python 3.12+

  • uv (recommended) or pip for package management

  • Claude Desktop or another MCP-compatible client

Installation

1. Enable BTT Webserver

First, enable the BetterTouchTool webserver:

  1. Open BetterTouchTool

  2. Go to Preferences → Advanced → Webserver

  3. Check Enable Webserver

  4. Note the port (default: 56786)

  5. Optionally set a Shared Secret for authentication

2. Install the MCP Server

# Clone the repository
git clone https://github.com/your-username/bettertouchtool-mcp-server.git
cd bettertouchtool-mcp-server

# Install dependencies with uv
uv sync

Option B: Install with pip

# Clone the repository
git clone https://github.com/your-username/bettertouchtool-mcp-server.git
cd bettertouchtool-mcp-server

# Create virtual environment and install
python -m venv .venv
source .venv/bin/activate
pip install -e .

3. Configure Claude Desktop

Add the server to your Claude Desktop configuration file:

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

Using uv:

{
  "mcpServers": {
    "bettertouchtool": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/bettertouchtool-mcp-server",
        "run",
        "btt-mcp-server"
      ]
    }
  }
}

Using Python directly:

{
  "mcpServers": {
    "bettertouchtool": {
      "command": "/path/to/bettertouchtool-mcp-server/.venv/bin/python",
      "args": ["-m", "btt_mcp"]
    }
  }
}

4. Restart Claude Desktop

After saving the configuration, restart Claude Desktop to load the MCP server.

Available Tools

The server provides 20 tools organized into categories:

Configuration Reading

Tool

Description

btt_get_triggers

List triggers with optional filtering by type, app, or parent

btt_get_trigger

Get detailed info about a specific trigger by UUID

btt_list_named_triggers

List all named triggers (quick actions)

btt_get_preset_details

Get info about presets and their status

Trigger Management

Tool

Description

btt_trigger_named

Execute a named trigger by name

btt_trigger_action

Execute any BTT action via JSON definition

btt_execute_trigger

Execute all actions assigned to a trigger UUID

btt_add_trigger

Create a new trigger from JSON definition

btt_update_trigger

Modify an existing trigger

btt_delete_trigger

Remove a trigger (⚠️ destructive)

Variable Management

Tool

Description

btt_get_variable

Read string or number variables

btt_set_variable

Set persistent or runtime variables

Widget Control

Tool

Description

btt_update_widget

Update widget text, icon, or colors

btt_refresh_widget

Force a script widget to refresh

Clipboard Operations

Tool

Description

btt_get_clipboard

Read clipboard in various formats

btt_set_clipboard

Write to clipboard

Preset Management

Tool

Description

btt_export_preset

Export preset to a file

btt_import_preset

Import preset from a file

System Utilities

Tool

Description

btt_display_notification

Show a macOS notification

btt_reveal_in_ui

Open BTT and navigate to an element

Usage Examples

Exploring Your Configuration

Ask Claude:

"What triggers do I have set up in BetterTouchTool?"

"Show me all my named triggers"

"What keyboard shortcuts do I have configured?"

Running Automations

"Run my 'Toggle Dark Mode' trigger in BTT"

"Execute the BTT trigger that opens my development environment"

Working with Variables

"What's the current value of my 'workMode' variable in BTT?"

"Set my BTT variable 'currentProject' to 'MCP Server Development'"

Updating Widgets

"Update my Touch Bar clock widget to show 'Meeting in 5 min' with a red background"

"Refresh my system stats widget"

Managing Configuration

"Export my current BTT preset to ~/Desktop/my-preset.bttpreset"

"Show me the details of trigger with UUID abc-123-def"

Complex Workflows

"I want to create a new named trigger that opens Safari and navigates to my project management tool"

"Help me understand what my 'Morning Routine' trigger does and suggest improvements"

Configuration

Configuration is stored in ~/.config/btt-mcp/config.yml. The file is created automatically with defaults on first use, or you can create it manually:

# BTT MCP Server Configuration
host: 127.0.0.1
port: 56786
shared_secret: null  # Set this if you've configured a shared secret in BTT
use_cli: false       # Set to true to use bttcli instead of HTTP

Configuration Options

Option

Default

Description

host

127.0.0.1

BTT webserver host

port

56786

BTT webserver port

shared_secret

null

Shared secret for authentication (if configured in BTT)

use_cli

false

Use bttcli CLI tool instead of HTTP (faster, uses Unix socket)

Example: With Shared Secret

If you've configured a shared secret in BTT preferences:

host: 127.0.0.1
port: 56786
shared_secret: my_secret_key

Example: Using CLI Mode

For faster performance using the Unix socket:

use_cli: true

This uses the socket at /tmp/com.hegenberg.BetterTouchTool.sock for lower latency.

Trigger Types

When filtering triggers, you can use these types:

  • named_trigger - Named triggers (quick actions)

  • keyboard_shortcut - Keyboard shortcuts

  • touchbar - Touch Bar items

  • trackpad - Trackpad gestures

  • magic_mouse - Magic Mouse gestures

  • drawings - Drawing gestures

  • siri_remote - Siri Remote

  • normal_mouse - Regular mouse buttons

  • stream_deck - Stream Deck buttons

  • midi - MIDI triggers

  • menubar - Menu bar items

Troubleshooting

"Connection refused" errors

  1. Ensure BTT is running

  2. Verify webserver is enabled in BTT preferences

  3. Check the port matches (default: 12345)

"403 Forbidden" errors

You have a shared secret configured in BTT. Either:

  • Add shared_secret: your_secret to ~/.config/btt-mcp/config.yml

  • Remove the shared secret from BTT preferences

"bttcli not found" (CLI mode)

The CLI tool should be at:

  • /Applications/BetterTouchTool.app/Contents/SharedSupport/bin/bttcli

  • or ~/Applications/BetterTouchTool.app/Contents/SharedSupport/bin/bttcli

Tools not appearing in Claude

  1. Check Claude Desktop config syntax is valid JSON

  2. Verify the path to the MCP server is correct

  3. Restart Claude Desktop

  4. Check Console.app for MCP-related errors

Development

Project Structure

The codebase is organized into a modular package:

src/btt_mcp/
├── server.py      # FastMCP server initialization
├── config.py      # Constants and configuration
├── models/        # Pydantic input models (7 files)
├── client/        # BTT communication (HTTP + CLI)
├── formatters/    # Output formatting
└── tools/         # MCP tool implementations (6 files)

See CLAUDE.md for detailed architecture documentation.

Running locally for testing

# With uv
uv run btt-mcp-server

# Or directly
python -m btt_mcp

Running Tests

# Run all 48 tests
uv run pytest

# With verbose output
uv run pytest -v

Testing with MCP Inspector

npx @modelcontextprotocol/inspector uv --directory /path/to/project run btt-mcp-server

API Reference

This server implements the BTT Webserver API. Key endpoints used:

  • GET /get_triggers - Retrieve trigger configurations

  • GET /trigger_named - Execute named triggers

  • GET /trigger_action - Execute arbitrary actions

  • GET /get_string_variable / set_string_variable - Variable management

  • GET /update_touch_bar_widget - Widget updates

  • GET /get_clipboard_content / set_clipboard_content - Clipboard access

License

MIT License - see LICENSE file.

Contributing

Contributions welcome! Please feel free to submit issues and pull requests.

Acknowledgments

Available Tools

20 tools
btt_add_triggerA

Add a new trigger to BetterTouchTool.

The trigger definition should be in JSON format. You can get
the format by copying an existing trigger's JSON in BTT.

Args:
    params: Contains the trigger JSON definition and optional parent UUID.

Returns:
    Confirmation of trigger creation.

Inputs: params (required). Returns: result

btt_delete_triggerA
Destructive

Delete a trigger from BetterTouchTool.

WARNING: This permanently removes the trigger. Make sure you have
the correct UUID before deleting.

Args:
    params: Contains the UUID of the trigger to delete.

Returns:
    Confirmation of deletion.

Inputs: params (required). Returns: result

btt_display_notificationB

Display a macOS notification via BTT.

Args:
    params: Notification title, subtitle, sound, and optional image.

Returns:
    Confirmation of notification being displayed.

Inputs: params (required). Returns: result

btt_execute_triggerB

Execute all actions assigned to a specific trigger by UUID.

Args:
    params: Contains the UUID of the trigger to execute.

Returns:
    Result of the execution.

Inputs: params (required). Returns: result

btt_export_presetA
Read-onlyIdempotent

Export a BTT preset to a file.

Useful for backing up configurations or sharing presets.

Args:
    params: Preset name and export options.

Returns:
    Path to exported preset file.

Inputs: params (required). Returns: result

btt_get_clipboardB
Read-onlyIdempotent

Get the current clipboard content.

Can retrieve content in various formats including plain text, HTML,
images (as base64), and more.

Args:
    params: Format to retrieve and whether to return as base64.

Returns:
    Clipboard content.

Inputs: params (required). Returns: result

btt_get_preset_detailsB
Read-onlyIdempotent

Get details about a specific preset.

Returns information about the preset's status, UUID, and visibility.

Args:
    params: Name of the preset to query.

Returns:
    Preset details in markdown or JSON format.

Inputs: params (required). Returns: result

btt_get_triggerA
Read-onlyIdempotent

Retrieve a specific trigger by its UUID.

Use this to get detailed information about a single trigger, including
all its configuration and assigned actions.

Args:
    params: Contains the UUID of the trigger to retrieve.

Returns:
    Trigger configuration in markdown or JSON format.

Inputs: params (required). Returns: result

btt_get_triggersA
Read-onlyIdempotent

Retrieve triggers from BetterTouchTool with optional filtering.

Use this tool to explore and understand the current BTT configuration.
You can filter by trigger type, parent folder, specific app, or get all triggers.

Args:
    params: Filter parameters including trigger_type, trigger_id, app_bundle_identifier, etc.

Returns:
    List of triggers in markdown or JSON format based on response_format setting.

Inputs: params (required). Returns: result

btt_get_variableA
Read-onlyIdempotent

Get the value of a BTT variable.

BTT has many built-in variables (like BTTActiveAppBundleIdentifier)
and supports user-defined variables.

Args:
    params: Variable name and type (string or number).

Returns:
    Current value of the variable.

Inputs: params (required). Returns: result

btt_import_presetB

Import a BTT preset from a file.

Args:
    params: Path to the preset file.

Returns:
    Confirmation of import.

Inputs: params (required). Returns: result

btt_list_named_triggersA
Read-onlyIdempotent

List all named triggers configured in BetterTouchTool.

Named triggers are triggers configured in the 'Other' tab that can be
called by name from scripts or other actions.

Returns:
    List of named triggers with their names and UUIDs.

Inputs: params (required). Returns: result

btt_refresh_widgetA
Idempotent

Refresh a script widget to re-execute its scripts.

Use this to force a widget to update its display by running
its assigned scripts again.

Args:
    params: UUID of the widget to refresh.

Returns:
    Confirmation of refresh.

Inputs: params (required). Returns: result

btt_reveal_in_uiA
Idempotent

Reveal a trigger or element in the BetterTouchTool UI.

Opens BTT and navigates to the specified element for editing.

Args:
    params: UUID of the element to reveal.

Returns:
    Confirmation.

Inputs: params (required). Returns: result

btt_set_clipboardB
Idempotent

Set the clipboard content.

Can set content in various formats including plain text and HTML.

Args:
    params: Content to set and format.

Returns:
    Confirmation of clipboard being set.

Inputs: params (required). Returns: result

btt_set_variableA
Idempotent

Set a BTT variable to a specified value.

Variables can be persistent (survive BTT restart) or runtime-only.

Args:
    params: Variable name, value, type, and persistence setting.

Returns:
    Confirmation of variable being set.

Inputs: params (required). Returns: result

btt_trigger_actionA

Trigger any BTT predefined action using a JSON definition.

You can get the JSON for an action by right-clicking a configured
trigger in BTT and selecting 'Copy JSON'.

Args:
    params: Contains the action JSON definition.

Returns:
    Result of the action execution.

Inputs: params (required). Returns: result

btt_trigger_namedA

Execute a named trigger by its name.

Named triggers are configured in BTT's 'Other' tab and can perform
any sequence of actions.

Args:
    params: Contains the trigger_name and whether to wait for completion.

Returns:
    Result of the trigger execution (if wait_for_reply is True).

Inputs: params (required). Returns: result

btt_update_triggerB
Idempotent

Update an existing trigger's configuration.

Provide the UUID of the trigger and a JSON object with the
properties to update.

Args:
    params: Contains UUID and JSON with properties to update.

Returns:
    Confirmation of update.

Inputs: params (required). Returns: result

btt_update_widgetA
Idempotent

Update the display of a Touch Bar, Menubar, or Stream Deck widget.

This allows temporary updates to widget appearance without changing
the underlying configuration.

Args:
    params: Widget UUID, type, and display properties to update.

Returns:
    Confirmation of widget update.

Inputs: params (required). Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 20 tools

    Disambiguation4/5

    Most tools have distinct purposes, but there is some potential confusion between btt_execute_trigger, btt_trigger_action, and btt_trigger_named, as they all involve executing triggers or actions. The descriptions help clarify differences, but an agent might initially struggle to choose the right one for a given task.

    Naming Consistency5/5

    All tool names follow a consistent btt_verb_noun pattern with snake_case, such as btt_add_trigger, btt_delete_trigger, and btt_get_clipboard. This uniformity makes the tool set predictable and easy to navigate.

    Tool Count4/5

    With 20 tools, the count is on the higher side but reasonable for a comprehensive BetterTouchTool server covering triggers, presets, variables, clipboard, notifications, and widgets. It might feel slightly heavy, but each tool appears to serve a specific function in the domain.

    Completeness5/5

    The tool set provides complete coverage for managing BetterTouchTool, including CRUD operations for triggers (add, delete, get, update, list), preset handling (export, import, get details), variable management (get, set), clipboard control, notifications, and widget updates. No obvious gaps are present for the intended domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      An advanced macOS automation toolkit that enables AI clients to directly control a machine through deep integration with Keyboard Maestro. It provides a comprehensive suite of tools for executing macros, managing variables, and performing complex system automation with enterprise-grade security.
      13
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables AI assistants to automate macOS through AppleScript and JXA by providing 44 tools for application management, window control, and UI interaction. It allows for comprehensive system control including screen capture, keyboard and mouse simulation, and system information retrieval.
      44
      15 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to automate macOS desktop tasks including mouse control, keyboard input, screenshots, window management, and UI interaction.
      10 npm
      415
      MIT