@chkp/documentation-mcp 1.4.9 → 1.4.12
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 +137 -72
- package/dist/package.json +1 -1
- package/package.json +1 -1
- package/package.json.bak +1 -1
package/dist/index.js
CHANGED
|
@@ -368,6 +368,11 @@ var init_ui_dialog = __esm({
|
|
|
368
368
|
// src/index.ts
|
|
369
369
|
import { z } from "zod";
|
|
370
370
|
|
|
371
|
+
// ../mcp-utils/dist/cli-options.js
|
|
372
|
+
function booleanOptionDefault(envValue, optionDefault) {
|
|
373
|
+
return envValue === "true" || optionDefault === "true";
|
|
374
|
+
}
|
|
375
|
+
|
|
371
376
|
// ../mcp-utils/dist/launcher.js
|
|
372
377
|
import { Command } from "commander";
|
|
373
378
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
@@ -533,7 +538,96 @@ var SettingsManager = class _SettingsManager {
|
|
|
533
538
|
};
|
|
534
539
|
SettingsManager.globalDebugState = void 0;
|
|
535
540
|
|
|
541
|
+
// ../mcp-utils/dist/telemetry.js
|
|
542
|
+
import machineIdPkg from "node-machine-id";
|
|
543
|
+
import { createHash } from "crypto";
|
|
544
|
+
var { machineIdSync } = machineIdPkg;
|
|
545
|
+
var machineId = null;
|
|
546
|
+
var hashedMachineId = null;
|
|
547
|
+
var transportType = "stdio";
|
|
548
|
+
function setTransportType(type) {
|
|
549
|
+
transportType = type;
|
|
550
|
+
}
|
|
551
|
+
function isTelemetryDisabled() {
|
|
552
|
+
return process.env.TELEMETRY_DISABLED === "true" || process.env.TELEMETRY_DISABLED === "1";
|
|
553
|
+
}
|
|
554
|
+
function getTelemetryUrl() {
|
|
555
|
+
return process.env.TELEMETRY_URL || "https://metrics.security.ai.checkpoint.com/api/v1/metrics/collect";
|
|
556
|
+
}
|
|
557
|
+
function hashString(input) {
|
|
558
|
+
return createHash("sha256").update(input).digest("hex");
|
|
559
|
+
}
|
|
560
|
+
function getMachineId() {
|
|
561
|
+
if (!machineId) {
|
|
562
|
+
try {
|
|
563
|
+
machineId = machineIdSync();
|
|
564
|
+
} catch (error) {
|
|
565
|
+
console.warn("Failed to get machine ID for telemetry:", error);
|
|
566
|
+
machineId = "unknown";
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
return machineId;
|
|
570
|
+
}
|
|
571
|
+
function getHashedMachineId() {
|
|
572
|
+
if (!hashedMachineId) {
|
|
573
|
+
hashedMachineId = hashString(getMachineId());
|
|
574
|
+
}
|
|
575
|
+
return hashedMachineId;
|
|
576
|
+
}
|
|
577
|
+
function calculateChecksum(mcpName, toolName, machineId2, clientVersion) {
|
|
578
|
+
const data = mcpName + machineId2.slice(0, 16) + toolName + clientVersion;
|
|
579
|
+
return hashString(data);
|
|
580
|
+
}
|
|
581
|
+
async function trackToolCall(mcpName, toolName, clientVersion, extra) {
|
|
582
|
+
if (isTelemetryDisabled()) {
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
try {
|
|
586
|
+
const machineId2 = getHashedMachineId();
|
|
587
|
+
const checksum = calculateChecksum(mcpName, toolName, machineId2, clientVersion);
|
|
588
|
+
fetch(getTelemetryUrl(), {
|
|
589
|
+
method: "POST",
|
|
590
|
+
headers: { "Content-Type": "application/json" },
|
|
591
|
+
body: JSON.stringify({
|
|
592
|
+
mcp_name: mcpName,
|
|
593
|
+
tool_name: toolName,
|
|
594
|
+
machine_id: machineId2,
|
|
595
|
+
client_version: clientVersion,
|
|
596
|
+
transport_type: transportType,
|
|
597
|
+
checksum
|
|
598
|
+
})
|
|
599
|
+
}).catch(() => {
|
|
600
|
+
});
|
|
601
|
+
} catch (error) {
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
|
|
536
605
|
// ../mcp-utils/dist/launcher.js
|
|
606
|
+
function optionKey(flag) {
|
|
607
|
+
const long = flag.split(/[,\s]+/).find((part) => part.startsWith("--"));
|
|
608
|
+
if (!long)
|
|
609
|
+
return void 0;
|
|
610
|
+
const negated = long.startsWith("--no-");
|
|
611
|
+
return {
|
|
612
|
+
key: long.replace(/^--(no-)?/, "").replace(/-([a-z])/g, (_match, char) => char.toUpperCase()),
|
|
613
|
+
negated
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
function mirrorBooleanFlagsToEnv(config, options) {
|
|
617
|
+
for (const option of config.options) {
|
|
618
|
+
if (option.type !== "boolean" || !option.env)
|
|
619
|
+
continue;
|
|
620
|
+
const derived = optionKey(option.flag);
|
|
621
|
+
if (!derived)
|
|
622
|
+
continue;
|
|
623
|
+
if (derived.negated) {
|
|
624
|
+
throw new Error(`Option '${option.flag}' in the configuration for '${config.name}' is a negatable flag paired with env var '${option.env}', which cannot be mirrored automatically: commander keys it as '${derived.key}' and inverts its meaning, so whether the flag being present should set '${option.env}' to 'true' or 'false' depends on how that variable is named. Mirror it explicitly in launchMCPServer instead, the way --no-telemetry does for TELEMETRY_DISABLED.`);
|
|
625
|
+
}
|
|
626
|
+
if (options[derived.key] === true) {
|
|
627
|
+
process.env[option.env] = "true";
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
537
631
|
async function launchMCPServer(configPath, serverModule2) {
|
|
538
632
|
const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
539
633
|
const program = new Command();
|
|
@@ -544,7 +638,7 @@ async function launchMCPServer(configPath, serverModule2) {
|
|
|
544
638
|
const envValue = option.env ? process.env[option.env] : void 0;
|
|
545
639
|
const defaultValue = envValue || option.default;
|
|
546
640
|
if (option.type === "boolean") {
|
|
547
|
-
const boolDefault = envValue
|
|
641
|
+
const boolDefault = booleanOptionDefault(envValue, option.default);
|
|
548
642
|
program.option(option.flag, option.description, boolDefault);
|
|
549
643
|
} else {
|
|
550
644
|
program.option(option.flag, option.description, defaultValue);
|
|
@@ -568,6 +662,7 @@ async function launchMCPServer(configPath, serverModule2) {
|
|
|
568
662
|
if (options.telemetryUrl) {
|
|
569
663
|
process.env.TELEMETRY_URL = options.telemetryUrl;
|
|
570
664
|
}
|
|
665
|
+
mirrorBooleanFlagsToEnv(config, options);
|
|
571
666
|
if (!serverModule2.settingsManager) {
|
|
572
667
|
throw new Error("ServerModule must have a settingsManager. Create it with createServerModule.");
|
|
573
668
|
}
|
|
@@ -576,11 +671,13 @@ async function launchMCPServer(configPath, serverModule2) {
|
|
|
576
671
|
console.error("[launchMCPServer] Applying tool policy before connecting");
|
|
577
672
|
serverModule2.server.applyToolPolicy();
|
|
578
673
|
}
|
|
579
|
-
const
|
|
674
|
+
const transportType2 = (options.transport || process.env.MCP_TRANSPORT_TYPE || "stdio").toLowerCase() === "http" ? "http" : "stdio";
|
|
580
675
|
const transportPort = options.transportPort ? parseInt(options.transportPort, 10) : process.env.MCP_TRANSPORT_PORT ? parseInt(process.env.MCP_TRANSPORT_PORT, 10) : 3e3;
|
|
581
|
-
if (
|
|
676
|
+
if (transportType2 === "http") {
|
|
677
|
+
setTransportType("http");
|
|
582
678
|
await launchHTTPServer(config, serverModule2, transportPort);
|
|
583
679
|
} else {
|
|
680
|
+
setTransportType("stdio");
|
|
584
681
|
const transport = new StdioServerTransport();
|
|
585
682
|
const defaultSessionId = "default";
|
|
586
683
|
const sessionMetadata = {
|
|
@@ -1310,10 +1407,11 @@ function wrapServerWithTracking(server2, createServerFn) {
|
|
|
1310
1407
|
newServer[reg.method](...reg.args);
|
|
1311
1408
|
}
|
|
1312
1409
|
}
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1410
|
+
const toolPolicy = typeof server2.getToolPolicy === "function" ? server2.getToolPolicy() : void 0;
|
|
1411
|
+
if (toolPolicy && typeof newServer.setToolPolicy === "function") {
|
|
1412
|
+
newServer.setToolPolicy(toolPolicy);
|
|
1413
|
+
if (typeof newServer.applyToolPolicy === "function") {
|
|
1414
|
+
newServer.applyToolPolicy();
|
|
1317
1415
|
}
|
|
1318
1416
|
}
|
|
1319
1417
|
return newServer;
|
|
@@ -1352,65 +1450,6 @@ function createServerModule(server2, Settings2, pkg2, apiManagerClass, toolPolic
|
|
|
1352
1450
|
// ../mcp-utils/dist/index.js
|
|
1353
1451
|
init_ui_dialog();
|
|
1354
1452
|
|
|
1355
|
-
// ../mcp-utils/dist/telemetry.js
|
|
1356
|
-
import machineIdPkg from "node-machine-id";
|
|
1357
|
-
import { createHash } from "crypto";
|
|
1358
|
-
var { machineIdSync } = machineIdPkg;
|
|
1359
|
-
var machineId = null;
|
|
1360
|
-
var hashedMachineId = null;
|
|
1361
|
-
function isTelemetryDisabled() {
|
|
1362
|
-
return process.env.TELEMETRY_DISABLED === "true" || process.env.TELEMETRY_DISABLED === "1";
|
|
1363
|
-
}
|
|
1364
|
-
function getTelemetryUrl() {
|
|
1365
|
-
return process.env.TELEMETRY_URL || "https://metrics.security.ai.checkpoint.com/api/v1/metrics/collect";
|
|
1366
|
-
}
|
|
1367
|
-
function hashString(input) {
|
|
1368
|
-
return createHash("sha256").update(input).digest("hex");
|
|
1369
|
-
}
|
|
1370
|
-
function getMachineId() {
|
|
1371
|
-
if (!machineId) {
|
|
1372
|
-
try {
|
|
1373
|
-
machineId = machineIdSync();
|
|
1374
|
-
} catch (error) {
|
|
1375
|
-
console.warn("Failed to get machine ID for telemetry:", error);
|
|
1376
|
-
machineId = "unknown";
|
|
1377
|
-
}
|
|
1378
|
-
}
|
|
1379
|
-
return machineId;
|
|
1380
|
-
}
|
|
1381
|
-
function getHashedMachineId() {
|
|
1382
|
-
if (!hashedMachineId) {
|
|
1383
|
-
hashedMachineId = hashString(getMachineId());
|
|
1384
|
-
}
|
|
1385
|
-
return hashedMachineId;
|
|
1386
|
-
}
|
|
1387
|
-
function calculateChecksum(mcpName, toolName, machineId2, clientVersion) {
|
|
1388
|
-
const data = mcpName + machineId2.slice(0, 16) + toolName + clientVersion;
|
|
1389
|
-
return hashString(data);
|
|
1390
|
-
}
|
|
1391
|
-
async function trackToolCall(mcpName, toolName, clientVersion, extra) {
|
|
1392
|
-
if (isTelemetryDisabled()) {
|
|
1393
|
-
return;
|
|
1394
|
-
}
|
|
1395
|
-
try {
|
|
1396
|
-
const machineId2 = getHashedMachineId();
|
|
1397
|
-
const checksum = calculateChecksum(mcpName, toolName, machineId2, clientVersion);
|
|
1398
|
-
fetch(getTelemetryUrl(), {
|
|
1399
|
-
method: "POST",
|
|
1400
|
-
headers: { "Content-Type": "application/json" },
|
|
1401
|
-
body: JSON.stringify({
|
|
1402
|
-
mcp_name: mcpName,
|
|
1403
|
-
tool_name: toolName,
|
|
1404
|
-
machine_id: machineId2,
|
|
1405
|
-
client_version: clientVersion,
|
|
1406
|
-
checksum
|
|
1407
|
-
})
|
|
1408
|
-
}).catch(() => {
|
|
1409
|
-
});
|
|
1410
|
-
} catch (error) {
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
1453
|
// ../mcp-utils/dist/mcp-server.js
|
|
1415
1454
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
1416
1455
|
var CPMcpServer = class extends McpServer {
|
|
@@ -1428,35 +1467,61 @@ var CPMcpServer = class extends McpServer {
|
|
|
1428
1467
|
console.error("[CPMcpServer] Setting tool policy callback");
|
|
1429
1468
|
this.toolPolicyCallback = callback;
|
|
1430
1469
|
}
|
|
1470
|
+
/**
|
|
1471
|
+
* Get the tool policy callback, if one was set.
|
|
1472
|
+
*
|
|
1473
|
+
* Needed so the policy can be carried onto the per-session server instances
|
|
1474
|
+
* created for HTTP transport. A typed accessor keeps that transfer honest:
|
|
1475
|
+
* callers do not have to reach into the private field, where a misspelling
|
|
1476
|
+
* would go unnoticed by the compiler.
|
|
1477
|
+
*/
|
|
1478
|
+
getToolPolicy() {
|
|
1479
|
+
return this.toolPolicyCallback;
|
|
1480
|
+
}
|
|
1431
1481
|
/**
|
|
1432
1482
|
* Apply the tool policy by checking all registered tools
|
|
1433
1483
|
* This should be called after all tools are registered but before connecting
|
|
1484
|
+
*
|
|
1485
|
+
* Per-tool tracing is behind the debug flag. This used to run once per process
|
|
1486
|
+
* on the template server, where a line per tool was a cheap startup banner.
|
|
1487
|
+
* It now also runs per session under HTTP transport, so unconditional tracing
|
|
1488
|
+
* would scale stderr with sessions x tools and bury the summary. The summary
|
|
1489
|
+
* line always prints — it is the fact worth having for every session.
|
|
1434
1490
|
*/
|
|
1435
1491
|
applyToolPolicy() {
|
|
1492
|
+
const verbose = SettingsManager.globalDebugState === true || SettingsManager.globalDebugState === "true";
|
|
1436
1493
|
if (!this.toolPolicyCallback) {
|
|
1437
|
-
|
|
1494
|
+
if (verbose) {
|
|
1495
|
+
console.error("[CPMcpServer] No tool policy callback set, allowing all tools");
|
|
1496
|
+
}
|
|
1438
1497
|
return;
|
|
1439
1498
|
}
|
|
1440
|
-
console.error("[CPMcpServer] Applying tool policy");
|
|
1441
1499
|
const registeredTools = this._registeredTools;
|
|
1442
1500
|
if (!registeredTools || typeof registeredTools !== "object") {
|
|
1443
1501
|
console.error("[CPMcpServer] No tools registered yet");
|
|
1444
1502
|
return;
|
|
1445
1503
|
}
|
|
1446
1504
|
const toolNames = Object.keys(registeredTools);
|
|
1447
|
-
|
|
1505
|
+
if (verbose) {
|
|
1506
|
+
console.error(`[CPMcpServer] Applying tool policy`);
|
|
1507
|
+
console.error(`[CPMcpServer] Found ${toolNames.length} registered tools:`, toolNames);
|
|
1508
|
+
}
|
|
1448
1509
|
let enabledCount = 0;
|
|
1449
1510
|
let disabledCount = 0;
|
|
1450
1511
|
for (const [toolName, tool] of Object.entries(registeredTools)) {
|
|
1451
1512
|
const isAllowed = this.toolPolicyCallback(toolName);
|
|
1452
1513
|
if (!isAllowed) {
|
|
1453
|
-
|
|
1514
|
+
if (verbose) {
|
|
1515
|
+
console.error(`[CPMcpServer] Tool '${toolName}' is NOT allowed by policy - disabling`);
|
|
1516
|
+
}
|
|
1454
1517
|
if (typeof tool.disable === "function") {
|
|
1455
1518
|
tool.disable();
|
|
1456
1519
|
disabledCount++;
|
|
1457
1520
|
}
|
|
1458
1521
|
} else {
|
|
1459
|
-
|
|
1522
|
+
if (verbose) {
|
|
1523
|
+
console.error(`[CPMcpServer] Tool '${toolName}' is allowed by policy`);
|
|
1524
|
+
}
|
|
1460
1525
|
enabledCount++;
|
|
1461
1526
|
}
|
|
1462
1527
|
}
|
|
@@ -2061,7 +2126,7 @@ server.tool(
|
|
|
2061
2126
|
- cloudguard: CloudGuard - Comprehensive cloud security and compliance platform
|
|
2062
2127
|
- cloudguardnetwork: CloudGuard Network - Cloud network security solutions
|
|
2063
2128
|
- cloudnetworksecurity: CloudGuard Network Security - Advanced cloud network protection
|
|
2064
|
-
- appsec:
|
|
2129
|
+
- appsec: Check Point WAF - Web Application Firewall and application security
|
|
2065
2130
|
|
|
2066
2131
|
Endpoint & Device Security:
|
|
2067
2132
|
- mobile: Harmony Mobile - Mobile device security and threat protection
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
package/package.json.bak
CHANGED