Token导航 LogoToken导航TokenDH.com
Applescript MCP logo
开发工具stdio官方级别未说明来源级核验

Applescript MCP

MCP Server

@modelcontextprotocol/inspector

A macOS AppleScript MCP server

工具数

0

提示词数

0

GitHub Stars

383

资源数

0
TypeScript开发工具命令行工具

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

joshrutkowski

提供方

joshrutkowski

最后核验

2026/5/18 03:32

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx @modelcontextprotocol/inspector node path/to/server/index.js args...

详细介绍

applexcript mcp mcp服务器

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

](https://github.com/joshrutkowski/applescript-mcp/actions/workflows/node.js.yml)

特性

  • 🗓️ 日历管理(事件、提醒)
  • 📋 剪贴板操作
  • 🔍 Finder集成
  • 🔔 系统通知
  • ⚙️ 系统控制(音量、暗模式、应用程序)
  • 📟 iTerm终端集成
  • 📬 邮件(创建新电子邮件、列出电子邮件、获取电子邮件)
  • 🔄 快捷方式自动化
  • 💬 消息(列出聊天记录、获取消息、搜索消息、发送消息)
  • 🗒️ 笔记(创建格式化笔记、列出笔记、搜索笔记)
  • 📄 页面(创建文档)

计划的功能

  • 🧭 Safari(在Safari中打开,保存页面内容,获取所选页面/标签)
  • ✅ 提醒(创建、获取)

先决条件

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

可用类别

日历

命令描述参数
add创建日历事件title, startDate, endDate, calendar (可选)
list列出今天的活动

例子

// Create a new calendar event
Create a calendar event titled "Team Meeting" starting tomorrow at 2pm for 1 hour

// List today's events
What events do I have scheduled for today?

剪贴板

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

例子

// Copy text to clipboard
Copy "Remember to buy groceries" to my clipboard

// Get clipboard contents
What's currently in my clipboard?

// Clear clipboard
Clear my clipboard

访达

命令描述参数
get_selected_files获取所选文件
search_files搜索文件query, location (可选)
quick_look预览文件path

例子

// Get selected files in Finder
What files do I currently have selected in Finder?

// Search for files
Find all PDF files in my Documents folder

// Preview a file
Show me a preview of ~/Documents/report.pdf

通知

注意:发送通知要求您在“系统设置”>“通知”>“脚本编辑器”中启用通知。
命令描述参数
send_notification显示通知title, message, sound (可选)
toggle_do_not_disturb切换DND模式

例子

// Send a notification
Send me a notification with the title "Reminder" and message "Time to take a break"

// Toggle Do Not Disturb
Turn on Do Not Disturb mode

系统

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

例子

// Set system volume
Set my Mac's volume to 50%

// Get active application
What app am I currently using?

// Launch an application
Open Safari

// Quit an application
Close Spotify

// Toggle dark mode
Switch to dark mode

iTerm

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

例子

// Paste clipboard to iTerm
Paste my clipboard contents into iTerm

// Run a command in iTerm
Run "ls -la" in iTerm

// Run a command in a new iTerm window
Run "top" in a new iTerm window

捷径

命令描述参数
run_shortcut运行快捷方式name, input (可选)
list_shortcuts列出所有可用快捷方式limit (可选)

例子

// List available shortcuts
List all my available shortcuts

// List with limit
Show me my top 5 shortcuts

// Run a shortcut
Run my "Daily Note in Bear" shortcut

// Run a shortcut with input
Run my "Add to-do" shortcut with input "Buy groceries"

邮件

命令描述参数
create_email在Mail.app中创建新电子邮件recipient, subject, body
list_emails列出邮箱中的电子邮件mailbox (可选), count (可选), unreadOnly (可选)
get_email通过搜索获取特定电子邮件subject (可选), sender (可选), dateReceived (可选), mailbox (可选), account (可选), unreadOnly (可选), includeBody (可选)

例子

// Create a new email
Compose an email to john@example.com with subject "Meeting Tomorrow" and body "Hi John, Can we meet tomorrow at 2pm?"

// List emails
Show me my 10 most recent unread emails

// Get a specific email
Find the email from sarah@example.com about "Project Update"

消息

命令描述参数
list_chats列出可用的iMessage和SMS聊天记录includeParticipantDetails (可选,默认值:false)
get_messages从messages应用程序获取消息limit (可选,默认值:100)
search_messages搜索包含特定文本的邮件searchText, sender (可选), chatId (可选), limit (可选,默认值:50), daysBack (可选,默认值:30)
compose_message打开带有预填消息或自动发送的消息应用程序recipient (必填), body (可选), auto (可选,默认值:false)

例子

// List available chats
Show me my recent message conversations

// Get recent messages
Show me my last 20 messages

// Search messages
Find messages containing "dinner plans" from John in the last week

// Compose a message
Send a message to 555-123-4567 saying "I'll be there in 10 minutes"

备注

命令描述参数
create使用类似markdown的格式创建笔记title, content, format (可选,带格式选项)
createRawHtml使用直接HTML内容创建注释title, html
list列出笔记,可选择来自特定文件夹folder (可选)
get按标题获取特定注释title, folder (可选)
search搜索包含特定文本的笔记query, folder (可选), limit (可选,默认值:5), includeBody (可选,默认值:true)

例子

// Create a new note with markdown formatting
Create a note titled "Meeting Minutes" with content "# Discussion Points\n- Project timeline\n- Budget review\n- Next steps" and format headings and lists

// Create a note with HTML
Create a note titled "Formatted Report" with HTML content "
Quarterly Report

Sales increased by 15%
"

// List notes
Show me all my notes in the "Work" folder

// Get a specific note
Show me my note titled "Shopping List"

// Search notes
Find notes containing "recipe" in my "Cooking" folder

页面

命令描述参数
create_document使用纯文本创建新的Pages文档content

例子

// Create a new Pages document
Create a Pages document with the content "Project Proposal\n\nThis document outlines the scope and timeline for the upcoming project."

建筑

applescript-mcp服务器是使用TypeScript构建的,遵循模块化架构:

核心组件

  1. AppleScript框架 (framework.ts):主服务器类:

- 管理MCP协议通信 - 处理工具注册和执行 - 提供日志记录功能 - 执行AppleScript命令

  1. 分类 (src/categories/*.ts):按功能组织的模块化脚本集合:

- 每个类别都包含相关的脚本(例如日历、系统、注释) - 类别在框架中注册 index.ts

  1. 类型 (src/types/index.ts):TypeScript接口定义:

- ScriptDefinition:单个脚本的结构 - ScriptCategory:相关脚本集合 - LogLevel:标准记录级别 - FrameworkOptions:配置选项

执行流程

  1. 客户端通过MCP协议发送工具请求
  2. 服务器标识适当的类别和脚本
  3. 生成脚本内容(静态或通过函数动态)
  4. AppleScript通过macOS执行 osascript 命令
  5. 结果返回给客户端

记录系统

该框架包括一个全面的日志记录系统,该系统:

  • 记录到stderr和MCP日志记录协议
  • 支持多种严重级别(调试、信息、警告、错误等)
  • 为故障排除提供详细的执行信息

发展

设置

# 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);

高级脚本开发

对于更复杂的脚本,您可以:

  1. 使用动态脚本生成:
   script: (args) => {
     // Process arguments and build script dynamically
     let scriptContent = `tell application "App"\n`;
     
     if (args.condition) {
       scriptContent += `  // Conditional logic\n`;
     }
     
     scriptContent += `end tell`;
     return scriptContent;
   }
  1. 处理复杂数据:
   // Example from Notes category
   function generateNoteHtml(args: any): string {
     // Process markdown-like syntax into HTML
     let processedContent = content;
     
     if (format.headings) {
       processedContent = processedContent.replace(/^# (.+)$/gm, '
$1
');
       // ...
     }
     
     return processedContent;
   }

调试

使用MCP检查器

MCP检查器提供了一个用于测试和调试服务器的web界面:

npm run inspector

日志记录

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

DEBUG=applescript-mcp* npm start

配置示例

运行后 npm run build 将以下内容添加到您的 mcp.json 文件:

{
  "mcpServers": {
    "applescript-mcp-server": {
      "command": "node",
      "args": ["/path/to/applescript-mcp/dist/index.js"]
    }
  }
}

常见问题

  • 权限错误:检查系统首选项>安全和隐私>隐私>自动化
  • 脚本失败:集成前直接在Script Editor.app中测试脚本
  • 沟通问题:检查stdio流是否未被重定向
  • 数据库访问:某些功能(如消息)需要完全磁盘访问权限

资源

贡献

  1. 分叉存储库
  2. 创建要素分支
  3. 提交您的更改
  4. 推到分支
  5. 创建拉取请求

许可证

MIT许可证-请参阅 许可证 详见

目录标签

目录标签

TypeScript开发工具命令行工具developer-toolsmacOS自动化本地部署AppleScript集成系统控制文件管理通知处理

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Node.js

部署方式(deploymentType,部署类型)

local-only

来源包(packageName,安装包名)

@modelcontextprotocol/inspector

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiononelocal-only

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP