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.
62 lines (61 loc) • 2.26 kB
TypeScript
import { z } from 'zod';
import { RateLimitConfig } from "../utils/rateLimiter.js";
import { OperationContext } from "../utils/security.js";
/**
* Metadata for a tool example
*/
export interface ToolExample {
/** Example input parameters */
input: Record<string, unknown>;
/** Expected output string */
output: string;
/** Description of the example */
description: string;
}
/**
* Configuration for a tool
*/
export interface ToolMetadata {
/** Examples showing how to use the tool */
examples: ToolExample[];
/** Optional permission required for this tool */
requiredPermission?: string;
/** Optional schema for the return value */
returnSchema?: z.ZodType<unknown>;
/** Rate limit configuration for the tool */
rateLimit?: RateLimitConfig;
/** Whether this tool can be used without authentication */
allowUnauthenticated?: boolean;
}
/**
* Create a tool example
*
* @param input Example input parameters
* @param output Expected output (as a formatted string)
* @param description Description of what the example demonstrates
* @returns A tool example object
*/
export declare function createToolExample(input: Record<string, unknown>, output: string, description: string): ToolExample;
/**
* Create tool metadata
*
* @param metadata Tool metadata options
* @returns Tool metadata configuration
*/
export declare function createToolMetadata(metadata: ToolMetadata): ToolMetadata;
/**
* Register a tool with the MCP server
*
* This is a compatibility wrapper for the McpServer.tool() method.
* In the current implementation, the tool registration is handled by the McpServer class,
* so this function primarily exists to provide a consistent API.
*
* @param server MCP server instance
* @param name Tool name
* @param description Tool description
* @param inputSchema Schema for validating input
* @param handler Handler function for the tool
* @param metadata Optional tool metadata
*/
export declare function registerTool(server: any, // Using any to avoid type conflicts
name: string, description: string, inputSchema: Record<string, z.ZodType<any>>, handler: (input: unknown, context: OperationContext) => Promise<unknown>, metadata?: ToolMetadata): Promise<void>;