macOS通知服务

一个通过MCP协议实现AI助手触发macOS通知、声音和文本转语音的服务。

  • by devizor
  • Python
  • 本地部署
  • 38 星标
  • 更新于
在 GitHub 查看 devizor/macOS-Notification-MCP

使用说明

🔔 macOS通知MCP

一个模型上下文协议(MCP)服务器,使AI助手能够触发macOS通知、声音和文本到语音。

✨ 特性

  • 🔊 声音通知:播放系统听起来像潜水艇、Ping或叮当声
  • 💬 横幅通知:显示具有可自定义标题、消息和字幕的视觉通知
  • 🗣️ 语音通知:将文本转换为语音,语音、速率和音量可调
  • 🎙️ 语音管理:列出可用系统语音并从中选择
  • 🧪 测试工具:用于验证所有通知方法的诊断实用程序

🚀 uvx快速入门(推荐)

使用此工具的最快方法是 uvx,它运行无需永久安装的包:

# Install uv if you don't have it
curl -LsSf https://astral.sh/uv/install.sh | sh

# Run the MCP server directly (no installation needed)
uvx macos-notification-mcp

⚙️ 配置Claude桌面

将此添加到您的Claude Desktop配置中(~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "macos-notification-mcp": {
      "command": "uvx",
      "args": ["macos-notification-mcp"]
    }
  }
}

然后重新启动Claude Desktop。

📦 替代安装方法

标准安装:

pip install macos-notification-mcp

从源代码安装:

git clone https://github.com/devizor/macos-notification-mcp
cd macos-notification-mcp
pip install .

🛠️ 可用的通知工具

🔊 声音通知

sound_notification(sound_name="Submarine")

可用声音:Basso、Blow、Bottle、Frog、Funk、Glass、Hero、Morse、Ping、Pop、Purr、Sosumi、Submarine、Tink

💬 横幅通知

banner_notification(
    title="Task Complete",
    message="Your analysis is ready",
    subtitle=None,  # Optional
    sound=False,    # Optional: Play sound with notification
    sound_name=None # Optional: Specify system sound
)

🗣️ 语音通知

speak_notification(
    text="The process has completed",
    voice=None,     # Optional: System voice to use
    rate=150,       # Optional: Words per minute (default: 150)
    volume=1.0      # Optional: Volume level 0.0-1.0
)

🎙️ 语音管理

list_available_voices()  # Lists all available text-to-speech voices

🧪 测试

test_notification_system()  # Tests all notification methods

🔒 实现细节

  • ⏱️ 速率限制:通知一次处理一个,最小间隔为0.5秒
  • 🔄 排队:按顺序处理多个通知请求
  • 🪟 OS集成:使用本机macOS命令(afplay, osascript, say)
  • 🔌 FastMCP:基于FastMCP框架构建,用于人工智能通信

⚠️ 故障排除

  • 🔐 权限:确保在系统设置中允许通知→ 通知
  • ⏳ 时机:一次只处理一个通知
  • 🌐 环境:如果直接使用命令(不是uvx),可能需要使用完整路径

📄 许可证

MIT许可证