@carrierllc/mcp 0.0.1 → 0.2.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.
- package/README.md +216 -3
- package/dist/apps/app-state.d.ts +19 -0
- package/dist/apps/app-state.d.ts.map +1 -0
- package/dist/apps/app-state.js +28 -0
- package/dist/apps/app-state.js.map +1 -0
- package/dist/apps/balance-topup.d.ts +19 -0
- package/dist/apps/balance-topup.d.ts.map +1 -0
- package/dist/apps/balance-topup.js +121 -0
- package/dist/apps/balance-topup.js.map +1 -0
- package/dist/apps/fleet-health-app.d.ts +29 -0
- package/dist/apps/fleet-health-app.d.ts.map +1 -0
- package/dist/apps/fleet-health-app.js +152 -0
- package/dist/apps/fleet-health-app.js.map +1 -0
- package/dist/apps/index.d.ts +37 -0
- package/dist/apps/index.d.ts.map +1 -0
- package/dist/apps/index.js +42 -0
- package/dist/apps/index.js.map +1 -0
- package/dist/apps/provisioning-wizard.d.ts +11 -0
- package/dist/apps/provisioning-wizard.d.ts.map +1 -0
- package/dist/apps/provisioning-wizard.js +345 -0
- package/dist/apps/provisioning-wizard.js.map +1 -0
- package/dist/audit.d.ts +31 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/audit.js +42 -0
- package/dist/audit.js.map +1 -0
- package/dist/billing-thresholds.d.ts +71 -0
- package/dist/billing-thresholds.d.ts.map +1 -0
- package/dist/billing-thresholds.js +238 -0
- package/dist/billing-thresholds.js.map +1 -0
- package/dist/billing.d.ts +95 -0
- package/dist/billing.d.ts.map +1 -0
- package/dist/billing.js +239 -0
- package/dist/billing.js.map +1 -0
- package/dist/clerk.d.ts +125 -0
- package/dist/clerk.d.ts.map +1 -0
- package/dist/clerk.js +389 -0
- package/dist/clerk.js.map +1 -0
- package/dist/client.d.ts +35 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +75 -0
- package/dist/client.js.map +1 -0
- package/dist/credits.d.ts +165 -0
- package/dist/credits.d.ts.map +1 -0
- package/dist/credits.js +483 -0
- package/dist/credits.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/intelligence.d.ts +4 -0
- package/dist/intelligence.d.ts.map +1 -0
- package/dist/intelligence.js +899 -0
- package/dist/intelligence.js.map +1 -0
- package/dist/list-recent-ocs-events.d.ts +48 -0
- package/dist/list-recent-ocs-events.d.ts.map +1 -0
- package/dist/list-recent-ocs-events.js +160 -0
- package/dist/list-recent-ocs-events.js.map +1 -0
- package/dist/manus-client.d.ts +429 -0
- package/dist/manus-client.d.ts.map +1 -0
- package/dist/manus-client.js +401 -0
- package/dist/manus-client.js.map +1 -0
- package/dist/manus-common.d.ts +5 -0
- package/dist/manus-common.d.ts.map +1 -0
- package/dist/manus-common.js +5 -0
- package/dist/manus-common.js.map +1 -0
- package/dist/manus-schedule.d.ts +74 -0
- package/dist/manus-schedule.d.ts.map +1 -0
- package/dist/manus-schedule.js +213 -0
- package/dist/manus-schedule.js.map +1 -0
- package/dist/manus-usage.d.ts +32 -0
- package/dist/manus-usage.d.ts.map +1 -0
- package/dist/manus-usage.js +120 -0
- package/dist/manus-usage.js.map +1 -0
- package/dist/manus-webhook.d.ts +60 -0
- package/dist/manus-webhook.d.ts.map +1 -0
- package/dist/manus-webhook.js +361 -0
- package/dist/manus-webhook.js.map +1 -0
- package/dist/pricing-tools.d.ts +26 -0
- package/dist/pricing-tools.d.ts.map +1 -0
- package/dist/pricing-tools.js +428 -0
- package/dist/pricing-tools.js.map +1 -0
- package/dist/projects-tools.d.ts +39 -0
- package/dist/projects-tools.d.ts.map +1 -0
- package/dist/projects-tools.js +545 -0
- package/dist/projects-tools.js.map +1 -0
- package/dist/prompts.d.ts +7 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +151 -0
- package/dist/prompts.js.map +1 -0
- package/dist/stripe-connect-tools.d.ts +33 -0
- package/dist/stripe-connect-tools.d.ts.map +1 -0
- package/dist/stripe-connect-tools.js +504 -0
- package/dist/stripe-connect-tools.js.map +1 -0
- package/dist/timing-safe-equal.d.ts +5 -0
- package/dist/timing-safe-equal.d.ts.map +1 -0
- package/dist/timing-safe-equal.js +13 -0
- package/dist/timing-safe-equal.js.map +1 -0
- package/dist/tools-backlog.d.ts +28 -0
- package/dist/tools-backlog.d.ts.map +1 -0
- package/dist/tools-backlog.js +315 -0
- package/dist/tools-backlog.js.map +1 -0
- package/dist/tools-carrier-ask.d.ts +138 -0
- package/dist/tools-carrier-ask.d.ts.map +1 -0
- package/dist/tools-carrier-ask.js +913 -0
- package/dist/tools-carrier-ask.js.map +1 -0
- package/dist/tools-pricing.d.ts +18 -0
- package/dist/tools-pricing.d.ts.map +1 -0
- package/dist/tools-pricing.js +172 -0
- package/dist/tools-pricing.js.map +1 -0
- package/dist/tools-ui-agent-ask.d.ts +29 -0
- package/dist/tools-ui-agent-ask.d.ts.map +1 -0
- package/dist/tools-ui-agent-ask.js +272 -0
- package/dist/tools-ui-agent-ask.js.map +1 -0
- package/dist/tools-ui-agent-schedule.d.ts +29 -0
- package/dist/tools-ui-agent-schedule.d.ts.map +1 -0
- package/dist/tools-ui-agent-schedule.js +517 -0
- package/dist/tools-ui-agent-schedule.js.map +1 -0
- package/dist/tools-ui-agent.d.ts +40 -0
- package/dist/tools-ui-agent.d.ts.map +1 -0
- package/dist/tools-ui-agent.js +508 -0
- package/dist/tools-ui-agent.js.map +1 -0
- package/dist/tools.d.ts +60 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +1295 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +291 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +55 -7
- package/index.js +0 -1
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Carrier MCP — v1.1 backlog tool registrations (9 tools).
|
|
3
|
+
*
|
|
4
|
+
* These are OCS methods confirmed live in the eSIMVault API docs but not yet
|
|
5
|
+
* exposed in the v1 server. All 9 are wired here to close coverage gaps
|
|
6
|
+
* identified in the 2026-05-12 forensic audit (mango/.planning/research/03-carrier-llc-audit.md).
|
|
7
|
+
*
|
|
8
|
+
* Scope assignments:
|
|
9
|
+
* write — affect_subscriber_phone_number, modify_subscriber_mobile_plan,
|
|
10
|
+
* modify_subscriber_package_active_period, modify_subscriber_voip_plan,
|
|
11
|
+
* push_steering_to_subscriber
|
|
12
|
+
* read — get_subscriber_location_by_cell_id, list_destination_lists
|
|
13
|
+
* admin — reset_subscriber_gz_counter
|
|
14
|
+
*
|
|
15
|
+
* Schema notes:
|
|
16
|
+
* - All ICCID-accepting tools use the subscriber-record lookup cache pattern
|
|
17
|
+
* (resolveSubscriberByIccid) for IMSI resolution where required.
|
|
18
|
+
* - pushSteeringToSubs is listed as "write" in the live docs; marked write here
|
|
19
|
+
* pending confirmation from eSIMVault support (gap G-04).
|
|
20
|
+
* - resetSubsGzCounter is admin-scoped; usage counter resets are irreversible.
|
|
21
|
+
*/
|
|
22
|
+
import { z } from "zod";
|
|
23
|
+
import { OcsClient } from "./client.js";
|
|
24
|
+
import { wrapHandler, resolveSubscriberByIccid, } from "./tools.js";
|
|
25
|
+
const DRY_RUN_FIELD = {
|
|
26
|
+
dry_run: z
|
|
27
|
+
.boolean()
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("If true, do not call OCS — return the would-be request for confirmation"),
|
|
30
|
+
};
|
|
31
|
+
/** Scope lookup for the 9 backlog tools. */
|
|
32
|
+
export const BACKLOG_TOOL_SCOPES = {
|
|
33
|
+
affect_subscriber_phone_number: "write",
|
|
34
|
+
get_subscriber_location_by_cell_id: "read",
|
|
35
|
+
list_destination_lists: "read",
|
|
36
|
+
modify_subscriber_mobile_plan: "write",
|
|
37
|
+
modify_subscriber_package_active_period: "write",
|
|
38
|
+
modify_subscriber_voip_plan: "write",
|
|
39
|
+
push_steering_to_subscriber: "write",
|
|
40
|
+
reset_subscriber_gz_counter: "admin",
|
|
41
|
+
};
|
|
42
|
+
export function registerAllBacklogTools(server, ctx) {
|
|
43
|
+
// =========================================================================
|
|
44
|
+
// 1. AFFECT SUBSCRIBER PHONE NUMBER
|
|
45
|
+
// OCS methods: affectSubscriberFakePhoneNumber / affectSubscriberRealPhoneNumber
|
|
46
|
+
// Gap: G-08 (MEDIUM). Merges two OCS methods behind one MCP tool.
|
|
47
|
+
// =========================================================================
|
|
48
|
+
server.registerTool("affect_subscriber_phone_number", {
|
|
49
|
+
title: "Assign Phone Number to Subscriber",
|
|
50
|
+
description: "Use this to assign a phone number (MSISDN) to a subscriber. Supports both fake/test MSISDNs " +
|
|
51
|
+
"and real production MSISDNs via the `phone_type` parameter. Required for MSISDN assignment " +
|
|
52
|
+
"workflows before activating voice services. " +
|
|
53
|
+
"Params: `iccid` (subscriber identifier), `phone_number` (E.164 format, e.g. +31612345678), " +
|
|
54
|
+
"`phone_type` ('fake' for test/dev, 'real' for production). " +
|
|
55
|
+
"Returns: updated subscriber record with the new MSISDN. " +
|
|
56
|
+
"Do NOT use this to check a subscriber's current MSISDN — use `get_subscriber` instead.",
|
|
57
|
+
inputSchema: {
|
|
58
|
+
iccid: z.string().describe("The subscriber ICCID (20-digit ICC identifier)"),
|
|
59
|
+
phone_number: z
|
|
60
|
+
.string()
|
|
61
|
+
.describe("E.164 phone number to assign (e.g. +31612345678)"),
|
|
62
|
+
phone_type: z
|
|
63
|
+
.enum(["fake", "real"])
|
|
64
|
+
.describe("'fake' assigns a test/dev MSISDN (affectSubscriberFakePhoneNumber in OCS); " +
|
|
65
|
+
"'real' assigns a production MSISDN (affectSubscriberRealPhoneNumber in OCS)"),
|
|
66
|
+
...DRY_RUN_FIELD,
|
|
67
|
+
},
|
|
68
|
+
annotations: { destructiveHint: true },
|
|
69
|
+
}, wrapHandler("affect_subscriber_phone_number", "affectSubscriberFakePhoneNumber/affectSubscriberRealPhoneNumber", BACKLOG_TOOL_SCOPES["affect_subscriber_phone_number"], ctx, async ({ iccid, phone_number, phone_type }, token) => {
|
|
70
|
+
const ocsMethod = phone_type === "fake"
|
|
71
|
+
? "affectSubscriberFakePhoneNumber"
|
|
72
|
+
: "affectSubscriberRealPhoneNumber";
|
|
73
|
+
const client = new OcsClient(ctx.env.CARRIER_OCS_BASE_URL, token);
|
|
74
|
+
const result = await client.call(ocsMethod, { subscriber: iccid, phoneNumber: phone_number });
|
|
75
|
+
return {
|
|
76
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
77
|
+
};
|
|
78
|
+
}));
|
|
79
|
+
// =========================================================================
|
|
80
|
+
// 2. GET SUBSCRIBER LOCATION BY CELL ID
|
|
81
|
+
// OCS method: getSubscriberLocationByCellId
|
|
82
|
+
// Gap: G-09 (MEDIUM). Cell-tower precision vs. get_subscriber_location.
|
|
83
|
+
// =========================================================================
|
|
84
|
+
server.registerTool("get_subscriber_location_by_cell_id", {
|
|
85
|
+
title: "Get Subscriber Location by Cell ID",
|
|
86
|
+
description: "Use this to retrieve a subscriber's current location with cell-tower-level precision " +
|
|
87
|
+
"(MCC, MNC, LAC, Cell ID). More precise than `get_subscriber_location` which returns " +
|
|
88
|
+
"country/network only. Useful for fraud detection, roaming cost attribution, and " +
|
|
89
|
+
"fine-grained network troubleshooting. " +
|
|
90
|
+
"Params: `iccid` (subscriber identifier). " +
|
|
91
|
+
"Returns: object containing `mcc` (mobile country code), `mnc` (mobile network code), " +
|
|
92
|
+
"`lac` (location area code), `cellId`, `country`, and `operator`. " +
|
|
93
|
+
"Do NOT use this for bulk location mapping — it incurs one OCS call per subscriber; " +
|
|
94
|
+
"use `audit_network_coverage` for fleet-level location analysis instead.",
|
|
95
|
+
inputSchema: {
|
|
96
|
+
iccid: z.string().describe("The subscriber ICCID (20-digit ICC identifier)"),
|
|
97
|
+
},
|
|
98
|
+
annotations: { readOnlyHint: true },
|
|
99
|
+
}, wrapHandler("get_subscriber_location_by_cell_id", "getSubscriberLocationByCellId", BACKLOG_TOOL_SCOPES["get_subscriber_location_by_cell_id"], ctx, async ({ iccid }, token) => {
|
|
100
|
+
const client = new OcsClient(ctx.env.CARRIER_OCS_BASE_URL, token);
|
|
101
|
+
const result = await client.call("getSubscriberLocationByCellId", { iccid });
|
|
102
|
+
return {
|
|
103
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
104
|
+
};
|
|
105
|
+
}));
|
|
106
|
+
// =========================================================================
|
|
107
|
+
// 3. LIST DESTINATION LISTS
|
|
108
|
+
// OCS method: listDetailedDestinationList
|
|
109
|
+
// Gap: G-13 (MEDIUM). The existing list_destination_prefixes only reads
|
|
110
|
+
// prefixes WITHIN a known list ID; this tool returns the list catalog itself.
|
|
111
|
+
// =========================================================================
|
|
112
|
+
server.registerTool("list_destination_lists", {
|
|
113
|
+
title: "List Destination Lists",
|
|
114
|
+
description: "Use this to retrieve the full catalog of destination lists available to this reseller. " +
|
|
115
|
+
"A destination list is a named set of phone number prefixes (country codes) that control " +
|
|
116
|
+
"which numbers a subscriber may call on a voice/SMS package. " +
|
|
117
|
+
"Returns: array of destination list records, each with `id`, `name`, and prefix count. " +
|
|
118
|
+
"Do NOT use this to read the prefixes inside a specific list — use `list_destination_prefixes` " +
|
|
119
|
+
"with a known `destinationListId` for that. " +
|
|
120
|
+
"Do NOT use this for data-only eSIM products without MOC voice; destination lists only " +
|
|
121
|
+
"apply to packages with voice/SMS allowances.",
|
|
122
|
+
inputSchema: {
|
|
123
|
+
resellerId: z
|
|
124
|
+
.number()
|
|
125
|
+
.optional()
|
|
126
|
+
.describe("Reseller ID (omit to use the token owner's reseller)"),
|
|
127
|
+
},
|
|
128
|
+
annotations: { readOnlyHint: true },
|
|
129
|
+
}, wrapHandler("list_destination_lists", "listDetailedDestinationList", BACKLOG_TOOL_SCOPES["list_destination_lists"], ctx, async ({ resellerId }, token) => {
|
|
130
|
+
const id = resellerId ??
|
|
131
|
+
(await (async () => {
|
|
132
|
+
const client = new OcsClient(ctx.env.CARRIER_OCS_BASE_URL, token);
|
|
133
|
+
const info = await client.call("getResellerInfo", {});
|
|
134
|
+
const resolvedId = info?.id;
|
|
135
|
+
if (typeof resolvedId !== "number") {
|
|
136
|
+
throw new Error("Could not determine resellerId from getResellerInfo");
|
|
137
|
+
}
|
|
138
|
+
return resolvedId;
|
|
139
|
+
})());
|
|
140
|
+
const client = new OcsClient(ctx.env.CARRIER_OCS_BASE_URL, token);
|
|
141
|
+
const result = await client.call("listDetailedDestinationList", id);
|
|
142
|
+
return {
|
|
143
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
144
|
+
};
|
|
145
|
+
}));
|
|
146
|
+
// =========================================================================
|
|
147
|
+
// 4. MODIFY SUBSCRIBER MOBILE PLAN
|
|
148
|
+
// OCS method: modifySubscriberMobilePlan
|
|
149
|
+
// Gap: G-06 (HIGH). Needed to change which pricing plan a subscriber is billed under.
|
|
150
|
+
// =========================================================================
|
|
151
|
+
server.registerTool("modify_subscriber_mobile_plan", {
|
|
152
|
+
title: "Modify Subscriber Mobile Plan",
|
|
153
|
+
description: "Use this to change the mobile pricing plan assigned to a specific subscriber. " +
|
|
154
|
+
"The mobile plan determines per-country rates for data, voice, and SMS. Changing the plan " +
|
|
155
|
+
"takes effect immediately on the next OCS rating cycle. " +
|
|
156
|
+
"Params: `iccid` (subscriber identifier), `mobile_plan_id` (integer plan ID — obtain valid " +
|
|
157
|
+
"plan IDs from the OCS reseller settings or `get_tariff`). " +
|
|
158
|
+
"Returns: updated subscriber record confirming the new plan assignment. " +
|
|
159
|
+
"Do NOT use this to change package allowances — use `modify_package_limits` for that. " +
|
|
160
|
+
"Do NOT use this to change account-level pricing — this only affects the individual subscriber.",
|
|
161
|
+
inputSchema: {
|
|
162
|
+
iccid: z.string().describe("The subscriber ICCID (20-digit ICC identifier)"),
|
|
163
|
+
mobile_plan_id: z
|
|
164
|
+
.number()
|
|
165
|
+
.describe("The mobile pricing plan ID to assign to this subscriber"),
|
|
166
|
+
...DRY_RUN_FIELD,
|
|
167
|
+
},
|
|
168
|
+
annotations: { destructiveHint: true },
|
|
169
|
+
}, wrapHandler("modify_subscriber_mobile_plan", "modifySubscriberMobilePlan", BACKLOG_TOOL_SCOPES["modify_subscriber_mobile_plan"], ctx, async ({ iccid, mobile_plan_id }, token) => {
|
|
170
|
+
const client = new OcsClient(ctx.env.CARRIER_OCS_BASE_URL, token);
|
|
171
|
+
const result = await client.call("modifySubscriberMobilePlan", { subscriber: iccid, mobilePlanId: mobile_plan_id });
|
|
172
|
+
return {
|
|
173
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
174
|
+
};
|
|
175
|
+
}));
|
|
176
|
+
// =========================================================================
|
|
177
|
+
// 5. MODIFY SUBSCRIBER PACKAGE ACTIVE PERIOD
|
|
178
|
+
// OCS method: modifySubscriberPrepaidPackageActivePeriod
|
|
179
|
+
// Gap: G-07 (HIGH). Controls when a package becomes active on a subscriber.
|
|
180
|
+
// =========================================================================
|
|
181
|
+
server.registerTool("modify_subscriber_package_active_period", {
|
|
182
|
+
title: "Modify Subscriber Package Active Period",
|
|
183
|
+
description: "Use this to change the start and/or end date of a prepaid package's active period for a " +
|
|
184
|
+
"specific subscriber. This controls WHEN the package runs, not what it contains. " +
|
|
185
|
+
"Useful for scheduling packages in advance (e.g. activate on arrival date) or extending " +
|
|
186
|
+
"a package that would otherwise expire while the subscriber is still travelling. " +
|
|
187
|
+
"Params: `iccid` (subscriber identifier), `package_id` (from `list_subscriber_packages`), " +
|
|
188
|
+
"`start_date` (ISO 8601 date, optional), `end_date` (ISO 8601 date, optional). " +
|
|
189
|
+
"Returns: updated package record with new active period. " +
|
|
190
|
+
"Do NOT use this to change a package's data/voice allowance — use `modify_package_limits`. " +
|
|
191
|
+
"Do NOT use this to change the expiry date of a package — use `modify_package_expiry`.",
|
|
192
|
+
inputSchema: {
|
|
193
|
+
iccid: z.string().describe("The subscriber ICCID (20-digit ICC identifier)"),
|
|
194
|
+
package_id: z
|
|
195
|
+
.number()
|
|
196
|
+
.describe("The subscriber package ID (from list_subscriber_packages)"),
|
|
197
|
+
start_date: z
|
|
198
|
+
.string()
|
|
199
|
+
.optional()
|
|
200
|
+
.describe("New start date in ISO 8601 format (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss)"),
|
|
201
|
+
end_date: z
|
|
202
|
+
.string()
|
|
203
|
+
.optional()
|
|
204
|
+
.describe("New end date in ISO 8601 format (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss)"),
|
|
205
|
+
...DRY_RUN_FIELD,
|
|
206
|
+
},
|
|
207
|
+
annotations: { destructiveHint: true },
|
|
208
|
+
}, wrapHandler("modify_subscriber_package_active_period", "modifySubscriberPrepaidPackageActivePeriod", BACKLOG_TOOL_SCOPES["modify_subscriber_package_active_period"], ctx, async ({ iccid, package_id, start_date, end_date }, token) => {
|
|
209
|
+
const params = { subscriber: iccid, packageId: package_id };
|
|
210
|
+
if (start_date !== undefined)
|
|
211
|
+
params.startDate = start_date;
|
|
212
|
+
if (end_date !== undefined)
|
|
213
|
+
params.endDate = end_date;
|
|
214
|
+
const client = new OcsClient(ctx.env.CARRIER_OCS_BASE_URL, token);
|
|
215
|
+
const result = await client.call("modifySubscriberPrepaidPackageActivePeriod", params);
|
|
216
|
+
return {
|
|
217
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
218
|
+
};
|
|
219
|
+
}));
|
|
220
|
+
// =========================================================================
|
|
221
|
+
// 6. MODIFY SUBSCRIBER VOIP PLAN
|
|
222
|
+
// OCS method: modifySubscriberVoipPlan
|
|
223
|
+
// Gap: G-11 (MEDIUM). Parallel to modify_subscriber_mobile_plan for VoIP.
|
|
224
|
+
// =========================================================================
|
|
225
|
+
server.registerTool("modify_subscriber_voip_plan", {
|
|
226
|
+
title: "Modify Subscriber VoIP Plan",
|
|
227
|
+
description: "Use this to change the VoIP pricing plan assigned to a specific subscriber. " +
|
|
228
|
+
"VoIP plans control billing rates for VoIP calls made through the OCS platform, " +
|
|
229
|
+
"separate from the standard mobile plan's call rates. " +
|
|
230
|
+
"Params: `iccid` (subscriber identifier), `voip_plan_id` (integer VoIP plan ID from " +
|
|
231
|
+
"the OCS reseller settings). " +
|
|
232
|
+
"Returns: updated subscriber record confirming the new VoIP plan. " +
|
|
233
|
+
"Do NOT use this for mobile (non-VoIP) plan changes — use `modify_subscriber_mobile_plan`. " +
|
|
234
|
+
"For data-only eSIM products without VoIP services this tool has no effect.",
|
|
235
|
+
inputSchema: {
|
|
236
|
+
iccid: z.string().describe("The subscriber ICCID (20-digit ICC identifier)"),
|
|
237
|
+
voip_plan_id: z
|
|
238
|
+
.number()
|
|
239
|
+
.describe("The VoIP pricing plan ID to assign to this subscriber"),
|
|
240
|
+
...DRY_RUN_FIELD,
|
|
241
|
+
},
|
|
242
|
+
annotations: { destructiveHint: true },
|
|
243
|
+
}, wrapHandler("modify_subscriber_voip_plan", "modifySubscriberVoipPlan", BACKLOG_TOOL_SCOPES["modify_subscriber_voip_plan"], ctx, async ({ iccid, voip_plan_id }, token) => {
|
|
244
|
+
const client = new OcsClient(ctx.env.CARRIER_OCS_BASE_URL, token);
|
|
245
|
+
const result = await client.call("modifySubscriberVoipPlan", { subscriber: iccid, voipPlanId: voip_plan_id });
|
|
246
|
+
return {
|
|
247
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
248
|
+
};
|
|
249
|
+
}));
|
|
250
|
+
// =========================================================================
|
|
251
|
+
// 7. PUSH STEERING TO SUBSCRIBER
|
|
252
|
+
// OCS method: pushSteeringToSubs
|
|
253
|
+
// Gap: G-04 (HIGH). Must be called AFTER modify_subscriber_steering_list
|
|
254
|
+
// to push the new OPLMN list to the physical device.
|
|
255
|
+
// =========================================================================
|
|
256
|
+
server.registerTool("push_steering_to_subscriber", {
|
|
257
|
+
title: "Push Steering List to Subscriber Device",
|
|
258
|
+
description: "Use this AFTER `modify_subscriber_steering_list` to actively push the updated OPLMN " +
|
|
259
|
+
"(operator preference list) to the subscriber's physical eSIM/SIM. " +
|
|
260
|
+
"Without this call, the steering list assignment change is recorded in OCS but the device " +
|
|
261
|
+
"continues using the old operator preference list until it performs a network re-registration. " +
|
|
262
|
+
"This is required for immediate operator switching (e.g. steering a subscriber away from " +
|
|
263
|
+
"an expensive roaming partner in real time). " +
|
|
264
|
+
"Params: `iccid` (subscriber identifier). " +
|
|
265
|
+
"Returns: push confirmation from OCS with delivery status. " +
|
|
266
|
+
"Do NOT call this without first calling `modify_subscriber_steering_list` — pushing without " +
|
|
267
|
+
"an assigned steering list is a no-op and wastes an OCS call.",
|
|
268
|
+
inputSchema: {
|
|
269
|
+
iccid: z.string().describe("The subscriber ICCID (20-digit ICC identifier)"),
|
|
270
|
+
...DRY_RUN_FIELD,
|
|
271
|
+
},
|
|
272
|
+
annotations: { destructiveHint: true },
|
|
273
|
+
}, wrapHandler("push_steering_to_subscriber", "pushSteeringToSubs", BACKLOG_TOOL_SCOPES["push_steering_to_subscriber"], ctx, async ({ iccid }, token) => {
|
|
274
|
+
const cache = new Map();
|
|
275
|
+
const sub = await resolveSubscriberByIccid(ctx.env, token, iccid, cache);
|
|
276
|
+
// OCS pushSteeringToSubs expects subscriber identifier — ICCID confirmed
|
|
277
|
+
// from live docs. Passing the full subscriber object as fallback.
|
|
278
|
+
const subscriberId = sub.id ?? sub.subscriberId ?? iccid;
|
|
279
|
+
const client = new OcsClient(ctx.env.CARRIER_OCS_BASE_URL, token);
|
|
280
|
+
const result = await client.call("pushSteeringToSubs", { subscriber: subscriberId });
|
|
281
|
+
return {
|
|
282
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
283
|
+
};
|
|
284
|
+
}));
|
|
285
|
+
// =========================================================================
|
|
286
|
+
// 8. RESET SUBSCRIBER GZ COUNTER
|
|
287
|
+
// OCS method: resetSubsGzCounter
|
|
288
|
+
// Gap: G-10 (MEDIUM). Resets usage counters — used after billing disputes.
|
|
289
|
+
// Admin scope — irreversible operation.
|
|
290
|
+
// =========================================================================
|
|
291
|
+
server.registerTool("reset_subscriber_gz_counter", {
|
|
292
|
+
title: "Reset Subscriber GZ Counter",
|
|
293
|
+
description: "ADMIN: Use this to reset the Gz (Diameter accounting) usage counter for a subscriber. " +
|
|
294
|
+
"Typically used after a billing dispute or test-cycle reset where accumulated usage data " +
|
|
295
|
+
"must be cleared. This operation is IRREVERSIBLE — the usage history for the current " +
|
|
296
|
+
"counter period is permanently zeroed. " +
|
|
297
|
+
"Params: `iccid` (subscriber identifier). " +
|
|
298
|
+
"Returns: OCS confirmation of the counter reset. " +
|
|
299
|
+
"Always call `subscriber_usage` first to capture the usage snapshot before resetting. " +
|
|
300
|
+
"Do NOT use this to pause data usage — use `set_subscriber_traffic_restrictions` with " +
|
|
301
|
+
"`dataAllowed=false` instead.",
|
|
302
|
+
inputSchema: {
|
|
303
|
+
iccid: z.string().describe("The subscriber ICCID (20-digit ICC identifier)"),
|
|
304
|
+
...DRY_RUN_FIELD,
|
|
305
|
+
},
|
|
306
|
+
annotations: { destructiveHint: true },
|
|
307
|
+
}, wrapHandler("reset_subscriber_gz_counter", "resetSubsGzCounter", BACKLOG_TOOL_SCOPES["reset_subscriber_gz_counter"], ctx, async ({ iccid }, token) => {
|
|
308
|
+
const client = new OcsClient(ctx.env.CARRIER_OCS_BASE_URL, token);
|
|
309
|
+
const result = await client.call("resetSubsGzCounter", { subscriber: iccid });
|
|
310
|
+
return {
|
|
311
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
312
|
+
};
|
|
313
|
+
}));
|
|
314
|
+
}
|
|
315
|
+
//# sourceMappingURL=tools-backlog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools-backlog.js","sourceRoot":"","sources":["../src/tools-backlog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,C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WAAW,CACT,6BAA6B,EAC7B,oBAAoB,EACpB,mBAAmB,CAAC,6BAA6B,CAAE,EACnD,GAAG,EACH,KAAK,EAAE,EAAE,KAAK,EAAqB,EAAE,KAAa,EAAE,EAAE;QACpD,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;QAClE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9E,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;SACnE,CAAC;IACJ,CAAC,CACF,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Carrier MCP — carrier_ask + carrier_ask_describe (v2.0 live routing).
|
|
3
|
+
*
|
|
4
|
+
* IMPLEMENTATION STATUS: LIVE (Phase 2)
|
|
5
|
+
* carrier_ask now routes via Claude Haiku 4.5 on AWS Bedrock tool-use.
|
|
6
|
+
* The router receives the full TOOL_REGISTRY as its tool catalog and returns
|
|
7
|
+
* a single tool_use block identifying the best matching tool + extracted params.
|
|
8
|
+
*
|
|
9
|
+
* ACTIVATION:
|
|
10
|
+
* - Requires AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY in Doppler carrier/dev+stg+prd.
|
|
11
|
+
* - Set CARRIER_ASK_ENABLED=true in Doppler to activate per-env.
|
|
12
|
+
* - Without the credentials/flag, carrier_ask gracefully degrades to routing_pending.
|
|
13
|
+
*
|
|
14
|
+
* DESIGN CHOICES:
|
|
15
|
+
* - Router model: Claude Haiku 4.5 on Bedrock (us.anthropic.claude-haiku-4-5-20251001-v1:0).
|
|
16
|
+
* - Auth: SigV4 via aws4fetch — no AWS SDK bundle (CF Worker compatible).
|
|
17
|
+
* - tool_choice: { type: "any" } — forces a tool_use response.
|
|
18
|
+
* - Ambiguous/no-match: sentinel "carrier_clarify" tool for Haiku to signal.
|
|
19
|
+
* - HARD_BLOCK_TOOLS: always return confirm_token; never auto-execute.
|
|
20
|
+
* - Confirm token TTL: 120s. Single-use (deleted on consume).
|
|
21
|
+
* - Intent hashing: SHA-256, hex. Not stored verbatim (PII guard).
|
|
22
|
+
* - Audit log: Analytics Engine, fire-and-forget. Extended schema for router.
|
|
23
|
+
* - Rate-limit (429): returns friendly retry hint, never crashes.
|
|
24
|
+
*
|
|
25
|
+
* SAFETY FLOORS (non-negotiable):
|
|
26
|
+
* - Resolved tool name validated against TOOL_REGISTRY — no hallucination.
|
|
27
|
+
* - HARD_BLOCK_TOOLS always require confirm_token round-trip.
|
|
28
|
+
* - No-match / ambiguous: structured response, never fabricated tool call.
|
|
29
|
+
*/
|
|
30
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
31
|
+
import { type ToolContext } from "./tools.js";
|
|
32
|
+
declare const TOOL_REGISTRY: ReadonlySet<string>;
|
|
33
|
+
declare const HARD_BLOCK_TOOLS: ReadonlySet<string>;
|
|
34
|
+
export declare function hashIntent(intent: string): string;
|
|
35
|
+
type RouteResult = {
|
|
36
|
+
match: "confirmed";
|
|
37
|
+
resolved_tool: string;
|
|
38
|
+
resolved_params: Record<string, unknown>;
|
|
39
|
+
confidence: number;
|
|
40
|
+
confirm_required: false;
|
|
41
|
+
execution_note: string;
|
|
42
|
+
} | {
|
|
43
|
+
match: "pending_confirm";
|
|
44
|
+
resolved_tool: string;
|
|
45
|
+
resolved_params: Record<string, unknown>;
|
|
46
|
+
confidence: number;
|
|
47
|
+
confirm_required: true;
|
|
48
|
+
confirm_token: string;
|
|
49
|
+
confirm_expires_in_seconds: number;
|
|
50
|
+
dry_run_preview?: string;
|
|
51
|
+
safety_note: string;
|
|
52
|
+
} | {
|
|
53
|
+
match: "ambiguous";
|
|
54
|
+
candidates: Array<{
|
|
55
|
+
tool: string;
|
|
56
|
+
reason: string;
|
|
57
|
+
}>;
|
|
58
|
+
clarifying_question: string;
|
|
59
|
+
} | {
|
|
60
|
+
match: "none";
|
|
61
|
+
closest: Array<{
|
|
62
|
+
tool: string;
|
|
63
|
+
reason: string;
|
|
64
|
+
}>;
|
|
65
|
+
suggestion: string;
|
|
66
|
+
} | {
|
|
67
|
+
match: "routing_pending";
|
|
68
|
+
intent_received: string;
|
|
69
|
+
note: string;
|
|
70
|
+
scaffold_version: string;
|
|
71
|
+
} | {
|
|
72
|
+
match: "rate_limited";
|
|
73
|
+
retry_after_seconds: number;
|
|
74
|
+
suggestion: string;
|
|
75
|
+
};
|
|
76
|
+
interface BedrockTool {
|
|
77
|
+
name: string;
|
|
78
|
+
description: string;
|
|
79
|
+
input_schema: {
|
|
80
|
+
type: "object";
|
|
81
|
+
properties: Record<string, unknown>;
|
|
82
|
+
required?: string[];
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
interface BedrockPayload {
|
|
86
|
+
anthropic_version: "bedrock-2023-05-31";
|
|
87
|
+
max_tokens: number;
|
|
88
|
+
system: string;
|
|
89
|
+
messages: Array<{
|
|
90
|
+
role: "user" | "assistant";
|
|
91
|
+
content: string;
|
|
92
|
+
}>;
|
|
93
|
+
tools: BedrockTool[];
|
|
94
|
+
tool_choice: {
|
|
95
|
+
type: "any";
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
interface BedrockToolUseBlock {
|
|
99
|
+
type: "tool_use";
|
|
100
|
+
id: string;
|
|
101
|
+
name: string;
|
|
102
|
+
input: Record<string, unknown>;
|
|
103
|
+
}
|
|
104
|
+
interface BedrockTextBlock {
|
|
105
|
+
type: "text";
|
|
106
|
+
text: string;
|
|
107
|
+
}
|
|
108
|
+
interface BedrockResponse {
|
|
109
|
+
content: Array<BedrockToolUseBlock | BedrockTextBlock>;
|
|
110
|
+
stop_reason: string;
|
|
111
|
+
}
|
|
112
|
+
type RoutedResult = Extract<RouteResult, {
|
|
113
|
+
match: "confirmed";
|
|
114
|
+
}> | Extract<RouteResult, {
|
|
115
|
+
match: "pending_confirm";
|
|
116
|
+
}> | Extract<RouteResult, {
|
|
117
|
+
match: "ambiguous";
|
|
118
|
+
}> | Extract<RouteResult, {
|
|
119
|
+
match: "none";
|
|
120
|
+
}> | Extract<RouteResult, {
|
|
121
|
+
match: "routing_pending";
|
|
122
|
+
}> | Extract<RouteResult, {
|
|
123
|
+
match: "rate_limited";
|
|
124
|
+
}>;
|
|
125
|
+
export declare function callBedrock(env: {
|
|
126
|
+
AWS_ACCESS_KEY_ID: string;
|
|
127
|
+
AWS_SECRET_ACCESS_KEY: string;
|
|
128
|
+
AWS_REGION?: string;
|
|
129
|
+
BEDROCK_MODEL_ID?: string;
|
|
130
|
+
}, payload: BedrockPayload): Promise<BedrockResponse>;
|
|
131
|
+
export declare function _routeIntent(intent: string, context: {
|
|
132
|
+
iccid?: string;
|
|
133
|
+
account_id?: number;
|
|
134
|
+
reseller_id?: number;
|
|
135
|
+
}, env: ToolContext["env"]): Promise<RoutedResult>;
|
|
136
|
+
export declare function registerAllCarrierAskTools(server: McpServer, ctx: ToolContext): void;
|
|
137
|
+
export { TOOL_REGISTRY, HARD_BLOCK_TOOLS };
|
|
138
|
+
//# sourceMappingURL=tools-carrier-ask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools-carrier-ask.d.ts","sourceRoot":"","sources":["../src/tools-carrier-ask.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAkC,KAAK,WAAW,EAAe,MAAM,YAAY,CAAC;AAO3F,QAAA,MAAM,aAAa,EAAE,WAAW,CAAC,MAAM,CAuBrC,CAAC;AAIH,QAAA,MAAM,gBAAgB,EAA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