BetterTouchTool MCP Server
Enables AI assistants to control and interact with BetterTouchTool on macOS, allowing users to query configurations, execute triggers and actions, manage variables and widgets, control presets, and access clipboard contents through natural language.
README
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
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:
- Open BetterTouchTool
- Go to Preferences → Advanced → Webserver
- Check Enable Webserver
- Note the port (default:
12345) - Optionally set a Shared Secret for authentication
2. Install the MCP Server
Option A: Install with uv (Recommended)
# 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.py"
]
}
}
}
Using Python directly:
{
"mcpServers": {
"bettertouchtool": {
"command": "/path/to/bettertouchtool-mcp-server/.venv/bin/python",
"args": ["/path/to/bettertouchtool-mcp-server/btt_mcp.py"]
}
}
}
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"
Connection Options
Default HTTP Connection
By default, tools connect via HTTP to 127.0.0.1:12345. No additional configuration needed if BTT webserver is enabled with default settings.
With Shared Secret
If you've configured a shared secret in BTT, include it in your requests:
Use my BTT shared secret "my_secret_key" when connecting
Or Claude will ask if authentication fails.
Using CLI Mode
For faster performance, you can use the bttcli command-line tool instead of HTTP:
Use CLI mode for BTT commands
This uses the Unix 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 shortcutstouchbar- Touch Bar itemstrackpad- Trackpad gesturesmagic_mouse- Magic Mouse gesturesdrawings- Drawing gesturessiri_remote- Siri Remotenormal_mouse- Regular mouse buttonsstream_deck- Stream Deck buttonsmidi- MIDI triggersmenubar- Menu bar items
Troubleshooting
"Connection refused" errors
- Ensure BTT is running
- Verify webserver is enabled in BTT preferences
- Check the port matches (default: 12345)
"403 Forbidden" errors
You have a shared secret configured in BTT. Either:
- Provide the secret in your request
- 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
- Check Claude Desktop config syntax is valid JSON
- Verify the path to the MCP server is correct
- Restart Claude Desktop
- Check Console.app for MCP-related errors
Development
Running locally for testing
# With uv
uv run btt_mcp.py
# Or directly
python btt_mcp.py
Testing with MCP Inspector
npx @modelcontextprotocol/inspector uv --directory /path/to/project run btt_mcp.py
API Reference
This server implements the BTT Webserver API. Key endpoints used:
GET /get_triggers- Retrieve trigger configurationsGET /trigger_named- Execute named triggersGET /trigger_action- Execute arbitrary actionsGET /get_string_variable/set_string_variable- Variable managementGET /update_touch_bar_widget- Widget updatesGET /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
- BetterTouchTool by folivora.AI
- Model Context Protocol by Anthropic
- FastMCP for the Python MCP framework
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。