🔔 macOS 通知 MCP
模型上下文协议 (MCP) 服务器,使 AI 助手能够触发 macOS 通知、声音和文本转语音。
✨ 特点
- 🔊声音通知:播放系统声音,例如潜艇、Ping 或 Tink
- 💬横幅通知:显示带有可自定义标题、消息和副标题的视觉通知
- 🗣️语音通知:将文本转换为语音,并可调节声音、速率和音量
- 🎙️语音管理:列出并选择可用的系统语音
- 🧪测试工具:用于验证所有通知方法的诊断实用程序
🚀 使用 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 秒
- 🔄排队:按顺序处理多个通知请求
- 🪟操作系统集成:使用原生 macOS 命令(
say``afplay
、 osascript
) - 🔌 FastMCP :基于 FastMCP 框架构建,用于 AI 通信
⚠️ 故障排除
- 🔐权限:确保在系统设置 → 通知中允许通知
- ⏳时间:每次只处理一条通知
- 🌐环境:如果直接使用命令(不是 uvx),则可能需要使用完整路径
📄 许可证
MIT 许可证