Claude Code Notification Hooks

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.

Category
Visit Server

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

  1. Clone and build:
git clone <this-repository>
cd ccnotify
npm install && npm run build
  1. Run setup:
npm run setup-hooks
  1. 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 osascript and system sounds
  • Windows/Linux: Cross-platform support via node-notifier package

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:

  1. Interception: Hook receives all notification calls from Claude Code
  2. Analysis: Analyzes notification content using pattern matching
  3. Enhancement: Adds appropriate sounds and styling based on content
  4. 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 osascript and system sounds
  • Windows/Linux: Cross-platform support via node-notifier package

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured