UNPKG

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.

86 lines (85 loc) 3.18 kB
import { NtfyMessage, NtfySubscriptionOptions } from './types.js'; /** * Validates a topic name * @param topic Topic name to validate * @returns True if the topic name is valid, false otherwise */ export declare function isValidTopic(topic: string): Promise<boolean>; /** * Validate a topic name synchronously * This is a synchronous version for performance and cases where async isn't possible * @param topic Topic to validate * @returns True if topic is valid */ export declare function validateTopicSync(topic: string): boolean; /** * Builds a ntfy subscription URL * @param topic Topic to subscribe to (can be comma-separated for multiple topics) * @param format Subscription format (json, sse, raw, ws) * @param options Subscription options * @returns Complete URL for the subscription */ export declare function buildSubscriptionUrl(topic: string, format: string, options: NtfySubscriptionOptions): Promise<string>; /** * Builds a subscription URL synchronously * @param topic Topic to subscribe to * @param format Subscription format * @param options Subscription options * @returns Complete URL */ export declare function buildSubscriptionUrlSync(topic: string, format: string, options: NtfySubscriptionOptions): string; /** * Creates authorization header for basic auth * @param username Username * @param password Password * @returns Basic auth header value */ export declare function createBasicAuthHeader(username: string, password: string): Promise<string>; /** * Creates basic auth header synchronously * @param username Username * @param password Password * @returns Basic auth header value */ export declare function createBasicAuthHeaderSync(username: string, password: string): string; /** * Parses a JSON message from ntfy * @param data JSON string to parse * @returns Parsed ntfy message * @throws NtfyParseError if the message cannot be parsed */ export declare function parseJsonMessage(data: string): Promise<NtfyMessage>; /** * Parse JSON message synchronously * @param data JSON string to parse * @returns Parsed ntfy message * @throws NtfyParseError if parsing fails */ export declare function parseJsonMessageSync(data: string): NtfyMessage; /** * Creates request headers for ntfy API calls * @param options Subscription options * @returns Headers object for fetch */ export declare function createRequestHeaders(options: NtfySubscriptionOptions): Promise<HeadersInit>; /** * Create request headers synchronously * @param options Subscription options * @returns Headers object */ export declare function createRequestHeadersSync(options: NtfySubscriptionOptions): HeadersInit; /** * Generates a timeout promise that rejects after the specified time * @param ms Timeout in milliseconds * @returns Promise that rejects after the specified time */ export declare function createTimeout(ms: number): Promise<never>; /** * Creates an AbortController with a timeout * @param timeoutMs Timeout in milliseconds * @returns AbortController and a cleanup function */ export declare function createAbortControllerWithTimeout(timeoutMs: number): { controller: AbortController; cleanup: () => void; };