通知服务服务器

一个用于触发macOS声音和视觉通知的MCP服务器,适用于Claude Desktop或其他MCP客户端。

  • by charles-adedotun
  • Python
  • 本地部署
  • 16 星标
  • 更新于
在 GitHub 查看 charles-adedotun/notifications-mcp-server

使用说明

通知MCP服务器

允许Claude Desktop或其他MCP客户端通过以下方式触发macOS声音和视觉通知的MCP服务器 task_status 工具。

当前状态

这是一个以macOS为中心的实用程序。它本身并不是一个自动的克劳德完成检测器:MCP客户端或模型必须调用 task_status 当它需要通知时,可以使用该工具。

今天什么有效

  • 注册a task_status MCP工具。
  • 播放macOS系统声音 afplay.
  • 使用终端通知器、AppleScript、PyObjC或pync回退发送视觉通知。
  • 支持单独的开始和完成声音。
  • 支持通过环境变量禁用视觉通知。
  • 包括模块化通知和声音管理器的测试。

重要限制

  • macOS是唯一实现的平台。
  • Linux和Windows支持尚未实现。
  • 通知仅在调用MCP工具时发生。
  • 打包的控制台脚本是 claude-notifications.
  • Python包是 notifications;没有 notifications_mcp_server 模块入口点。
  • 自定义声音配置使用环境变量,而不是旧README版本显示的JSON配置块。

安装

pip install notifications-mcp-server

可选的视觉通知依赖关系:

pip install "notifications-mcp-server[visual]"
pip install "notifications-mcp-server[pync]"

对于终端通知器回退支持:

brew install terminal-notifier

Claude桌面配置

使用软件包安装的控制台脚本:

{
  "mcpServers": {
    "notifications": {
      "command": "claude-notifications"
    }
  }
}

更改配置后重新启动Claude Desktop。

配置

环境变量:

export CLAUDE_START_SOUND="/System/Library/Sounds/Glass.aiff"
export CLAUDE_COMPLETE_SOUND="/System/Library/Sounds/Hero.aiff"
export CLAUDE_VISUAL_NOTIFICATIONS="true"
export CLAUDE_NOTIFICATION_ICON="/path/to/icon.png"

如果没有设置自定义声音,服务器将使用macOS系统声音。

MCP工具

task_status

输入:

{
  "message": "Task completed"
}

包含以下内容的邮件 start 或 processing 被视为开始通知。其他消息被视为完成通知。

验证演示

在macOS上运行本地诊断脚本以测试可用的通知路径:

python3 test_notification.py

MCP工具在尝试声音和视觉通知传递后返回一个紧凑的状态对象:

{
  "status": "success",
  "message": "Task completed",
  "sound": "/System/Library/Sounds/Hero.aiff",
  "visual": true
}

对于跳过视觉通知提示的更安静的烟雾测试:

CLAUDE_VISUAL_NOTIFICATIONS=false claude-notifications

发展

git clone https://github.com/charles-adedotun/notifications-mcp-server.git
cd notifications-mcp-server
pip install -e ".[dev]"
pytest

许可证

麻省理工学院