Skip to main content
Glama
MCP Notification Server

MCP Notification Server

by whocaresthat

MCP Notification Server - Complete Demonstration

A comprehensive, production-ready demonstration of MCP (Model Context Protocol) notifications and subscriptions with working examples, multiple patterns, interactive demos, and complete documentation.

🎯 What's This?

This repository provides the most complete demonstration of MCP notifications available, including:

  • Working server implementations (basic and advanced)

  • Interactive client demos

  • Real-world notification patterns

  • Comprehensive testing scenarios

  • Complete architecture documentation

  • Step-by-step guides

Perfect for learning how to implement notifications in your own MCP servers!

Related MCP server: MCP Events Starter

⚑ Quick Start

Get running in 5 minutes β†’ QUICKSTART.md

git clone https://github.com/whocaresthat/mcp-notification-server.git
cd mcp-notification-server
npm install
npm run build

# Run interactive demo
node dist/examples/client.js

πŸ“š Complete Documentation

Document

Description

πŸš€ QUICKSTART.md

Get up and running in 5 minutes

🎬 DEMO.md

Interactive demonstration walkthrough

πŸ—οΈ ARCHITECTURE.md

System design, patterns, and best practices

πŸ§ͺ test-scenarios.md

10 comprehensive test scenarios

πŸ“š patterns.md

7 notification patterns with code examples

✨ Features

Three Implementation Levels

  1. Basic Server (src/index.ts)

    • Simple, easy to understand

    • Core notification concepts

    • Perfect for learning

  2. Advanced Server (examples/advanced-server.ts)

    • File system watching

    • Webhook endpoints

    • Periodic updates

    • Production patterns

  3. Interactive Client (examples/client.ts)

    • Full client implementation

    • Automated demo

    • Shows notifications in action

Comprehensive Examples

βœ… Event-driven notifications βœ… Periodic updates (timers) βœ… File system monitoring βœ… Webhook integration βœ… Threshold-based alerts βœ… Batched notifications βœ… Multiple subscribers βœ… Subscription lifecycle management

πŸŽ“ What You'll Learn

For Beginners

  • βœ“ What are MCP notifications?

  • βœ“ How to enable subscriptions

  • βœ“ Sending your first notification

  • βœ“ Testing with Claude Desktop

For Advanced Users

  • βœ“ Production-ready patterns

  • βœ“ Performance optimization

  • βœ“ Error handling strategies

  • βœ“ Security considerations

  • βœ“ Scalability patterns

πŸš€ Usage

Option 1: Interactive Demo

npm install
npm run build
node dist/examples/client.js

See notifications in action with automated demo!

Option 2: Claude Desktop

Add to your Claude config:

{
  "mcpServers": {
    "notification-demo": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-notification-server/dist/index.js"]
    }
  }
}

Then try in Claude:

  • "Subscribe to counter://main"

  • "Increment the counter by 5"

  • "What's the current counter value?"

Option 3: MCP Inspector

npx @modelcontextprotocol/inspector dist/index.js

Open http://localhost:5173 for interactive testing.

Option 4: Custom Integration

Use the code as a template for your own MCP server!

πŸ“– Documentation Highlights

Architecture Overview

Client ──subscribe──> Server
Client <──notifyβ”€β”€β”€β”€β”€β”€β”˜

The server:

  1. Accepts subscriptions from clients

  2. Monitors resources for changes

  3. Automatically notifies subscribers

  4. Manages subscription lifecycle

See ARCHITECTURE.md for complete details.

Notification Patterns

From patterns.md:

  1. Event-Driven - User actions trigger notifications

  2. Periodic - Regular updates (timers)

  3. File System - Monitor file changes

  4. Threshold - Alert on important values

  5. Batched - Group notifications

  6. Filtered - Conditional updates

  7. Cascading - Related resource updates

Test Scenarios

From test-scenarios.md:

  • Basic subscribe and notify

  • Multiple subscribers

  • Unsubscribe behavior

  • Multiple resources

  • Error handling

  • Performance under load

  • Connection loss recovery

  • And more...

🎯 Real-World Use Cases

This demonstration shows patterns for:

  • πŸ“Š Real-time Dashboards - Live data updates

  • πŸ” System Monitoring - Health checks and alerts

  • πŸ“ File Synchronization - Hot-reload configurations

  • πŸ“ Log Streaming - Real-time log viewing

  • 🚨 Alert Systems - Threshold-based notifications

  • πŸ‘₯ Collaboration Tools - Multi-user updates

  • πŸ“ˆ Analytics - Live metrics tracking

πŸ“¦ What's Included

mcp-notification-server/
β”œβ”€β”€ πŸ“„ QUICKSTART.md              # 5-minute setup guide
β”œβ”€β”€ πŸ“„ DEMO.md                    # Interactive walkthrough
β”œβ”€β”€ πŸ“„ ARCHITECTURE.md            # System design docs
β”œβ”€β”€ src/
β”‚   └── index.ts                  # Basic server (start here!)
β”œβ”€β”€ examples/
β”‚   β”œβ”€β”€ advanced-server.ts        # Production patterns
β”‚   β”œβ”€β”€ client.ts                 # Interactive demo
β”‚   β”œβ”€β”€ patterns.md               # 7 notification patterns
β”‚   β”œβ”€β”€ test-scenarios.md         # Testing guide
β”‚   └── run-demo.sh               # Easy demo runner
β”œβ”€β”€ package.json
└── tsconfig.json

πŸ”§ Development

# Install dependencies
npm install

# Build everything
npm run build

# Run basic server
npm start

# Run advanced server
node dist/examples/advanced-server.js

# Run interactive client demo
node dist/examples/client.js

πŸ“Š Code Examples

Minimal Server

import { Server } from "@modelcontextprotocol/sdk/server/index.js";

const server = new Server(
  { name: "my-server", version: "1.0.0" },
  { capabilities: { resources: { subscribe: true } } }
);

// Handle subscriptions
server.setRequestHandler(SubscribeRequestSchema, async (request) => {
  subscriptions.set(clientId, request.params.uri);
  return {};
});

// Send notifications
await server.notification({
  method: "notifications/resources/updated",
  params: { uri: "resource://example" }
});

Minimal Client

import { Client } from "@modelcontextprotocol/sdk/client/index.js";

// Handle notifications
client.setNotificationHandler({
  method: "notifications/resources/updated",
  handler: async (notification) => {
    console.log(`Updated: ${notification.params.uri}`);
  }
});

// Subscribe
await client.request({
  method: "resources/subscribe",
  params: { uri: "resource://example" }
});

πŸ§ͺ Testing

Run the comprehensive test scenarios:

# See all test scenarios
cat examples/test-scenarios.md

# Run with MCP Inspector
npx @modelcontextprotocol/inspector dist/index.js

🌟 Key Features

Feature

Basic Server

Advanced Server

Subscribe/Unsubscribe

βœ…

βœ…

Tool-triggered notifications

βœ…

βœ…

File system watching

❌

βœ…

Periodic updates

❌

βœ…

Webhook integration

❌

βœ…

Multiple subscribers

βœ…

βœ…

Error handling

βœ…

βœ…

Performance optimized

Basic

βœ…

🀝 Contributing

Contributions welcome! Please:

  1. Read ARCHITECTURE.md

  2. Check test-scenarios.md

  3. Add tests for new features

  4. Update documentation

πŸ“š Learn More

🎯 Next Steps

  1. Start Here β†’ QUICKSTART.md

  2. Try Demo β†’ node dist/examples/client.js

  3. Read Patterns β†’ patterns.md

  4. Understand Design β†’ ARCHITECTURE.md

  5. Build Your Own β†’ Use this as a template!

πŸ“„ License

MIT License - See LICENSE file for details


🌟 Why This Repository?

This is the most comprehensive MCP notification demonstration available because it includes:

  • βœ… Three levels of implementation (basic, advanced, client)

  • βœ… Seven real-world notification patterns

  • βœ… Complete architecture documentation

  • βœ… Ten comprehensive test scenarios

  • βœ… Interactive demos you can run immediately

  • βœ… Production-ready code you can use as a template

  • βœ… Step-by-step guides for every skill level

Ready to master MCP notifications? Start with QUICKSTART.md! πŸš€

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI clients to create and configure monitors, subscribe to their evidence streams with durable cursors, and process observations with guaranteed at-least-once delivery.
      21 npm
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables clients to create tasks and subscribe to a task.created event stream, delivering signed, filterable webhook callbacks with verified challenges and managed subscription lifecycles. It exposes event discovery, listing, subscribing, and unsubscribing alongside the task tool over a single MCP endpoint.
      3
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables MCP clients to manage signed event subscriptions, submit Grok requests and receive results and replies, and track deduplicated asynchronous delivery through an authenticated owner console backed by persistent storage. External message text is treated strictly as data, with bounded retries and receipt-based roundtrip termination.
      MIT