mcpField
N
Ntfy MCP Server

Ntfy MCP Server

Local
npmjs.comCommunication24Updated 2w ago

About Ntfy MCP Server

Ntfy MCP Server exposes ntfy push-notification management to MCP clients. It supports sending, updating, clearing, and replaying topic messages, with both STDIO and Streamable HTTP transports.

Key features

  1. 01Publish or update notifications
  2. 02Clear or delete sent notifications
  3. 03Fetch filtered topic history
  4. 04Search emoji tag codes
  5. 05STDIO and Streamable HTTP transports

Use cases

  1. 01Send ntfy alerts from an AI workflow
  2. 02Review recent messages on alert topics
  3. 03Dismiss or remove a sent notification

MCP support

The server exposes four tools and the `ntfy://{topic}` resource to MCP clients. It supports STDIO and Streamable HTTP transports.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"ntfy": {
"command": "npx",
"args": [
"-y",
"ntfy-mcp-server"
],
"env": {
"NTFY_SERVERS": "<NTFY_SERVERS>",
"NTFY_BASE_URL": "<NTFY_BASE_URL>",
"NTFY_DEFAULT_TOPIC": "<NTFY_DEFAULT_TOPIC>",
"NTFY_AUTH_TOKEN": "<NTFY_AUTH_TOKEN>",
"NTFY_AUTH_USERNAME": "<NTFY_AUTH_USERNAME>",
"NTFY_AUTH_PASSWORD": "<NTFY_AUTH_PASSWORD>",
"NTFY_REQUEST_TIMEOUT_MS": "<NTFY_REQUEST_TIMEOUT_MS>",
"NTFY_MAX_RETRIES": "<NTFY_MAX_RETRIES>",
"NTFY_BLOCK_PRIVATE_HOSTS": "<NTFY_BLOCK_PRIVATE_HOSTS>",
"NTFY_ENABLE_EMOJI_TAGS": "<NTFY_ENABLE_EMOJI_TAGS>",
"MCP_LOG_LEVEL": "<MCP_LOG_LEVEL>",
"LOGS_DIR": "<LOGS_DIR>",
"OTEL_ENABLED": "<OTEL_ENABLED>",
"MCP_TRANSPORT_TYPE": "<MCP_TRANSPORT_TYPE>",
"MCP_SESSION_MODE": "<MCP_SESSION_MODE>",
"MCP_HTTP_HOST": "<MCP_HTTP_HOST>",
"MCP_HTTP_PORT": "<MCP_HTTP_PORT>",
"MCP_HTTP_ENDPOINT_PATH": "<MCP_HTTP_ENDPOINT_PATH>",
"MCP_AUTH_MODE": "<MCP_AUTH_MODE>",
"MCP_REQUEST_STATE_KEY": "<MCP_REQUEST_STATE_KEY>"
}
}
}
}
Run commandnpx -y ntfy-mcp-server
Environment variables to set
NTFY_SERVERSJSON array of `{ baseUrl, authToken? | authUsername?+authPassword? }` entries — one per ntfy server. First entry is the default base. Auth is scoped to the entry's `baseUrl`; per-call `base_url` overrides that match a registered base forward that server's auth. Takes precedence over the single-server NTFY_BASE_URL / NTFY_AUTH_* shorthand.
NTFY_BASE_URLSingle-server shorthand — base URL of the ntfy server (no trailing slash). Used when NTFY_SERVERS is unset.
NTFY_DEFAULT_TOPICTopic used when a tool call omits `topic`. Treat the topic name as a secret — anyone who knows it can publish or subscribe.
NTFY_AUTH_TOKENSecretBearer access token (`tk_…`) for the single-server shorthand. Mutually exclusive with NTFY_AUTH_USERNAME / NTFY_AUTH_PASSWORD.
NTFY_AUTH_USERNAMESecretBasic-auth username for the single-server shorthand — must be set together with NTFY_AUTH_PASSWORD.
NTFY_AUTH_PASSWORDSecretBasic-auth password for the single-server shorthand — must be set together with NTFY_AUTH_USERNAME.
NTFY_REQUEST_TIMEOUT_MSPer-attempt HTTP timeout in milliseconds, covering the response body. Each call is also capped at 50 s across all attempts.
NTFY_MAX_RETRIESMax retry attempts for transient upstream failures (5xx, network, 429).
NTFY_BLOCK_PRIVATE_HOSTSWhen true, a per-call `base_url` override must resolve to a public address and its redirects are not followed. Servers registered under NTFY_SERVERS / NTFY_BASE_URL are exempt. Turn it on where callers you do not control can reach the server.
NTFY_ENABLE_EMOJI_TAGSSet to false to disable the ntfy_search_emoji_tags tool: it leaves tools/list, and the server instructions and ntfy_publish_message stop pointing at it.
MCP_LOG_LEVELSets the minimum log level for output (e.g., 'debug', 'info', 'warn').
LOGS_DIRDirectory for file-based logs (Node only; ignored on Workers).
OTEL_ENABLEDEnable OpenTelemetry instrumentation (spans, metrics, completion logs).
MCP_TRANSPORT_TYPESelects the HTTP transport.
MCP_SESSION_MODEHTTP session model: 'auto', 'stateful', or 'stateless'. This server requires 'stateful' over HTTP — the consent prompt on destructive and outbound calls is a multi-round-trip request that a 2025-era HTTP client can only complete over a live session — so an HTTP start with 'stateless' is refused. 'auto' resolves to 'stateful'; stdio ignores the setting.
MCP_HTTP_HOSTThe hostname for the HTTP server.
MCP_HTTP_PORTThe port to run the HTTP server on.
MCP_HTTP_ENDPOINT_PATHThe endpoint path for the MCP server.
MCP_AUTH_MODESecretAuthentication mode to use: 'none', 'jwt', or 'oauth'.
MCP_REQUEST_STATE_KEYSecretRecommended for HTTP. Key (>= 32 bytes, the same on every instance) that seals the requestState carrying the consent-record id of a confirmation prompt, bound to the caller for 900 s; a forged, tampered, or expired state is rejected before the handler runs.

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npmntfy-mcp-server2.3.7

Tools

4

Saved tool list · updated 3w ago

ParameterTypeRequiredDescription
callstringNoTrigger a voice call — `+CCNNNNNNNNNN` or `'yes'` for the authenticated user's first verified number. Requires an authenticated ntfy account; ntfy.sh limits this to Pro plans.
iconstringNoAbsolute JPEG/PNG icon URL shown next to the message body. Cached for 24h.
tagsarrayNoUp to 10 tags. Strings matching ntfy emoji short codes render as emojis prepended to the title; others render as a tag list. Use `ntfy_search_emoji_tags` to discover short codes.
cachebooleanNoSet false to skip server-side caching. Live subscribers still receive the message but `ntfy_fetch_messages` will not see it. Sent as `X-Cache: no`.
clickstringNoURL opened when the notification is tapped — http(s), mailto:, geo:, ntfy://, etc.
delaystringNoSchedule delivery for later. Accepts a duration (`30m`, `2h`, `1d`), a Unix timestamp, or natural-language time (`tomorrow, 10am`, `Tuesday, 7am`). Server-enforced 10s minimum, 3-day maximum.
emailstringNoForward to email — an address (`[email protected]`) or `'yes'` to use the authenticated user's first verified address.
titlestringNoNotification title. Defaults to the topic URL on the recipient device.
topicstringNoTarget topic. Required unless `NTFY_DEFAULT_TOPIC` is configured. Treat the topic name as a secret — anyone who knows it can publish or subscribe.
attachstringNoExternal attachment URL (absolute). ntfy fetches it on the recipient device — host the file somewhere reachable first; no local file uploads.
actionsarrayNoUp to 3 action buttons. Discriminated by `action` (`view`, `broadcast`, `http`, `copy`).
messagestringNoNotification body, ≤4096 bytes (not characters — accented letters, CJK, and emoji cost 2–4 bytes each). Empty/missing is replaced server-side with the literal `triggered`; pass real content even for ping-style alerts.
base_urlstringNoOverride the configured `NTFY_BASE_URL` for this call — an absolute `http(s)://` URL. When the override differs from the configured base URL, server-configured auth credentials are NOT forwarded.
filenamestringNoOverrides the attachment's display filename in the client.
firebasebooleanNoSet false to skip Firebase Cloud Messaging. Delays Android delivery up to 15 min unless the recipient enabled instant delivery. Sent as `X-Firebase: no`.
markdownbooleanNoRender the message body as Markdown (web app only; mobile renders plain text).
priorityintegerNoNotification priority — 1=min, 2=low, 3=default, 4=high, 5=max/urgent. Server defaults to 3 when omitted.
sequence_idstringNoUpdate or replace a previously-published message instead of creating a new one. Same identifier used by `ntfy_manage_message`. 1–64 chars, `[a-zA-Z0-9_-]`.

Details

From the project README

ntfy-mcp-server

Send, manage, and replay ntfy push notifications via MCP. STDIO or Streamable HTTP.

4 Tools • 1 Resource

npm Version Framework MCP SDK

License TypeScript Bun

Install in Claude Desktop Install in Cursor Install in VS Code


Overview

Push notifications to your phone or desktop through ntfy. Publish, update, and manage notifications, poll a topic's recent history, and look up emoji short codes for tags.

Tools
ToolDescription
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.
Resources
ResourceDescription
ntfy://{topic}Snapshot of a topic — latest 20 messages from the past 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.

Capability reference

ntfy_publish_message tool
  • Topics are created on first publish — treat the topic name as a secret; anyone who knows it can publish or subscribe
  • Takes title, priority (1–5), tags, click, attach, icon, filename, markdown, delay, email, call, cache, firebase, and up to three action buttons (view, broadcast, http, copy); body capped at 4096 bytes, empty body defaults to triggered; pass the original sequence_id to update a sent message
  • Publishes with email, call, or a broadcast/http button ask the user to confirm the target before sending
  • A per-call base_url gets credentials only if it matches a registered server (NTFY_BASE_URL or an NTFY_SERVERS entry); otherwise the request is unauthenticated

ntfy_manage_message tool
  • operation: clear marks the notification read and dismisses it (subscribers see message_clear); delete removes it from the drawer (subscribers see message_delete)
  • Every call asks the user to confirm the topic, sequence_id, and operation first; declining fails with consent_declined
  • The original message stays in cache, and repeating an operation is safe; ntfy.sh accepts an unknown sequence_id, stricter deployments return not_found

ntfy_fetch_messages tool
  • Returns a snapshot, not a live stream; accepts comma-separated topics (e.g. alerts,backups) and filters since (duration / timestamp / message ID / all / latest), priority, tags, id, title, message, scheduled-only
  • Default window 10m, default limit 20, at most 100 per call; a larger window returns the newest limit messages with totalCount and a nextCursor to pass back as cursor
  • Bodies truncate at ~500 chars (messageTruncated gives the dropped count); refetch with id for the full text
  • Flags upstreamTruncated when ntfy capped the replay, and fails with upstream_malformed if the server doesn't return an ntfy message stream

ntfy_search_emoji_tags tool
  • Case-insensitive substring match on tag names; omit query to list the reference in order
  • limit default 25, at most 200 per call; page with offset using totalCount
  • Returned tag strings go straight into ntfy_publish_message's tags
  • On by default; set NTFY_ENABLE_EMOJI_TAGS=false to remove it from tools/list

ntfy://{topic} resource
  • Fixed snapshot: latest 20 messages from the past hour plus the topic's browser URL, in the same shape as ntfy_fetch_messages (including upstreamTruncated)
  • For custom windows or filters, use ntfy_fetch_messages

Features

Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.

ntfy-specific:

  • Retrying ntfy client with a per-attempt timeout, and each call capped at 50 s so it settles before an MCP client's 60 s default
  • Per-server auth: credentials bind to each registered base URL (NTFY_BASE_URL or an NTFY_SERVERS entry), with bearer-token and basic-auth modes mutually exclusive
  • User confirmation before a clear/delete, or a publish with email, call, or a broadcast/http button, on both stdio and Streamable HTTP
  • Optional SSRF guard on base_url overrides (NTFY_BLOCK_PRIVATE_HOSTS); registered servers are exempt
  • Bundled emoji-tag reference, regenerated from upstream docs/ntfy/emojis.md via scripts/build-emoji-tags.ts

Agent-friendly output:

  • Publish and manage echo the resolved topic, ID, and timestamp; fetch also echoes the resolved since and applied filters
  • Typed reason codes (consent_declined, forbidden_topic, rate_limited, not_found, payload_too_large, and more) let callers branch on failure mode
  • Fetch and emoji search report truncated, totalCount, and a notice naming the next step (pass nextCursor as cursor, advance offset)

Getting started

Add the following to your MCP client configuration file. Public ntfy.sh works out of the box without an account; for protected topics, generate an access token at https://ntfy.sh/account.

{
  "mcpServers": {
    "ntfy-mcp-server": {
      "type": "stdio",
      "command": "bunx",
      "args": ["ntfy-mcp-server@latest"],
      "env": {
        "MCP_TRANSPORT_TYPE": "stdio",
        "MCP_LOG_LEVEL": "info",
        "NTFY_DEFAULT_TOPIC": "your-topic-name"
      }
    }
  }
}

Or with npx (no Bun required):

{
  "mcpServers": {
    "ntfy-mcp-server": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "ntfy-mcp-server@latest"],
      "env": {
        "MCP_TRANSPORT_TYPE": "stdio",
        "MCP_LOG_LEVEL": "info",
        "NTFY_DEFAULT_TOPIC": "your-topic-name"
      }
    }
  }
}

Or with Docker:

{
  "mcpServers": {
    "ntfy-mcp-server": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-e", "MCP_TRANSPORT_TYPE=stdio",
        "-e", "NTFY_DEFAULT_TOPIC=your-topic-name",
        "ghcr.io/cyanheads/ntfy-mcp-server:latest"
      ]
    }
  }
}

For Streamable HTTP, set the transport and start the server:

MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 NTFY_DEFAULT_TOPIC=your-topic bun run start:http
# Server listens at http://127.0.0.1:3010/mcp
Prerequisites
  • Bun v1.4.0 or higher (or Node.js v24+).
  • A topic name on an ntfy server. Public ntfy.sh requires no account; self-hosted instances and protected topics may need a bearer token or basic-auth credentials.
Installation
  1. Clone the repository:
git clone https://github.com/cyanheads/ntfy-mcp-server.git
  1. Navigate into the directory:
cd ntfy-mcp-server
  1. Install dependencies:
bun install
  1. Configure environment:
cp .env.example .env
# edit .env and set NTFY_DEFAULT_TOPIC (and auth, if needed)

Configuration

VariableDescriptionDefault
NTFY_SERVERSJSON array of { baseUrl, authToken? | authUsername?+authPassword? } entries, one per ntfy server; the first is the default. Takes precedence over the single-server vars below.—
NTFY_BASE_URLSingle-server shorthand — base URL of the ntfy server (no trailing slash). Used when NTFY_SERVERS is unset.https://ntfy.sh
NTFY_DEFAULT_TOPICTopic used when a tool call omits topic.—
NTFY_AUTH_TOKENBearer access token (tk_…) for the single-server shorthand. Mutually exclusive with NTFY_AUTH_USERNAME / NTFY_AUTH_PASSWORD.—
NTFY_AUTH_USERNAMEBasic-auth username for the single-server shorthand — required together with NTFY_AUTH_PASSWORD.—
NTFY_AUTH_PASSWORDBasic-auth password for the single-server shorthand — required together with NTFY_AUTH_USERNAME.—
NTFY_REQUEST_TIMEOUT_MSPer-attempt HTTP timeout in milliseconds. Each call is also capped at 50 s across all attempts.15000
NTFY_MAX_RETRIESMax retry attempts for transient upstream failures (5xx, network, 429).3
NTFY_BLOCK_PRIVATE_HOSTSWhen true, a per-call base_url override must resolve to a public address and redirects are not followed. Registered servers are exempt. Turn it on where callers you don't control can reach the server.false
NTFY_ENABLE_EMOJI_TAGSSet to false to disable ntfy_search_emoji_tags. An unrecognized value fails startup.true
MCP_TRANSPORT_TYPETransport: stdio or http.stdio
MCP_SESSION_MODEHTTP session model: auto, stateful, or stateless. Over HTTP this server requires stateful (auto resolves to it); stateless is refused at start. Ignored on stdio.stateful
MCP_HTTP_HOSTHTTP host.127.0.0.1
MCP_HTTP_PORTHTTP port.3010
MCP_HTTP_ENDPOINT_PATHHTTP endpoint path./mcp
MCP_AUTH_MODEAuth mode: none, jwt, or oauth.none
MCP_REQUEST_STATE_KEYRecommended for HTTP. Key (≥ 32 bytes, e.g. openssl rand -base64 32, the same on every instance) that seals the consent requestState for 900 s; an invalid or expired state is rejected with -32602 invalid_request_state.—
STORAGE_PROVIDER_TYPEWhere consent records live (600 s TTL). Multi-instance HTTP needs shared storage: filesystem (shared volume), supabase, or cloudflare-d1, not cloudflare-kv.in-memory
MCP_LOG_LEVELLog level (RFC 5424).info
LOGS_DIRDirectory for file-based logs (Node only; ignored on Workers)../logs
LOG_TOOL_FAILURE_PAYLOADSLog each failed tool call's arguments and result, redacted by key name and capped at LOG_TOOL_FAILURE_PAYLOAD_MAX_BYTES (default 16384). A secret inside a free-form value is not redacted.false
OTEL_ENABLEDEnable OpenTelemetry instrumentation (spans, metrics, completion logs).false

See .env.example for the full list of optional overrides.

Running the server

Local development
  • Build and run:

    # One-time build
    bun run rebuild
    
    # Run the built server
    bun run start:stdio
    # or
    bun run start:http
    
  • Run checks and tests:

    bun run devcheck     # Lint, format, typecheck, security, changelog sync
    bun run test         # Vitest test suite
    bun run lint:mcp     # Validate MCP definitions against spec
    
Docker
docker build -t ntfy-mcp-server .
docker run --rm -e NTFY_DEFAULT_TOPIC=your-topic -p 3010:3010 ntfy-mcp-server

The Dockerfile defaults to HTTP transport, stateful session mode, and logs to /var/log/ntfy-mcp-server. OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.

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

Contributing

Issues are welcome. Run checks and tests before submitting:

bun run devcheck
bun run test

License

Apache-2.0 — see LICENSE for details.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.