项目简介

Apple Notifier MCP Server 是一个基于 Model Context Protocol (MCP) 的服务器实现,旨在扩展 LLM 客户端在 macOS 系统上的能力。它允许 LLM 通过标准化的 MCP 协议调用 macOS 的原生功能,例如发送系统通知、显示用户提示对话框、进行文本到语音的转换、截取屏幕截图以及打开文件选择对话框。这使得 LLM 能够与用户桌面环境进行更丰富的交互。

主要功能点

  • 发送系统通知: 允许 LLM 发送 macOS 原生通知,可自定义标题、消息内容、副标题和声音。
  • 显示用户提示: 允许 LLM 显示交互式对话框,获取用户输入,支持自定义消息、默认答案、按钮和图标。
  • 文本转语音: 允许 LLM 使用 macOS 的文本转语音功能朗读文本,支持选择声音和调整语速。
  • 屏幕截图: 允许 LLM 截取 macOS 屏幕截图,支持全屏、窗口或选定区域截图,并可配置图片格式和选项。
  • 文件选择: 允许 LLM 打开 macOS 原生的文件选择对话框,让用户选择文件,支持文件类型过滤和多选。

安装步骤

通过 Smithery 安装 (Claude Desktop)

如果您使用 Claude Desktop,可以通过 Smithery 自动安装 Apple Notifier MCP Server:

  1. 确保已安装 Smithery CLI
  2. 运行以下命令:
    npx -y @smithery/cli install apple-notifier-mcp --client claude

手动安装

  1. 安装 Node.js: 确保您的 macOS 系统已安装 Node.js (>= 18)。
  2. 全局安装 npm 包: 打开终端并运行以下命令全局安装 'apple-notifier-mcp' 包:
    npm install -g apple-notifier-mcp
  3. 配置 MCP 客户端: 根据您使用的 MCP 客户端 (Cline 或 Claude Desktop) 修改相应的配置文件。

Cline 配置 ('cline_mcp_settings.json')

打开或创建 'cline_mcp_settings.json' 文件,并添加以下配置:

{
  "mcpServers": {
    "apple-notifier": {
      "command": "apple-notifier-mcp"
    }
  }
}

Claude Desktop 配置 ('claude_desktop_config.json')

打开或创建 'claude_desktop_config.json' 文件,并添加以下配置:

{
  "mcpServers": {
    "apple-notifier": {
      "command": "apple-notifier-mcp"
    }
  }
}

服务器配置说明:

  • '"server name"': '"apple-notifier"' - 服务器名称,在客户端配置中用于标识和引用此服务器。
  • '"command"': '"apple-notifier-mcp"' - 启动 Apple Notifier MCP Server 的命令。客户端会执行此命令来启动服务器。

注意: 此服务器不需要额外的参数配置,客户端只需配置启动命令即可。

基本使用方法

安装并配置完成后,您的 MCP 客户端 (如 Claude Desktop 或 Cline) 应该能够检测到并连接到 Apple Notifier MCP Server。

您可以使用 MCP 客户端提供的工具调用功能来使用 Apple Notifier 提供的各项功能。以下是一些基本的使用示例 (假设您的 MCP 客户端提供 'client.use_mcp_tool' 方法):

// 发送通知
await client.use_mcp_tool("apple-notifier", "send_notification", {
  title: "你好",
  message: "世界!",
  sound: true
});

// 显示用户提示并获取用户输入
const result = await client.use_mcp_tool("apple-notifier", "prompt_user", {
  message: "你叫什么名字?",
  defaultAnswer: "John Doe",
  buttons: ["确定", "取消"]
});
console.log("用户输入:", result);

// 文本转语音
await client.use_mcp_tool("apple-notifier", "speak", {
  text: "你好,世界!",
  voice: "Samantha" // 可选,指定语音
});

// 截取窗口截图并保存到文件
await client.use_mcp_tool("apple-notifier", "take_screenshot", {
  path: "screenshot.png",
  type: "window"
});

// 打开文件选择对话框并选择文件
const files = await client.use_mcp_tool("apple-notifier", "select_file", {
  prompt: "请选择图片文件",
  fileTypes: {
    "public.image": ["png", "jpg", "jpeg"]
  },
  multiple: true
});
console.log("选择的文件:", files);

请参考您的 MCP 客户端的文档,了解如何使用 'use_mcp_tool' 或类似的 API 来调用 MCP 服务器提供的工具。工具名称和参数定义请参考 'README.md' 文件中的 "Features" 部分或代码中的 'ListToolsRequestSchema' 处理逻辑。

信息

分类

桌面与硬件