@chkp/policy-insights-mcp 0.2.0 → 0.3.2

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
@@ -986,9 +986,10 @@ var ClientResponse = class {
986
986
  }
987
987
  };
988
988
  var APIClientBase = class {
989
- constructor(authToken = "", tokenType = TokenType.API_KEY) {
989
+ constructor(authToken = "", tokenType = TokenType.API_KEY, cloudConnected = false) {
990
990
  this.authToken = authToken;
991
991
  this.tokenType = tokenType;
992
+ this.cloudConnected = cloudConnected;
992
993
  this.sid = null;
993
994
  this.sessionTimeout = null;
994
995
  this.sessionStart = null;
@@ -1011,6 +1012,10 @@ var APIClientBase = class {
1011
1012
  if (this.sid) {
1012
1013
  headers["X-chkp-sid"] = this.sid;
1013
1014
  }
1015
+ if (this.cloudConnected && this.tokenType === TokenType.CI_TOKEN) {
1016
+ headers["Authorization"] = `Bearer ${this.authToken}`;
1017
+ headers["CLOUD-INFRA-TOKEN"] = this.authToken;
1018
+ }
1014
1019
  return headers;
1015
1020
  }
1016
1021
  /**
@@ -1114,12 +1119,15 @@ var APIClientBase = class {
1114
1119
  const now = Date.now();
1115
1120
  return now > this.sessionStart + (this.sessionTimeout - 5) * 1e3;
1116
1121
  }
1122
+ getHeadersForLogin() {
1123
+ return { "Content-Type": "application/json" };
1124
+ }
1117
1125
  /**
1118
1126
  * Login to the API using the API key
1119
1127
  */
1120
1128
  async login() {
1121
1129
  const apiTokenHeader = this.tokenType === TokenType.API_KEY ? "api-key" : "ci-token";
1122
- const loginResp = await this.makeRequest(this.getHost(), "POST", "login", { [apiTokenHeader]: this.authToken }, { "Content-Type": "application/json" });
1130
+ const loginResp = await this.makeRequest(this.getHost(), "POST", "login", { [apiTokenHeader]: this.authToken }, this.getHeadersForLogin());
1123
1131
  if (loginResp.status !== 200 || !loginResp.response || !loginResp.response.sid) {
1124
1132
  throw loginResp;
1125
1133
  }
@@ -1193,13 +1201,20 @@ var APIClientBase = class {
1193
1201
  }
1194
1202
  };
1195
1203
  var SmartOneCloudAPIClient = class extends APIClientBase {
1196
- constructor(authToken, tokenType, s1cUrl) {
1197
- super(authToken, tokenType);
1204
+ constructor(authToken, tokenType, s1cUrl, cloudConnected = false) {
1205
+ super(authToken, tokenType, cloudConnected);
1198
1206
  this.s1cUrl = s1cUrl;
1199
1207
  }
1200
1208
  getHost() {
1201
1209
  return this.s1cUrl;
1202
1210
  }
1211
+ getHeadersForLogin() {
1212
+ const headers = { "Content-Type": "application/json" };
1213
+ if (this.cloudConnected && this.tokenType === TokenType.CI_TOKEN) {
1214
+ headers["Authorization"] = `Bearer ${this.authToken}`;
1215
+ }
1216
+ return headers;
1217
+ }
1203
1218
  };
1204
1219
  var OnPremAPIClient = class extends APIClientBase {
1205
1220
  constructor(apiKey, managementHost, managementPort = "443", username, password) {
@@ -2779,7 +2794,7 @@ var APIManagerForAPIKey = class extends APIManagerBase {
2779
2794
  }
2780
2795
  throw new Error("API key or cloud infrastructure token is required");
2781
2796
  }
2782
- return new this(SmartOneCloudAPIClient.create(key, keyType, args.s1cUrl));
2797
+ return new this(SmartOneCloudAPIClient.create(key, keyType, args.s1cUrl, !!args.cloudConnected));
2783
2798
  }
2784
2799
  };
2785
2800
 
@@ -2818,7 +2833,7 @@ var Settings = class _Settings {
2818
2833
  return "STG";
2819
2834
  return void 0;
2820
2835
  }
2821
- constructor({ apiKey = process.env.API_KEY, username = process.env.USERNAME, password = process.env.PASSWORD, s1cUrl = process.env.S1C_URL, managementHost = process.env.MANAGEMENT_HOST, managementPort = process.env.MANAGEMENT_PORT || "443", cloudInfraToken = process.env.CLOUD_INFRA_TOKEN, clientId = process.env.CLIENT_ID, secretKey = process.env.SECRET_KEY, region = process.env.REGION || "EU", devPort = process.env.DEV_PORT || "8006", gatewayUrl } = {}) {
2836
+ constructor({ apiKey = process.env.API_KEY, username = process.env.USERNAME, password = process.env.PASSWORD, s1cUrl = process.env.S1C_URL, managementHost = process.env.MANAGEMENT_HOST, managementPort = process.env.MANAGEMENT_PORT || "443", cloudInfraToken = process.env.CLOUD_INFRA_TOKEN, cloudConnected = process.env.CLOUD_CONNECTED === "true", clientId = process.env.CLIENT_ID, secretKey = process.env.SECRET_KEY, region = process.env.REGION || "EU", devPort = process.env.DEV_PORT || "8006", gatewayUrl } = {}) {
2822
2837
  this.region = "EU";
2823
2838
  this.devPort = "8006";
2824
2839
  this.gatewayUrl = "";
@@ -2845,6 +2860,7 @@ var Settings = class _Settings {
2845
2860
  this.managementHost = managementHost;
2846
2861
  this.managementPort = managementPort;
2847
2862
  this.cloudInfraToken = cloudInfraToken;
2863
+ this.cloudConnected = cloudConnected;
2848
2864
  this.clientId = clientId;
2849
2865
  this.secretKey = secretKey;
2850
2866
  this.region = this.normalizeRegion(region) || "EU";
@@ -2868,7 +2884,7 @@ var Settings = class _Settings {
2868
2884
  * Check if the provided string is a valid region
2869
2885
  */
2870
2886
  isValidRegion(region) {
2871
- return ["EU", "US", "STG", "LOCAL"].includes(region.toUpperCase());
2887
+ return ["EU", "US", "STG", "DEV", "LOCAL"].includes(region.toUpperCase());
2872
2888
  }
2873
2889
  /**
2874
2890
  * Get the base gateway URL for a given region
@@ -2880,6 +2896,7 @@ var Settings = class _Settings {
2880
2896
  case "US":
2881
2897
  return "https://cloudinfra-gw-us.portal.checkpoint.com";
2882
2898
  case "STG":
2899
+ case "DEV":
2883
2900
  case "LOCAL":
2884
2901
  return "https://dev-cloudinfra-gw.kube1.iaas.checkpoint.com";
2885
2902
  default:
@@ -2976,6 +2993,7 @@ var Settings = class _Settings {
2976
2993
  managementHost: args.managementHost,
2977
2994
  managementPort: args.managementPort,
2978
2995
  cloudInfraToken: args.cloudInfraToken,
2996
+ cloudConnected: args.cloudConnected,
2979
2997
  clientId: args.clientId,
2980
2998
  secretKey: args.secretKey,
2981
2999
  region: typeof args.region === "string" ? args.region.trim().toUpperCase() : void 0,
@@ -3001,6 +3019,7 @@ var Settings = class _Settings {
3001
3019
  managementHost: getHeaderValue(headers, "MANAGEMENT-HOST"),
3002
3020
  managementPort: getHeaderValue(headers, "MANAGEMENT-PORT"),
3003
3021
  cloudInfraToken: getHeaderValue(headers, "CLOUD-INFRA-TOKEN"),
3022
+ cloudConnected: getHeaderValue(headers, "CLOUD-CONNECTED"),
3004
3023
  clientId: getHeaderValue(headers, "CLIENT-ID"),
3005
3024
  secretKey: getHeaderValue(headers, "SECRET-KEY"),
3006
3025
  region: getHeaderValue(headers, "REGION"),
@@ -3033,6 +3052,7 @@ var Settings = class _Settings {
3033
3052
  managementHost: extractedValues.managementHost,
3034
3053
  managementPort: extractedValues.managementPort,
3035
3054
  cloudInfraToken: extractedValues.cloudInfraToken,
3055
+ cloudConnected: extractedValues.cloudConnected === "true",
3036
3056
  clientId: extractedValues.clientId,
3037
3057
  secretKey: extractedValues.secretKey,
3038
3058
  region: extractedValues.region?.toUpperCase(),
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chkp/policy-insights-mcp",
3
- "version": "0.2.0",
3
+ "version": "0.3.2",
4
4
  "bin": {
5
5
  "policy-insights-mcp": "dist/index.js"
6
6
  },
@@ -20,9 +20,13 @@
20
20
  "build:bundle": "node ../../bundle-mcp.js",
21
21
  "build:tsc": "npx tsc && npx shx chmod +x ./dist/index.js && npx shx cp src/server-config.json dist/",
22
22
  "dev": "tsc --watch",
23
- "start": "node dist/index.js"
23
+ "start": "node dist/index.js",
24
+ "prepack": "node ../../scripts/strip-bundled-deps.js",
25
+ "postpack": "node ../../scripts/strip-bundled-deps.js restore"
24
26
  },
25
27
  "dependencies": {
28
+ "@chkp/mcp-utils": "*",
29
+ "@chkp/quantum-infra": "*",
26
30
  "@modelcontextprotocol/sdk": "^1.26.0",
27
31
  "axios": "^1.13.5",
28
32
  "commander": "^13.1.0",
@@ -30,8 +34,6 @@
30
34
  "zod": "^3.22.4"
31
35
  },
32
36
  "devDependencies": {
33
- "@chkp/mcp-utils": "*",
34
- "@chkp/quantum-infra": "*",
35
37
  "@types/node": "^22.15.2",
36
38
  "@typescript-eslint/eslint-plugin": "^8.38.0",
37
39
  "@typescript-eslint/parser": "^8.38.0",
@@ -23,6 +23,13 @@
23
23
  "type": "string",
24
24
  "hidden": true
25
25
  },
26
+ {
27
+ "flag": "--cloud-connected",
28
+ "description": "Enable cloud-connected mode",
29
+ "env": "CLOUD_CONNECTED",
30
+ "type": "boolean",
31
+ "hidden": true
32
+ },
26
33
  {
27
34
  "flag": "--username <username>",
28
35
  "description": "Username for on-prem authentication",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chkp/policy-insights-mcp",
3
- "version": "0.2.0",
3
+ "version": "0.3.2",
4
4
  "bin": {
5
5
  "policy-insights-mcp": "dist/index.js"
6
6
  },
@@ -20,7 +20,9 @@
20
20
  "build:bundle": "node ../../bundle-mcp.js",
21
21
  "build:tsc": "npx tsc && npx shx chmod +x ./dist/index.js && npx shx cp src/server-config.json dist/",
22
22
  "dev": "tsc --watch",
23
- "start": "node dist/index.js"
23
+ "start": "node dist/index.js",
24
+ "prepack": "node ../../scripts/strip-bundled-deps.js",
25
+ "postpack": "node ../../scripts/strip-bundled-deps.js restore"
24
26
  },
25
27
  "dependencies": {
26
28
  "@modelcontextprotocol/sdk": "^1.26.0",
@@ -30,8 +32,6 @@
30
32
  "zod": "^3.24.4"
31
33
  },
32
34
  "devDependencies": {
33
- "@chkp/mcp-utils": "*",
34
- "@chkp/quantum-infra": "*",
35
35
  "@types/node": "^22.15.2",
36
36
  "@typescript-eslint/eslint-plugin": "^8.38.0",
37
37
  "@typescript-eslint/parser": "^8.38.0",
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@chkp/policy-insights-mcp",
3
+ "version": "0.3.2",
4
+ "bin": {
5
+ "policy-insights-mcp": "dist/index.js"
6
+ },
7
+ "description": "Official MCP server for Check Point Policy Insights",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/CheckPointSW/mcp-servers.git",
11
+ "directory": "packages/policy-insights"
12
+ },
13
+ "license": "MIT",
14
+ "type": "module",
15
+ "main": "dist/index.js",
16
+ "types": "dist/index.d.ts",
17
+ "scripts": {
18
+ "clean": "rimraf dist",
19
+ "build": "npm run build:bundle && npx shx chmod +x ./dist/index.js && npx shx cp src/server-config.json dist/",
20
+ "build:bundle": "node ../../bundle-mcp.js",
21
+ "build:tsc": "npx tsc && npx shx chmod +x ./dist/index.js && npx shx cp src/server-config.json dist/",
22
+ "dev": "tsc --watch",
23
+ "start": "node dist/index.js",
24
+ "prepack": "node ../../scripts/strip-bundled-deps.js",
25
+ "postpack": "node ../../scripts/strip-bundled-deps.js restore"
26
+ },
27
+ "dependencies": {
28
+ "@chkp/mcp-utils": "*",
29
+ "@chkp/quantum-infra": "*",
30
+ "@modelcontextprotocol/sdk": "^1.26.0",
31
+ "commander": "^13.1.0",
32
+ "axios": "^1.13.5",
33
+ "node-machine-id": "^1.1.12",
34
+ "zod": "^3.24.4"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "^22.15.2",
38
+ "@typescript-eslint/eslint-plugin": "^8.38.0",
39
+ "@typescript-eslint/parser": "^8.38.0",
40
+ "eslint": "^8.57.0",
41
+ "eslint-config-prettier": "^9.1.0",
42
+ "eslint-plugin-prettier": "^5.2.1",
43
+ "prettier": "^3.6.2",
44
+ "typescript": "^5.8.3"
45
+ },
46
+ "engines": {
47
+ "node": ">=20.0.0"
48
+ },
49
+ "keywords": [],
50
+ "author": ""
51
+ }