Claude Code Notification Hooks
Provides automatic desktop notifications and contextual sounds for Claude Code operations across macOS, Windows, and Linux. It enhances the development experience by intelligently mapping specific event types to native system alerts and sounds.
README
🔔 Claude Code Notification Hooks
⚠️ DEPRECATED: This project has been superseded by cat-ccnotify-hook. Please use the new standalone package for better performance and easier installation.
Enhanced Claude Code experience with automatic desktop notifications and contextual sounds for all events. No manual notification calls needed - works automatically with all Claude Code operations!
✨ Features
- 🔔 Automatic Notifications: Intercepts ALL Claude Code notifications and enhances them
- 🎵 Contextual Sounds: Different sounds for success, error, warning, and other event types
- 🚀 Zero Configuration: Automatic detection and enhancement of notification types
- 📋 Smart Sound Mapping: Intelligent analysis of notification content for appropriate sounds
- 🖱️ Native System Integration: Uses macOS/Windows/Linux native notification systems
🚀 Quick Start
Method 1: One-Command Setup (Recommended)
Run this in Claude Code:
cd /path/to/ccnotify && npm run setup-hooks
Method 2: Manual Setup
- Clone and build:
git clone <this-repository>
cd ccnotify
npm install && npm run build
- Run setup:
npm run setup-hooks
- Restart Claude Code if it's currently running
3. That's It!
All Claude Code notifications will now automatically have enhanced sounds and styling. No additional configuration needed!
📱 How It Works
The notification hook automatically detects and enhances all Claude Code notifications:
Automatic Sound Assignment
- ✅ Success/Completion → Glass sound (macOS)
- 🚨 Errors/Failures → Basso sound (macOS)
- ⚠️ Warnings/Attention → Sosumi sound (macOS)
- 💡 Info/Updates → Blow sound (macOS)
- ⏳ Progress/Ongoing → Tink sound (macOS)
Examples in Action
# Building a project
npm run build
# → Automatic success notification with Glass sound when complete
# → Automatic error notification with Basso sound if failed
# Running tests
npm test
# → Automatic progress notification with Tink sound while running
# → Automatic completion notification when finished
# Git operations
git push origin main
# → Automatic notifications for each step with appropriate sounds
🎵 Available Sounds
| Sound | Use Case | macOS Sound |
|---|---|---|
success |
Task completion, success | Glass |
error |
Errors, failures | Basso |
warning |
Warnings, attention needed | Sosumi |
info |
Information, status updates | Blow |
progress |
Progress updates, ongoing work | Tink |
reminder |
Reminders, prompts | Ping |
default |
System default notification sound | - |
silent |
No sound | - |
🛠️ Advanced Configuration
Customizing Sound Mappings
Edit the hook script at hooks/notification-hook.js to customize sound mappings:
// Example: Add custom sound rules
const customSoundRules = [
{ pattern: /deployment/i, sound: 'Ping' },
{ pattern: /security/i, sound: 'Funk' },
{ pattern: /backup/i, sound: 'Purr' }
];
Troubleshooting
Hook not working?
# Check if hook is properly installed
cat ~/.config/claude-code/settings.json | grep -A 10 "hooks"
# Verify hook script is executable
ls -la hooks/notification-hook.js
# Re-run setup if needed
npm run setup-hooks
Sounds not playing?
# Test system sound (macOS)
afplay /System/Library/Sounds/Glass.aiff
# Check notification permissions in System Preferences
🌍 Real-World Examples
Automatic Enhancement Examples
Claude Code Operations → Enhanced Notifications
# File operations
"Create a new React component"
→ ✅ "Component created successfully" + Glass sound
# Build processes
"Run the build process"
→ ⏳ "Build in progress..." + Tink sound
→ ✅ "Build completed successfully" + Glass sound
# Error scenarios
"Fix the TypeScript errors"
→ 🚨 "3 type errors found" + Basso sound
# Git operations
"Commit these changes"
→ ✅ "Changes committed successfully" + Glass sound
🔧 Development
Development Commands
npm run dev # Development mode with auto-reload
npm run build # Production build
npm start # Start production server
Platform Support
- macOS: Full native support with
osascriptand system sounds - Windows/Linux: Cross-platform support via
node-notifierpackage
Architecture
- Type-safe TypeScript implementation
- MCP (Model Context Protocol) compliant
- Automatic platform-specific implementation switching
- Extensible notification type system
📋 Technical Details
Hook Architecture
The notification hook intercepts Claude Code's notification system and enhances it:
- Interception: Hook receives all notification calls from Claude Code
- Analysis: Analyzes notification content using pattern matching
- Enhancement: Adds appropriate sounds and styling based on content
- Native Integration: Uses platform-specific notification APIs
Installation Structure
~/.config/claude-code/settings.json # Claude Code configuration
hooks/notification-hook.js # Main hook script
dist/index.js # Built MCP server (optional)
scripts/setup-hooks.js # Automated setup script
Platform Support
- macOS: Full native support with
osascriptand system sounds - Windows/Linux: Cross-platform support via
node-notifierpackage
Legacy MCP Server (Optional)
For advanced users who want manual notification control, the MCP server is still available:
{
"mcpServers": {
"ccnotify": {
"command": "node",
"args": ["/absolute/path/to/ccnotify/dist/index.js"]
}
}
}
🤝 Contributing
Bug reports and feature requests are welcome! Please open an issue.
📄 License
MIT License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。