ntfy-mcp-server
Version:
An MCP (Model Context Protocol) server designed to interact with the ntfy push notification service. It enables LLMs and AI agents to send notifications to your devices with extensive customization options.
80 lines (79 loc) • 2.52 kB
TypeScript
/**
* Custom error classes for the ntfy service
*/
import { McpError } from '../../types-global/errors.js';
/**
* Base error class for ntfy service errors
*/
export declare class NtfyError extends McpError {
constructor(message: string, details?: Record<string, unknown>);
}
/**
* Error thrown when connection to ntfy server fails
*/
export declare class NtfyConnectionError extends NtfyError {
readonly url?: string | undefined;
constructor(message: string, url?: string | undefined);
}
/**
* Error thrown when authentication fails
*/
export declare class NtfyAuthenticationError extends NtfyError {
constructor(message: string);
}
/**
* Error thrown when a message cannot be parsed
*/
export declare class NtfyParseError extends NtfyError {
readonly rawData?: string | undefined;
constructor(message: string, rawData?: string | undefined);
}
/**
* Error thrown when a subscription is closed unexpectedly
*/
export declare class NtfySubscriptionClosedError extends NtfyError {
readonly reason?: string | undefined;
constructor(message: string, reason?: string | undefined);
}
/**
* Error thrown when an invalid topic name is provided
*/
export declare class NtfyInvalidTopicError extends NtfyError {
readonly topic?: string | undefined;
constructor(message: string, topic?: string | undefined);
}
/**
* Error thrown when a timeout occurs
*/
export declare class NtfyTimeoutError extends NtfyError {
readonly timeoutMs?: number | undefined;
constructor(message: string, timeoutMs?: number | undefined);
}
/**
* Error mapping for ntfy errors
*/
export declare const NTFY_ERROR_MAPPINGS: ({
pattern: RegExp;
errorCode: "UNAUTHORIZED";
factory: (error: unknown) => NtfyAuthenticationError;
} | {
pattern: RegExp;
errorCode: "VALIDATION_ERROR";
factory: (error: unknown, context?: Record<string, unknown>) => NtfyParseError;
} | {
pattern: RegExp;
errorCode: "VALIDATION_ERROR";
factory: (error: unknown, context?: Record<string, unknown>) => NtfyInvalidTopicError;
} | {
pattern: RegExp;
errorCode: "TIMEOUT";
factory: (error: unknown, context?: Record<string, unknown>) => NtfyTimeoutError;
} | {
pattern: RegExp;
errorCode: "SERVICE_UNAVAILABLE";
factory: (error: unknown, context?: Record<string, unknown>) => NtfyConnectionError;
})[];
/**
* Create an error mapper function for ntfy errors
*/
export declare const ntfyErrorMapper: (error: unknown, context?: Record<string, unknown>) => McpError;