Labsco
cyanheads logo

Ntfy MCP Server

β˜… 16

from cyanheads

Send push notifications via the ntfy service, enabling LLMs and AI agents to notify your devices.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeAdvanced setup
<div align="center"> <h1>ntfy-mcp-server</h1> <p><b>Send, manage, and replay ntfy push notifications via MCP. STDIO or Streamable HTTP.</b> <div>4 Tools β€’ 1 Resource</div> </p> </div> <div align="center">

npm Version Framework MCP SDK

License TypeScript Bun

</div>

Tools

Four tools covering the ntfy publish/subscribe surface β€” message lifecycle (publish, manage, fetch) plus an emoji-tag lookup that feeds the publish tool's tags field:

Tool NameDescription
ntfy_publish_messageSend or update a push notification on an ntfy topic.
ntfy_manage_messageClear or delete a previously-sent notification by sequence_id.
ntfy_fetch_messagesPoll cached messages from one or more topics with optional filters.
ntfy_search_emoji_tagsLook up ntfy emoji tag short codes for use in tags.

ntfy_publish_message

Send or update a push notification on an ntfy topic. Topics are created on first publish β€” treat the topic name as a secret because anyone who knows it can publish or subscribe.

  • Full publish-parameter coverage β€” title, priority (1–5), tags, click, attach, icon, filename, markdown, delay, email, call, cache, firebase
  • Up to three discriminated action buttons (view, broadcast, http, copy) per message
  • Update or replace previously-sent messages by passing the original sequence_id
  • Per-call base_url override that forwards credentials only when the override matches a registered server (NTFY_BASE_URL or an NTFY_SERVERS entry); otherwise the request goes out unauthenticated, so credentials never leak to alternate hosts

ntfy_manage_message

Clear (mark read & dismiss) or delete a previously-sent ntfy notification by sequence_id. Append-only β€” the original message stays in cache, and a message_clear / message_delete event is emitted to subscribers. Idempotent.


ntfy_fetch_messages

Poll cached messages from one or more topics with optional filters. Returns a snapshot, not a live stream β€” use it to confirm delivery, replay missed alerts, or audit topic activity.

  • Comma-separated multi-topic queries (e.g. alerts,backups,phil_alerts)
  • Filter by since (duration / timestamp / message ID / all / latest), priority, tags, id, title, message, scheduled-only
  • Default window 10m, default limit 20 messages per response, hard cap 100
  • Long bodies truncated to ~500 chars with messageTruncated reporting the dropped count

ntfy_search_emoji_tags

Substring search over the bundled ntfy emoji-tag reference. Returns the tag strings ready to plug into ntfy_publish_message's tags field. Without a query, returns the first slice of the full reference.

Resources and prompts

TypeNameDescription
Resourcentfy://{topic}Snapshot of a topic β€” last 20 messages from the past 1 hour, plus the topic's browser URL.

ntfy_fetch_messages covers the same topic data with custom windows and filters when the resource's fixed defaults aren't enough.

Features

Built on @cyanheads/mcp-ts-core:

  • Declarative tool and resource definitions β€” single file per primitive, framework handles registration and validation
  • Typed error contracts via ctx.fail(reason, …) plus framework error factories (forbidden, notFound, validationError, …)
  • Pluggable auth: none, jwt, oauth
  • Swappable storage backends: in-memory, filesystem, Supabase, Cloudflare KV/R2/D1
  • Structured logging with optional OpenTelemetry tracing
  • STDIO and Streamable HTTP transports

ntfy-specific:

  • Wraps ntfy's HTTP API with retry-aware client (withRetry + per-request timeout)
  • Per-server scoped auth β€” credentials are bound to each registered base URL (NTFY_BASE_URL or per-entry under NTFY_SERVERS); per-call base_url overrides forward auth only when the override matches a registered server, and go out unauthenticated otherwise
  • Bundled emoji-tag reference, regenerated from upstream docs/ntfy/emojis.md via scripts/build-emoji-tags.ts
  • Mutually-exclusive auth modes (bearer token or basic auth) validated at config-load time

Project structure

DirectoryPurpose
src/index.tscreateApp() entry point β€” registers tools and resources, initializes services.
src/configServer-specific environment variable parsing (NTFY_*) with Zod.
src/mcp-server/toolsTool definitions (*.tool.ts).
src/mcp-server/resourcesResource definitions (*.resource.ts).
src/services/ntfyntfy HTTP client, types, and error classifier.
src/services/emoji-tagsBundled emoji short-code reference and lookup service.
docs/ntfyMirrored upstream ntfy API docs (pinned commit in SOURCES.md).
tests/Unit and integration tests mirroring src/.

Development guide

See CLAUDE.md for development guidelines and architectural rules. The short version:

  • Handlers throw, framework catches β€” no try/catch in tool logic
  • Use ctx.log for request-scoped logging, ctx.state for tenant-scoped storage
  • Wrap external API calls: validate raw β†’ normalize to domain type β†’ return output schema; never fabricate missing fields
  • Per-tool errors[] contracts stay inline β€” repetition is intended for locality