applescript-mcp

applescript-mcp

使LLM应用程序能够通过AppleScript与macOS交互。

操作系统自动化
访问服务器

Tools

system_toggle_dark_mode

[System control and information] Toggle system dark mode

system_volume

[System control and information] Set system volume

system_get_frontmost_app

[System control and information] Get the name of the frontmost application

system_launch_app

[System control and information] Launch an application

system_quit_app

[System control and information] Quit an application

system_get_battery_status

[System control and information] Get battery level and charging status

calendar_add

[Calendar operations] Add a new event to Calendar

calendar_list

[Calendar operations] List all events for today

finder_get_selected_files

[Finder and file operations] Get currently selected files in Finder

finder_search_files

[Finder and file operations] Search for files by name

finder_quick_look_file

[Finder and file operations] Preview a file using Quick Look

clipboard_get_clipboard

[Clipboard management operations] Get current clipboard content

clipboard_set_clipboard

[Clipboard management operations] Set clipboard content

clipboard_clear_clipboard

[Clipboard management operations] Clear clipboard content

notifications_toggle_do_not_disturb

[Notification management] Toggle Do Not Disturb mode using keyboard shortcut

notifications_send_notification

[Notification management] Send a system notification

iterm_paste_clipboard

[iTerm terminal operations] Paste clipboard content into iTerm

iterm_run

[iTerm terminal operations] Run a command in iTerm

README

applescript-mcp MCP 服务器

一个模型上下文协议服务器,使 LLM 应用程序能够通过 AppleScript 与 macOS 交互。 此服务器为 AI 应用程序提供了一个标准化的接口,用于控制系统功能、管理文件、处理通知等。

功能

  • 🗓️ 日历管理(事件、提醒)
  • 📋 剪贴板操作
  • 🔍 Finder 集成
  • 🔔 系统通知
  • ⚙️ 系统控制(音量、黑暗模式、应用程序)
  • 📟 iTerm 终端集成

计划功能

  • 📬 邮件(列出电子邮件、保存附件、总结、发送)
  • 🧭 Safari(在 Safari 中打开、保存页面内容、获取选定的页面/标签)
  • 💬 消息(发送、获取、列表)
  • ✅ 提醒事项(创建、获取)
  • 🗒️ 笔记(创建、获取、列表)

前提条件

  • macOS 10.15 或更高版本
  • Node.js 18 或更高版本

可用类别

日历

命令 描述 参数
add 创建日历事件 title(标题), startDate(开始日期), endDate(结束日期)
list 列出今天的事件

剪贴板

命令 描述 参数
set_clipboard 复制到剪贴板 content(内容)
get_clipboard 获取剪贴板内容
clear_clipboard 清空剪贴板

Finder

命令 描述 参数
get_selected_files 获取选定的文件
search_files 搜索文件 query(查询), location(位置)(可选)
quick_look 预览文件 path(路径)

通知

命令 描述 参数
send_notification 显示通知 title(标题), message(消息), sound(声音)(可选)
toggle_do_not_disturb 切换免打扰模式

系统

命令 描述 参数
volume 设置系统音量 level(级别)(0-100)
get_frontmost_app 获取活动应用程序
launch_app 打开应用程序 name(名称)
quit_app 关闭应用程序 name(名称), force(强制)(可选)
toggle_dark_mode 切换黑暗模式

iTerm

命令 描述 参数
paste_clipboard 粘贴到 iTerm
run 执行命令 command(命令), newWindow(新窗口)(可选)

开发

设置

# 安装依赖
npm install

# 构建服务器
npm run build

# 启动 MCP Inspector
# 参见: https://modelcontextprotocol.io/docs/tools/inspector
npx @modelcontextprotocol/inspector node path/to/server/index.js args...

添加新功能

1. 创建类别文件

创建 src/categories/newcategory.ts:

import { ScriptCategory } from "../types/index.js";

export const newCategory: ScriptCategory = {
  name: "category_name",
  description: "Category description",
  scripts: [
    // Scripts will go here
  ]
};

2. 添加脚本

{
  name: "script_name",
  description: "What the script does",
  schema: {
    type: "object",
    properties: {
      paramName: {
        type: "string",
        description: "Parameter description"
      }
    },
    required: ["paramName"]
  },
  script: (args) => `
    tell application "App"
      // AppleScript code using ${args.paramName}
    end tell
  `
}

3. 注册类别

更新 src/index.ts:

import { newCategory } from "./categories/newcategory.js";
// ...
server.addCategory(newCategory);

调试

使用 MCP Inspector

MCP Inspector 提供了一个 Web 界面,用于测试和调试您的服务器:

npm run inspector

日志记录

通过设置环境变量启用调试日志记录:

DEBUG=applescript-mcp* npm start

常见问题

  • 权限错误: 检查系统偏好设置 > 安全性与隐私
  • 脚本失败: 直接在 Script Editor.app 中测试脚本
  • 通信问题: 检查 stdio 流是否被重定向

资源

贡献

  1. Fork 仓库
  2. 创建一个功能分支
  3. 提交您的更改
  4. 推送到分支
  5. 创建一个 Pull Request

许可证

MIT 许可证 - 参见 LICENSE 了解详情

推荐服务器

Claude Code MCP

Claude Code MCP

一个实现了 Claude Code 作为模型上下文协议(Model Context Protocol, MCP)服务器的方案,它可以通过标准化的 MCP 接口来使用 Claude 的软件工程能力(代码生成、编辑、审查和文件操作)。

精选
本地
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

用于任务管理的模型上下文协议服务器。它允许 Claude Desktop(或任何 MCP 客户端)在基于队列的系统中管理和执行任务。

精选
本地
JavaScript
Beamlit MCP Server

Beamlit MCP Server

一个 MCP 服务器实现,它支持 Beamlit CLI 和 AI 模型之间的无缝集成,并使用模型上下文协议标准。

官方
TypeScript
ThingsPanel MCP

ThingsPanel MCP

一个集成服务器,将人工智能模型与 ThingsPanel 物联网平台连接起来,使人工智能助手能够通过自然语言与物联网设备交互,以进行设备控制、数据检索和管理操作。

官方
Python
systemd-coredump MCP Server

systemd-coredump MCP Server

启用支持 MCP 的应用程序,通过与 systemd-coredump 功能集成,来访问、管理和分析系统核心转储。

本地
JavaScript
Terminal Controller for MCP

Terminal Controller for MCP

一个 MCP 服务器,它通过一个标准化的接口,使 LLM 能够安全地执行终端命令、进行目录导航和进行文件系统操作。

本地
Python
mac-apps-launcher

mac-apps-launcher

一个 MCP 服务器,用于在 MacOS 上列出和启动应用程序。 (Yī gè MCP fúwùqì, yòng yú zài MacOS shàng lièchū hé qǐdòng yìngyòng chéngxù.)

本地
JavaScript
Google Tasks MCP Server

Google Tasks MCP Server

与 Google Tasks 集成,允许列出、读取、搜索、创建、更新和删除任务。

本地
TypeScript
MCP 3D Printer Server

MCP 3D Printer Server

通过 MCP 服务器实现与 3D 打印机管理系统的交互,支持 STL 文件操作、切片以及对 OctoPrint、Klipper、Duet 等打印机的控制。

本地
TypeScript
claude-code-mcp

claude-code-mcp

这个项目的目标是构建一个 Claude Code MCP 服务器,并实现其相关的工具(explain\_code, review\_code, fix\_code, edit\_code, test\_code, simulate\_command, your\_own\_query)。该服务器使用 Node.js 和 MCP SDK 实现。它通过 Stdio 接收来自客户端的工具请求,并动态地...

本地
JavaScript