@drumbeats/mcp 0.1.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 (120) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +130 -0
  3. package/dist/api/client.d.ts +47 -0
  4. package/dist/api/client.d.ts.map +1 -0
  5. package/dist/api/client.js +57 -0
  6. package/dist/api/client.js.map +1 -0
  7. package/dist/api/errors.d.ts +14 -0
  8. package/dist/api/errors.d.ts.map +1 -0
  9. package/dist/api/errors.js +59 -0
  10. package/dist/api/errors.js.map +1 -0
  11. package/dist/api/schemas.d.ts +14 -0
  12. package/dist/api/schemas.d.ts.map +1 -0
  13. package/dist/api/schemas.js +13 -0
  14. package/dist/api/schemas.js.map +1 -0
  15. package/dist/auth/resource-metadata.d.ts +22 -0
  16. package/dist/auth/resource-metadata.d.ts.map +1 -0
  17. package/dist/auth/resource-metadata.js +18 -0
  18. package/dist/auth/resource-metadata.js.map +1 -0
  19. package/dist/auth/scope-map.d.ts +20 -0
  20. package/dist/auth/scope-map.d.ts.map +1 -0
  21. package/dist/auth/scope-map.js +32 -0
  22. package/dist/auth/scope-map.js.map +1 -0
  23. package/dist/auth/verify-token.d.ts +29 -0
  24. package/dist/auth/verify-token.d.ts.map +1 -0
  25. package/dist/auth/verify-token.js +23 -0
  26. package/dist/auth/verify-token.js.map +1 -0
  27. package/dist/config.d.ts +16 -0
  28. package/dist/config.d.ts.map +1 -0
  29. package/dist/config.js +32 -0
  30. package/dist/config.js.map +1 -0
  31. package/dist/server-http.d.ts +2 -0
  32. package/dist/server-http.d.ts.map +1 -0
  33. package/dist/server-http.js +83 -0
  34. package/dist/server-http.js.map +1 -0
  35. package/dist/stdio.d.ts +3 -0
  36. package/dist/stdio.d.ts.map +1 -0
  37. package/dist/stdio.js +35 -0
  38. package/dist/stdio.js.map +1 -0
  39. package/dist/tools/context/list-projects.d.ts +21 -0
  40. package/dist/tools/context/list-projects.d.ts.map +1 -0
  41. package/dist/tools/context/list-projects.js +73 -0
  42. package/dist/tools/context/list-projects.js.map +1 -0
  43. package/dist/tools/diagnostics/check-dns.d.ts +13 -0
  44. package/dist/tools/diagnostics/check-dns.d.ts.map +1 -0
  45. package/dist/tools/diagnostics/check-dns.js +25 -0
  46. package/dist/tools/diagnostics/check-dns.js.map +1 -0
  47. package/dist/tools/diagnostics/check-http.d.ts +20 -0
  48. package/dist/tools/diagnostics/check-http.d.ts.map +1 -0
  49. package/dist/tools/diagnostics/check-http.js +30 -0
  50. package/dist/tools/diagnostics/check-http.js.map +1 -0
  51. package/dist/tools/diagnostics/check-ssl.d.ts +15 -0
  52. package/dist/tools/diagnostics/check-ssl.d.ts.map +1 -0
  53. package/dist/tools/diagnostics/check-ssl.js +26 -0
  54. package/dist/tools/diagnostics/check-ssl.js.map +1 -0
  55. package/dist/tools/incidents/list-incidents.d.ts +25 -0
  56. package/dist/tools/incidents/list-incidents.d.ts.map +1 -0
  57. package/dist/tools/incidents/list-incidents.js +39 -0
  58. package/dist/tools/incidents/list-incidents.js.map +1 -0
  59. package/dist/tools/incidents/manage-incident.d.ts +19 -0
  60. package/dist/tools/incidents/manage-incident.d.ts.map +1 -0
  61. package/dist/tools/incidents/manage-incident.js +30 -0
  62. package/dist/tools/incidents/manage-incident.js.map +1 -0
  63. package/dist/tools/incidents/shared.d.ts +25 -0
  64. package/dist/tools/incidents/shared.d.ts.map +1 -0
  65. package/dist/tools/incidents/shared.js +14 -0
  66. package/dist/tools/incidents/shared.js.map +1 -0
  67. package/dist/tools/index.d.ts +5 -0
  68. package/dist/tools/index.d.ts.map +1 -0
  69. package/dist/tools/index.js +45 -0
  70. package/dist/tools/index.js.map +1 -0
  71. package/dist/tools/monitors/create-monitor.d.ts +46 -0
  72. package/dist/tools/monitors/create-monitor.d.ts.map +1 -0
  73. package/dist/tools/monitors/create-monitor.js +98 -0
  74. package/dist/tools/monitors/create-monitor.js.map +1 -0
  75. package/dist/tools/monitors/get-monitor-history.d.ts +29 -0
  76. package/dist/tools/monitors/get-monitor-history.d.ts.map +1 -0
  77. package/dist/tools/monitors/get-monitor-history.js +68 -0
  78. package/dist/tools/monitors/get-monitor-history.js.map +1 -0
  79. package/dist/tools/monitors/get-monitor.d.ts +13 -0
  80. package/dist/tools/monitors/get-monitor.d.ts.map +1 -0
  81. package/dist/tools/monitors/get-monitor.js +23 -0
  82. package/dist/tools/monitors/get-monitor.js.map +1 -0
  83. package/dist/tools/monitors/list-monitors.d.ts +13 -0
  84. package/dist/tools/monitors/list-monitors.d.ts.map +1 -0
  85. package/dist/tools/monitors/list-monitors.js +29 -0
  86. package/dist/tools/monitors/list-monitors.js.map +1 -0
  87. package/dist/tools/monitors/pause-resume.d.ts +16 -0
  88. package/dist/tools/monitors/pause-resume.d.ts.map +1 -0
  89. package/dist/tools/monitors/pause-resume.js +41 -0
  90. package/dist/tools/monitors/pause-resume.js.map +1 -0
  91. package/dist/tools/monitors/shared.d.ts +40 -0
  92. package/dist/tools/monitors/shared.d.ts.map +1 -0
  93. package/dist/tools/monitors/shared.js +21 -0
  94. package/dist/tools/monitors/shared.js.map +1 -0
  95. package/dist/tools/monitors/update-monitor.d.ts +50 -0
  96. package/dist/tools/monitors/update-monitor.d.ts.map +1 -0
  97. package/dist/tools/monitors/update-monitor.js +75 -0
  98. package/dist/tools/monitors/update-monitor.js.map +1 -0
  99. package/dist/tools/result.d.ts +8 -0
  100. package/dist/tools/result.d.ts.map +1 -0
  101. package/dist/tools/result.js +13 -0
  102. package/dist/tools/result.js.map +1 -0
  103. package/dist/tools/types.d.ts +13 -0
  104. package/dist/tools/types.d.ts.map +1 -0
  105. package/dist/tools/types.js +2 -0
  106. package/dist/tools/types.js.map +1 -0
  107. package/dist/tools/uptime/get-uptime-summary.d.ts +15 -0
  108. package/dist/tools/uptime/get-uptime-summary.d.ts.map +1 -0
  109. package/dist/tools/uptime/get-uptime-summary.js +69 -0
  110. package/dist/tools/uptime/get-uptime-summary.js.map +1 -0
  111. package/dist/tools/validation.d.ts +5 -0
  112. package/dist/tools/validation.d.ts.map +1 -0
  113. package/dist/tools/validation.js +7 -0
  114. package/dist/tools/validation.js.map +1 -0
  115. package/dist/version.d.ts +3 -0
  116. package/dist/version.d.ts.map +1 -0
  117. package/dist/version.js +7 -0
  118. package/dist/version.js.map +1 -0
  119. package/manifest.json +35 -0
  120. package/package.json +64 -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 2026 Lucky S Software
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,130 @@
1
+ # Drumbeats MCP
2
+
3
+ [![CI](https://github.com/drumbeats-io/mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/drumbeats-io/mcp/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/@drumbeats/mcp.svg)](https://www.npmjs.com/package/@drumbeats/mcp)
5
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](./LICENSE)
6
+
7
+ The official [Model Context Protocol](https://modelcontextprotocol.io) server for
8
+ **[Drumbeats](https://drumbeats.io)** — run your monitoring from any AI client.
9
+ Create monitors, triage incidents, and run HTTP / SSL / DNS checks in plain language
10
+ from Claude, Cursor, VS Code, or any MCP-capable tool.
11
+
12
+ ## What is Drumbeats?
13
+
14
+ Drumbeats is heartbeat and uptime monitoring for background jobs and services —
15
+ cron jobs, queues, scheduled tasks, and HTTP endpoints. If a job stops checking in
16
+ or a site goes down, Drumbeats alerts you. Create a free account at
17
+ **[drumbeats.io](https://drumbeats.io)**.
18
+
19
+ ## Install
20
+
21
+ Add the server to your AI client and set one environment variable — your Drumbeats
22
+ account API key:
23
+
24
+ ```jsonc
25
+ {
26
+ "mcpServers": {
27
+ "drumbeats": {
28
+ "command": "npx",
29
+ "args": ["-y", "@drumbeats/mcp"],
30
+ "env": { "DRUMBEATS_API_KEY": "dk_your_key" }
31
+ }
32
+ }
33
+ }
34
+ ```
35
+
36
+ 1. **Get a key** — at [drumbeats.io](https://drumbeats.io) → **Account → API keys**. An
37
+ account-scoped key (`dk_…`) works across every project you own or belong to.
38
+ 2. **Add the config** — paste the block above into your client's MCP config and
39
+ restart it.
40
+ 3. **Ask** — *"List my monitors."*
41
+
42
+ **Claude Desktop:** prefer a one-click install — download the latest `.mcpb` bundle
43
+ from the [Releases page](https://github.com/drumbeats-io/mcp/releases/latest),
44
+ double-click it, and paste your key when prompted.
45
+
46
+ Requires Node.js 22 when running via `npx`.
47
+
48
+ ## Tools
49
+
50
+ Fourteen tools over one shared layer. The HTTP / SSL / DNS diagnostics work with **no
51
+ account and no API key** — point any client at the server and start checking.
52
+
53
+ **Monitors & projects**
54
+ | Tool | What it does |
55
+ | --- | --- |
56
+ | `list_projects` | List the projects your key can access (with notification channels and groups). |
57
+ | `create_monitor` | Create a monitor — cron, heartbeat, or HTTP uptime. |
58
+ | `list_monitors` | List a project's monitors with type, status, and schedule. |
59
+ | `get_monitor` | Fetch one monitor by id, with its full configuration. |
60
+ | `update_monitor` | Update an existing monitor (partial patch). |
61
+ | `pause_monitor` | Pause a monitor (stops checks and alerts). |
62
+ | `resume_monitor` | Resume a paused monitor. |
63
+
64
+ **Observe & triage**
65
+ | Tool | What it does |
66
+ | --- | --- |
67
+ | `get_monitor_history` | Recent pings, checks, and response times for a monitor. |
68
+ | `get_uptime_summary` | Project-wide uptime / SLA rollup across monitors. |
69
+ | `list_incidents` | List incidents (downtime and missed runs), filterable by status or monitor. |
70
+ | `manage_incident` | Get, acknowledge, or resolve an incident. |
71
+
72
+ **Diagnostics — no account required**
73
+ | Tool | What it does |
74
+ | --- | --- |
75
+ | `check_http` | Check a URL's reachability, status code, and response time. |
76
+ | `check_ssl` | Inspect a TLS certificate — validity, expiry, and issuer. |
77
+ | `check_dns` | Resolve a hostname and report its DNS records. |
78
+
79
+ ## Example prompts
80
+
81
+ ```text
82
+ List all my monitors and their current status.
83
+ Create a cron monitor for my nightly backup that runs every day at 02:00 UTC.
84
+ What's my uptime this month?
85
+ Show me open incidents and acknowledge the most recent one.
86
+ Is https://example.com up right now? # no account needed
87
+ Is the SSL certificate for example.com about to expire? # no account needed
88
+ ```
89
+
90
+ ## Try it with zero setup
91
+
92
+ The `check_http`, `check_ssl`, and `check_dns` tools need no Drumbeats account or API
93
+ key. Add the server, leave `DRUMBEATS_API_KEY` unset, and ask *"Is my site up?"* before
94
+ you sign up. When you're ready for continuous monitoring and alerts,
95
+ [create a free account](https://drumbeats.io).
96
+
97
+ ## Configuration
98
+
99
+ | Variable | Required | Default | Description |
100
+ | --- | --- | --- | --- |
101
+ | `DRUMBEATS_API_KEY` | For the monitoring tools | — | Account-scoped key (`dk_…`). Not needed for the diagnostics tools. |
102
+ | `DRUMBEATS_API_BASE_URL` | No | `https://api.drumbeats.io` | Override the API base URL (e.g. for testing). |
103
+
104
+ ## Development
105
+
106
+ Requires the Node version in [`.nvmrc`](./.nvmrc).
107
+
108
+ ```bash
109
+ npm ci # install dependencies
110
+ npm run build # compile TypeScript to dist/
111
+ npm run lint # Biome lint + format check
112
+ npm test # run the test suite
113
+ ```
114
+
115
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for the contribution workflow and
116
+ [SECURITY.md](./SECURITY.md) for the security policy. This is a security product —
117
+ please report vulnerabilities privately.
118
+
119
+ ## Links
120
+
121
+ - **Product:** [drumbeats.io](https://drumbeats.io) · [sign up](https://drumbeats.io)
122
+ - **Issues:** [github.com/drumbeats-io/mcp/issues](https://github.com/drumbeats-io/mcp/issues)
123
+
124
+ ## License
125
+
126
+ [Apache-2.0](./LICENSE) © Lucky S Software. See [NOTICE](./NOTICE).
127
+
128
+ ---
129
+
130
+ A product by **[Lucky S Software](https://luckys.dev)**.
@@ -0,0 +1,47 @@
1
+ /** How the REST client authenticates each request. */
2
+ export type ApiAuth = {
3
+ readonly kind: 'apiKey';
4
+ readonly apiKey: string;
5
+ } | {
6
+ readonly kind: 'bearer';
7
+ readonly token: string;
8
+ };
9
+ export interface ApiRequest {
10
+ readonly method?: string;
11
+ readonly path: string;
12
+ readonly query?: Record<string, string | number | boolean | undefined>;
13
+ readonly body?: unknown;
14
+ /** Optional caller signal, combined with the client's timeout. */
15
+ readonly signal?: AbortSignal;
16
+ }
17
+ /**
18
+ * Abstraction the tool layer depends on. Tools only ever touch this — never the
19
+ * concrete client or the transport — which keeps handlers testable without a
20
+ * network and transport-agnostic.
21
+ */
22
+ export interface ApiClient {
23
+ request<T = unknown>(req: ApiRequest): Promise<T>;
24
+ }
25
+ export interface DrumbeatsApiClientOptions {
26
+ readonly baseUrl: string;
27
+ readonly auth: ApiAuth;
28
+ /** Per-request timeout in milliseconds. Defaults to 15s. */
29
+ readonly requestTimeoutMs?: number;
30
+ /** Override fetch (used in tests). Defaults to the global fetch. */
31
+ readonly fetchImpl?: typeof fetch;
32
+ }
33
+ /**
34
+ * Thin REST client for the Drumbeats API, shared by both transports. It injects
35
+ * the auth header (X-API-Key for stdio account keys, Bearer for hosted OAuth),
36
+ * applies a timeout, parses JSON, and normalizes non-2xx into DrumbeatsApiError.
37
+ */
38
+ export declare class DrumbeatsApiClient implements ApiClient {
39
+ private readonly baseUrl;
40
+ private readonly auth;
41
+ private readonly timeoutMs;
42
+ private readonly fetchImpl;
43
+ constructor(options: DrumbeatsApiClientOptions);
44
+ private authHeaders;
45
+ request<T = unknown>(req: ApiRequest): Promise<T>;
46
+ }
47
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAEA,sDAAsD;AACtD,MAAM,MAAM,OAAO,GACf;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACpD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;IACtE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;IACvB,kEAAkE;IAClE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAC9B;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;CAClD;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,4DAA4D;IAC5D,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAClC,oEAAoE;IACpE,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;CAClC;AAID;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,SAAS;IAClD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAQ;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAc;gBAE5B,OAAO,EAAE,yBAAyB;IAO9C,OAAO,CAAC,WAAW;IAMb,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC;CAqCxD"}
@@ -0,0 +1,57 @@
1
+ import { DrumbeatsApiError } from './errors.js';
2
+ const DEFAULT_TIMEOUT_MS = 15_000;
3
+ /**
4
+ * Thin REST client for the Drumbeats API, shared by both transports. It injects
5
+ * the auth header (X-API-Key for stdio account keys, Bearer for hosted OAuth),
6
+ * applies a timeout, parses JSON, and normalizes non-2xx into DrumbeatsApiError.
7
+ */
8
+ export class DrumbeatsApiClient {
9
+ baseUrl;
10
+ auth;
11
+ timeoutMs;
12
+ fetchImpl;
13
+ constructor(options) {
14
+ this.baseUrl = options.baseUrl.replace(/\/+$/, '');
15
+ this.auth = options.auth;
16
+ this.timeoutMs = options.requestTimeoutMs ?? DEFAULT_TIMEOUT_MS;
17
+ this.fetchImpl = options.fetchImpl ?? globalThis.fetch;
18
+ }
19
+ authHeaders() {
20
+ return this.auth.kind === 'apiKey'
21
+ ? { 'X-API-Key': this.auth.apiKey }
22
+ : { Authorization: `Bearer ${this.auth.token}` };
23
+ }
24
+ async request(req) {
25
+ const url = new URL(`${this.baseUrl}${req.path}`);
26
+ for (const [key, value] of Object.entries(req.query ?? {})) {
27
+ if (value !== undefined) {
28
+ url.searchParams.set(key, String(value));
29
+ }
30
+ }
31
+ const headers = { Accept: 'application/json', ...this.authHeaders() };
32
+ if (req.body !== undefined) {
33
+ headers['Content-Type'] = 'application/json';
34
+ }
35
+ const timeoutSignal = AbortSignal.timeout(this.timeoutMs);
36
+ const signal = req.signal ? AbortSignal.any([req.signal, timeoutSignal]) : timeoutSignal;
37
+ const response = await this.fetchImpl(url, {
38
+ method: req.method ?? 'GET',
39
+ headers,
40
+ body: req.body === undefined ? undefined : JSON.stringify(req.body),
41
+ signal,
42
+ });
43
+ const text = await response.text();
44
+ let payload;
45
+ try {
46
+ payload = text.length > 0 ? JSON.parse(text) : undefined;
47
+ }
48
+ catch {
49
+ payload = text;
50
+ }
51
+ if (!response.ok) {
52
+ throw new DrumbeatsApiError(response.status, response.statusText, payload);
53
+ }
54
+ return payload;
55
+ }
56
+ }
57
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MA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import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
2
+ /** Raised when the Drumbeats REST API returns a non-2xx response. */
3
+ export declare class DrumbeatsApiError extends Error {
4
+ readonly status: number;
5
+ readonly body: unknown;
6
+ constructor(status: number, message: string, body?: unknown);
7
+ }
8
+ /**
9
+ * Maps any thrown error (non-2xx, network, timeout) into a clean MCP tool-result.
10
+ * Tool handlers return this instead of throwing, so a raw stack or 500 body never
11
+ * reaches the model.
12
+ */
13
+ export declare function toToolErrorResult(error: unknown): CallToolResult;
14
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/api/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAExE,qEAAqE;AACrE,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;gBAEV,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;CAM5D;AA6CD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,CAEhE"}
@@ -0,0 +1,59 @@
1
+ /** Raised when the Drumbeats REST API returns a non-2xx response. */
2
+ export class DrumbeatsApiError extends Error {
3
+ status;
4
+ body;
5
+ constructor(status, message, body) {
6
+ super(message);
7
+ this.name = 'DrumbeatsApiError';
8
+ this.status = status;
9
+ this.body = body;
10
+ }
11
+ }
12
+ // Short, model-facing hints per status. We never echo a raw 5xx body or stack.
13
+ const STATUS_HINTS = {
14
+ 400: 'The request was rejected as invalid.',
15
+ 401: 'Authentication failed — check that DRUMBEATS_API_KEY is set and valid.',
16
+ 403: 'The API key lacks the scope required for this action.',
17
+ 404: 'The requested resource was not found.',
18
+ 409: 'The request conflicts with the current state.',
19
+ 429: 'Rate limit exceeded — slow down and retry shortly.',
20
+ };
21
+ /** Extracts a short, safe detail string from an API error body, if present. */
22
+ function extractDetail(body) {
23
+ if (body && typeof body === 'object') {
24
+ const record = body;
25
+ let candidate = record.message ?? (typeof record.error === 'string' ? record.error : undefined);
26
+ // Some endpoints nest the reason under error: { code, message }.
27
+ if (candidate === undefined && record.error && typeof record.error === 'object') {
28
+ const nested = record.error;
29
+ candidate = nested.message ?? nested.code;
30
+ }
31
+ if (typeof candidate === 'string' && candidate.length > 0 && candidate.length <= 200) {
32
+ return candidate;
33
+ }
34
+ }
35
+ return '';
36
+ }
37
+ function humanMessage(error) {
38
+ if (error instanceof DrumbeatsApiError) {
39
+ const hint = STATUS_HINTS[error.status] ?? (error.status >= 500 ? 'The Drumbeats API is temporarily unavailable.' : '');
40
+ const detail = extractDetail(error.body);
41
+ return [`Drumbeats API request failed (HTTP ${error.status}).`, hint, detail].filter(Boolean).join(' ');
42
+ }
43
+ if (error instanceof Error && (error.name === 'TimeoutError' || error.name === 'AbortError')) {
44
+ return 'The request to the Drumbeats API timed out.';
45
+ }
46
+ if (error instanceof Error && error.name === 'TypeError') {
47
+ return 'Could not reach the Drumbeats API (network error).';
48
+ }
49
+ return error instanceof Error ? `Unexpected error: ${error.message}` : 'Unexpected error.';
50
+ }
51
+ /**
52
+ * Maps any thrown error (non-2xx, network, timeout) into a clean MCP tool-result.
53
+ * Tool handlers return this instead of throwing, so a raw stack or 500 body never
54
+ * reaches the model.
55
+ */
56
+ export function toToolErrorResult(error) {
57
+ return { content: [{ type: 'text', text: humanMessage(error) }], isError: true };
58
+ }
59
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/api/errors.ts"],"names":[],"mappings":"AAEA,qEAAqE;AACrE,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACjC,MAAM,CAAQ;IACd,IAAI,CAAS;IAEtB,YAAY,MAAc,EAAE,OAAe,EAAE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AE,CAAC;QACvC,MAAM,IAAI,GACR,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,+CAA+C,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;QAC5G,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACxC,OAAO,CAAC,sCAAsC,KAAK,CAAC,MAAM,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACzG,CAAC;IACD,IAAI,KAAK,YAAY,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,cAAc,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,CAAC,EAAE,CAAC;QAC7F,OAAO,6CAA6C,CAAA;IACtD,CAAC;IACD,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACzD,OAAO,oDAAoD,CAAA;IAC7D,CAAC;IACD,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,qBAAqB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAA;AAC5F,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;AAClF,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Shared zod schemas mirroring the Drumbeats REST API contract.
4
+ *
5
+ * Scaffold stub: only the error envelope is modelled today. Per-resource
6
+ * request/response schemas (monitors, incidents, projects, diagnostics) are
7
+ * added alongside the tools that use them, one file per tool.
8
+ */
9
+ export declare const apiErrorBodySchema: z.ZodObject<{
10
+ error: z.ZodOptional<z.ZodString>;
11
+ message: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strip>;
13
+ export type ApiErrorBody = z.infer<typeof apiErrorBodySchema>;
14
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/api/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;iBAG7B,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Shared zod schemas mirroring the Drumbeats REST API contract.
4
+ *
5
+ * Scaffold stub: only the error envelope is modelled today. Per-resource
6
+ * request/response schemas (monitors, incidents, projects, diagnostics) are
7
+ * added alongside the tools that use them, one file per tool.
8
+ */
9
+ export const apiErrorBodySchema = z.object({
10
+ error: z.string().optional(),
11
+ message: z.string().optional(),
12
+ });
13
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/api/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAA"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * RFC 9728 Protected Resource Metadata, served by the MCP at the well-known
3
+ * path below. It advertises which authorization server (the Drumbeats `id`
4
+ * service) can mint tokens for this MCP and which scopes those tokens may
5
+ * carry — this is how MCP clients discover where to authorize. Hosted only.
6
+ */
7
+ export declare const PROTECTED_RESOURCE_METADATA_PATH = "/.well-known/oauth-protected-resource";
8
+ export interface ProtectedResourceMetadata {
9
+ readonly resource: string;
10
+ readonly authorization_servers: readonly string[];
11
+ readonly scopes_supported: readonly string[];
12
+ readonly bearer_methods_supported: readonly string[];
13
+ }
14
+ export interface ResourceMetadataOptions {
15
+ /** Canonical MCP resource identifier, e.g. https://mcp.drumbeats.io */
16
+ readonly resourceUrl: string;
17
+ /** Authorization server base URL, e.g. https://api.drumbeats.io */
18
+ readonly authServerUrl: string;
19
+ }
20
+ /** Builds the RFC 9728 metadata document for this MCP resource. */
21
+ export declare function buildProtectedResourceMetadata(options: ResourceMetadataOptions): ProtectedResourceMetadata;
22
+ //# sourceMappingURL=resource-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-metadata.d.ts","sourceRoot":"","sources":["../../src/auth/resource-metadata.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,0CAA0C,CAAA;AAEvF,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,qBAAqB,EAAE,SAAS,MAAM,EAAE,CAAA;IACjD,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAA;IAC5C,QAAQ,CAAC,wBAAwB,EAAE,SAAS,MAAM,EAAE,CAAA;CACrD;AAED,MAAM,WAAW,uBAAuB;IACtC,uEAAuE;IACvE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAC/B;AAED,mEAAmE;AACnE,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,uBAAuB,GAAG,yBAAyB,CAO1G"}
@@ -0,0 +1,18 @@
1
+ import { SCOPES } from './scope-map.js';
2
+ /**
3
+ * RFC 9728 Protected Resource Metadata, served by the MCP at the well-known
4
+ * path below. It advertises which authorization server (the Drumbeats `id`
5
+ * service) can mint tokens for this MCP and which scopes those tokens may
6
+ * carry — this is how MCP clients discover where to authorize. Hosted only.
7
+ */
8
+ export const PROTECTED_RESOURCE_METADATA_PATH = '/.well-known/oauth-protected-resource';
9
+ /** Builds the RFC 9728 metadata document for this MCP resource. */
10
+ export function buildProtectedResourceMetadata(options) {
11
+ return {
12
+ resource: options.resourceUrl,
13
+ authorization_servers: [options.authServerUrl],
14
+ scopes_supported: [...SCOPES],
15
+ bearer_methods_supported: ['header'],
16
+ };
17
+ }
18
+ //# sourceMappingURL=resource-metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-metadata.js","sourceRoot":"","sources":["../../src/auth/resource-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,uCAAuC,CAAA;AAgBvF,mEAAmE;AACnE,MAAM,UAAU,8BAA8B,CAAC,OAAgC;IAC7E,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,WAAW;QAC7B,qBAAqB,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC;QAC9C,gBAAgB,EAAE,CAAC,GAAG,MAAM,CAAC;QAC7B,wBAAwB,EAAE,CAAC,QAAQ,CAAC;KACrC,CAAA;AACH,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * OAuth token scope ↔ tool availability (the Drumbeats API key-scope model), reused
3
+ * verbatim from the stdio account-key model. The hosted transport reads these
4
+ * scopes from the verified OAuth token; stdio reads them from the account key.
5
+ */
6
+ export declare const SCOPES: readonly ["read", "manage_monitors"];
7
+ export type Scope = (typeof SCOPES)[number];
8
+ /**
9
+ * Tools unlocked by each scope. `read` is always granted; `manage_monitors`
10
+ * adds the write/lifecycle tools.
11
+ *
12
+ * Scaffold stub: the tool-name lists are populated in the tool phase. The
13
+ * structure exists from day one so the least-privilege gate is real.
14
+ */
15
+ export declare const TOOLS_BY_SCOPE: Readonly<Record<Scope, readonly string[]>>;
16
+ /** Returns the set of tool names available for a set of granted scopes. */
17
+ export declare function toolsForScopes(scopes: readonly Scope[]): ReadonlySet<string>;
18
+ /** Type guard: is an arbitrary string one of the known scopes? */
19
+ export declare function isScope(value: string): value is Scope;
20
+ //# sourceMappingURL=scope-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-map.d.ts","sourceRoot":"","sources":["../../src/auth/scope-map.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,MAAM,sCAAuC,CAAA;AAC1D,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC,CAGrE,CAAA;AAED,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,CAQ5E;AAED,kEAAkE;AAClE,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,KAAK,CAErD"}