@jupiterone/jupiterone-mcp 1.2.0 → 1.3.0
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/client/services/j1ql-service.d.ts +44 -3
- package/dist/client/services/j1ql-service.d.ts.map +1 -1
- package/dist/client/services/j1ql-service.js +82 -31
- package/dist/client/services/j1ql-service.js.map +1 -1
- package/dist/generated/description-map.d.ts.map +1 -1
- package/dist/generated/description-map.js +36 -1
- package/dist/generated/description-map.js.map +1 -1
- package/dist/server/mcp-server.d.ts +10 -0
- package/dist/server/mcp-server.d.ts.map +1 -1
- package/dist/server/mcp-server.js +45 -32
- package/dist/server/mcp-server.js.map +1 -1
- package/dist/server/tools/j1ql.d.ts.map +1 -1
- package/dist/server/tools/j1ql.js +215 -22
- package/dist/server/tools/j1ql.js.map +1 -1
- package/dist/server/tools/usage.d.ts.map +1 -1
- package/dist/server/tools/usage.js +4 -0
- package/dist/server/tools/usage.js.map +1 -1
- package/node_modules/dtrace-provider/build/Makefile +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import { GraphQLClient } from 'graphql-request';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Default poll budget for deferred results (attempts × 1s). 45 finishes comfortably under the
|
|
4
|
+
* remote proxy's 55s request deadline and the ~60s host tool-call ceiling, so the handle-bearing
|
|
5
|
+
* timeout below reaches the caller instead of the transport aborting mid-poll.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_MAX_POLL_ATTEMPTS = 45;
|
|
8
|
+
/**
|
|
9
|
+
* Thrown when a deferred query is still running after the poll budget is exhausted — a distinct
|
|
10
|
+
* type so callers can tell "still running" apart from a real query error. The backend keeps
|
|
11
|
+
* executing regardless of this client-side budget (Neo4j allows up to ~4 minutes per attempt)
|
|
12
|
+
* and retains results at the status URL for ~1 hour, so the error carries that URL as a
|
|
13
|
+
* resume handle.
|
|
5
14
|
*/
|
|
6
15
|
export declare class J1qlQueryTimeoutError extends Error {
|
|
7
|
-
|
|
16
|
+
readonly resultsUrl: string;
|
|
17
|
+
readonly correlationId?: string | undefined;
|
|
18
|
+
/** Epoch ms when the query was initiated, when the caller knows it (execute path). */
|
|
19
|
+
readonly startedAt?: number | undefined;
|
|
20
|
+
constructor(seconds: number, resultsUrl: string, correlationId?: string | undefined,
|
|
21
|
+
/** Epoch ms when the query was initiated, when the caller knows it (execute path). */
|
|
22
|
+
startedAt?: number | undefined);
|
|
8
23
|
}
|
|
9
24
|
export declare class J1qlService {
|
|
10
25
|
private client;
|
|
@@ -14,6 +29,32 @@ export declare class J1qlService {
|
|
|
14
29
|
* Construct query results URL based on subdomain
|
|
15
30
|
*/
|
|
16
31
|
constructQueryUrl(query: string, subdomain?: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Initiate a J1QL query without waiting for results. Returns the raw `queryV2` payload: for
|
|
34
|
+
* deferred execution that is `{ type: 'deferred', url, correlationId }` where `url` is the
|
|
35
|
+
* status/results file the backend writes to (pollable for ~1 hour); small queries may return
|
|
36
|
+
* inline results instead.
|
|
37
|
+
*/
|
|
38
|
+
startJ1qlQuery({ query, variables, cursor, scopeFilters, flags, }: {
|
|
39
|
+
query: string;
|
|
40
|
+
variables?: Record<string, any>;
|
|
41
|
+
cursor?: string;
|
|
42
|
+
scopeFilters?: Record<string, any>[];
|
|
43
|
+
flags?: Record<string, any>;
|
|
44
|
+
}): Promise<any>;
|
|
45
|
+
/**
|
|
46
|
+
* Poll a deferred query's status URL until it reports a terminal status or the poll budget
|
|
47
|
+
* (attempts × 1s) is exhausted. The status file moves ENQUEUED → IN_PROGRESS → COMPLETED/FAILED;
|
|
48
|
+
* unknown statuses are treated as still-running so a new upstream state never gets returned as
|
|
49
|
+
* results. Budget exhaustion throws a handle-bearing J1qlQueryTimeoutError — the query itself
|
|
50
|
+
* keeps running server-side.
|
|
51
|
+
*/
|
|
52
|
+
pollDeferredResult(url: string, { maxPollAttempts, correlationId, startedAt, }?: {
|
|
53
|
+
maxPollAttempts?: number;
|
|
54
|
+
correlationId?: string;
|
|
55
|
+
/** Query initiation time (epoch ms), carried into the timeout error for liveness reporting. */
|
|
56
|
+
startedAt?: number;
|
|
57
|
+
}): Promise<any>;
|
|
17
58
|
/**
|
|
18
59
|
* Execute a J1QL query
|
|
19
60
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"j1ql-service.d.ts","sourceRoot":"","sources":["../../../src/client/services/j1ql-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD
|
|
1
|
+
{"version":3,"file":"j1ql-service.d.ts","sourceRoot":"","sources":["../../../src/client/services/j1ql-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAI5C;;;;;;GAMG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;aAG5B,UAAU,EAAE,MAAM;aAClB,aAAa,CAAC,EAAE,MAAM;IACtC,sFAAsF;aACtE,SAAS,CAAC,EAAE,MAAM;gBAJlC,OAAO,EAAE,MAAM,EACC,UAAU,EAAE,MAAM,EAClB,aAAa,CAAC,EAAE,MAAM,YAAA;IACtC,sFAAsF;IACtE,SAAS,CAAC,EAAE,MAAM,YAAA;CAKrC;AAED,qBAAa,WAAW;IAEpB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,WAAW,CAAC;gBADZ,MAAM,EAAE,aAAa,EACrB,WAAW,CAAC,EAAE,WAAW,YAAA;IAGnC;;OAEG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM;IAK5D;;;;;OAKG;IACG,cAAc,CAAC,EACnB,KAAK,EACL,SAAS,EACT,MAAM,EACN,YAAY,EACZ,KAAK,GACN,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAChC,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;QACrC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC7B,GAAG,OAAO,CAAC,GAAG,CAAC;IAchB;;;;;;OAMG;IACG,kBAAkB,CACtB,GAAG,EAAE,MAAM,EACX,EACE,eAAe,EACf,aAAa,EACb,SAAS,GACV,GAAE;QACD,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,+FAA+F;QAC/F,SAAS,CAAC,EAAE,MAAM,CAAC;KACf,GACL,OAAO,CAAC,GAAG,CAAC;IA2Cf;;OAEG;IACG,gBAAgB,CAAC,EACrB,KAAK,EACL,SAAS,EACT,MAAM,EACN,YAAY,EACZ,KAAK,EACL,eAAe,GAChB,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAChC,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;QACrC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAE5B,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,GAAG,OAAO,CAAC,GAAG,CAAC;IAehB;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC;CAatC"}
|
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.J1qlService = exports.J1qlQueryTimeoutError = void 0;
|
|
3
|
+
exports.J1qlService = exports.J1qlQueryTimeoutError = exports.DEFAULT_MAX_POLL_ATTEMPTS = void 0;
|
|
4
4
|
const queries_js_1 = require("../graphql/queries.js");
|
|
5
5
|
const appUrl_js_1 = require("../../utils/appUrl.js");
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Default poll budget for deferred results (attempts × 1s). 45 finishes comfortably under the
|
|
8
|
+
* remote proxy's 55s request deadline and the ~60s host tool-call ceiling, so the handle-bearing
|
|
9
|
+
* timeout below reaches the caller instead of the transport aborting mid-poll.
|
|
10
|
+
*/
|
|
11
|
+
exports.DEFAULT_MAX_POLL_ATTEMPTS = 45;
|
|
12
|
+
const POLL_INTERVAL_MS = 1000;
|
|
13
|
+
/**
|
|
14
|
+
* Thrown when a deferred query is still running after the poll budget is exhausted — a distinct
|
|
15
|
+
* type so callers can tell "still running" apart from a real query error. The backend keeps
|
|
16
|
+
* executing regardless of this client-side budget (Neo4j allows up to ~4 minutes per attempt)
|
|
17
|
+
* and retains results at the status URL for ~1 hour, so the error carries that URL as a
|
|
18
|
+
* resume handle.
|
|
9
19
|
*/
|
|
10
20
|
class J1qlQueryTimeoutError extends Error {
|
|
11
|
-
|
|
21
|
+
resultsUrl;
|
|
22
|
+
correlationId;
|
|
23
|
+
startedAt;
|
|
24
|
+
constructor(seconds, resultsUrl, correlationId,
|
|
25
|
+
/** Epoch ms when the query was initiated, when the caller knows it (execute path). */
|
|
26
|
+
startedAt) {
|
|
12
27
|
super(`Query timed out after ${seconds} seconds`);
|
|
28
|
+
this.resultsUrl = resultsUrl;
|
|
29
|
+
this.correlationId = correlationId;
|
|
30
|
+
this.startedAt = startedAt;
|
|
13
31
|
this.name = 'J1qlQueryTimeoutError';
|
|
14
32
|
}
|
|
15
33
|
}
|
|
@@ -29,9 +47,12 @@ class J1qlService {
|
|
|
29
47
|
return (0, appUrl_js_1.constructAppUrl)(`home?${params.toString()}`, subdomain);
|
|
30
48
|
}
|
|
31
49
|
/**
|
|
32
|
-
*
|
|
50
|
+
* Initiate a J1QL query without waiting for results. Returns the raw `queryV2` payload: for
|
|
51
|
+
* deferred execution that is `{ type: 'deferred', url, correlationId }` where `url` is the
|
|
52
|
+
* status/results file the backend writes to (pollable for ~1 hour); small queries may return
|
|
53
|
+
* inline results instead.
|
|
33
54
|
*/
|
|
34
|
-
async
|
|
55
|
+
async startJ1qlQuery({ query, variables, cursor, scopeFilters, flags, }) {
|
|
35
56
|
// Use queryV2 for better error messages
|
|
36
57
|
const response = await this.client.request(queries_js_1.QUERY_V2, {
|
|
37
58
|
query,
|
|
@@ -42,37 +63,67 @@ class J1qlService {
|
|
|
42
63
|
returnRowMetadata: flags?.returnRowMeta,
|
|
43
64
|
returnComputedProperties: flags?.computedProperties,
|
|
44
65
|
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
66
|
+
return response.queryV2;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Poll a deferred query's status URL until it reports a terminal status or the poll budget
|
|
70
|
+
* (attempts × 1s) is exhausted. The status file moves ENQUEUED → IN_PROGRESS → COMPLETED/FAILED;
|
|
71
|
+
* unknown statuses are treated as still-running so a new upstream state never gets returned as
|
|
72
|
+
* results. Budget exhaustion throws a handle-bearing J1qlQueryTimeoutError — the query itself
|
|
73
|
+
* keeps running server-side.
|
|
74
|
+
*/
|
|
75
|
+
async pollDeferredResult(url, { maxPollAttempts, correlationId, startedAt, } = {}) {
|
|
76
|
+
const maxAttempts = maxPollAttempts ?? exports.DEFAULT_MAX_POLL_ATTEMPTS;
|
|
77
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
78
|
+
let fetchResponse;
|
|
79
|
+
try {
|
|
51
80
|
// Honor the host's abort signal: it fires when the caller disconnects or a deadline passes.
|
|
52
81
|
this.abortSignal?.throwIfAborted();
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
return result;
|
|
64
|
-
}
|
|
65
|
-
// If still in progress, wait before next poll
|
|
66
|
-
if (result.status === 'IN_PROGRESS') {
|
|
67
|
-
await new Promise(resolve => setTimeout(resolve, pollInterval));
|
|
68
|
-
continue;
|
|
82
|
+
// Result URLs never legitimately redirect, so refuse redirects — following one would let a
|
|
83
|
+
// response move the request off the host allowlist callers validated.
|
|
84
|
+
fetchResponse = await fetch(url, { signal: this.abortSignal, redirect: 'error' });
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
// An abort ends the wait, not the query: surface the handle so the caller can still hand
|
|
88
|
+
// back a resumable IN_PROGRESS envelope instead of discarding the running query.
|
|
89
|
+
if (error?.name === 'AbortError') {
|
|
90
|
+
throw new J1qlQueryTimeoutError(attempt, url, correlationId, startedAt);
|
|
69
91
|
}
|
|
70
|
-
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
if (!fetchResponse.ok) {
|
|
95
|
+
throw new Error(`Failed to fetch query results: ${fetchResponse.statusText}`);
|
|
96
|
+
}
|
|
97
|
+
const result = await fetchResponse.json();
|
|
98
|
+
if (result.status === 'FAILED') {
|
|
99
|
+
throw new Error(result.error || 'Query execution failed');
|
|
100
|
+
}
|
|
101
|
+
// The executor commits 'COMPLETED'; 'COMPLETE' is kept for compatibility with older payloads.
|
|
102
|
+
if (result.status === 'COMPLETE' || result.status === 'COMPLETED') {
|
|
71
103
|
return result;
|
|
72
104
|
}
|
|
73
|
-
|
|
105
|
+
// Still running (ENQUEUED/IN_PROGRESS/unknown): wait before the next poll, but not after the
|
|
106
|
+
// final attempt — the caller should get the timeout handle immediately.
|
|
107
|
+
if (attempt < maxAttempts - 1) {
|
|
108
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
109
|
+
}
|
|
74
110
|
}
|
|
75
|
-
|
|
111
|
+
throw new J1qlQueryTimeoutError(maxAttempts, url, correlationId, startedAt);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Execute a J1QL query
|
|
115
|
+
*/
|
|
116
|
+
async executeJ1qlQuery({ query, variables, cursor, scopeFilters, flags, maxPollAttempts, }) {
|
|
117
|
+
const startedAt = Date.now();
|
|
118
|
+
const started = await this.startJ1qlQuery({ query, variables, cursor, scopeFilters, flags });
|
|
119
|
+
if (started.type === 'deferred' && started.url) {
|
|
120
|
+
return this.pollDeferredResult(started.url, {
|
|
121
|
+
maxPollAttempts,
|
|
122
|
+
correlationId: started.correlationId,
|
|
123
|
+
startedAt,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return started;
|
|
76
127
|
}
|
|
77
128
|
/**
|
|
78
129
|
* List all entity types in the account
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"j1ql-service.js","sourceRoot":"","sources":["../../../src/client/services/j1ql-service.ts"],"names":[],"mappings":";;;AACA,sDAAoE;AACpE,qDAAwD;AAExD
|
|
1
|
+
{"version":3,"file":"j1ql-service.js","sourceRoot":"","sources":["../../../src/client/services/j1ql-service.ts"],"names":[],"mappings":";;;AACA,sDAAoE;AACpE,qDAAwD;AAExD;;;;GAIG;AACU,QAAA,yBAAyB,GAAG,EAAE,CAAC;AAE5C,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAE9B;;;;;;GAMG;AACH,MAAa,qBAAsB,SAAQ,KAAK;IAG5B;IACA;IAEA;IALlB,YACE,OAAe,EACC,UAAkB,EAClB,aAAsB;IACtC,sFAAsF;IACtE,SAAkB;QAElC,KAAK,CAAC,yBAAyB,OAAO,UAAU,CAAC,CAAC;QALlC,eAAU,GAAV,UAAU,CAAQ;QAClB,kBAAa,GAAb,aAAa,CAAS;QAEtB,cAAS,GAAT,SAAS,CAAS;QAGlC,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAXD,sDAWC;AAED,MAAa,WAAW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,KAAK,EACL,eAAe,GAShB;QACC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;QAE7F,IAAI,OAAO,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;YAC/C,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,GAAG,EAAE;gBAC1C,eAAe;gBACf,aAAa,EAAE,OAAO,CAAC,aAAa;gBACpC,SAAS;aACV,CAAC,CAAC;QACL,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,eAAe;QACnB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAKvC,8BAAiB,CAAC,CAAC;QAEtB,OAAO;YACL,OAAO,EAAE,QAAQ,CAAC,eAAe,EAAE,OAAO,IAAI,EAAE;YAChD,KAAK,EAAE,QAAQ,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;SAC7C,CAAC;IACJ,CAAC;CACF;AA7JD,kCA6JC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"description-map.d.ts","sourceRoot":"","sources":["../../src/generated/description-map.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"description-map.d.ts","sourceRoot":"","sources":["../../src/generated/description-map.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA8vFjD,CAAC"}
|
|
@@ -1332,7 +1332,16 @@ The \`url\` field in every response is a direct link to view the results in the
|
|
|
1332
1332
|
- Export results to CSV or other formats
|
|
1333
1333
|
- Save the query for future use
|
|
1334
1334
|
- Share results with team members
|
|
1335
|
-
- Further refine the query in the JupiterOne UI
|
|
1335
|
+
- Further refine the query in the JupiterOne UI
|
|
1336
|
+
|
|
1337
|
+
#### Long-running queries
|
|
1338
|
+
|
|
1339
|
+
This tool waits about 10 seconds (which covers ~97% of queries). If the response has \`status: "IN_PROGRESS"\` and a \`resultsUrl\`, the query did **not** fail — it is still executing server-side (usually done within ~4 minutes; a query still running past ~13 minutes — the backend's full retry window — will not succeed) and its results stay retrievable for about an hour. **You do not need to wait for it, and you should not re-issue this query.**
|
|
1340
|
+
|
|
1341
|
+
1. **Keep working.** Run other queries and tools in the meantime — the query completes on its own.
|
|
1342
|
+
2. **Collect when convenient:** call \`get-query-results\` with the returned \`resultsUrl\`. By default it waits up to 40 seconds and returns the results the moment they are ready; pass \`waitSeconds: 1\` for an instant status check.
|
|
1343
|
+
3. **Only rewrite the query if it actually fails.** If \`get-query-results\` reports the query FAILED, run a narrower version (indexed \`WITH\` filters, smaller \`LIMIT\`, fewer traversals).
|
|
1344
|
+
`,
|
|
1336
1345
|
"get-dashboard-details.md": `# Get Dashboard Details Tool
|
|
1337
1346
|
|
|
1338
1347
|
Get detailed information about a specific JupiterOne dashboard including its widgets, layout, and configuration.
|
|
@@ -1483,6 +1492,32 @@ Get jobs for a specific integration instance:
|
|
|
1483
1492
|
"size": 10
|
|
1484
1493
|
}
|
|
1485
1494
|
\`\`\``,
|
|
1495
|
+
"get-query-results.md": `# Get Query Results
|
|
1496
|
+
|
|
1497
|
+
**Purpose**: Retrieves the results of a J1QL query that was still running when \`execute-j1ql-query\` returned. Use this whenever \`execute-j1ql-query\` responds with \`status: "IN_PROGRESS"\` and a \`resultsUrl\`.
|
|
1498
|
+
|
|
1499
|
+
A query that outlives the tool-call window keeps executing server-side (heavy traversals can take up to ~4 minutes) and its results stay retrievable for about an hour. This tool waits for completion and returns the results in the same format as \`execute-j1ql-query\`.
|
|
1500
|
+
|
|
1501
|
+
## Parameters
|
|
1502
|
+
|
|
1503
|
+
| Parameter | Required | Description |
|
|
1504
|
+
|-----------|----------|-------------|
|
|
1505
|
+
| \`resultsUrl\` | Yes | The exact \`resultsUrl\` returned by \`execute-j1ql-query\`. Do not construct or modify this URL. |
|
|
1506
|
+
| \`waitSeconds\` | No | How long to wait for completion before returning the \`IN_PROGRESS\` handle again (1–45, default 40). |
|
|
1507
|
+
|
|
1508
|
+
## Behavior
|
|
1509
|
+
|
|
1510
|
+
- **Query finished** → returns the standard query envelope (\`data\`, \`cursor\`, \`hasMore\`, \`totalCount\`, \`status: "COMPLETED"\`). Continue pagination, if any, through \`execute-j1ql-query\` with the returned \`cursor\`.
|
|
1511
|
+
- **Query still running** → returns \`status: "IN_PROGRESS"\` with the same \`resultsUrl\`, plus \`startedAt\`/\`elapsedSeconds\` when recoverable. Successful queries almost always finish within ~4 minutes of execution; past ~13 minutes (the backend's full retry window) a query will not succeed — abandon the handle and run a narrower query instead.
|
|
1512
|
+
- **Query failed server-side** → returns the execution error. At that point, narrow the query (indexed \`WITH\` filters, smaller \`LIMIT\`, fewer traversals) and run it again with \`execute-j1ql-query\`.
|
|
1513
|
+
|
|
1514
|
+
## Tips
|
|
1515
|
+
|
|
1516
|
+
- **You do not need to babysit a running query.** Do other work between checks — each call here already waits up to 40 seconds, so a handful of calls spread over a few minutes is plenty. Long queries usually finish within ~4 minutes.
|
|
1517
|
+
- Use \`waitSeconds: 1\` when you only want a quick status check before moving on.
|
|
1518
|
+
- Do **not** re-issue \`execute-j1ql-query\` just to get these results — that starts from scratch. Only re-issue if the query FAILED (narrowed) or the handle expired.
|
|
1519
|
+
- The \`resultsUrl\` handle expires roughly an hour after the query started. If it has expired or was lost, re-run the original query with \`execute-j1ql-query\` (an identical re-run within ~5 minutes of the original re-attaches to the same execution server-side).
|
|
1520
|
+
`,
|
|
1486
1521
|
"get-raw-data-download-url.md": `# Get Raw Data Download URL Tool
|
|
1487
1522
|
|
|
1488
1523
|
Generate a signed URL for downloading raw data from JupiterOne. This is typically used to download large result sets from r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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAymBxB;IACC,gCAAgC,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gHA6a4E;CAC/G,CAAC"}
|
|
@@ -32,6 +32,16 @@ export declare class JupiterOneMcpServer {
|
|
|
32
32
|
* error formatting (C2), and per-call telemetry (O1).
|
|
33
33
|
*/
|
|
34
34
|
private register;
|
|
35
|
+
/** Build the SDK registration config for a tool. */
|
|
36
|
+
private toolConfig;
|
|
37
|
+
private buildInputSchema;
|
|
38
|
+
/**
|
|
39
|
+
* Resolve a call's execution scope: strip the injected `reason`, and in multi-tenant mode
|
|
40
|
+
* consume `accountId` into an account-scoped client clone. Returns null when a required
|
|
41
|
+
* accountId is missing.
|
|
42
|
+
*/
|
|
43
|
+
private scopeCall;
|
|
44
|
+
private static readonly MISSING_ACCOUNT_MESSAGE;
|
|
35
45
|
private invoke;
|
|
36
46
|
start(): Promise<void>;
|
|
37
47
|
stop(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../src/server/mcp-server.ts"],"names":[],"mappings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SAAS,CAAC;IACzB,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,aAAa,CAAU;IAC/B,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,eAAe,CAAC,CAAkB;gBAE9B,MAAM,EAAE,gBAAgB,EAAE,OAAO,GAAE,0BAA+B;IAyB9E;;;OAGG;IACH,OAAO,CAAC,WAAW;IAInB;;;;OAIG;IACH,OAAO,CAAC,QAAQ;IAKhB,oDAAoD;IACpD,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,gBAAgB;IAsBxB;;;;OAIG;IACH,OAAO,CAAC,SAAS;IA2BjB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAC0G;YAE3I,MAAM;IAgDd,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAKtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5B"}
|
|
@@ -57,8 +57,24 @@ class JupiterOneMcpServer {
|
|
|
57
57
|
* error formatting (C2), and per-call telemetry (O1).
|
|
58
58
|
*/
|
|
59
59
|
register(tool) {
|
|
60
|
+
const registerTool = this.server.registerTool.bind(this.server);
|
|
61
|
+
registerTool(tool.name, this.toolConfig(tool), (params) => this.invoke(tool, params));
|
|
62
|
+
}
|
|
63
|
+
/** Build the SDK registration config for a tool. */
|
|
64
|
+
toolConfig(tool) {
|
|
65
|
+
return {
|
|
66
|
+
title: tool.title,
|
|
67
|
+
description: tool.description,
|
|
68
|
+
inputSchema: this.buildInputSchema(tool),
|
|
69
|
+
...(tool.outputSchema ? { outputSchema: tool.outputSchema } : {}),
|
|
70
|
+
// The connector directory validates `annotations.title`, so mirror the per-tool title into
|
|
71
|
+
// annotations (the SDK's top-level `title` above is a separate field it does not check).
|
|
72
|
+
annotations: { ...tool.annotations, title: tool.title },
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
buildInputSchema(tool) {
|
|
60
76
|
const needsAccount = this.isMultiTenant && !tool.accountAgnostic;
|
|
61
|
-
|
|
77
|
+
return {
|
|
62
78
|
...tool.inputSchema,
|
|
63
79
|
reason: zod_1.z
|
|
64
80
|
.string()
|
|
@@ -72,41 +88,38 @@ class JupiterOneMcpServer {
|
|
|
72
88
|
}
|
|
73
89
|
: {}),
|
|
74
90
|
};
|
|
75
|
-
const registerTool = this.server.registerTool.bind(this.server);
|
|
76
|
-
registerTool(tool.name, {
|
|
77
|
-
title: tool.title,
|
|
78
|
-
description: tool.description,
|
|
79
|
-
inputSchema,
|
|
80
|
-
...(tool.outputSchema ? { outputSchema: tool.outputSchema } : {}),
|
|
81
|
-
// The connector directory validates `annotations.title`, so mirror the per-tool title into
|
|
82
|
-
// annotations (the SDK's top-level `title` above is a separate field it does not check).
|
|
83
|
-
annotations: { ...tool.annotations, title: tool.title },
|
|
84
|
-
}, (params) => this.invoke(tool, params));
|
|
85
91
|
}
|
|
86
|
-
|
|
87
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Resolve a call's execution scope: strip the injected `reason`, and in multi-tenant mode
|
|
94
|
+
* consume `accountId` into an account-scoped client clone. Returns null when a required
|
|
95
|
+
* accountId is missing.
|
|
96
|
+
*/
|
|
97
|
+
scopeCall(tool, params) {
|
|
88
98
|
const { reason: rawReason, ...rest } = params;
|
|
89
99
|
const reason = typeof rawReason === 'string' && rawReason.length > 0 ? (0, usage_js_1.truncateReason)(rawReason) : undefined;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
100
|
+
if (!this.isMultiTenant || tool.accountAgnostic) {
|
|
101
|
+
return { client: this.client, toolParams: rest, accountId: this.envAccountId, reason };
|
|
102
|
+
}
|
|
103
|
+
const { accountId: requested, ...toolParams } = rest;
|
|
104
|
+
if (!requested || typeof requested !== 'string')
|
|
105
|
+
return null;
|
|
106
|
+
return {
|
|
107
|
+
client: this.client.cloneWithAccountId(requested),
|
|
108
|
+
toolParams,
|
|
109
|
+
accountId: requested,
|
|
110
|
+
reason,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
static MISSING_ACCOUNT_MESSAGE = 'accountId is required for this operation. Call `list-accounts` to discover the accounts you can access, then retry with the accountId parameter set.';
|
|
114
|
+
async invoke(tool, params) {
|
|
115
|
+
const scoped = this.scopeCall(tool, params);
|
|
116
|
+
if (!scoped) {
|
|
117
|
+
return {
|
|
118
|
+
content: [{ type: 'text', text: `Error: ${JupiterOneMcpServer.MISSING_ACCOUNT_MESSAGE}` }],
|
|
119
|
+
isError: true,
|
|
120
|
+
};
|
|
109
121
|
}
|
|
122
|
+
const { client, toolParams, accountId, reason } = scoped;
|
|
110
123
|
const startedAt = Date.now();
|
|
111
124
|
let outcome = 'success';
|
|
112
125
|
let errorClass;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../../src/server/mcp-server.ts"],"names":[],"mappings":";;;AAAA,oEAAoE;AACpE,wEAAiF;AACjF,6BAAwB;AACxB,yEAAkE;AAElE,qDAA6C;AAE7C,kEAA2D;AAC3D,+CAA4C;AAC5C,iDAA4F;AAE5F,uDAA2E;AAC3E,uCAA4C;AAC5C,+CAAmF;AAgCnF,MAAa,mBAAmB;IACvB,MAAM,CAAY;IACjB,MAAM,CAAmB;IACzB,SAAS,CAAgB;IACzB,aAAa,CAAU;IACvB,SAAS,CAAgB;IACzB,YAAY,CAAU;IACtB,eAAe,CAAmB;IAE1C,YAAY,MAAwB,EAAE,UAAsC,EAAE;QAC5E,IAAI,CAAC,MAAM,GAAG,IAAI,uCAAgB,CAAC,MAAM,CAAC,CAAC;QAC3C,4FA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CAAC,GAAG,EAAE,GAAG,SAAS;gBAClC,UAAU;gBACV,YAAY;gBACZ,SAAS;gBACT,MAAM;gBACN,KAAK,EAAE,IAAA,yBAAc,EAAC,UAAU,CAAC;gBACjC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,IAAA,0BAAe,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;aACrD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;QAC7C,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,IAAI;QACR,oBAAoB;IACtB,CAAC;;AAjLH,kDAkLC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"j1ql.d.ts","sourceRoot":"","sources":["../../../src/server/tools/j1ql.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"j1ql.d.ts","sourceRoot":"","sources":["../../../src/server/tools/j1ql.ts"],"names":[],"mappings":"AAMA,OAAO,EAAyB,KAAK,cAAc,EAAmB,MAAM,YAAY,CAAC;AAiNzF,eAAO,MAAM,SAAS,EAAE,cAAc,EAkIrC,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.j1qlTools = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const j1ql_service_js_1 = require("../../client/services/j1ql-service.js");
|
|
5
6
|
const j1ql_validator_js_1 = require("../../utils/j1ql-validator.js");
|
|
6
7
|
const load_description_js_1 = require("../../utils/load-description.js");
|
|
7
8
|
const errors_js_1 = require("./errors.js");
|
|
@@ -23,7 +24,156 @@ const executeJ1qlOutput = {
|
|
|
23
24
|
cursor: zod_1.z.string().nullish(),
|
|
24
25
|
hasMore: zod_1.z.boolean().optional(),
|
|
25
26
|
messages: zod_1.z.array(zod_1.z.any()).optional(),
|
|
27
|
+
resultsUrl: zod_1.z.string().optional(),
|
|
28
|
+
startedAt: zod_1.z.string().optional(),
|
|
29
|
+
elapsedSeconds: zod_1.z.number().optional(),
|
|
26
30
|
};
|
|
31
|
+
// Upstream execution lifecycle (query-engine): a Neo4j transaction is abandoned at 4 minutes and
|
|
32
|
+
// the job is redelivered up to 3 times, so a query still IN_PROGRESS past ~13 minutes will not
|
|
33
|
+
// succeed. These bounds power the liveness guidance in the IN_PROGRESS envelope.
|
|
34
|
+
const QUERY_WORST_CASE_MS = 13 * 60 * 1000;
|
|
35
|
+
/**
|
|
36
|
+
* Recover a query's start time from its handle URL. The storage-token form embeds a JWT whose
|
|
37
|
+
* `iat` is the initiation time; S3 presigned URLs carry `X-Amz-Date`. Returns null when the URL
|
|
38
|
+
* matches neither shape — liveness then degrades gracefully rather than blocking the envelope.
|
|
39
|
+
*/
|
|
40
|
+
function handleStartedAtMs(rawUrl) {
|
|
41
|
+
let url;
|
|
42
|
+
try {
|
|
43
|
+
url = new URL(rawUrl);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const amzDate = url.searchParams.get('X-Amz-Date');
|
|
49
|
+
if (amzDate) {
|
|
50
|
+
const m = amzDate.match(/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z$/);
|
|
51
|
+
if (m)
|
|
52
|
+
return Date.UTC(+m[1], +m[2] - 1, +m[3], +m[4], +m[5], +m[6]);
|
|
53
|
+
}
|
|
54
|
+
for (const segment of url.pathname.split('/')) {
|
|
55
|
+
const parts = segment.split('.');
|
|
56
|
+
if (parts.length !== 3)
|
|
57
|
+
continue;
|
|
58
|
+
try {
|
|
59
|
+
const payload = JSON.parse(Buffer.from(parts[1], 'base64url').toString('utf8'));
|
|
60
|
+
if (typeof payload.iat === 'number')
|
|
61
|
+
return payload.iat * 1000;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// Not a JWT segment; keep scanning.
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
function formatElapsed(elapsedMs) {
|
|
70
|
+
const totalSeconds = Math.round(elapsedMs / 1000);
|
|
71
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
72
|
+
return minutes > 0 ? `${minutes}m ${totalSeconds % 60}s` : `${totalSeconds}s`;
|
|
73
|
+
}
|
|
74
|
+
/** Phase-appropriate liveness sentence for a still-running query, or null when age is unknown. */
|
|
75
|
+
function livenessNote(elapsedMs) {
|
|
76
|
+
if (elapsedMs === null)
|
|
77
|
+
return null;
|
|
78
|
+
const elapsed = formatElapsed(elapsedMs);
|
|
79
|
+
if (elapsedMs >= QUERY_WORST_CASE_MS) {
|
|
80
|
+
return (`Elapsed so far: ${elapsed} — this is past the backend's full retry window (~13 minutes), ` +
|
|
81
|
+
'so it is unlikely to succeed. Abandon this handle and run a narrower version of the query ' +
|
|
82
|
+
'now (indexed WITH filters, smaller LIMIT, fewer traversals).');
|
|
83
|
+
}
|
|
84
|
+
return (`Elapsed so far: ${elapsed}. Queries that succeed usually finish within ~4 minutes of ` +
|
|
85
|
+
'execution (the backend abandons an attempt at 4 minutes and redelivers up to 3 times, so ' +
|
|
86
|
+
'~13 minutes is the hard ceiling).');
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Synchronous wait before returning the IN_PROGRESS handle, in poll attempts (× 1s). Sized from
|
|
90
|
+
* production latency (21 days, n=4,537 successful queries: p50 1.7s, p95 6.8s, p99 17s): 10s
|
|
91
|
+
* completes ~97% of queries in a single call, while genuinely long queries get their resume
|
|
92
|
+
* handle ~35s sooner than the previous full-window wait.
|
|
93
|
+
*/
|
|
94
|
+
const FIRST_RESPONSE_MAX_POLL_ATTEMPTS = 10;
|
|
95
|
+
/**
|
|
96
|
+
* Non-error envelope returned when the first-response budget expires while the backend is still
|
|
97
|
+
* executing (it runs to completion regardless — typically within ~4 minutes — and retains results
|
|
98
|
+
* at the status URL for about an hour). The guidance is deliberately non-blocking: the two worst
|
|
99
|
+
* agent behaviors here are idling until the query finishes and spamming execute-j1ql-query to
|
|
100
|
+
* force a result, so it leads with "keep working" and routes collection through
|
|
101
|
+
* get-query-results.
|
|
102
|
+
*/
|
|
103
|
+
function queryStillRunningResult(error) {
|
|
104
|
+
const startedAtMs = error.startedAt ?? handleStartedAtMs(error.resultsUrl);
|
|
105
|
+
// Clamped at 0: the handle's timestamp is unverified and clocks can skew, so a future
|
|
106
|
+
// startedAt must not produce negative elapsed values in the liveness text or envelope.
|
|
107
|
+
const elapsedMs = startedAtMs === null || startedAtMs === undefined ? null : Math.max(0, Date.now() - startedAtMs);
|
|
108
|
+
const liveness = livenessNote(elapsedMs);
|
|
109
|
+
const output = (0, result_js_1.structuredResult)({
|
|
110
|
+
status: 'IN_PROGRESS',
|
|
111
|
+
resultsUrl: error.resultsUrl,
|
|
112
|
+
...(error.correlationId ? { correlationId: error.correlationId } : {}),
|
|
113
|
+
...(startedAtMs !== null && startedAtMs !== undefined
|
|
114
|
+
? { startedAt: new Date(startedAtMs).toISOString() }
|
|
115
|
+
: {}),
|
|
116
|
+
...(elapsedMs !== null ? { elapsedSeconds: Math.round(elapsedMs / 1000) } : {}),
|
|
117
|
+
});
|
|
118
|
+
output.content.push({
|
|
119
|
+
type: 'text',
|
|
120
|
+
text: 'This query is still running server-side — it has not failed, and you do not need to wait ' +
|
|
121
|
+
'for it. Keep working (including running other queries) and collect this result when ' +
|
|
122
|
+
'convenient. To collect: call `get-query-results` with this `resultsUrl` — it waits up to ' +
|
|
123
|
+
'40s and returns the results as soon as they are ready; pass waitSeconds: 1 for an instant ' +
|
|
124
|
+
'status check instead. ' +
|
|
125
|
+
(liveness ?? 'Heavy queries usually finish within ~4 minutes.') +
|
|
126
|
+
' Do not re-issue execute-j1ql-query for this query; only rewrite it to be more selective ' +
|
|
127
|
+
'(indexed WITH filters, smaller LIMIT, fewer traversals) if it reports FAILED.',
|
|
128
|
+
});
|
|
129
|
+
return output;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Map tool parameters onto the client's query-execution arguments (folding the standalone
|
|
133
|
+
* `includeDeleted` parameter into the flags object).
|
|
134
|
+
*/
|
|
135
|
+
function buildJ1qlQueryArgs({ query, variables, cursor, includeDeleted, flags, scopeFilters, }) {
|
|
136
|
+
const queryFlags = { ...flags };
|
|
137
|
+
if (typeof includeDeleted === 'boolean')
|
|
138
|
+
queryFlags.includeDeleted = includeDeleted;
|
|
139
|
+
return {
|
|
140
|
+
query,
|
|
141
|
+
variables,
|
|
142
|
+
cursor,
|
|
143
|
+
scopeFilters,
|
|
144
|
+
flags: Object.keys(queryFlags).length > 0 ? queryFlags : undefined,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Standard success envelope for a query result: surfaces `hasMore` (the backend signals more
|
|
149
|
+
* pages by returning a cursor) and, when true, appends the cursor-paging note as a separate text
|
|
150
|
+
* block so content[0] stays pure payload JSON. Shared by execute-j1ql-query and get-query-results.
|
|
151
|
+
*/
|
|
152
|
+
function formatQueryResult(result, extras = {}) {
|
|
153
|
+
const hasMore = typeof result.cursor === 'string' && result.cursor.length > 0;
|
|
154
|
+
const output = (0, result_js_1.structuredResult)({ ...result, ...extras, hasMore });
|
|
155
|
+
if (hasMore) {
|
|
156
|
+
output.content.push({ type: 'text', text: PAGINATION_NOTE });
|
|
157
|
+
}
|
|
158
|
+
return output;
|
|
159
|
+
}
|
|
160
|
+
// The handle URL is fetched server-side, so an agent-supplied value is an SSRF vector (e.g. the
|
|
161
|
+
// EC2 metadata endpoint). Only redeem handles that point at the places the backend actually
|
|
162
|
+
// writes result files: S3 (possibly via the JupiterOne download domain).
|
|
163
|
+
const ALLOWED_RESULTS_URL_SUFFIXES = ['.amazonaws.com', '.jupiterone.io'];
|
|
164
|
+
function resultsUrlProblem(raw) {
|
|
165
|
+
let url;
|
|
166
|
+
try {
|
|
167
|
+
url = new URL(raw);
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
return 'not a valid URL';
|
|
171
|
+
}
|
|
172
|
+
if (url.protocol !== 'https:')
|
|
173
|
+
return 'must use https';
|
|
174
|
+
const allowed = ALLOWED_RESULTS_URL_SUFFIXES.some((suffix) => url.hostname.endsWith(suffix));
|
|
175
|
+
return allowed ? null : 'host is not a JupiterOne results location';
|
|
176
|
+
}
|
|
27
177
|
// One-line note emitted as a separate text content block when more pages exist, steering agents to
|
|
28
178
|
// the cursor parameter rather than SKIP (which re-scans from the start and is not a pagination
|
|
29
179
|
// mechanism). A separate block keeps content[0] as pure payload JSON (parity with structuredContent)
|
|
@@ -63,40 +213,83 @@ exports.j1qlTools = [
|
|
|
63
213
|
outputSchema: executeJ1qlOutput,
|
|
64
214
|
errorContext: 'Error executing J1QL query',
|
|
65
215
|
formatError: (error, { query }, validator) => (0, errors_js_1.createQueryErrorResponse)(error, query, validator),
|
|
66
|
-
handler: async (
|
|
216
|
+
handler: async (params, client, validator) => {
|
|
67
217
|
// Static parse gate: syntax errors fail here in milliseconds, with the same parser (and
|
|
68
218
|
// message) the backend would use, instead of costing a query-service round-trip. Thrown
|
|
69
219
|
// (not returned) so the rejection carries errorClass/errorMessage through the telemetry
|
|
70
220
|
// chokepoint exactly like a backend-thrown parse error; formatError renders the envelope.
|
|
71
221
|
// Skipped when variables are supplied — substitution happens server-side, so the raw
|
|
72
222
|
// template text may not parse locally.
|
|
73
|
-
if (!variables || Object.keys(variables).length === 0) {
|
|
74
|
-
const validation = validator.validateQuery(query);
|
|
223
|
+
if (!params.variables || Object.keys(params.variables).length === 0) {
|
|
224
|
+
const validation = validator.validateQuery(params.query);
|
|
75
225
|
if (!validation.isValid) {
|
|
76
226
|
throw new j1ql_validator_js_1.J1qlSyntaxError(validation.error ?? 'Invalid J1QL query', validation.suggestion);
|
|
77
227
|
}
|
|
78
228
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
229
|
+
let result;
|
|
230
|
+
try {
|
|
231
|
+
result = await client.executeJ1qlQuery({
|
|
232
|
+
...buildJ1qlQueryArgs(params),
|
|
233
|
+
maxPollAttempts: FIRST_RESPONSE_MAX_POLL_ATTEMPTS,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
if (error instanceof j1ql_service_js_1.J1qlQueryTimeoutError)
|
|
238
|
+
return queryStillRunningResult(error);
|
|
239
|
+
throw error;
|
|
240
|
+
}
|
|
89
241
|
const accountInfo = await client.getAccountInfo();
|
|
90
|
-
const queryUrl = client.j1qlService.constructQueryUrl(query, accountInfo.subdomain);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
242
|
+
const queryUrl = client.j1qlService.constructQueryUrl(params.query, accountInfo.subdomain);
|
|
243
|
+
return formatQueryResult(result, { url: queryUrl });
|
|
244
|
+
},
|
|
245
|
+
}),
|
|
246
|
+
(0, types_js_1.defineTool)({
|
|
247
|
+
name: 'get-query-results',
|
|
248
|
+
title: 'Get Query Results',
|
|
249
|
+
description: (0, load_description_js_1.loadDescription)('get-query-results.md'),
|
|
250
|
+
inputSchema: {
|
|
251
|
+
resultsUrl: zod_1.z
|
|
252
|
+
.string()
|
|
253
|
+
.describe('The exact resultsUrl handle returned by execute-j1ql-query when the query was still running. Do not construct or modify this URL.'),
|
|
254
|
+
waitSeconds: zod_1.z
|
|
255
|
+
.number()
|
|
256
|
+
.int()
|
|
257
|
+
.min(1)
|
|
258
|
+
.max(45)
|
|
259
|
+
.optional()
|
|
260
|
+
.describe('How long to wait for completion before returning the IN_PROGRESS handle again (default 40)'),
|
|
261
|
+
},
|
|
262
|
+
annotations: types_js_1.READ_ONLY,
|
|
263
|
+
// The presigned handle URL is the complete capability — no account context is needed to
|
|
264
|
+
// redeem it, so multi-tenant mode must not demand an accountId.
|
|
265
|
+
accountAgnostic: true,
|
|
266
|
+
outputSchema: executeJ1qlOutput,
|
|
267
|
+
errorContext: 'Error fetching query results',
|
|
268
|
+
handler: async ({ resultsUrl, waitSeconds }, client) => {
|
|
269
|
+
const problem = resultsUrlProblem(resultsUrl);
|
|
270
|
+
if (problem) {
|
|
271
|
+
return {
|
|
272
|
+
content: [
|
|
273
|
+
{
|
|
274
|
+
type: 'text',
|
|
275
|
+
text: `Invalid resultsUrl (${problem}). Pass the exact resultsUrl returned by execute-j1ql-query — do not construct or modify it.`,
|
|
276
|
+
},
|
|
277
|
+
],
|
|
278
|
+
isError: true,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
let result;
|
|
282
|
+
try {
|
|
283
|
+
result = await client.j1qlService.pollDeferredResult(resultsUrl, {
|
|
284
|
+
maxPollAttempts: waitSeconds ?? 40,
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
catch (error) {
|
|
288
|
+
if (error instanceof j1ql_service_js_1.J1qlQueryTimeoutError)
|
|
289
|
+
return queryStillRunningResult(error);
|
|
290
|
+
throw error;
|
|
98
291
|
}
|
|
99
|
-
return
|
|
292
|
+
return formatQueryResult(result);
|
|
100
293
|
},
|
|
101
294
|
}),
|
|
102
295
|
(0, types_js_1.defineTool)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"j1ql.js","sourceRoot":"","sources":["../../../src/server/tools/j1ql.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,qEAAgE;AAChE,yEAAkE;AAClE,2CAAuD;AACvD,2CAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"j1ql.js","sourceRoot":"","sources":["../../../src/server/tools/j1ql.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,2EAA8E;AAC9E,qEAAgE;AAChE,yEAAkE;AAClE,2CAAuD;AACvD,2CAA+C;AAC/C,yCAAyF;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AAC;QACnC,CAAC;KACF,CAAC;IAEF,IAAA,qBAAU,EAAC;QACT,IAAI,EAAE,mBAAmB;QACzB,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EAAE,IAAA,qCAAe,EAAC,sBAAsB,CAAC;QACpD,WAAW,EAAE,EAAE;QACf,YAAY,EAAE,qBAAqB;QACnC,WAAW,EAAE,oBAAS;QACtB,YAAY,EAAE,4BAA4B;QAC1C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;YACjC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,eAAe,EAAE,CAAC;YAC/C,OAAO,IAAA,4BAAgB,EAAC,OAAO,CAAC,CAAC;QACnC,CAAC;KACF,CAAC;CACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/server/tools/usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIhD;AAID,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD;AA2BD,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASvF;AAcD,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/server/tools/usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIhD;AAID,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD;AA2BD,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASvF;AAcD,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA+B3E"}
|
|
@@ -79,6 +79,10 @@ function summarizeResult(result) {
|
|
|
79
79
|
const obj = sc;
|
|
80
80
|
if (typeof obj.status === 'string')
|
|
81
81
|
out.status = obj.status;
|
|
82
|
+
// The query correlation id ties an IN_PROGRESS handle issuance to its later get-query-results
|
|
83
|
+
// redemptions, making the deferred-query lifecycle joinable in telemetry.
|
|
84
|
+
if (typeof obj.correlationId === 'string')
|
|
85
|
+
out.correlationId = obj.correlationId;
|
|
82
86
|
const explicit = obj.total ?? obj.returned ?? obj.totalCount;
|
|
83
87
|
if (typeof explicit === 'number') {
|
|
84
88
|
out.resultCount = explicit;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../src/server/tools/usage.ts"],"names":[],"mappings":";;AAUA,gCAIC;AAID,wCAEC;AA4BD,wCASC;AAeD,
|
|
1
|
+
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../src/server/tools/usage.ts"],"names":[],"mappings":";;AAUA,gCAIC;AAID,wCAEC;AA4BD,wCASC;AAeD,0CA+BC;AArGD;;;;;;;GAOG;AACH,SAAgB,UAAU,CAAC,KAAa;IACtC,OAAO,KAAK;SACT,OAAO,CAAC,oBAAoB,EAAE,cAAc,CAAC;SAC7C,OAAO,CAAC,oBAAoB,EAAE,cAAc,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB,SAAgB,cAAc,CAAC,MAAc;IAC3C,OAAO,M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G,IAAI,CAAC;IACzB,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -339,7 +339,7 @@ endif
|
|
|
339
339
|
|
|
340
340
|
quiet_cmd_regen_makefile = ACTION Regenerating $@
|
|
341
341
|
cmd_regen_makefile = cd $(srcdir); /opt/hostedtoolcache/node/18.20.8/x64/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/home/runner/.cache/node-gyp/18.20.8" "-Dnode_gyp_dir=/opt/hostedtoolcache/node/18.20.8/x64/lib/node_modules/npm/node_modules/node-gyp" "-Dnode_lib_file=/home/runner/.cache/node-gyp/18.20.8/<(target_arch)/node.lib" "-Dmodule_root_dir=/home/runner/work/jupiterone-mcp-server/jupiterone-mcp-server/node_modules/dtrace-provider" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/home/runner/work/jupiterone-mcp-server/jupiterone-mcp-server/node_modules/dtrace-provider/build/config.gypi -I/opt/hostedtoolcache/node/18.20.8/x64/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/home/runner/.cache/node-gyp/18.20.8/include/node/common.gypi "--toplevel-dir=." binding.gyp
|
|
342
|
-
Makefile: $(srcdir)/../../../../../../../opt/hostedtoolcache/node/18.20.8/x64/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/../../../../../.cache/node-gyp/18.20.8/include/node/common.gypi
|
|
342
|
+
Makefile: $(srcdir)/binding.gyp $(srcdir)/../../../../../../../opt/hostedtoolcache/node/18.20.8/x64/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/build/config.gypi $(srcdir)/../../../../../.cache/node-gyp/18.20.8/include/node/common.gypi
|
|
343
343
|
$(call do_cmd,regen_makefile)
|
|
344
344
|
|
|
345
345
|
# "all" is a concatenation of the "all" targets from all the included
|