@carrierllc/mcp 0.2.18 → 0.2.19

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/dist/index.js CHANGED
@@ -4,10 +4,6 @@
4
4
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
5
5
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
6
 
7
- // src/tools.ts
8
- import { z } from "zod";
9
- import * as Sentry from "@sentry/cloudflare";
10
-
11
7
  // ../../packages/ocs-client/dist/chunk-PMFMORPK.js
12
8
  var ENDPOINT_LIMITS_PER_MIN = {
13
9
  // Global sentinel (keyed as "__global__")
@@ -169,6 +165,38 @@ function getRateLimitWindowCounts(resellerKey, endpoint) {
169
165
  return { calls_in_window, batch_calls_in_window };
170
166
  }
171
167
 
168
+ // ../../packages/ocs-client/dist/chunk-W6L6SMW5.js
169
+ var OCS_MAX_USAGE_WINDOW_DAYS = 7;
170
+ function clampUsagePeriod(start, end, maxDays = OCS_MAX_USAGE_WINDOW_DAYS) {
171
+ const endMs = Date.parse(`${end}T00:00:00Z`);
172
+ const startMs = Date.parse(`${start}T00:00:00Z`);
173
+ if (Number.isNaN(endMs) || Number.isNaN(startMs) || startMs > endMs) {
174
+ return { start, end };
175
+ }
176
+ const minStartMs = endMs - (maxDays - 1) * 864e5;
177
+ if (startMs < minStartMs) {
178
+ return { start: new Date(minStartMs).toISOString().slice(0, 10), end };
179
+ }
180
+ return { start, end };
181
+ }
182
+ function locationParams(iccid) {
183
+ return { iccid };
184
+ }
185
+ function subscriberIdParams(iccid) {
186
+ return { iccid };
187
+ }
188
+ function networkEventsOverPeriodParams(iccid, start, end) {
189
+ return usageOverPeriodParams(iccid, start, end);
190
+ }
191
+ function usageOverPeriodParams(iccid, start, end) {
192
+ const period = clampUsagePeriod(start, end);
193
+ return { subscriber: { iccid }, period };
194
+ }
195
+
196
+ // src/tools.ts
197
+ import { z } from "zod";
198
+ import * as Sentry from "@sentry/cloudflare";
199
+
172
200
  // src/client.ts
173
201
  var OcsApiError2 = class extends Error {
174
202
  constructor(code, message, method) {
@@ -864,7 +892,7 @@ function registerAllTools(server2, ctx) {
864
892
  "getSubscriberLocation",
865
893
  TOOL_SCOPES["get_subscriber_location"],
866
894
  ctx,
867
- async ({ iccid }, token2) => ocsCall(ctx.env, token2, "getSubscriberLocation", { iccid })
895
+ async ({ iccid }, token2) => ocsCall(ctx.env, token2, "getSubscriberLocation", locationParams(iccid))
868
896
  )
869
897
  );
870
898
  server2.registerTool(
@@ -1530,10 +1558,7 @@ function registerAllTools(server2, ctx) {
1530
1558
  "subscriberUsageOverPeriod",
1531
1559
  TOOL_SCOPES["subscriber_usage"],
1532
1560
  ctx,
1533
- async ({ iccid, startDate, endDate }, token2) => ocsCall(ctx.env, token2, "subscriberUsageOverPeriod", {
1534
- subscriber: { iccid },
1535
- period: { start: startDate, end: endDate }
1536
- })
1561
+ async ({ iccid, startDate, endDate }, token2) => ocsCall(ctx.env, token2, "subscriberUsageOverPeriod", usageOverPeriodParams(iccid, startDate, endDate))
1537
1562
  )
1538
1563
  );
1539
1564
  server2.registerTool(
@@ -1553,10 +1578,7 @@ function registerAllTools(server2, ctx) {
1553
1578
  "subscriberNetworkEventsOverPeriod",
1554
1579
  TOOL_SCOPES["subscriber_network_events"],
1555
1580
  ctx,
1556
- async ({ iccid, startDate, endDate }, token2) => ocsCall(ctx.env, token2, "subscriberNetworkEventsOverPeriod", {
1557
- subscriber: { iccid },
1558
- period: { start: startDate, end: endDate }
1559
- })
1581
+ async ({ iccid, startDate, endDate }, token2) => ocsCall(ctx.env, token2, "subscriberNetworkEventsOverPeriod", networkEventsOverPeriodParams(iccid, startDate, endDate))
1560
1582
  )
1561
1583
  );
1562
1584
  server2.registerTool(
@@ -1572,7 +1594,7 @@ function registerAllTools(server2, ctx) {
1572
1594
  "getSubscriberActivePeriod",
1573
1595
  TOOL_SCOPES["subscriber_active_period"],
1574
1596
  ctx,
1575
- async ({ iccid }, token2) => ocsCall(ctx.env, token2, "getSubscriberActivePeriod", { iccid })
1597
+ async ({ iccid }, token2) => ocsCall(ctx.env, token2, "getSubscriberActivePeriod", subscriberIdParams(iccid))
1576
1598
  )
1577
1599
  );
1578
1600
  server2.registerTool(
@@ -10723,7 +10745,7 @@ var audit = (_row) => {
10723
10745
  var getUserToken = async (_sub) => token;
10724
10746
  var toolCtx = { env: stdioEnv, props, audit, getUserToken };
10725
10747
  var server = new McpServer(
10726
- { name: "carrier-mcp", version: "0.2.18" },
10748
+ { name: "carrier-mcp", version: "0.2.19" },
10727
10749
  {
10728
10750
  instructions: "Carrier MCP \u2014 single-user stdio mode. Full tool registry (mirrors the deployed Worker)."
10729
10751
  }