桌面通知MCP服务器
一种模型上下文协议(MCP)服务器,使AI代理能够发送具有优先级、类别和持续时间控制的跨平台桌面通知。
特性
- 跨平台支持(macOS、Windows、Linux)
- 紧急控制的优先级
- 基于类别的视觉区分
- 可配置的显示持续时间
- 可选通知声音
- 成功/错误状态报告
安装
npm install
npm run build用法
使用克劳德桌面
添加到您的Claude Desktop配置文件中:
macOS/Linux: ~/Library/Application Support/Claude/claude_desktop_config.json 视窗: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"desktop-notifications": {
"command": "node",
"args": [
"/absolute/path/to/desktop-notification-mcp/dist/index.js"
]
}
}
}参数
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
title | 字符串 | *必需的* | 通知标题 |
message | 字符串 | *必需的* | 通知消息正文 |
sound | 布尔值 | false | 启用通知声音 |
priority | 字符串 | "normal" | 优先级: "low", "normal", "high", "critical" |
category | 字符串 | "task" | 类别: "task", "error", "success", "progress", "question", "reminder" |
duration | 编号 | *自动* | 显示持续时间(毫秒)(0=持久) |
优先级
low-快速更新,5秒超时normal-标准通知,10秒超时(默认)high-重要更新,超时15秒critical-严重警报,持续到解除
分类
task-一般任务通知error-错误和失败通知success-成功和完成通知progress-进度更新question-需要用户注意的问题reminder-提醒和预定通知
例子
基本通知
{
"title": "Task Complete",
"message": "Your analysis has finished"
}高优先级错误
{
"title": "Build Failed",
"message": "Tests failed - review errors in output",
"priority": "high",
"category": "error",
"sound": true
}严重警报(持续)
{
"title": "User Input Required",
"message": "Please review the following options",
"priority": "critical",
"category": "question",
"sound": true
}进度更新
{
"title": "Processing...",
"message": "Step 3 of 10 complete",
"priority": "low",
"category": "progress",
"duration": 3000
}成功通知
{
"title": "Deployment Complete",
"message": "Successfully deployed to production",
"priority": "normal",
"category": "success",
"sound": true
}平台支持
服务器会自动检测并使用适当的通知系统:
- macOS 10.8+:通知中心
- Windows 8+:吐司通知
- Windows\<8:任务栏气球
- Linux:通知发送(必填
libnotify-bin)
平台特定行为
Linux:优先级映射到 urgency 参数(低/正常/临界),持续时间精确控制超时
Windows/macOS:通过视觉指示器显示优先级和类别,超时行为因操作系统版本而异
Linux要求
安装通知支持:
# Ubuntu/Debian
sudo apt-get install libnotify-bin
# Fedora
sudo dnf install libnotify
# Arch
sudo pacman -S libnotify