AgentSkillsCN

shortcuts-bridge

通过本地HTTP服务器触发macOS快捷指令。适用于用户想要发送短信、创建提醒、触发自动化任务,或执行任何macOS快捷指令的场景。需在用户Mac上运行shortcuts_bridge服务器。触发短语包括“给[某人]发短信”“向[某人]发送消息”“提醒我”“运行快捷指令”,或任何可以通过macOS快捷指令完成的请求。

SKILL.md
--- frontmatter
name: shortcuts-bridge
description: Trigger macOS Shortcuts via local HTTP server. Use when the user asks to send text messages, create reminders, trigger automations, or perform any macOS Shortcut action. Requires shortcuts_bridge server running on user's Mac. Trigger phrases include "text [person]", "send a message to", "remind me", "run shortcut", or any request that could be fulfilled by a macOS Shortcut.

Shortcuts Bridge

Trigger macOS Shortcuts from Claude via a local HTTP bridge server running on the user's Mac.

Prerequisites

The user must have shortcuts_bridge.py running:

bash
python3 shortcuts_bridge.py

Bridge URL: http://127.0.0.1:9876

Security defaults:

  • allow_remote_clients should stay false
  • auth_token should be set for POST endpoints
  • enable_savefile should stay false unless needed
  • Browser calls require cors_allowed_origins to include the page origin

Step 1: Check Available Shortcuts

Read the bridge health endpoint and only use shortcuts in allowed_shortcuts:

javascript
fetch('http://127.0.0.1:9876/health').then(r => r.json()).then(console.log)

If token auth is enabled, include header X-Bridge-Token.

Step 2: Trigger via Browser JavaScript

If direct shell HTTP calls are unavailable, use browser JavaScript:

javascript
(async () => {
  const r = await fetch('http://127.0.0.1:9876/run', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-Bridge-Token': 'YOUR_TOKEN_IF_REQUIRED'
    },
    body: JSON.stringify({
      shortcut: 'SHORTCUT_NAME',
      input: 'Your message or input here'
    })
  });
  return await r.text();
})()

Response Format

Success: {"success": true, "shortcut": "SendText"} Error: {"error": "...", "allowed": ["SendText", ...]}

Adding New Shortcuts

User must:

  1. Create a Shortcut in Shortcuts.app (accepts text input if needed)
  2. Add shortcut name to allowed_shortcuts in shortcuts_bridge.local.json
  3. Restart the server

Common Shortcut Pattern

ShortcutPurposeInput
SendTextSend iMessage/SMSMessage text
CreateReminderAdd reminderReminder text
ShowNotificationLocal notificationMessage text

Troubleshooting

  • Timeout/no response: server not running or crashed. Restart shortcuts_bridge.py.
  • Connection refused: bridge not started.
  • Shortcut not in allowlist: add it to allowed_shortcuts and restart.