@carrierllc/mcp 0.2.3 → 0.2.5
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 +22 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/.metadata_never_index +0 -0
package/dist/index.js
CHANGED
|
@@ -74,6 +74,9 @@ async function checkCallQuota(env, sub, tier) {
|
|
|
74
74
|
if (tier === "enterprise") {
|
|
75
75
|
return { allowed: true, remaining: Infinity, resetAt, tier };
|
|
76
76
|
}
|
|
77
|
+
if (!env.CARRIER_USERS) {
|
|
78
|
+
return { allowed: true, remaining: Infinity, resetAt, tier };
|
|
79
|
+
}
|
|
77
80
|
const month = currentMonth();
|
|
78
81
|
const usageKey = `usage:${sub}:${month}`;
|
|
79
82
|
const raw = await env.CARRIER_USERS.get(usageKey, "json").catch(() => null);
|
|
@@ -87,6 +90,7 @@ async function checkCallQuota(env, sub, tier) {
|
|
|
87
90
|
};
|
|
88
91
|
}
|
|
89
92
|
function recordUsage(env, sub, tier) {
|
|
93
|
+
if (!env.CARRIER_USERS) return;
|
|
90
94
|
(async () => {
|
|
91
95
|
const month = currentMonth();
|
|
92
96
|
const usageKey = `usage:${sub}:${month}`;
|
|
@@ -107,6 +111,7 @@ function recordUsage(env, sub, tier) {
|
|
|
107
111
|
async function pushStripeUsageRecord(env, sub, quantity) {
|
|
108
112
|
const stripeKey = env.STRIPE_SECRET_KEY;
|
|
109
113
|
if (!stripeKey) return;
|
|
114
|
+
if (!env.CARRIER_USERS) return;
|
|
110
115
|
const subItemId = await env.CARRIER_USERS.get(`stripe_sub_item_id:${sub}`);
|
|
111
116
|
if (!subItemId) return;
|
|
112
117
|
const body = new URLSearchParams({
|
|
@@ -525,13 +530,22 @@ function registerAllTools(server2, ctx) {
|
|
|
525
530
|
"list_subscribers",
|
|
526
531
|
{
|
|
527
532
|
title: "List Subscribers",
|
|
528
|
-
description: "Use this to list subscribers with optional filters and pagination. Good for fleet enumeration, bulk status checks, and finding subscribers by account or status. Params: `accountId` (integer,
|
|
529
|
-
inputSchema: {
|
|
533
|
+
description: "Use this to list subscribers with optional filters and pagination. Good for fleet enumeration, bulk status checks, and finding subscribers by account or status. OCS REQUIRES at least one search key \u2014 provide exactly one of: `imsi`, `iccid`, `activationCode`, `accountId`, or `msisdn`. Calling with no key will be rejected before reaching OCS. Params: `imsi` (string), `iccid` (string), `activationCode` (string), `accountId` (integer), `msisdn` (string), `status` (string, e.g. 'ACTIVE'/'SUSPENDED'), `offset` (integer, pagination \u2014 default 0), `limit` (integer, max results \u2014 always set to avoid unbounded fetches; recommended max 100 per call). Returns: array of subscriber summary records with ICCID, status, and account. Do NOT use this to fetch full details for a specific subscriber \u2014 use `get_subscriber` for that.",
|
|
534
|
+
inputSchema: z.object({
|
|
535
|
+
imsi: z.string().optional().describe("Filter by IMSI"),
|
|
536
|
+
iccid: z.string().optional().describe("Filter by ICCID"),
|
|
537
|
+
activationCode: z.string().optional().describe("Filter by activation code"),
|
|
530
538
|
accountId: z.number().optional().describe("Filter by account ID"),
|
|
539
|
+
msisdn: z.string().optional().describe("Filter by MSISDN"),
|
|
531
540
|
status: z.string().optional().describe("Filter by status"),
|
|
532
541
|
offset: z.number().optional().describe("Pagination offset"),
|
|
533
542
|
limit: z.number().optional().describe("Max results to return")
|
|
534
|
-
}
|
|
543
|
+
}).refine(
|
|
544
|
+
(d) => d.imsi !== void 0 || d.iccid !== void 0 || d.activationCode !== void 0 || d.accountId !== void 0 || d.msisdn !== void 0,
|
|
545
|
+
{
|
|
546
|
+
message: "Provide at least one of: imsi, iccid, activationCode, accountId, msisdn"
|
|
547
|
+
}
|
|
548
|
+
),
|
|
535
549
|
annotations: { readOnlyHint: true }
|
|
536
550
|
},
|
|
537
551
|
wrapHandler(
|
|
@@ -541,7 +555,11 @@ function registerAllTools(server2, ctx) {
|
|
|
541
555
|
ctx,
|
|
542
556
|
async (args, token2) => {
|
|
543
557
|
const params = {};
|
|
558
|
+
if (args.imsi) params.imsi = args.imsi;
|
|
559
|
+
if (args.iccid) params.iccid = args.iccid;
|
|
560
|
+
if (args.activationCode) params.activationCode = args.activationCode;
|
|
544
561
|
if (args.accountId !== void 0) params.accountId = args.accountId;
|
|
562
|
+
if (args.msisdn) params.msisdn = args.msisdn;
|
|
545
563
|
if (args.status) params.status = args.status;
|
|
546
564
|
if (args.offset !== void 0) params.offset = args.offset;
|
|
547
565
|
const client = new OcsClient(ctx.env.CARRIER_OCS_BASE_URL, token2);
|
|
@@ -9370,7 +9388,7 @@ var audit = (_row) => {
|
|
|
9370
9388
|
var getUserToken = async (_sub) => token;
|
|
9371
9389
|
var toolCtx = { env: stdioEnv, props, audit, getUserToken };
|
|
9372
9390
|
var server = new McpServer(
|
|
9373
|
-
{ name: "carrier-mcp", version: "0.2.
|
|
9391
|
+
{ name: "carrier-mcp", version: "0.2.4" },
|
|
9374
9392
|
{
|
|
9375
9393
|
instructions: "Carrier MCP \u2014 single-user stdio mode. Full tool registry (mirrors the deployed Worker)."
|
|
9376
9394
|
}
|