ntfy-mcp-server 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +423 -0
  3. package/dist/config/index.d.ts +23 -0
  4. package/dist/config/index.js +111 -0
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.js +108 -0
  7. package/dist/mcp-server/resources/ntfyResource/getNtfyTopic.d.ts +2 -0
  8. package/dist/mcp-server/resources/ntfyResource/getNtfyTopic.js +111 -0
  9. package/dist/mcp-server/resources/ntfyResource/index.d.ts +12 -0
  10. package/dist/mcp-server/resources/ntfyResource/index.js +72 -0
  11. package/dist/mcp-server/resources/ntfyResource/types.d.ts +27 -0
  12. package/dist/mcp-server/resources/ntfyResource/types.js +8 -0
  13. package/dist/mcp-server/server.d.ts +40 -0
  14. package/dist/mcp-server/server.js +245 -0
  15. package/dist/mcp-server/tools/ntfyTool/index.d.ts +11 -0
  16. package/dist/mcp-server/tools/ntfyTool/index.js +110 -0
  17. package/dist/mcp-server/tools/ntfyTool/ntfyMessage.d.ts +9 -0
  18. package/dist/mcp-server/tools/ntfyTool/ntfyMessage.js +289 -0
  19. package/dist/mcp-server/tools/ntfyTool/types.d.ts +252 -0
  20. package/dist/mcp-server/tools/ntfyTool/types.js +144 -0
  21. package/dist/mcp-server/utils/registrationHelper.d.ts +48 -0
  22. package/dist/mcp-server/utils/registrationHelper.js +63 -0
  23. package/dist/services/ntfy/constants.d.ts +37 -0
  24. package/dist/services/ntfy/constants.js +37 -0
  25. package/dist/services/ntfy/errors.d.ts +79 -0
  26. package/dist/services/ntfy/errors.js +134 -0
  27. package/dist/services/ntfy/index.d.ts +33 -0
  28. package/dist/services/ntfy/index.js +56 -0
  29. package/dist/services/ntfy/publisher.d.ts +66 -0
  30. package/dist/services/ntfy/publisher.js +229 -0
  31. package/dist/services/ntfy/subscriber.d.ts +81 -0
  32. package/dist/services/ntfy/subscriber.js +502 -0
  33. package/dist/services/ntfy/types.d.ts +161 -0
  34. package/dist/services/ntfy/types.js +4 -0
  35. package/dist/services/ntfy/utils.d.ts +85 -0
  36. package/dist/services/ntfy/utils.js +410 -0
  37. package/dist/types-global/errors.d.ts +35 -0
  38. package/dist/types-global/errors.js +39 -0
  39. package/dist/types-global/mcp.d.ts +30 -0
  40. package/dist/types-global/mcp.js +25 -0
  41. package/dist/types-global/tool.d.ts +61 -0
  42. package/dist/types-global/tool.js +99 -0
  43. package/dist/utils/errorHandler.d.ts +98 -0
  44. package/dist/utils/errorHandler.js +271 -0
  45. package/dist/utils/idGenerator.d.ts +94 -0
  46. package/dist/utils/idGenerator.js +149 -0
  47. package/dist/utils/index.d.ts +13 -0
  48. package/dist/utils/index.js +16 -0
  49. package/dist/utils/logger.d.ts +36 -0
  50. package/dist/utils/logger.js +92 -0
  51. package/dist/utils/rateLimiter.d.ts +115 -0
  52. package/dist/utils/rateLimiter.js +180 -0
  53. package/dist/utils/requestContext.d.ts +68 -0
  54. package/dist/utils/requestContext.js +91 -0
  55. package/dist/utils/sanitization.d.ts +224 -0
  56. package/dist/utils/sanitization.js +367 -0
  57. package/dist/utils/security.d.ts +26 -0
  58. package/dist/utils/security.js +27 -0
  59. package/package.json +47 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 Casey Hand @cyanheads
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,423 @@
1
+ # Ntfy MCP Server
2
+
3
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.8.2-blue.svg)](https://www.typescriptlang.org/)
4
+ [![Model Context Protocol](https://img.shields.io/badge/MCP-1.8.0-green.svg)](https://modelcontextprotocol.io/)
5
+ [![Version](https://img.shields.io/badge/Version-1.0.0-blue.svg)](https://github.com/cyanheads/ntfy-mcp-server/releases)
6
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7
+ [![Status](https://img.shields.io/badge/Status-Stable-green.svg)](https://github.com/cyanheads/ntfy-mcp-server)
8
+ [![GitHub](https://img.shields.io/github/stars/cyanheads/ntfy-mcp-server?style=social)](https://github.com/cyanheads/ntfy-mcp-server)
9
+
10
+ An MCP (Model Context Protocol) server designed to interact with the [ntfy](https://ntfy.sh/) push notification service. It enables LLMs and AI agents to send notifications to your devices with extensive customization options.
11
+
12
+ ## Table of Contents
13
+
14
+ - [Overview](#overview)
15
+ - [Features](#features)
16
+ - [Quick Start](#quick-start)
17
+ - [Installation](#installation)
18
+ - [Configuration](#configuration)
19
+ - [Project Structure](#project-structure)
20
+ - [Tools](#tools)
21
+ - [Resources](#resources)
22
+ - [Use Cases](#use-cases)
23
+ - [Available Scripts](#available-scripts)
24
+ - [Contributing](#contributing)
25
+ - [License](#license)
26
+
27
+ ## Overview
28
+
29
+ This server implements the Model Context Protocol (MCP), enabling standardized communication between LLMs and external systems. Specifically, it provides an interface to the ntfy push notification service.
30
+
31
+ [Ntfy](https://ntfy.sh/) is a simple HTTP-based pub-sub notification service that allows you to send notifications to your phone or desktop via simple HTTP requests. With this MCP server, LLM agents like Claude can send notifications to you through ntfy without needing direct HTTP access.
32
+
33
+ ```
34
+ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌─────────┐
35
+ │ LLM Agent │ ────▶│ Ntfy MCP │ ────▶│ Ntfy │ ────▶│ Your │
36
+ │ (Claude) │ │ Server │ │ Service │ │ Devices │
37
+ └───────────┘ └───────────┘ └───────────┘ └─────────┘
38
+ ```
39
+
40
+ ## Features
41
+
42
+ - **MCP Server Implementation:** Built using the `@modelcontextprotocol/sdk` for seamless integration with LLM agents.
43
+ - **Ntfy Integration:** Provides a tool (`send_ntfy`) to send notifications with support for:
44
+ - Message prioritization (1-5 levels)
45
+ - Emoji tags
46
+ - Clickable actions and buttons
47
+ - File attachments
48
+ - Delayed delivery
49
+ - Markdown formatting
50
+ - **Resource Exposure:** Exposes the configured default ntfy topic as an MCP resource.
51
+ - **TypeScript:** Modern, type-safe codebase with comprehensive type definitions.
52
+ - **Structured Logging:** Uses `winston` and `winston-daily-rotate-file` for detailed and rotatable logs.
53
+ - **Configuration Management:** Uses `dotenv` for easy environment-based configuration.
54
+ - **Utility Scripts:** Includes scripts for cleaning build artifacts and generating directory structure documentation.
55
+ - **Error Handling & Security:** Implements robust error handling, input sanitization (`sanitize-html`), and security filters (`xss-filters`).
56
+
57
+ ## Quick Start
58
+
59
+ 1. **Prerequisites:**
60
+
61
+ - Node.js (v16+)
62
+ - npm or yarn
63
+ - An MCP-compatible client (Claude Desktop, Cline, etc.)
64
+
65
+ 2. **Install and Run:**
66
+
67
+ ```bash
68
+ # Clone repository (if applicable)
69
+ git clone https://github.com/cyanheads/ntfy-mcp-server.git
70
+ cd ntfy-mcp-server
71
+
72
+ # Install dependencies and build
73
+ npm install
74
+ npm run build
75
+
76
+ # Create .env file (optional but recommended)
77
+ cp .env.example .env
78
+ # Edit .env to set NTFY_DEFAULT_TOPIC
79
+
80
+ # Start the server
81
+ npm start
82
+ ```
83
+
84
+ 3. **Add to MCP Client Settings:** Add the server to your MCP client settings file (see [Configuration](#configuration))
85
+
86
+ 4. **Use the tool:** Once connected, you can use the `send_ntfy` tool to send notifications.
87
+
88
+ ## Installation
89
+
90
+ 1. **Clone the repository (if applicable):**
91
+
92
+ ```bash
93
+ git clone https://github.com/cyanheads/ntfy-mcp-server.git
94
+ cd ntfy-mcp-server
95
+ ```
96
+
97
+ 2. **Install dependencies:**
98
+
99
+ ```bash
100
+ npm install
101
+ ```
102
+
103
+ 3. **Build the project:**
104
+ ```bash
105
+ npm run build
106
+ ```
107
+
108
+ ## Configuration
109
+
110
+ ### Environment Variables
111
+
112
+ Create a `.env` file in the project root based on `.env.example`:
113
+
114
+ ```bash
115
+ # Ntfy Configuration
116
+ NTFY_BASE_URL=https://ntfy.sh # Optional: Base URL of your ntfy instance
117
+ NTFY_DEFAULT_TOPIC=your_default_topic # Optional: Default topic if none specified in requests
118
+
119
+ # Application Configuration
120
+ LOG_LEVEL=info # Optional: Logging level (debug, info, warn, error)
121
+ NODE_ENV=development # Optional: Environment (development, production)
122
+ ```
123
+
124
+ ### MCP Client Settings
125
+
126
+ #### For Cline VSCode Extension
127
+
128
+ Add the following configuration to your Cline MCP settings file (usually located at `~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json` on macOS):
129
+
130
+ ```json
131
+ {
132
+ "mcpServers": {
133
+ "ntfy": {
134
+ "command": "node",
135
+ "args": ["/path/to/ntfy-mcp-server/dist/index.js"],
136
+ "env": {
137
+ "NTFY_BASE_URL": "https://ntfy.sh",
138
+ "NTFY_DEFAULT_TOPIC": "your_default_topic",
139
+ "LOG_LEVEL": "info",
140
+ "NODE_ENV": "production"
141
+ }
142
+ }
143
+ }
144
+ }
145
+ ```
146
+
147
+ #### For Claude Desktop App
148
+
149
+ Add the following configuration to your Claude Desktop config file (usually located at `~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
150
+
151
+ ```json
152
+ {
153
+ "mcpServers": {
154
+ "ntfy": {
155
+ "command": "node",
156
+ "args": ["/path/to/ntfy-mcp-server/dist/index.js"],
157
+ "env": {
158
+ "NTFY_BASE_URL": "https://ntfy.sh",
159
+ "NTFY_DEFAULT_TOPIC": "your_default_topic",
160
+ "LOG_LEVEL": "info",
161
+ "NODE_ENV": "production"
162
+ }
163
+ }
164
+ }
165
+ }
166
+ ```
167
+
168
+ _Replace `/path/to/ntfy-mcp-server/dist/index.js` with the actual absolute path to the built server file._
169
+ _Adjust `env` variables as needed for your setup._
170
+
171
+ ### Ntfy Setup
172
+
173
+ 1. **Install the ntfy app** on your devices from [ntfy.sh](https://ntfy.sh/app) or the app stores
174
+ 2. **Subscribe to your topic** in the app
175
+ 3. **Use the same topic** in your MCP server configuration
176
+
177
+ ## Project Structure
178
+
179
+ ```
180
+ .
181
+ ├── .env.example # Example environment variables
182
+ ├── .gitignore # Git ignore patterns
183
+ ├── LICENSE # Project license (Apache-2.0)
184
+ ├── package.json # Project metadata and dependencies
185
+ ├── tsconfig.json # TypeScript compiler configuration
186
+ ├── docs/
187
+ │ └── tree.md # Auto-generated directory structure
188
+ ├── logs/ # Runtime logs (created automatically)
189
+ ├── scripts/ # Utility scripts
190
+ │ ├── clean.ts # Cleans build artifacts and logs
191
+ │ └── tree.ts # Generates the docs/tree.md file
192
+ └── src/ # Source code
193
+ ├── index.ts # Main server entry point
194
+ ├── config/ # Configuration loading
195
+ ├── mcp-server/ # MCP server logic, tools, and resources
196
+ │ ├── resources/ # MCP resource implementations
197
+ │ ├── tools/ # MCP tool implementations
198
+ │ └── utils/ # MCP-specific utilities
199
+ ├── services/ # External service integrations (ntfy)
200
+ ├── types-global/ # Global type definitions
201
+ └── utils/ # General utility functions
202
+ ```
203
+
204
+ ## Tools
205
+
206
+ ### `send_ntfy`
207
+
208
+ Sends a notification message via the ntfy service.
209
+
210
+ #### Key Arguments:
211
+
212
+ | Parameter | Type | Required | Description |
213
+ | ------------ | -------- | -------- | ---------------------------------------------------------------------------- |
214
+ | `topic` | string | Yes | The ntfy topic to publish to. |
215
+ | `message` | string | Yes | The main content of the notification (max 4096 bytes). |
216
+ | `title` | string | No | Notification title (max 250 bytes). |
217
+ | `tags` | string[] | No | Emojis or keywords for categorization (e.g., `["warning", "robot"]`). Max 5. |
218
+ | `priority` | integer | No | Message priority: 1=min, 2=low, 3=default, 4=high, 5=max. |
219
+ | `click` | string | No | URL to open when the notification is clicked. |
220
+ | `actions` | array | No | Action buttons (view, http, broadcast). Max 3. |
221
+ | `attachment` | object | No | URL and name of an attachment. |
222
+ | `email` | string | No | Email address to forward the notification to. |
223
+ | `delay` | string | No | Delay delivery (e.g., `30m`, `1h`, `tomorrow`). |
224
+ | `cache` | string | No | Cache duration (e.g., `10m`, `1h`, `1d`). |
225
+ | `firebase` | string | No | Firebase Cloud Messaging (FCM) topic to forward to. |
226
+ | `id` | string | No | Unique ID for the message. |
227
+ | `expires` | string | No | Message expiration (e.g., `10m`, `1h`, `1d`). |
228
+ | `markdown` | boolean | No | Set to `true` to enable markdown formatting in the message. |
229
+ | `baseUrl` | string | No | Override the default ntfy server URL for this request. |
230
+
231
+ #### Example Usage:
232
+
233
+ ```javascript
234
+ // Basic notification
235
+ {
236
+ "topic": "alerts",
237
+ "message": "The task has completed successfully."
238
+ }
239
+
240
+ // Advanced notification
241
+ {
242
+ "topic": "alerts",
243
+ "title": "System Alert",
244
+ "message": "CPU usage has exceeded 90% for 5 minutes.",
245
+ "tags": ["warning", "computer"],
246
+ "priority": 4,
247
+ "click": "https://server-dashboard.example.com",
248
+ "actions": [
249
+ {
250
+ "id": "view",
251
+ "label": "View Details",
252
+ "action": "view",
253
+ "url": "https://server-dashboard.example.com/cpu"
254
+ },
255
+ {
256
+ "id": "restart",
257
+ "label": "Restart Service",
258
+ "action": "http",
259
+ "url": "https://api.example.com/restart-service",
260
+ "method": "POST",
261
+ "headers": {
262
+ "Authorization": "Bearer token123"
263
+ }
264
+ }
265
+ ],
266
+ "markdown": true
267
+ }
268
+ ```
269
+
270
+ #### Example Response:
271
+
272
+ ```json
273
+ {
274
+ "success": true,
275
+ "id": "5ZFY362156Sa",
276
+ "topic": "ATLAS",
277
+ "time": 1743064235,
278
+ "expires": 1743496235,
279
+ "message": "This is a test message from the README verification process",
280
+ "title": "README Testing"
281
+ }
282
+ ```
283
+
284
+ ## Resources
285
+
286
+ ### Direct Resources
287
+
288
+ #### `ntfy://default`
289
+
290
+ - **Description:** Returns the default ntfy topic configured in the server's environment variables (`NTFY_DEFAULT_TOPIC`).
291
+ - **Usage:** Useful for clients to discover the primary topic without needing prior configuration.
292
+ - **Example:** An LLM agent can access this resource to automatically use the default topic when sending notifications.
293
+ - **Example Response:**
294
+ ```json
295
+ {
296
+ "defaultTopic": "ATLAS",
297
+ "timestamp": "2025-03-27T08:30:25.619Z",
298
+ "requestUri": "ntfy://default",
299
+ "requestId": "0da963d0-30e0-4dbc-bb77-4bf2dee14484"
300
+ }
301
+ ```
302
+
303
+ ### Resource Templates
304
+
305
+ #### `ntfy://{topic}`
306
+
307
+ - **Description:** Returns information about a specific ntfy topic.
308
+ - **Parameters:** `topic` - The name of the ntfy topic.
309
+ - **Usage:** For querying information about topics other than the default.
310
+ - **Example Response:**
311
+ ```json
312
+ {
313
+ "topic": "ATLAS",
314
+ "timestamp": "2025-03-27T08:30:30.038Z",
315
+ "requestUri": "ntfy://ATLAS",
316
+ "requestId": "31baf1df-278f-4fdb-860d-019f156a72b0"
317
+ }
318
+ ```
319
+
320
+ ## Use Cases
321
+
322
+ 1. **Long-running Task Notifications** - Get notified when tasks like database backups, code generation, or data processing complete.
323
+ 2. **Scheduled Reminders** - Set delayed notifications for future events or reminders.
324
+ 3. **Alert Systems** - Set up critical alerts for monitoring systems or important events.
325
+ 4. **Mobile Notifications from LLMs** - Allow LLMs to send notifications directly to your phone.
326
+ 5. **Multi-step Process Updates** - Receive updates as different stages of a complex process complete.
327
+
328
+ ### Usage Examples
329
+
330
+ #### Basic Notification
331
+
332
+ ```
333
+ <use_mcp_tool>
334
+ <server_name>ntfy-mcp-server</server_name>
335
+ <tool_name>send_ntfy</tool_name>
336
+ <arguments>
337
+ {
338
+ "topic": "updates",
339
+ "title": "Task Completed",
340
+ "message": "Your requested data analysis has finished",
341
+ "tags": ["check"]
342
+ }
343
+ </arguments>
344
+ </use_mcp_tool>
345
+ ```
346
+
347
+ #### Rich Notification with Actions
348
+
349
+ ```
350
+ <use_mcp_tool>
351
+ <server_name>ntfy-mcp-server</server_name>
352
+ <tool_name>send_ntfy</tool_name>
353
+ <arguments>
354
+ {
355
+ "topic": "alerts",
356
+ "title": "Critical Error Detected",
357
+ "message": "The application has encountered a critical error.\n\n**Error Code**: E123\n\n**Details**: Database connection failed",
358
+ "tags": ["warning", "skull"],
359
+ "priority": 5,
360
+ "actions": [
361
+ {
362
+ "id": "view",
363
+ "label": "View Logs",
364
+ "action": "view",
365
+ "url": "https://logs.example.com"
366
+ },
367
+ {
368
+ "id": "restart",
369
+ "label": "Restart Service",
370
+ "action": "http",
371
+ "url": "https://api.example.com/restart",
372
+ "method": "POST"
373
+ }
374
+ ],
375
+ "markdown": true
376
+ }
377
+ </arguments>
378
+ </use_mcp_tool>
379
+ ```
380
+
381
+ ## Available Scripts
382
+
383
+ - `npm run build`: Compiles the TypeScript source code to JavaScript in the `dist/` directory.
384
+ - `npm run clean`: Removes the `dist/` directory and cleans the contents of the `logs/` directory.
385
+ - `npm run rebuild`: Runs `clean` and then `build`.
386
+ - `npm run tree`: Generates a directory tree representation in `docs/tree.md`.
387
+ - `npm start`: Runs the compiled server from the `dist/` directory using Node.js.
388
+ - `npm run watch`: Tails the combined log file (`logs/combined.log`) for real-time monitoring.
389
+
390
+ ## Contributing
391
+
392
+ Contributions are welcome! Please feel free to submit pull requests or open issues to improve the project.
393
+
394
+ 1. Fork the repository.
395
+ 2. Create a feature branch (`git checkout -b feature/your-feature`).
396
+ 3. Commit your changes (`git commit -m 'Add some feature'`).
397
+ 4. Push to the branch (`git push origin feature/your-feature`).
398
+ 5. Create a new Pull Request.
399
+
400
+ For bugs and feature requests, please create an issue on the repository.
401
+
402
+ ### Development Best Practices
403
+
404
+ - Follow TypeScript best practices and maintain strong typing
405
+ - Write tests for new functionality
406
+ - Keep dependencies up to date
407
+ - Follow the existing code style and patterns
408
+
409
+ ## License
410
+
411
+ This project is licensed under the Apache-2.0 License. See the [LICENSE](LICENSE) file for details.
412
+
413
+ ## Acknowledgements
414
+
415
+ - [ntfy.sh](https://ntfy.sh/) for providing the notification service
416
+ - [Model Context Protocol](https://modelcontextprotocol.io/) for enabling LLM-to-tool connections
417
+ - All contributors and users of this project
418
+
419
+ ---
420
+
421
+ <div align="center">
422
+ Built with the Model Context Protocol
423
+ </div>
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Environment variable configuration
3
+ */
4
+ export declare const config: {
5
+ environment: string;
6
+ logLevel: string;
7
+ server: {
8
+ port: number;
9
+ host: string;
10
+ };
11
+ rateLimit: {
12
+ windowMs: number;
13
+ maxRequests: number;
14
+ };
15
+ ntfy: {
16
+ baseUrl: string;
17
+ defaultTopic: string;
18
+ apiKey: string;
19
+ maxMessageSize: number;
20
+ maxRetries: number;
21
+ };
22
+ };
23
+ export default config;