@practicemakes/mcp 26.1121.1 → 26.1202.2

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.
package/README.md CHANGED
@@ -79,15 +79,14 @@ yarn workspace @practicemakes/mcp publish # runs prepublishOnly (clean + build
79
79
 
80
80
  ### Server identifiers
81
81
 
82
- The monitoring tools take **two different, non-interchangeable identifiers**, and passing the wrong
83
- one returns a 404 that reads like a missing server. `list_servers` returns both:
84
-
85
- | Identifier | Used by | Route family |
86
- |---|---|---|
87
- | `serverShortLink` | `get_server_uptime`, `get_server_uptime_daily` | `/api/public/...` (unauthenticated) |
88
- | `serverId` | `get_server`, `list_server_incidents` | `/api/server/...` (authenticated, org-scoped) |
89
-
90
- Neither is a UUID — `serverId` is the operator-assigned id (e.g. `web-01`).
82
+ Every monitoring tool (`get_server`, `list_server_incidents`, `get_server_uptime`,
83
+ `get_server_uptime_daily`) takes `serverId` and calls the authenticated, org-scoped
84
+ `/api/server/...` routes. `list_servers` also returns `serverShortLink`, the public status-page key;
85
+ passing it instead returns a 404 that reads like a missing server. The uptime tools stay off the
86
+ public `/api/public/...` routes because those require an App Check token once `APP_CHECK_ENFORCED`
87
+ is on.
88
+
89
+ `serverId` is not a UUID — it is the operator-assigned id (e.g. `web-01`).
91
90
 
92
91
  ## Tools (write)
93
92
 
@@ -3,14 +3,13 @@ import { runTool } from "./shared.js";
3
3
  /**
4
4
  * Server-monitoring tools.
5
5
  *
6
- * Two identifiers are in play and they are NOT interchangeable — passing one where the other
7
- * belongs yields a 404 that looks like a missing server:
6
+ * Every tool here is keyed by `serverId`, the operator-assigned identifier (e.g. "web-01"), not
7
+ * the row's UUID and not `serverShortLink`. Passing the short link yields a 404 that looks like a
8
+ * missing server; `list_servers` returns both fields.
8
9
  *
9
- * - `serverShortLink` keys the unauthenticated `/api/public/...` uptime routes.
10
- * - `serverId` keys the authenticated, org-scoped `/api/server/...` routes. It is the
11
- * operator-assigned identifier (e.g. "web-01"), not the row's UUID.
12
- *
13
- * `list_servers` returns both fields, so it is the way to resolve either one.
10
+ * The uptime tools use the authenticated `/api/server/{serverId}/uptime...` routes rather than the
11
+ * public status-page ones: `/api/public/**` requires an App Check token once `APP_CHECK_ENFORCED`
12
+ * is on, and the MCP has no app to attest.
14
13
  */
15
14
  /** The backend caps a daily-uptime range at 366 days; 30 is the useful default window. */
16
15
  const DEFAULT_DAILY_DAYS = 30;
@@ -22,7 +21,7 @@ function isoDate(date) {
22
21
  export function registerMonitorTools(server, client) {
23
22
  server.registerTool("list_servers", {
24
23
  title: "List monitored servers",
25
- description: "Every server your organization monitors, with its configuration. Start here: the response carries both identifiers the other monitoring tools need — `serverId` (the operator-assigned id used by get_server and list_server_incidents) and `serverShortLink` (used by the uptime tools).",
24
+ description: "Every server your organization monitors, with its configuration. Start here: the response carries `serverId`, the operator-assigned id every other monitoring tool takes. Its `serverShortLink` is the public status-page key; no tool here takes it.",
26
25
  inputSchema: {},
27
26
  }, async () => runTool(() => client.get("/api/server")));
28
27
  server.registerTool("get_server", {
@@ -39,9 +38,9 @@ export function registerMonitorTools(server, client) {
39
38
  }, async () => runTool(() => client.get("/api/server/status")));
40
39
  server.registerTool("get_server_uptime", {
41
40
  title: "Get server uptime",
42
- description: "Uptime percentage over a recent window, computed from raw heartbeats (retained ~31 days). Keyed by `serverShortLink` from list_servers — NOT the serverId the /api/server tools take. For history older than the heartbeat retention, use get_server_uptime_daily.",
41
+ description: "Uptime percentage over a recent window, computed from raw heartbeats (retained ~31 days). Keyed by `serverId` from list_servers — NOT the serverShortLink. For history older than the heartbeat retention, use get_server_uptime_daily.",
43
42
  inputSchema: {
44
- serverShortLink: z.string().describe("Server short link from list_servers (public uptime identifier)."),
43
+ serverId: z.string().describe("Operator-assigned server id from list_servers (not the short link)."),
45
44
  hours: z
46
45
  .number()
47
46
  .int()
@@ -50,12 +49,12 @@ export function registerMonitorTools(server, client) {
50
49
  .default(24)
51
50
  .describe("Window in hours. Values outside 1-168 are rejected before the request is sent."),
52
51
  },
53
- }, async ({ serverShortLink, hours }) => runTool(() => client.get(`/api/public/server/${encodeURIComponent(serverShortLink)}/uptime?hours=${hours}`)));
52
+ }, async ({ serverId, hours }) => runTool(() => client.get(`/api/server/${encodeURIComponent(serverId)}/uptime?hours=${hours}`)));
54
53
  server.registerTool("get_server_uptime_daily", {
55
54
  title: "Get daily uptime history",
56
- description: "Per-day uptime rollups: uptime percent, online/downtime/planned-downtime seconds and incident count for each day. This is the long-term history — it survives past the ~31-day raw heartbeat retention that get_server_uptime is limited to. Keyed by `serverShortLink`, NOT serverId. Defaults to the last 30 days; the backend rejects ranges wider than 366 days.",
55
+ description: "Per-day uptime rollups: uptime percent, online/downtime/planned-downtime seconds and incident count for each day. This is the long-term history — it survives past the ~31-day raw heartbeat retention that get_server_uptime is limited to. Keyed by `serverId`, NOT serverShortLink. Defaults to the last 30 days; the backend rejects ranges wider than 366 days.",
57
56
  inputSchema: {
58
- serverShortLink: z.string().describe("Server short link from list_servers (public uptime identifier)."),
57
+ serverId: z.string().describe("Operator-assigned server id from list_servers (not the short link)."),
59
58
  from: z
60
59
  .string()
61
60
  .regex(/^\d{4}-\d{2}-\d{2}$/)
@@ -67,12 +66,12 @@ export function registerMonitorTools(server, client) {
67
66
  .optional()
68
67
  .describe("End date, ISO YYYY-MM-DD. Defaults to today."),
69
68
  },
70
- }, async ({ serverShortLink, from, to }) => runTool(() => {
69
+ }, async ({ serverId, from, to }) => runTool(() => {
71
70
  const today = new Date();
72
71
  const resolvedTo = to ?? isoDate(today);
73
72
  const resolvedFrom = from ?? isoDate(new Date(today.getTime() - DEFAULT_DAILY_DAYS * 24 * 60 * 60 * 1000));
74
73
  const query = new URLSearchParams({ from: resolvedFrom, to: resolvedTo });
75
- return client.get(`/api/public/server/${encodeURIComponent(serverShortLink)}/uptime/daily?${query}`);
74
+ return client.get(`/api/server/${encodeURIComponent(serverId)}/uptime/daily?${query}`);
76
75
  }));
77
76
  server.registerTool("list_server_incidents", {
78
77
  title: "List server incidents",
@@ -1 +1 @@
1
- {"version":3,"file":"monitor.js","sourceRoot":"","sources":["../../src/tools/monitor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC;;;;;;;;;;;GAWG;AAEH,0FAA0F;AAC1F,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B,8FAA8F;AAC9F,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAEnC,SAAS,OAAO,CAAC,IAAU;IACzB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,MAAiB,EAAE,MAAgB;IACtE,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EACT,2RAA2R;QAC7R,WAAW,EAAE,EAAE;KAChB,EACD,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CACrD,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,YAAY,EACZ;QACE,KAAK,EAAE,YAAY;QACnB,WAAW,EACT,4RAA4R;QAC9R,WAAW,EAAE;YACX,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+DAA+D,CAAC;SAC/F;KACF,EACD,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CACjG,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,sBAAsB,EACtB;QACE,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EACT,uNAAuN;QACzN,WAAW,EA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EAAE;iBACL,GAAG,CAAC,CAAC,CAAC;iBACN,GAAG,CAAC,sBAAsB,CAAC;iBAC3B,OAAO,CAAC,EAAE,CAAC;iBACX,QAAQ,CAAC,2BAA2B,sBAAsB,GAAG,CAAC;SAClE;KACF,EACD,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CACjC,OAAO,CAAC,GAAG,EAAE;QACX,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9E,OAAO,MAAM,CAAC,GAAG,CAAC,eAAe,kBAAkB,CAAC,QAAQ,CAAC,cAAc,KAAK,EAAE,CAAC,CAAC;IACtF,CAAC,CAAC,CACL,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@practicemakes/mcp",
3
- "version": "26.1121.1",
3
+ "version": "26.1202.2",
4
4
  "description": "MCP server exposing PracticeMakes prod data to Claude (read-only unless PM_ENABLE_WRITES opts in to write tools), authenticated as the calling user's own Firebase identity.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",