NTFY MCP Server
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Integrations
Enables sending notifications to any device with ntfy integration, supporting rich message formatting with titles, tags, priorities, action buttons, and attachments for real-time notifications to phones, desktops, and other devices.
NTFY MCP Server
A powerful Model Context Protocol (MCP) server for integrating ntfy notification services with AI systems. This server enables AI models to send notifications to various devices through the ntfy publish/subscribe service.
Use this server to empower your AI assistants to send real-time notifications to phones, desktops, and other devices!
Using this server will get you:
- Notification Capabilities: Send instant notifications from AI systems to any device with ntfy integration.
- Rich Message Formatting: Support for titles, tags, priorities, action buttons, and attachments.
- Type Safety: Strong typing with TypeScript to catch errors at compile time.
- Security: Built-in security features to protect against common vulnerabilities.
- Error Handling: A robust error handling system that categorizes and formats errors consistently.
- Subscription Support: Listen for incoming notifications (future feature).
.clinerules: This repository includes a .clinerules file that serves as a developer cheat sheet for your LLM coding agent with quick reference for the codebase patterns, file locations, and code snippets.
Table of Contents
- Overview
- Features
- Installation
- Configuration
- Project Structure
- Tool Documentation
- Development Guidelines
- Future Plans
- License
Overview
What is NTFY?
NTFY is a simple HTTP-based pub-sub notification service that enables sending push notifications to your phone or desktop via scripts from any computer. It works without signing up or installing an app, using simple HTTP requests to trigger notifications.
This MCP server wraps NTFY's functionality in a standardized Model Context Protocol interface, allowing AI systems to:
- Send notifications to any device with the ntfy app or integration
- Configure notification options like priority, tags, and actions
- Schedule delayed notifications
- Attach images or files to notifications (via URLs)
- Add action buttons to notifications
Architecture & Components
The server follows a modular architecture designed for clarity and extensibility:
Core Components:
- Configuration System: Environment-aware configuration with validation
- Logging System: Structured logging with sensitive data redaction
- Error Handling: Centralized error processing with consistent patterns
- MCP Server: Protocol implementation for tools
- NTFY Service: Core service for interacting with the ntfy API
- Validation Layer: Input validation using schemas
- Utilities: Reusable utility functions for common operations
Features
Core Utilities
- Logging: Configurable logging with file rotation and sensitive data redaction
- Error Handling: Pattern-based error classification and standardized reporting
- ID Generation: Secure unique identifier creation with prefix support
- Rate Limiting: Request throttling to prevent API abuse
- Request Context: Request tracking and correlation
- Sanitization: Input validation and cleaning
Type Safety
- Global Types: Shared type definitions for consistent interfaces
- Error Types: Standardized error codes and structures
- MCP Protocol Types: Type definitions for the MCP protocol
- Tool Types: Interfaces for tool registration and configuration
- NTFY Types: Specialized types for ntfy notification parameters
Error Handling
- Pattern-Based Classification: Automatically categorize errors based on message patterns
- Consistent Formatting: Standardized error responses with additional context
- Error Mapping: Custom error transformation for domain-specific errors
- Safe Try/Catch Patterns: Centralized error processing helpers
Security
- Input Validation: Schema-based validation using Zod
- Input Sanitization: Protection against injection attacks
- Parameter Bounds: Enforced limits to prevent abuse
- Sensitive Data Redaction: Automatic redaction in logs
Installation
Prerequisites
Setup
- Clone this repository:Copy
- Install dependencies:Copy
- Configure environment variables (see Configuration)
- Build the project:Copy
- Start the server:Copy
Configuration
Environment Variables
Create a .env
file based on .env.example
:
Configuration System
The configuration system provides a flexible way to manage settings:
- Environment Config: Load settings from environment variables
- MCP Servers Config: Configure MCP server connections (for future client implementations)
- Lazy Loading: Configurations are loaded only when needed
Project Structure
The codebase follows a modular structure:
Tool Documentation
Send NTFY
The send_ntfy
tool allows sending notifications to any device with ntfy integration.
Parameters
Parameter | Type | Description | Required |
---|---|---|---|
topic | string | The ntfy topic to send the notification to | Yes |
message | string | The notification message body | Yes |
title | string | The notification title | No |
tags | string[] | Tags that appear as emojis (e.g., ["warning", "robot"]) | No |
priority | number | Message priority (1-5, where 5 is highest) | No |
click | string | URL to open when notification is clicked | No |
actions | Action[] | Action buttons to display in the notification | No |
attachment | Attachment | Attachment URL and optional name | No |
string | Email address to send the notification to | No | |
delay | string | Delay the message (e.g., "30m", "1h", "tomorrow") | No |
markdown | boolean | Whether to format the message as markdown | No |
baseUrl | string | Base URL for the ntfy server (default: https://ntfy.sh) | No |
Usage Example
Development Guidelines
Adding Advanced Features
- Extend the NTFY service in
src/services/ntfy/
- Add new parameters or functionality to the tool in
src/mcp-server/tools/ntfyTool/
- Ensure proper validation and error handling for new features
- Update the type definitions as needed
Example of extending the tool:
Future Plans
This server serves as a foundation for:
- Subscription Support: Listen for incoming notifications on specific topics
- Web Hook Integration: Allow callbacks for notification events
- Multiple Service Support: Add support for additional notification services
- Enhanced Message Formatting: Add support for rich text and interactive elements
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
This server cannot be installed
A Model Context Protocol server enabling AI systems to send real-time notifications to phones, desktops, and other devices through the ntfy publish/subscribe service.