@chkp/policy-insights-mcp 0.4.0 → 0.4.1

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
@@ -1771,6 +1771,70 @@ var SettingsManager = class _SettingsManager {
1771
1771
  };
1772
1772
  SettingsManager.globalDebugState = void 0;
1773
1773
 
1774
+ // ../mcp-utils/dist/telemetry.js
1775
+ import machineIdPkg from "node-machine-id";
1776
+ import { createHash } from "crypto";
1777
+ var { machineIdSync } = machineIdPkg;
1778
+ var machineId = null;
1779
+ var hashedMachineId = null;
1780
+ var transportType = "stdio";
1781
+ function setTransportType(type) {
1782
+ transportType = type;
1783
+ }
1784
+ function isTelemetryDisabled() {
1785
+ return process.env.TELEMETRY_DISABLED === "true" || process.env.TELEMETRY_DISABLED === "1";
1786
+ }
1787
+ function getTelemetryUrl() {
1788
+ return process.env.TELEMETRY_URL || "https://metrics.security.ai.checkpoint.com/api/v1/metrics/collect";
1789
+ }
1790
+ function hashString(input) {
1791
+ return createHash("sha256").update(input).digest("hex");
1792
+ }
1793
+ function getMachineId() {
1794
+ if (!machineId) {
1795
+ try {
1796
+ machineId = machineIdSync();
1797
+ } catch (error) {
1798
+ console.warn("Failed to get machine ID for telemetry:", error);
1799
+ machineId = "unknown";
1800
+ }
1801
+ }
1802
+ return machineId;
1803
+ }
1804
+ function getHashedMachineId() {
1805
+ if (!hashedMachineId) {
1806
+ hashedMachineId = hashString(getMachineId());
1807
+ }
1808
+ return hashedMachineId;
1809
+ }
1810
+ function calculateChecksum(mcpName, toolName, machineId2, clientVersion) {
1811
+ const data = mcpName + machineId2.slice(0, 16) + toolName + clientVersion;
1812
+ return hashString(data);
1813
+ }
1814
+ async function trackToolCall(mcpName, toolName, clientVersion, extra) {
1815
+ if (isTelemetryDisabled()) {
1816
+ return;
1817
+ }
1818
+ try {
1819
+ const machineId2 = getHashedMachineId();
1820
+ const checksum = calculateChecksum(mcpName, toolName, machineId2, clientVersion);
1821
+ fetch(getTelemetryUrl(), {
1822
+ method: "POST",
1823
+ headers: { "Content-Type": "application/json" },
1824
+ body: JSON.stringify({
1825
+ mcp_name: mcpName,
1826
+ tool_name: toolName,
1827
+ machine_id: machineId2,
1828
+ client_version: clientVersion,
1829
+ transport_type: transportType,
1830
+ checksum
1831
+ })
1832
+ }).catch(() => {
1833
+ });
1834
+ } catch (error) {
1835
+ }
1836
+ }
1837
+
1774
1838
  // ../mcp-utils/dist/launcher.js
1775
1839
  async function launchMCPServer(configPath, serverModule2) {
1776
1840
  const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
@@ -1814,11 +1878,13 @@ async function launchMCPServer(configPath, serverModule2) {
1814
1878
  console.error("[launchMCPServer] Applying tool policy before connecting");
1815
1879
  serverModule2.server.applyToolPolicy();
1816
1880
  }
1817
- const transportType = (options.transport || process.env.MCP_TRANSPORT_TYPE || "stdio").toLowerCase() === "http" ? "http" : "stdio";
1881
+ const transportType2 = (options.transport || process.env.MCP_TRANSPORT_TYPE || "stdio").toLowerCase() === "http" ? "http" : "stdio";
1818
1882
  const transportPort = options.transportPort ? parseInt(options.transportPort, 10) : process.env.MCP_TRANSPORT_PORT ? parseInt(process.env.MCP_TRANSPORT_PORT, 10) : 3e3;
1819
- if (transportType === "http") {
1883
+ if (transportType2 === "http") {
1884
+ setTransportType("http");
1820
1885
  await launchHTTPServer(config, serverModule2, transportPort);
1821
1886
  } else {
1887
+ setTransportType("stdio");
1822
1888
  const transport = new StdioServerTransport();
1823
1889
  const defaultSessionId = "default";
1824
1890
  const sessionMetadata = {
@@ -2590,65 +2656,6 @@ function createServerModule(server2, Settings2, pkg2, apiManagerClass, toolPolic
2590
2656
  // ../mcp-utils/dist/index.js
2591
2657
  init_ui_dialog();
2592
2658
 
2593
- // ../mcp-utils/dist/telemetry.js
2594
- import machineIdPkg from "node-machine-id";
2595
- import { createHash } from "crypto";
2596
- var { machineIdSync } = machineIdPkg;
2597
- var machineId = null;
2598
- var hashedMachineId = null;
2599
- function isTelemetryDisabled() {
2600
- return process.env.TELEMETRY_DISABLED === "true" || process.env.TELEMETRY_DISABLED === "1";
2601
- }
2602
- function getTelemetryUrl() {
2603
- return process.env.TELEMETRY_URL || "https://metrics.security.ai.checkpoint.com/api/v1/metrics/collect";
2604
- }
2605
- function hashString(input) {
2606
- return createHash("sha256").update(input).digest("hex");
2607
- }
2608
- function getMachineId() {
2609
- if (!machineId) {
2610
- try {
2611
- machineId = machineIdSync();
2612
- } catch (error) {
2613
- console.warn("Failed to get machine ID for telemetry:", error);
2614
- machineId = "unknown";
2615
- }
2616
- }
2617
- return machineId;
2618
- }
2619
- function getHashedMachineId() {
2620
- if (!hashedMachineId) {
2621
- hashedMachineId = hashString(getMachineId());
2622
- }
2623
- return hashedMachineId;
2624
- }
2625
- function calculateChecksum(mcpName, toolName, machineId2, clientVersion) {
2626
- const data = mcpName + machineId2.slice(0, 16) + toolName + clientVersion;
2627
- return hashString(data);
2628
- }
2629
- async function trackToolCall(mcpName, toolName, clientVersion, extra) {
2630
- if (isTelemetryDisabled()) {
2631
- return;
2632
- }
2633
- try {
2634
- const machineId2 = getHashedMachineId();
2635
- const checksum = calculateChecksum(mcpName, toolName, machineId2, clientVersion);
2636
- fetch(getTelemetryUrl(), {
2637
- method: "POST",
2638
- headers: { "Content-Type": "application/json" },
2639
- body: JSON.stringify({
2640
- mcp_name: mcpName,
2641
- tool_name: toolName,
2642
- machine_id: machineId2,
2643
- client_version: clientVersion,
2644
- checksum
2645
- })
2646
- }).catch(() => {
2647
- });
2648
- } catch (error) {
2649
- }
2650
- }
2651
-
2652
2659
  // ../mcp-utils/dist/mcp-server.js
2653
2660
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2654
2661
  var CPMcpServer = class extends McpServer {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chkp/policy-insights-mcp",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "bin": {
5
5
  "policy-insights-mcp": "dist/index.js"
6
6
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chkp/policy-insights-mcp",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "bin": {
5
5
  "policy-insights-mcp": "dist/index.js"
6
6
  },
package/package.json.bak CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chkp/policy-insights-mcp",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "bin": {
5
5
  "policy-insights-mcp": "dist/index.js"
6
6
  },