AppleScript macOS连接器
启用LLM应用程序通过AppleScript与macOS交互。
可用工具 (18 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
system_volume 1 个参数 需填 1 项
[System control and information] Set system volume
必填参数:level
system_get_frontmost_app
[System control and information] Get the name of the frontmost application
该工具无需必填参数,直接调用即可
system_launch_app 1 个参数 需填 1 项
[System control and information] Launch an application
必填参数:name
system_quit_app 2 个参数 需填 1 项
[System control and information] Quit an application
必填参数:name
system_toggle_dark_mode
[System control and information] Toggle system dark mode
该工具无需必填参数,直接调用即可
system_get_battery_status
[System control and information] Get battery level and charging status
该工具无需必填参数,直接调用即可
calendar_add 4 个参数 需填 3 项
[Calendar operations] Add a new event to Calendar
必填参数:title、startDate、endDate
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 2 个参数 需填 1 项
[Finder and file operations] Search for files by name
必填参数:query
finder_quick_look_file 1 个参数 需填 1 项
[Finder and file operations] Preview a file using Quick Look
必填参数:path
clipboard_get_clipboard 1 个参数
[Clipboard management operations] Get current clipboard content
该工具无需必填参数,直接调用即可
clipboard_set_clipboard 1 个参数 需填 1 项
[Clipboard management operations] Set clipboard content
必填参数: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 3 个参数 需填 2 项
[Notification management] Send a system notification
必填参数:title、message
iterm_paste_clipboard
[iTerm terminal operations] Paste clipboard content into iTerm
该工具无需必填参数,直接调用即可
iterm_run 2 个参数 需填 1 项
[iTerm terminal operations] Run a command in iTerm
必填参数:command
服务介绍
applescript-mcp MCP 服务器
一个模型上下文协议(Model Context Protocol)服务器,使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 (可选) |
开发
设置
# Install dependencies
npm install
# Build the server
npm run build
# Launch MCP Inspector
# See: 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 提供了一个用于测试和调试服务器的网页界面:
npm run inspector
日志
通过设置环境变量启用调试日志:
DEBUG=applescript-mcp* npm start
常见问题
- 权限错误:检查系统偏好设置 > 安全与隐私
- 脚本失败:直接在 Script Editor.app 中测试脚本
- 通信问题:检查 stdio 流是否被重定向
资源
贡献
- 分叉仓库
- 创建一个功能分支
- 提交你的更改
- 推送到该分支
- 创建一个拉取请求
许可证
MIT 许可证 - 查看 LICENSE 获取详情