Apple快捷指令生成器

一个通过MCP协议使用AI创建、复制、列出和运行Apple快捷指令的服务,支持使用Cherri语言编程式生成快捷指令。

  • by Suisei110
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 Suisei110/apple-shortcut-maker-mcp

使用说明

苹果快捷键制造商MCP

使用MCP(模型上下文协议)使用AI创建Apple快捷方式。

描述

一个MCP服务器,允许AI助手(如Claude、Cursor等)直接从代码创建、复制、列出和运行Apple Shortcuts。使用Cherri编程语言以编程方式创建快捷方式。

特性

  • 创建快捷方式 -使用Cherri代码创建新的Apple快捷方式
  • 复制快捷方式 -用新名称复制现有快捷方式
  • 列出快捷方式 -列出Mac上所有可用的快捷方式
  • 运行快捷方式 -使用可选输入运行任何快捷方式

需求

  • macOS蒙特利或更高版本
  • Python 3.10+
  • 樱桃 已安装编译器

安装

1.安装Cherri

brew tap electrikmilk/cherri
brew install electrikmilk/cherri/cherri

验证Cherri是否已安装:

cherri --version

2.安装此MCP服务器

# Clone the repository
git clone https://github.com/suisei110/apple-shortcut-maker-mcp.git
cd apple-shortcut-maker-mcp

# Install as package (recommended for direct CLI usage)
uv pip install -e . --system

或者仅安装依赖项:

uv sync

3.配置MCP客户端

克劳德桌面版

将此添加到您的 claude_desktop_config.json:

{
  "mcpServers": {
    "Apple Shortcut Maker": {
      "command": "apple-shortcut-mcp",
      "enabled": true
    }
  }
}

或使用紫外线(替代):

{
  "mcpServers": {
    "apple-shortcut-maker": {
      "command": "uv",
      "args": [
        "--directory",
        "/PATH/TO/apple-shortcut-maker-mcp",
        "run",
        "apple-shortcut-mcp"
      ]
    }
  }
}

VS代码(光标)

添加到MCP设置中:

{
  "mcpServers": {
    "Apple Shortcut Maker": {
      "command": "apple-shortcut-mcp",
      "enabled": true
    }
  }
}

用法

可用工具

配置后,您可以在AI助手中使用这些工具:

1.create_shortcut

使用Cherri代码创建新的Apple快捷方式。

参数:

  • code (string,必填):快捷方式的Cherri代码
  • name (字符串,必填):快捷方式的名称

例子:

Create a shortcut named "Hello World" that shows an alert with "Hello, World!"

2.复制_快捷方式

用新名称复制现有快捷方式。

参数:

  • source_name (字符串,必填):要复制的快捷方式的名称
  • new_name (字符串,必填):新快捷方式的名称

3.列表_短路

列出Mac上所有可用的快捷方式。

参数:

  • folder (字符串,可选):按文件夹名称筛选

4.运行短路

运行现有快捷方式。

参数:

  • name (字符串,必填):要运行的快捷方式的名称
  • input (字符串,可选):要传递给快捷方式的输入

Cherri代码示例

简单警报

#define name "Hello World"
#define color blue
#define glyph star

alert("Hello, World!", "Greeting")

带变量

#define name "Calculate"

@number1 = askNumber("Enter first number")
@number2 = askNumber("Enter second number")
@result = calculate(@number1 + @number2)

showResult("Result: {@result}")

菜单

#define name "Main Menu"

menu "Choose an option:" {
    item "Option 1":
        alert("You chose 1")
    item "Option 2":
        alert("You chose 2")
    item "Option 3":
        alert("You chose 3")
}

故障排除

未找到Cherri

确保Cherri已安装并位于您的PATH中:

which cherri

如果未找到,请重新安装:

brew reinstall electrikmilk/cherri/cherri

快捷方式权限被拒绝

确保快捷方式有运行权限。首选 系统设置>隐私和安全>自动化

未找到包

确保你使用了正确的Python路径。服务器需要Python 3.10+。

许可证

MIT许可证-请参阅 许可证 了解详情。

作者

自杀110

致谢


快速测试

安装后,您可以直接测试MCP服务器:

cd apple-shortcut-maker-mcp
uv run apple-shortcut-mcp

您应该看到服务器启动时没有错误。然后配置您的MCP客户端以使用它。

可用工具

配置后,这些工具将在您的AI助手中可用:

工具 说明
create_shortcut 使用Cherri代码创建新的Apple快捷方式
duplicate_shortcut 复制现有快捷方式
list_shortcuts 列出所有可用快捷方式
run_shortcut 运行现有快捷方式

示例用法

创建快捷方式

Create a shortcut named "Hello World" with code:
#define name "Hello World"
#define color blue
alert("Hello, World!", "Greeting")

列出快捷方式

List all shortcuts on my Mac

运行快捷方式

Run the shortcut named "My Daily Routine"