Skip to content

trigger-notification

Purpose

Demonstrate MCP notification protocol

Description

The trigger-notification tool demonstrates how MCP servers can send notifications to clients. Notifications allow servers to proactively inform clients about events, resource changes, and other important updates without waiting for client requests.

This demonstration tool supports three types of notifications:

  • resource_updated: Notify about changes to a specific resource
  • resource_list_changed: Notify that the list of available resources has changed
  • custom: Send custom notification messages

Notifications enable real-time features like:

  • Resource change alerts
  • Cache invalidation
  • Live updates
  • Event notifications

Parameters

ParameterTypeRequiredDescription
typeenumNoNotification type: resource_updated, resource_list_changed, custom (default: resource_updated)
resourceUristringNoURI of affected resource (for resource notifications)
messagestringNoCustom notification message

Example Usage

Ask Claude:

"Trigger a resource update notification for user://profile"
"Demonstrate a resource list changed notification"
"Send a custom notification with message 'Hello from server'"
"Show how MCP notifications work"

Response

# MCP Notification Demo

**Type:** resource_updated
**Resource:** user://profile

Notification has been sent to demonstrate how MCP servers can notify clients
about resource changes, allowing clients to refresh their cached data.

Notification Types

resource_updated

Notifies clients that a specific resource has been modified.

Use cases:

  • User profile updated
  • Configuration changed
  • Document edited
  • Settings modified

Client action: Refresh cached copy of the resource

Example:

"Trigger resource update for config://server"

resource_list_changed

Notifies clients that the list of available resources has changed.

Use cases:

  • New resource added
  • Resource removed
  • Resource became available/unavailable
  • Permissions changed

Client action: Re-fetch the resource list

Example:

"Notify that the resource list has changed"

custom

Sends a custom notification with an arbitrary message.

Use cases:

  • Application-specific events
  • User notifications
  • System alerts
  • Status updates

Client action: Display message to user or handle based on content

Example:

"Send custom notification: 'Background job completed'"

Authentication

Required: No

The trigger-notification tool is a demonstration tool and does not require authentication.

How MCP Notifications Work

The MCP notification flow:

  1. Event occurs on server (resource change, new data, etc.)
  2. Server sends notification through MCP transport
  3. Client receives notification asynchronously
  4. Client takes action (refresh data, show message, update UI)
  5. Client may request updated data using MCP resources or tools

Notifications are one-way messages from server to client. The server doesn't wait for a response.

Notification Structure

MCP notifications follow this structure:

typescript
{
  method: "notifications/resources/updated",
  params: {
    uri: "user://profile",
    timestamp: "2025-01-05T10:30:00.000Z"
  }
}

Different notification types have different methods:

  • notifications/resources/updated
  • notifications/resources/list_changed
  • Custom notification methods

Common Use Cases

Testing Client Notification Handling

"Send a resource update notification to test my client"

Understanding Notification Types

"What's the difference between resource_updated and resource_list_changed?"

Learning MCP Protocol

"How do MCP notifications work? Show me examples"

Cache Invalidation Demo

"Trigger a resource update to see cache invalidation in action"

Client Notification Handling

MCP clients can:

  • Display notifications in a notification panel or toast
  • Auto-refresh resources when notified of changes
  • Invalidate caches for updated resources
  • Re-fetch resource lists when list changes
  • Show status indicators for resource states

Example client behaviors:

  • Resource updated → Reload that resource automatically
  • List changed → Refresh the resource picker/list
  • Custom notification → Show message to user

Real-World Examples

User Profile Updates

User updates their profile in a web UI
→ Server sends resource_updated notification
→ All connected clients refresh user://profile
→ Chat interface shows updated name/avatar

Configuration Changes

Admin modifies server config
→ Server sends resource_updated for config://server
→ Clients reload configuration
→ UI reflects new settings immediately

New Resource Available

User uploads a new document
→ Server sends resource_list_changed
→ Clients re-fetch available documents
→ New document appears in file picker

Next Steps

Released under the MIT License.