@chkp/policy-insights-mcp 0.1.1 → 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/CHANGELOG.md +6 -0
- package/dist/index.js +29 -19
- package/dist/package.json +6 -4
- package/dist/server-config.json +7 -0
- package/package.json +4 -4
- package/package.json.bak +51 -0
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -360,9 +360,6 @@ var init_ui_dialog = __esm({
|
|
|
360
360
|
}
|
|
361
361
|
});
|
|
362
362
|
|
|
363
|
-
// src/index.ts
|
|
364
|
-
import { z as z2 } from "zod";
|
|
365
|
-
|
|
366
363
|
// src/toolDefinitionMap.ts
|
|
367
364
|
var toolDefinitionMap = [
|
|
368
365
|
{
|
|
@@ -989,9 +986,10 @@ var ClientResponse = class {
|
|
|
989
986
|
}
|
|
990
987
|
};
|
|
991
988
|
var APIClientBase = class {
|
|
992
|
-
constructor(authToken = "", tokenType = TokenType.API_KEY) {
|
|
989
|
+
constructor(authToken = "", tokenType = TokenType.API_KEY, cloudConnected = false) {
|
|
993
990
|
this.authToken = authToken;
|
|
994
991
|
this.tokenType = tokenType;
|
|
992
|
+
this.cloudConnected = cloudConnected;
|
|
995
993
|
this.sid = null;
|
|
996
994
|
this.sessionTimeout = null;
|
|
997
995
|
this.sessionStart = null;
|
|
@@ -1014,6 +1012,10 @@ var APIClientBase = class {
|
|
|
1014
1012
|
if (this.sid) {
|
|
1015
1013
|
headers["X-chkp-sid"] = this.sid;
|
|
1016
1014
|
}
|
|
1015
|
+
if (this.cloudConnected && this.tokenType === TokenType.CI_TOKEN) {
|
|
1016
|
+
headers["Authorization"] = `Bearer ${this.authToken}`;
|
|
1017
|
+
headers["CLOUD-INFRA-TOKEN"] = this.authToken;
|
|
1018
|
+
}
|
|
1017
1019
|
return headers;
|
|
1018
1020
|
}
|
|
1019
1021
|
/**
|
|
@@ -1117,12 +1119,15 @@ var APIClientBase = class {
|
|
|
1117
1119
|
const now = Date.now();
|
|
1118
1120
|
return now > this.sessionStart + (this.sessionTimeout - 5) * 1e3;
|
|
1119
1121
|
}
|
|
1122
|
+
getHeadersForLogin() {
|
|
1123
|
+
return { "Content-Type": "application/json" };
|
|
1124
|
+
}
|
|
1120
1125
|
/**
|
|
1121
1126
|
* Login to the API using the API key
|
|
1122
1127
|
*/
|
|
1123
1128
|
async login() {
|
|
1124
1129
|
const apiTokenHeader = this.tokenType === TokenType.API_KEY ? "api-key" : "ci-token";
|
|
1125
|
-
const loginResp = await this.makeRequest(this.getHost(), "POST", "login", { [apiTokenHeader]: this.authToken },
|
|
1130
|
+
const loginResp = await this.makeRequest(this.getHost(), "POST", "login", { [apiTokenHeader]: this.authToken }, this.getHeadersForLogin());
|
|
1126
1131
|
if (loginResp.status !== 200 || !loginResp.response || !loginResp.response.sid) {
|
|
1127
1132
|
throw loginResp;
|
|
1128
1133
|
}
|
|
@@ -1196,13 +1201,20 @@ var APIClientBase = class {
|
|
|
1196
1201
|
}
|
|
1197
1202
|
};
|
|
1198
1203
|
var SmartOneCloudAPIClient = class extends APIClientBase {
|
|
1199
|
-
constructor(authToken, tokenType, s1cUrl) {
|
|
1200
|
-
super(authToken, tokenType);
|
|
1204
|
+
constructor(authToken, tokenType, s1cUrl, cloudConnected = false) {
|
|
1205
|
+
super(authToken, tokenType, cloudConnected);
|
|
1201
1206
|
this.s1cUrl = s1cUrl;
|
|
1202
1207
|
}
|
|
1203
1208
|
getHost() {
|
|
1204
1209
|
return this.s1cUrl;
|
|
1205
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
|
+
}
|
|
1206
1218
|
};
|
|
1207
1219
|
var OnPremAPIClient = class extends APIClientBase {
|
|
1208
1220
|
constructor(apiKey, managementHost, managementPort = "443", username, password) {
|
|
@@ -1654,18 +1666,11 @@ async function launchHTTPServer(config, serverModule2, port) {
|
|
|
1654
1666
|
} else if (req.url === "/health" || req.url === "/status") {
|
|
1655
1667
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
1656
1668
|
const sessionCount = serverModule2.sessionManager.getSessionCount();
|
|
1657
|
-
const sessions = serverModule2.sessionManager.getAllSessions().map((session) => ({
|
|
1658
|
-
id: session.sessionId,
|
|
1659
|
-
createdAt: session.createdAt,
|
|
1660
|
-
lastActive: session.lastActive
|
|
1661
|
-
// Don't include potentially sensitive metadata
|
|
1662
|
-
}));
|
|
1663
1669
|
res.end(JSON.stringify({
|
|
1664
1670
|
status: "ok",
|
|
1665
1671
|
server: config.name,
|
|
1666
1672
|
version: serverModule2.pkg.version,
|
|
1667
|
-
activeSessions: sessionCount
|
|
1668
|
-
sessions
|
|
1673
|
+
activeSessions: sessionCount
|
|
1669
1674
|
}));
|
|
1670
1675
|
} else {
|
|
1671
1676
|
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
@@ -2789,7 +2794,7 @@ var APIManagerForAPIKey = class extends APIManagerBase {
|
|
|
2789
2794
|
}
|
|
2790
2795
|
throw new Error("API key or cloud infrastructure token is required");
|
|
2791
2796
|
}
|
|
2792
|
-
return new this(SmartOneCloudAPIClient.create(key, keyType, args.s1cUrl));
|
|
2797
|
+
return new this(SmartOneCloudAPIClient.create(key, keyType, args.s1cUrl, !!args.cloudConnected));
|
|
2793
2798
|
}
|
|
2794
2799
|
};
|
|
2795
2800
|
|
|
@@ -2828,7 +2833,7 @@ var Settings = class _Settings {
|
|
|
2828
2833
|
return "STG";
|
|
2829
2834
|
return void 0;
|
|
2830
2835
|
}
|
|
2831
|
-
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 } = {}) {
|
|
2832
2837
|
this.region = "EU";
|
|
2833
2838
|
this.devPort = "8006";
|
|
2834
2839
|
this.gatewayUrl = "";
|
|
@@ -2855,6 +2860,7 @@ var Settings = class _Settings {
|
|
|
2855
2860
|
this.managementHost = managementHost;
|
|
2856
2861
|
this.managementPort = managementPort;
|
|
2857
2862
|
this.cloudInfraToken = cloudInfraToken;
|
|
2863
|
+
this.cloudConnected = cloudConnected;
|
|
2858
2864
|
this.clientId = clientId;
|
|
2859
2865
|
this.secretKey = secretKey;
|
|
2860
2866
|
this.region = this.normalizeRegion(region) || "EU";
|
|
@@ -2878,7 +2884,7 @@ var Settings = class _Settings {
|
|
|
2878
2884
|
* Check if the provided string is a valid region
|
|
2879
2885
|
*/
|
|
2880
2886
|
isValidRegion(region) {
|
|
2881
|
-
return ["EU", "US", "STG", "LOCAL"].includes(region.toUpperCase());
|
|
2887
|
+
return ["EU", "US", "STG", "DEV", "LOCAL"].includes(region.toUpperCase());
|
|
2882
2888
|
}
|
|
2883
2889
|
/**
|
|
2884
2890
|
* Get the base gateway URL for a given region
|
|
@@ -2890,6 +2896,7 @@ var Settings = class _Settings {
|
|
|
2890
2896
|
case "US":
|
|
2891
2897
|
return "https://cloudinfra-gw-us.portal.checkpoint.com";
|
|
2892
2898
|
case "STG":
|
|
2899
|
+
case "DEV":
|
|
2893
2900
|
case "LOCAL":
|
|
2894
2901
|
return "https://dev-cloudinfra-gw.kube1.iaas.checkpoint.com";
|
|
2895
2902
|
default:
|
|
@@ -2986,6 +2993,7 @@ var Settings = class _Settings {
|
|
|
2986
2993
|
managementHost: args.managementHost,
|
|
2987
2994
|
managementPort: args.managementPort,
|
|
2988
2995
|
cloudInfraToken: args.cloudInfraToken,
|
|
2996
|
+
cloudConnected: args.cloudConnected,
|
|
2989
2997
|
clientId: args.clientId,
|
|
2990
2998
|
secretKey: args.secretKey,
|
|
2991
2999
|
region: typeof args.region === "string" ? args.region.trim().toUpperCase() : void 0,
|
|
@@ -3011,6 +3019,7 @@ var Settings = class _Settings {
|
|
|
3011
3019
|
managementHost: getHeaderValue(headers, "MANAGEMENT-HOST"),
|
|
3012
3020
|
managementPort: getHeaderValue(headers, "MANAGEMENT-PORT"),
|
|
3013
3021
|
cloudInfraToken: getHeaderValue(headers, "CLOUD-INFRA-TOKEN"),
|
|
3022
|
+
cloudConnected: getHeaderValue(headers, "CLOUD-CONNECTED"),
|
|
3014
3023
|
clientId: getHeaderValue(headers, "CLIENT-ID"),
|
|
3015
3024
|
secretKey: getHeaderValue(headers, "SECRET-KEY"),
|
|
3016
3025
|
region: getHeaderValue(headers, "REGION"),
|
|
@@ -3043,6 +3052,7 @@ var Settings = class _Settings {
|
|
|
3043
3052
|
managementHost: extractedValues.managementHost,
|
|
3044
3053
|
managementPort: extractedValues.managementPort,
|
|
3045
3054
|
cloudInfraToken: extractedValues.cloudInfraToken,
|
|
3055
|
+
cloudConnected: extractedValues.cloudConnected === "true",
|
|
3046
3056
|
clientId: extractedValues.clientId,
|
|
3047
3057
|
secretKey: extractedValues.secretKey,
|
|
3048
3058
|
region: extractedValues.region?.toUpperCase(),
|
|
@@ -3089,7 +3099,7 @@ var runApi = createApiRunner(serverModule);
|
|
|
3089
3099
|
server.tool(
|
|
3090
3100
|
`${SERVER_PACKAGE_NAME.split("/").pop().replace(/-mcp$/, "")}__init`,
|
|
3091
3101
|
"Verify, login and initialize management connection. Use this tool on your first interaction with the server.",
|
|
3092
|
-
|
|
3102
|
+
{},
|
|
3093
3103
|
async (args, extra) => {
|
|
3094
3104
|
try {
|
|
3095
3105
|
const apiManager = SessionContext.getAPIManager(serverModule, extra);
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chkp/policy-insights-mcp",
|
|
3
|
-
"version": "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",
|
package/dist/server-config.json
CHANGED
|
@@ -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.
|
|
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",
|
package/package.json.bak
ADDED
|
@@ -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
|
+
}
|