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 流是否被重定向
资源
贡献
- Fork 仓库
- 创建一个功能分支
- 提交您的更改
- 推送到分支
- 创建一个 Pull Request
许可证
MIT 许可证 - 参见 LICENSE 了解详情
推荐服务器
@kazuph/mcp-taskmanager
用于任务管理的模型上下文协议服务器。它允许 Claude Desktop(或任何 MCP 客户端)在基于队列的系统中管理和执行任务。
Claude Code MCP
一个实现了 Claude Code 作为模型上下文协议(Model Context Protocol, MCP)服务器的方案,它可以通过标准化的 MCP 接口来使用 Claude 的软件工程能力(代码生成、编辑、审查和文件操作)。
Beamlit MCP Server
一个 MCP 服务器实现,它支持 Beamlit CLI 和 AI 模型之间的无缝集成,并使用模型上下文协议标准。
ThingsPanel MCP
一个集成服务器,将人工智能模型与 ThingsPanel 物联网平台连接起来,使人工智能助手能够通过自然语言与物联网设备交互,以进行设备控制、数据检索和管理操作。
Shell MCP Server
一个模型上下文协议服务器,允许大型语言模型以受控方式执行 shell 命令并接收其输出。
WinTerm MCP
一个模型上下文协议服务器,它提供对 Windows 终端的程序化访问,使 AI 模型能够通过标准化的工具与 Windows 命令行交互,这些工具用于编写命令、读取输出和发送控制信号。
Everything Search MCP Server
提供与 Everything 搜索器的集成,通过模型上下文协议实现强大的文件搜索功能,并提供高级搜索选项,如正则表达式、区分大小写和排序。
Blender MCP Server
一个模型上下文协议服务器,允许管理和执行 Blender Python 脚本,使用户能够通过自然语言界面在无头 Blender 环境中创建、编辑和运行脚本。
Node Omnibus MCP Server
一个综合性的模型上下文协议服务器,提供先进的 Node.js 开发工具,用于自动化项目创建、组件生成、包管理和文档编写,并提供人工智能驱动的辅助功能。
mcp-installer
这个服务器可以帮你安装其他的 MCP 服务器。安装好它之后,你可以让 Claude 为你安装托管在 npm 或 PyPi 上的 MCP 服务器。需要分别安装 npx 和 uv 来支持 Node 和 Python 服务器。