@nibgat/nmcp 2.0.1 → 2.0.3

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.
@@ -1013,7 +1013,7 @@ export const registerTools = (server, ctx) => {
1013
1013
  // 25. buyment_list_invoices
1014
1014
  server.registerTool("buyment_list_invoices", {
1015
1015
  title: "List N - Buyment e-Invoices",
1016
- description: "Lists Trendyol e-Fatura and e-Arşiv invoices for the authenticated account (GET /nbuyment/sso/invoices).",
1016
+ description: "Lists official e-Fatura and e-Arşiv invoices for the authenticated account (GET /nbuyment/sso/invoices).",
1017
1017
  inputSchema: {},
1018
1018
  annotations: READ_ONLY_REMOTE_ANNOTATIONS
1019
1019
  }, async () => {
@@ -1084,6 +1084,101 @@ export const registerTools = (server, ctx) => {
1084
1084
  });
1085
1085
  });
1086
1086
  }
1087
+ // 26b. buyment_list_orders
1088
+ server.registerTool("buyment_list_orders", {
1089
+ title: "List N - Buyment Orders",
1090
+ description: "Lists the authenticated account's N - Buyment orders, statuses, payment methods, and VAT-inclusive TRY totals (GET /nbuyment/sso/orders).",
1091
+ inputSchema: {},
1092
+ annotations: READ_ONLY_REMOTE_ANNOTATIONS
1093
+ }, async () => {
1094
+ const endpoint = "/nbuyment/sso/orders";
1095
+ const resp = await httpClient.request({
1096
+ target: "core",
1097
+ method: "GET",
1098
+ path: endpoint,
1099
+ requireAuth: true
1100
+ });
1101
+ if (!resp.ok) {
1102
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to list orders.", resp.data);
1103
+ }
1104
+ return jsonToolResult({
1105
+ ok: true,
1106
+ latencyMs: resp.latencyMs,
1107
+ result: resp.data
1108
+ });
1109
+ });
1110
+ // 26c. buyment_cancel_order (WRITE - DESTRUCTIVE)
1111
+ if (!readOnly) {
1112
+ server.registerTool("buyment_cancel_order", {
1113
+ title: "Cancel Pending N - Buyment Order",
1114
+ description: "Cancels an unpaid or pending N - Buyment order (POST /nbuyment/sso/orders/:id/cancel). Requires confirm: true. Disabled in --read-only mode.",
1115
+ inputSchema: {
1116
+ orderId: z.string().trim().min(2).max(120).describe("Target unpaid/pending order ID."),
1117
+ confirm: z.literal(true).describe("Must be true to confirm order cancellation.")
1118
+ },
1119
+ annotations: {
1120
+ ...WRITE_REMOTE_ANNOTATIONS,
1121
+ destructiveHint: true
1122
+ }
1123
+ }, async ({ orderId }) => {
1124
+ if (readOnly) {
1125
+ return readOnlyBlockedResult("buyment_cancel_order");
1126
+ }
1127
+ const endpoint = `/nbuyment/sso/orders/${encodeURIComponent(orderId)}/cancel`;
1128
+ const resp = await httpClient.request({
1129
+ target: "core",
1130
+ method: "POST",
1131
+ path: endpoint,
1132
+ requireAuth: true,
1133
+ body: {}
1134
+ });
1135
+ if (!resp.ok) {
1136
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to cancel order.", resp.data);
1137
+ }
1138
+ return jsonToolResult({
1139
+ ok: true,
1140
+ latencyMs: resp.latencyMs,
1141
+ result: resp.data
1142
+ });
1143
+ });
1144
+ }
1145
+ // 26d. buyment_cancel_subscription (WRITE - DESTRUCTIVE)
1146
+ if (!readOnly) {
1147
+ server.registerTool("buyment_cancel_subscription", {
1148
+ title: "Cancel N - Buyment Subscription",
1149
+ description: "Schedules an active N - Buyment subscription for cancellation at period end (POST /nbuyment/sso/subscriptions/:id/cancel). Requires confirm: true. Disabled in --read-only mode.",
1150
+ inputSchema: {
1151
+ subscriptionId: z.string().trim().min(2).max(120).describe("Target subscription ID."),
1152
+ confirm: z.literal(true).describe("Must be true to confirm subscription cancellation.")
1153
+ },
1154
+ annotations: {
1155
+ ...WRITE_REMOTE_ANNOTATIONS,
1156
+ destructiveHint: true
1157
+ }
1158
+ }, async ({ subscriptionId }) => {
1159
+ if (readOnly) {
1160
+ return readOnlyBlockedResult("buyment_cancel_subscription");
1161
+ }
1162
+ const endpoint = `/nbuyment/sso/subscriptions/${encodeURIComponent(subscriptionId)}/cancel`;
1163
+ const resp = await httpClient.request({
1164
+ target: "core",
1165
+ method: "POST",
1166
+ path: endpoint,
1167
+ requireAuth: true,
1168
+ body: {
1169
+ immediate: false
1170
+ }
1171
+ });
1172
+ if (!resp.ok) {
1173
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to cancel subscription.", resp.data);
1174
+ }
1175
+ return jsonToolResult({
1176
+ ok: true,
1177
+ latencyMs: resp.latencyMs,
1178
+ result: resp.data
1179
+ });
1180
+ });
1181
+ }
1087
1182
  // 27. cloud_list_regions
1088
1183
  server.registerTool("cloud_list_regions", {
1089
1184
  title: "List N - Cloud Global Regions",
@@ -1109,7 +1204,7 @@ export const registerTools = (server, ctx) => {
1109
1204
  // 28. cloud_get_catalog
1110
1205
  server.registerTool("cloud_get_catalog", {
1111
1206
  title: "Get N - Cloud & Physical Hardware Catalog",
1112
- description: "Fetches live N - Compute, N - Storage, N - Run, N - Metal, and N - Hardware plans with VAT-inclusive TRY pricing (GET /ncloud/catalog).",
1207
+ description: "Fetches live NC - Pulse, Rig, Flux, Hive, Crate/Lock, Safe, Prism, and NC - Iron/Forge plans with VAT-inclusive TRY pricing (GET /ncloud/catalog).",
1113
1208
  inputSchema: {
1114
1209
  region: z.string().trim().max(32).optional().describe("Optional region filter (e.g. 'tr-ist-1').")
1115
1210
  },
@@ -1159,16 +1254,18 @@ export const registerTools = (server, ctx) => {
1159
1254
  // 30. cloud_list_resources
1160
1255
  server.registerTool("cloud_list_resources", {
1161
1256
  title: "List N - Cloud Active Resources",
1162
- description: "Lists active N - Compute, N - Run, N - Storage, N - Net, and N - Vault resources (GET /ncloud/sso/resources).",
1257
+ description: "Lists active NC - Pulse, Rig, Flux, Hive, Crate/Lock, Safe, Prism/Mesh/Route, and Iron resources (GET /ncloud/sso/resources).",
1163
1258
  inputSchema: {
1164
1259
  type: z.enum([
1165
1260
  "server",
1261
+ "serverless",
1166
1262
  "container",
1167
1263
  "storage",
1264
+ "storage_lock",
1265
+ "load_balancer",
1168
1266
  "vpc",
1169
1267
  "dns",
1170
- "backup",
1171
- "metal"
1268
+ "backup"
1172
1269
  ]).optional().describe("Optional resource type filter.")
1173
1270
  },
1174
1271
  annotations: READ_ONLY_REMOTE_ANNOTATIONS
@@ -1195,8 +1292,8 @@ export const registerTools = (server, ctx) => {
1195
1292
  // 31. cloud_create_server (WRITE)
1196
1293
  if (!readOnly) {
1197
1294
  server.registerTool("cloud_create_server", {
1198
- title: "Create N - Compute Cloud Server",
1199
- description: "Deploys a new N - Compute cloud server or NVMe VDS in an active region (default: tr-ist-1) via POST /ncloud/sso/servers. Disabled in --read-only mode.",
1295
+ title: "Create N - Cloud Server (NC - Pulse / Rig)",
1296
+ description: "Deploys a new NC - Pulse cloud server or NC - Rig NVMe VDS in an active region (default: tr-ist-1) via POST /ncloud/sso/servers. Disabled in --read-only mode.",
1200
1297
  inputSchema: {
1201
1298
  name: z.string().trim().min(2).max(64).regex(/^[a-zA-Z0-9-]+$/).describe("Server hostname (letters, digits, hyphens)."),
1202
1299
  planCode: z.string().trim().min(2).max(64).describe("Cloud plan code from cloud_get_catalog."),
@@ -1236,11 +1333,83 @@ export const registerTools = (server, ctx) => {
1236
1333
  });
1237
1334
  });
1238
1335
  }
1336
+ // 31b. cloud_create_resource (WRITE)
1337
+ if (!readOnly) {
1338
+ server.registerTool("cloud_create_resource", {
1339
+ title: "Create N - Cloud Resource (Flux/Hive/Crate/Safe/Prism/Mesh/Route)",
1340
+ description: "Provisions an NC - Flux serverless container, NC - Hive cluster, NC - Crate/Lock S3 bucket, NC - Safe backup vault, NC - Prism load balancer, NC - Mesh VPC, or NC - Route DNS zone (POST /ncloud/sso/resources). Disabled in --read-only mode.",
1341
+ inputSchema: {
1342
+ resourceType: z.enum([
1343
+ "serverless",
1344
+ "container",
1345
+ "storage",
1346
+ "storage_lock",
1347
+ "load_balancer",
1348
+ "vpc",
1349
+ "dns",
1350
+ "backup"
1351
+ ]).describe("Target N - Cloud resource type."),
1352
+ name: z.string().trim().min(2).max(64).describe("Resource name."),
1353
+ regionCode: z.string().trim().max(32).optional().describe("Region code (default: 'tr-ist-1')."),
1354
+ planCode: z.string().trim().min(2).max(64).optional().describe("Plan code (required for container, storage, storage_lock, load_balancer, backup)."),
1355
+ projectId: z.string().trim().max(120).optional().describe("Optional project ID."),
1356
+ tags: z.array(z.string().trim().max(40)).max(15).optional().describe("Optional resource tags."),
1357
+ vcpu: z.number().min(0.25).max(16).optional().describe("NC - Flux vCPU per replica (0.25-16)."),
1358
+ ramGb: z.number().min(0.5).max(64).optional().describe("NC - Flux RAM GB per replica (0.5-64)."),
1359
+ replicas: z.number().int().min(1).max(20).optional().describe("NC - Flux replica count (1-20)."),
1360
+ hoursPerDay: z.number().int().min(1).max(24).optional().describe("NC - Flux active hours per day (1-24).")
1361
+ },
1362
+ annotations: WRITE_REMOTE_ANNOTATIONS
1363
+ }, async ({ resourceType, name, regionCode, planCode, projectId, tags, vcpu, ramGb, replicas, hoursPerDay }) => {
1364
+ if (readOnly) {
1365
+ return readOnlyBlockedResult("cloud_create_resource");
1366
+ }
1367
+ const specs = {};
1368
+ if (resourceType === "serverless") {
1369
+ if (vcpu !== undefined) {
1370
+ specs.vcpu = vcpu;
1371
+ }
1372
+ if (ramGb !== undefined) {
1373
+ specs.ramGb = ramGb;
1374
+ }
1375
+ if (replicas !== undefined) {
1376
+ specs.replicas = replicas;
1377
+ }
1378
+ if (hoursPerDay !== undefined) {
1379
+ specs.hoursPerDay = hoursPerDay;
1380
+ }
1381
+ }
1382
+ const endpoint = "/ncloud/sso/resources";
1383
+ const resp = await httpClient.request({
1384
+ target: "core",
1385
+ method: "POST",
1386
+ path: endpoint,
1387
+ requireAuth: true,
1388
+ body: {
1389
+ resourceType,
1390
+ name,
1391
+ regionCode: regionCode || "tr-ist-1",
1392
+ ...(planCode ? { planCode } : {}),
1393
+ ...(projectId ? { projectId } : {}),
1394
+ ...(tags ? { tags } : {}),
1395
+ ...(Object.keys(specs).length > 0 ? { specs } : {})
1396
+ }
1397
+ });
1398
+ if (!resp.ok) {
1399
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to create cloud resource.", resp.data);
1400
+ }
1401
+ return jsonToolResult({
1402
+ ok: true,
1403
+ latencyMs: resp.latencyMs,
1404
+ resource: resp.data
1405
+ });
1406
+ });
1407
+ }
1239
1408
  // 32. cloud_server_power (WRITE)
1240
1409
  if (!readOnly) {
1241
1410
  server.registerTool("cloud_server_power", {
1242
- title: "Control N - Compute Server Power",
1243
- description: "Executes start, stop, reboot, or poweroff on an N - Compute server (POST /ncloud/sso/servers/:id/power). Disabled in --read-only mode.",
1411
+ title: "Control N - Cloud Server Power",
1412
+ description: "Executes start, stop, reboot, or poweroff on an NC - Pulse / NC - Rig server (POST /ncloud/sso/servers/:id/power). Disabled in --read-only mode.",
1244
1413
  inputSchema: {
1245
1414
  resourceId: z.string().trim().min(2).max(120).describe("Target cloud resource ID."),
1246
1415
  action: z.enum([
@@ -1250,7 +1419,10 @@ export const registerTools = (server, ctx) => {
1250
1419
  "poweroff"
1251
1420
  ]).describe("Power action to execute.")
1252
1421
  },
1253
- annotations: WRITE_REMOTE_ANNOTATIONS
1422
+ annotations: {
1423
+ ...WRITE_REMOTE_ANNOTATIONS,
1424
+ destructiveHint: true
1425
+ }
1254
1426
  }, async ({ resourceId, action }) => {
1255
1427
  if (readOnly) {
1256
1428
  return readOnlyBlockedResult("cloud_server_power");
@@ -1279,7 +1451,7 @@ export const registerTools = (server, ctx) => {
1279
1451
  if (!readOnly) {
1280
1452
  server.registerTool("cloud_create_hardware_order", {
1281
1453
  title: "Create N - Cloud Physical Hardware Order",
1282
- description: "Places an N - Metal bare-metal rental or N - Hardware purchase order (POST /ncloud/sso/hardware/orders). Disabled in --read-only mode.",
1454
+ description: "Places an NC - Iron bare-metal rental or NC - Forge purchase order (POST /ncloud/sso/hardware/orders). Disabled in --read-only mode.",
1283
1455
  inputSchema: {
1284
1456
  hardwareItemId: z.string().trim().min(2).max(120).describe("Hardware catalog item ID from cloud_get_catalog."),
1285
1457
  quantity: z.number().int().min(1).max(20).optional().describe("Order quantity (default: 1)."),
@@ -1319,5 +1491,481 @@ export const registerTools = (server, ctx) => {
1319
1491
  });
1320
1492
  });
1321
1493
  }
1494
+ // 33b. cloud_cancel_hardware_order (WRITE - DESTRUCTIVE)
1495
+ if (!readOnly) {
1496
+ server.registerTool("cloud_cancel_hardware_order", {
1497
+ title: "Cancel Pending Physical Hardware Order",
1498
+ description: "Cancels an unpaid pending NC - Iron / NC - Forge hardware order (POST /ncloud/sso/hardware/orders/:id/cancel). Requires confirm: true. Disabled in --read-only mode.",
1499
+ inputSchema: {
1500
+ orderId: z.string().trim().min(2).max(120).describe("Target unpaid pending hardware order ID."),
1501
+ confirm: z.literal(true).describe("Must be true to confirm hardware order cancellation.")
1502
+ },
1503
+ annotations: {
1504
+ ...WRITE_REMOTE_ANNOTATIONS,
1505
+ destructiveHint: true
1506
+ }
1507
+ }, async ({ orderId }) => {
1508
+ if (readOnly) {
1509
+ return readOnlyBlockedResult("cloud_cancel_hardware_order");
1510
+ }
1511
+ const endpoint = `/ncloud/sso/hardware/orders/${encodeURIComponent(orderId)}/cancel`;
1512
+ const resp = await httpClient.request({
1513
+ target: "core",
1514
+ method: "POST",
1515
+ path: endpoint,
1516
+ requireAuth: true,
1517
+ body: {}
1518
+ });
1519
+ if (!resp.ok) {
1520
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to cancel hardware order.", resp.data);
1521
+ }
1522
+ return jsonToolResult({
1523
+ ok: true,
1524
+ latencyMs: resp.latencyMs,
1525
+ result: resp.data
1526
+ });
1527
+ });
1528
+ }
1529
+ // 34. cloud_sync_resource
1530
+ server.registerTool("cloud_sync_resource", {
1531
+ title: "Sync N - Cloud Resource Live State",
1532
+ description: "Syncs a cloud resource's live power state and network info through N - Cloud control plane (POST /ncloud/sso/resources/:id/sync).",
1533
+ inputSchema: {
1534
+ resourceId: z.string().trim().min(2).max(120).describe("Target cloud resource ID.")
1535
+ },
1536
+ annotations: READ_ONLY_REMOTE_ANNOTATIONS
1537
+ }, async ({ resourceId }) => {
1538
+ const endpoint = `/ncloud/sso/resources/${encodeURIComponent(resourceId)}/sync`;
1539
+ const resp = await httpClient.request({
1540
+ target: "core",
1541
+ method: "POST",
1542
+ path: endpoint,
1543
+ requireAuth: true,
1544
+ body: {}
1545
+ });
1546
+ if (!resp.ok) {
1547
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to sync resource.", resp.data);
1548
+ }
1549
+ return jsonToolResult({
1550
+ ok: true,
1551
+ latencyMs: resp.latencyMs,
1552
+ result: resp.data
1553
+ });
1554
+ });
1555
+ // 35. cloud_server_vnc_console (WRITE)
1556
+ if (!readOnly) {
1557
+ server.registerTool("cloud_server_vnc_console", {
1558
+ title: "Open N - Cloud Server VNC Console Ticket",
1559
+ description: "Requests a one-time VNC console ticket for a server through N - Cloud (POST /ncloud/sso/servers/:id/console). Disabled in --read-only mode.",
1560
+ inputSchema: {
1561
+ resourceId: z.string().trim().min(2).max(120).describe("Target server resource ID.")
1562
+ },
1563
+ annotations: WRITE_REMOTE_ANNOTATIONS
1564
+ }, async ({ resourceId }) => {
1565
+ if (readOnly) {
1566
+ return readOnlyBlockedResult("cloud_server_vnc_console");
1567
+ }
1568
+ const endpoint = `/ncloud/sso/servers/${encodeURIComponent(resourceId)}/console`;
1569
+ const resp = await httpClient.request({
1570
+ target: "core",
1571
+ method: "POST",
1572
+ path: endpoint,
1573
+ requireAuth: true,
1574
+ body: {}
1575
+ });
1576
+ if (!resp.ok) {
1577
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to open VNC console.", resp.data);
1578
+ }
1579
+ return jsonToolResult({
1580
+ ok: true,
1581
+ latencyMs: resp.latencyMs,
1582
+ console: resp.data
1583
+ });
1584
+ });
1585
+ }
1586
+ // 36. cloud_snapshots_list
1587
+ server.registerTool("cloud_snapshots_list", {
1588
+ title: "List Paid Server Snapshots & Pricing",
1589
+ description: "Lists customer-private S3 vaulted snapshots and transparent TRY pricing for a server (GET /ncloud/sso/servers/:id/snapshots).",
1590
+ inputSchema: {
1591
+ serverId: z.string().trim().min(2).max(120).describe("Target server resource ID.")
1592
+ },
1593
+ annotations: READ_ONLY_REMOTE_ANNOTATIONS
1594
+ }, async ({ serverId }) => {
1595
+ const endpoint = `/ncloud/sso/servers/${encodeURIComponent(serverId)}/snapshots`;
1596
+ const resp = await httpClient.request({
1597
+ target: "core",
1598
+ method: "GET",
1599
+ path: endpoint,
1600
+ requireAuth: true
1601
+ });
1602
+ if (!resp.ok) {
1603
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to list snapshots.", resp.data);
1604
+ }
1605
+ return jsonToolResult({
1606
+ ok: true,
1607
+ latencyMs: resp.latencyMs,
1608
+ result: resp.data
1609
+ });
1610
+ });
1611
+ // 37. cloud_snapshot_create (WRITE - PAID)
1612
+ if (!readOnly) {
1613
+ server.registerTool("cloud_snapshot_create", {
1614
+ title: "Create Paid Server Snapshot (Private S3 Vault)",
1615
+ description: "Charges N - Buyment wallet and takes a server snapshot sealed in the customer-private S3 vault (POST /ncloud/sso/servers/:id/snapshots). Disabled in --read-only mode.",
1616
+ inputSchema: {
1617
+ serverId: z.string().trim().min(2).max(120).describe("Target server resource ID."),
1618
+ label: z.string().trim().min(2).max(80).optional().describe("Optional human-readable snapshot label."),
1619
+ notes: z.string().trim().max(240).optional().describe("Optional snapshot notes.")
1620
+ },
1621
+ annotations: WRITE_REMOTE_ANNOTATIONS
1622
+ }, async ({ serverId, label, notes }) => {
1623
+ if (readOnly) {
1624
+ return readOnlyBlockedResult("cloud_snapshot_create");
1625
+ }
1626
+ const endpoint = `/ncloud/sso/servers/${encodeURIComponent(serverId)}/snapshots`;
1627
+ const resp = await httpClient.request({
1628
+ target: "core",
1629
+ method: "POST",
1630
+ path: endpoint,
1631
+ requireAuth: true,
1632
+ body: {
1633
+ ...(label ? { label } : {}),
1634
+ ...(notes ? { notes } : {})
1635
+ }
1636
+ });
1637
+ if (!resp.ok) {
1638
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to create snapshot.", resp.data);
1639
+ }
1640
+ return jsonToolResult({
1641
+ ok: true,
1642
+ latencyMs: resp.latencyMs,
1643
+ result: resp.data
1644
+ });
1645
+ });
1646
+ }
1647
+ // 38. cloud_snapshot_restore (WRITE - DESTRUCTIVE)
1648
+ if (!readOnly) {
1649
+ server.registerTool("cloud_snapshot_restore", {
1650
+ title: "Restore Server Snapshot (Overwrites Disk)",
1651
+ description: "Restores a customer-private snapshot onto its server (POST /ncloud/sso/servers/:id/snapshots/:sid/restore). Requires confirm: true. Disabled in --read-only mode.",
1652
+ inputSchema: {
1653
+ serverId: z.string().trim().min(2).max(120).describe("Target server resource ID."),
1654
+ snapshotId: z.string().trim().min(2).max(120).describe("Target snapshot ID."),
1655
+ confirm: z.literal(true).describe("Must be true to confirm disk overwrite.")
1656
+ },
1657
+ annotations: {
1658
+ ...WRITE_REMOTE_ANNOTATIONS,
1659
+ destructiveHint: true
1660
+ }
1661
+ }, async ({ serverId, snapshotId, confirm }) => {
1662
+ if (readOnly) {
1663
+ return readOnlyBlockedResult("cloud_snapshot_restore");
1664
+ }
1665
+ const endpoint = `/ncloud/sso/servers/${encodeURIComponent(serverId)}/snapshots/${encodeURIComponent(snapshotId)}/restore`;
1666
+ const resp = await httpClient.request({
1667
+ target: "core",
1668
+ method: "POST",
1669
+ path: endpoint,
1670
+ requireAuth: true,
1671
+ body: { confirm }
1672
+ });
1673
+ if (!resp.ok) {
1674
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to restore snapshot.", resp.data);
1675
+ }
1676
+ return jsonToolResult({
1677
+ ok: true,
1678
+ latencyMs: resp.latencyMs,
1679
+ result: resp.data
1680
+ });
1681
+ });
1682
+ }
1683
+ // 39. cloud_snapshot_delete (WRITE)
1684
+ if (!readOnly) {
1685
+ server.registerTool("cloud_snapshot_delete", {
1686
+ title: "Delete Server Snapshot",
1687
+ description: "Deletes a server snapshot and removes its private S3 vault record (DELETE /ncloud/sso/servers/:id/snapshots/:sid). Disabled in --read-only mode.",
1688
+ inputSchema: {
1689
+ serverId: z.string().trim().min(2).max(120).describe("Target server resource ID."),
1690
+ snapshotId: z.string().trim().min(2).max(120).describe("Target snapshot ID."),
1691
+ confirm: z.literal(true).describe("Must be true to confirm irreversible snapshot deletion.")
1692
+ },
1693
+ annotations: {
1694
+ ...WRITE_REMOTE_ANNOTATIONS,
1695
+ destructiveHint: true
1696
+ }
1697
+ }, async ({ serverId, snapshotId }) => {
1698
+ if (readOnly) {
1699
+ return readOnlyBlockedResult("cloud_snapshot_delete");
1700
+ }
1701
+ const endpoint = `/ncloud/sso/servers/${encodeURIComponent(serverId)}/snapshots/${encodeURIComponent(snapshotId)}`;
1702
+ const resp = await httpClient.request({
1703
+ target: "core",
1704
+ method: "DELETE",
1705
+ path: endpoint,
1706
+ requireAuth: true
1707
+ });
1708
+ if (!resp.ok) {
1709
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to delete snapshot.", resp.data);
1710
+ }
1711
+ return jsonToolResult({
1712
+ ok: true,
1713
+ latencyMs: resp.latencyMs,
1714
+ result: resp.data
1715
+ });
1716
+ });
1717
+ }
1718
+ // 40. cloud_delete_resource (WRITE)
1719
+ if (!readOnly) {
1720
+ server.registerTool("cloud_delete_resource", {
1721
+ title: "Terminate N - Cloud Resource",
1722
+ description: "Terminates a cloud server or resource through N - Cloud control plane (DELETE /ncloud/sso/resources/:id). Disabled in --read-only mode.",
1723
+ inputSchema: {
1724
+ resourceId: z.string().trim().min(2).max(120).describe("Target cloud resource ID."),
1725
+ confirm: z.literal(true).describe("Must be true to confirm irreversible resource termination.")
1726
+ },
1727
+ annotations: {
1728
+ ...WRITE_REMOTE_ANNOTATIONS,
1729
+ destructiveHint: true
1730
+ }
1731
+ }, async ({ resourceId }) => {
1732
+ if (readOnly) {
1733
+ return readOnlyBlockedResult("cloud_delete_resource");
1734
+ }
1735
+ const endpoint = `/ncloud/sso/resources/${encodeURIComponent(resourceId)}`;
1736
+ const resp = await httpClient.request({
1737
+ target: "core",
1738
+ method: "DELETE",
1739
+ path: endpoint,
1740
+ requireAuth: true
1741
+ });
1742
+ if (!resp.ok) {
1743
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to terminate resource.", resp.data);
1744
+ }
1745
+ return jsonToolResult({
1746
+ ok: true,
1747
+ latencyMs: resp.latencyMs,
1748
+ result: resp.data
1749
+ });
1750
+ });
1751
+ }
1752
+ // 41. cloud_container_scale (WRITE)
1753
+ if (!readOnly) {
1754
+ server.registerTool("cloud_container_scale", {
1755
+ title: "Scale N - Cloud Container Service",
1756
+ description: "Scales a NC - Flux / NC - Hive container service replicas count (POST /ncloud/sso/containers/:id/scale). Disabled in --read-only mode.",
1757
+ inputSchema: {
1758
+ resourceId: z.string().trim().min(2).max(120).describe("Container resource ID."),
1759
+ serviceName: z.string().trim().min(1).max(80).describe("Service name inside the container environment."),
1760
+ replicas: z.number().int().min(0).max(25).describe("Desired replica count (0 stops service).")
1761
+ },
1762
+ annotations: WRITE_REMOTE_ANNOTATIONS
1763
+ }, async ({ resourceId, serviceName, replicas }) => {
1764
+ if (readOnly) {
1765
+ return readOnlyBlockedResult("cloud_container_scale");
1766
+ }
1767
+ const endpoint = `/ncloud/sso/containers/${encodeURIComponent(resourceId)}/scale`;
1768
+ const resp = await httpClient.request({
1769
+ target: "core",
1770
+ method: "POST",
1771
+ path: endpoint,
1772
+ requireAuth: true,
1773
+ body: { serviceName, replicas }
1774
+ });
1775
+ if (!resp.ok) {
1776
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to scale container.", resp.data);
1777
+ }
1778
+ return jsonToolResult({
1779
+ ok: true,
1780
+ latencyMs: resp.latencyMs,
1781
+ result: resp.data
1782
+ });
1783
+ });
1784
+ }
1785
+ // 42. cloud_container_restart (WRITE)
1786
+ if (!readOnly) {
1787
+ server.registerTool("cloud_container_restart", {
1788
+ title: "Restart N - Cloud Container Service",
1789
+ description: "Restarts a container service through N - Cloud (POST /ncloud/sso/containers/:id/restart). Disabled in --read-only mode.",
1790
+ inputSchema: {
1791
+ resourceId: z.string().trim().min(2).max(120).describe("Container resource ID."),
1792
+ serviceName: z.string().trim().min(1).max(80).describe("Service name.")
1793
+ },
1794
+ annotations: WRITE_REMOTE_ANNOTATIONS
1795
+ }, async ({ resourceId, serviceName }) => {
1796
+ if (readOnly) {
1797
+ return readOnlyBlockedResult("cloud_container_restart");
1798
+ }
1799
+ const endpoint = `/ncloud/sso/containers/${encodeURIComponent(resourceId)}/restart`;
1800
+ const resp = await httpClient.request({
1801
+ target: "core",
1802
+ method: "POST",
1803
+ path: endpoint,
1804
+ requireAuth: true,
1805
+ body: { serviceName }
1806
+ });
1807
+ if (!resp.ok) {
1808
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to restart container.", resp.data);
1809
+ }
1810
+ return jsonToolResult({
1811
+ ok: true,
1812
+ latencyMs: resp.latencyMs,
1813
+ result: resp.data
1814
+ });
1815
+ });
1816
+ }
1817
+ // 43. cloud_container_logs
1818
+ server.registerTool("cloud_container_logs", {
1819
+ title: "Get N - Cloud Container Service Logs",
1820
+ description: "Fetches recent container service logs through N - Cloud (GET /ncloud/sso/containers/:id/logs).",
1821
+ inputSchema: {
1822
+ resourceId: z.string().trim().min(2).max(120).describe("Container resource ID."),
1823
+ serviceName: z.string().trim().min(1).max(80).describe("Service name."),
1824
+ sinceMinutes: z.number().int().min(1).max(10080).optional().describe("Lookback minutes (default: 60)."),
1825
+ limit: z.number().int().min(1).max(1000).optional().describe("Max log lines (default: 200).")
1826
+ },
1827
+ annotations: READ_ONLY_REMOTE_ANNOTATIONS
1828
+ }, async ({ resourceId, serviceName, sinceMinutes, limit }) => {
1829
+ const endpoint = `/ncloud/sso/containers/${encodeURIComponent(resourceId)}/logs`;
1830
+ const resp = await httpClient.request({
1831
+ target: "core",
1832
+ method: "GET",
1833
+ path: endpoint,
1834
+ query: { serviceName, sinceMinutes, limit },
1835
+ requireAuth: true
1836
+ });
1837
+ if (!resp.ok) {
1838
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to fetch container logs.", resp.data);
1839
+ }
1840
+ return jsonToolResult({
1841
+ ok: true,
1842
+ latencyMs: resp.latencyMs,
1843
+ result: resp.data
1844
+ });
1845
+ });
1846
+ // 44. cloud_projects_list
1847
+ server.registerTool("cloud_projects_list", {
1848
+ title: "List N - Cloud Projects",
1849
+ description: "Lists N - Cloud projects grouping related cloud resources (GET /ncloud/sso/projects).",
1850
+ inputSchema: {},
1851
+ annotations: READ_ONLY_REMOTE_ANNOTATIONS
1852
+ }, async () => {
1853
+ const endpoint = "/ncloud/sso/projects";
1854
+ const resp = await httpClient.request({
1855
+ target: "core",
1856
+ method: "GET",
1857
+ path: endpoint,
1858
+ requireAuth: true
1859
+ });
1860
+ if (!resp.ok) {
1861
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to list cloud projects.", resp.data);
1862
+ }
1863
+ return jsonToolResult({
1864
+ ok: true,
1865
+ latencyMs: resp.latencyMs,
1866
+ result: resp.data
1867
+ });
1868
+ });
1869
+ // 45. cloud_project_create (WRITE)
1870
+ if (!readOnly) {
1871
+ server.registerTool("cloud_project_create", {
1872
+ title: "Create N - Cloud Project",
1873
+ description: "Creates a new N - Cloud project (POST /ncloud/sso/projects). Disabled in --read-only mode.",
1874
+ inputSchema: {
1875
+ name: z.string().trim().min(2).max(80).describe("Project name."),
1876
+ environment: z.enum(["production", "staging", "development", "personal"]).optional().describe("Environment tag."),
1877
+ description: z.string().trim().max(280).optional().describe("Optional project description.")
1878
+ },
1879
+ annotations: WRITE_REMOTE_ANNOTATIONS
1880
+ }, async ({ name, environment, description }) => {
1881
+ if (readOnly) {
1882
+ return readOnlyBlockedResult("cloud_project_create");
1883
+ }
1884
+ const endpoint = "/ncloud/sso/projects";
1885
+ const resp = await httpClient.request({
1886
+ target: "core",
1887
+ method: "POST",
1888
+ path: endpoint,
1889
+ requireAuth: true,
1890
+ body: {
1891
+ name,
1892
+ environment: environment || "production",
1893
+ ...(description ? { description } : {})
1894
+ }
1895
+ });
1896
+ if (!resp.ok) {
1897
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to create project.", resp.data);
1898
+ }
1899
+ return jsonToolResult({
1900
+ ok: true,
1901
+ latencyMs: resp.latencyMs,
1902
+ result: resp.data
1903
+ });
1904
+ });
1905
+ }
1906
+ // 46. cloud_resource_update_meta (WRITE)
1907
+ if (!readOnly) {
1908
+ server.registerTool("cloud_resource_update_meta", {
1909
+ title: "Update N - Cloud Resource Project & Tags",
1910
+ description: "Assigns a project and/or tags to a cloud resource (PATCH /ncloud/sso/resources/:id/meta). Disabled in --read-only mode.",
1911
+ inputSchema: {
1912
+ resourceId: z.string().trim().min(2).max(120).describe("Target resource ID."),
1913
+ projectId: z.string().trim().nullable().optional().describe("Target project ID or null to unassign."),
1914
+ tags: z.array(z.string().trim().max(40)).max(15).optional().describe("List of resource tags.")
1915
+ },
1916
+ annotations: WRITE_REMOTE_ANNOTATIONS
1917
+ }, async ({ resourceId, projectId, tags }) => {
1918
+ if (readOnly) {
1919
+ return readOnlyBlockedResult("cloud_resource_update_meta");
1920
+ }
1921
+ const endpoint = `/ncloud/sso/resources/${encodeURIComponent(resourceId)}/meta`;
1922
+ const resp = await httpClient.request({
1923
+ target: "core",
1924
+ method: "PATCH",
1925
+ path: endpoint,
1926
+ requireAuth: true,
1927
+ body: {
1928
+ ...(projectId !== undefined ? { projectId } : {}),
1929
+ ...(tags !== undefined ? { tags } : {})
1930
+ }
1931
+ });
1932
+ if (!resp.ok) {
1933
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to update resource metadata.", resp.data);
1934
+ }
1935
+ return jsonToolResult({
1936
+ ok: true,
1937
+ latencyMs: resp.latencyMs,
1938
+ result: resp.data
1939
+ });
1940
+ });
1941
+ }
1942
+ // 47. cloud_activity_logs
1943
+ server.registerTool("cloud_activity_logs", {
1944
+ title: "List N - Cloud Action & Audit Logs",
1945
+ description: "Fetches immutable cloud action and audit logs across Web, ncli, nmcp, and NİBGAT Managed Ops (GET /ncloud/sso/logs).",
1946
+ inputSchema: {
1947
+ resourceId: z.string().trim().max(120).optional().describe("Optional filter by resource ID."),
1948
+ channel: z.enum(["web", "ncli", "nmcp"]).optional().describe("Optional filter by origin channel."),
1949
+ limit: z.number().int().min(1).max(200).optional().describe("Max log entries (default: 50).")
1950
+ },
1951
+ annotations: READ_ONLY_REMOTE_ANNOTATIONS
1952
+ }, async ({ resourceId, channel, limit }) => {
1953
+ const endpoint = "/ncloud/sso/logs";
1954
+ const resp = await httpClient.request({
1955
+ target: "core",
1956
+ method: "GET",
1957
+ path: endpoint,
1958
+ query: { resourceId, channel, limit },
1959
+ requireAuth: true
1960
+ });
1961
+ if (!resp.ok) {
1962
+ return apiErrorResult(endpoint, resp.status, resp.errorMessage || "Failed to fetch cloud audit logs.", resp.data);
1963
+ }
1964
+ return jsonToolResult({
1965
+ ok: true,
1966
+ latencyMs: resp.latencyMs,
1967
+ result: resp.data
1968
+ });
1969
+ });
1322
1970
  };
1323
1971
  //# sourceMappingURL=index.js.map