sophos-central-mcp-server 0.10.1 → 0.10.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/README.md +1 -1
- package/dist/fusion/case-reference-data.d.ts +1 -0
- package/dist/fusion/case-reference-data.d.ts.map +1 -1
- package/dist/fusion/case-reference-data.js +2 -2
- package/dist/fusion/case-reference-data.js.map +1 -1
- package/dist/fusion/migration.d.ts +12 -3
- package/dist/fusion/migration.d.ts.map +1 -1
- package/dist/fusion/migration.js +29 -1
- package/dist/fusion/migration.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -247,7 +247,7 @@ The server speaks to two Sophos API generations on one credential:
|
|
|
247
247
|
- **Sophos Central REST APIs** (retained). Every tool without the `fusion` prefix. Regional hosts, discovered from `/whoami/v1`.
|
|
248
248
|
- **Sophos Fusion GraphQL APIs** (new, 18/09/2026). The `sophos_fusion_*` tools. One endpoint, `https://api.taegis.sophos.com/graphql`, same token, same `X-Tenant-ID` header. Filters are written in Fusion Query Language (QL). Case types, statuses and verdicts are tenant reference data resolved to IDs at runtime, case severity is an integer (2 to 10), and assignees are Subject IDs, not email addresses. A GraphQL failure arrives as HTTP 200 with an `errors` array; the client treats that as an error, and a partial response (data plus errors) is returned with a `warnings` list rather than as a clean result.
|
|
249
249
|
|
|
250
|
-
Sophos is moving tenants to Fusion over the coming months (the [upgrade centre](https://community.sophos.com/sophos-xdr/sophos-xdr-mdr-expansion/upgrade-center) announces each account's slot). This is a point in time change, not a fallback: once a tenant has moved, the Classic Cases and Detections REST APIs reference the pre-migration Sophos Central objects, so their answers are wrong rather than stale. The Classic tools therefore check which world a tenant is in before every call, using the Fusion case reference data (a tenant that has not moved gets an empty case type list), and refuse a migrated tenant with a message naming the `sophos_fusion_*` tool to use. For a tenant that has not moved they stay correct and carry no deprecation label. Fusion holds a separate case set (a UUID plus a `CSE#####` short ID) and neither ID form resolves in the other API. Live Discover and XDR Query are unaffected. Data Lake search over GraphQL shipped on 12/10/2026 as the Search GraphQL API (`sophos_fusion_create_search` and friends); the SQL XDR Query API stays available, and `sophos_run_xdr_query` stays on it. Fusion tools for events, threat timeline and live endpoint search are planned.
|
|
250
|
+
Sophos is moving tenants to Fusion over the coming months (the [upgrade centre](https://community.sophos.com/sophos-xdr/sophos-xdr-mdr-expansion/upgrade-center) announces each account's slot). This is a point in time change, not a fallback: once a tenant has moved, the Classic Cases and Detections REST APIs reference the pre-migration Sophos Central objects, so their answers are wrong rather than stale. The Classic tools therefore check which world a tenant is in before every call, using the Fusion case reference data (a tenant that has not moved gets an empty case type list; a tenant Fusion does not hold at all gets a 503 "not found or not accessible", which also reads as not moved and is held for 15 minutes), and refuse a migrated tenant with a message naming the `sophos_fusion_*` tool to use. For a tenant that has not moved they stay correct and carry no deprecation label. Fusion holds a separate case set (a UUID plus a `CSE#####` short ID) and neither ID form resolves in the other API. Live Discover and XDR Query are unaffected. Data Lake search over GraphQL shipped on 12/10/2026 as the Search GraphQL API (`sophos_fusion_create_search` and friends); the SQL XDR Query API stays available, and `sophos_run_xdr_query` stays on it. Fusion tools for events, threat timeline and live endpoint search are planned.
|
|
251
251
|
|
|
252
252
|
Two Fusion case writes, `createCase` and `addEvidenceToCase`, fail 74% of the time with `not allowed` on `partnerPreferences` from `investigations-v2`. It is an intermittent downstream fault, not authorisation: the identical call succeeds on retry, and `updateCase` does not carry the fault at all. Measured on a live tenant 22/09/2026: 111 faults in 150 calls, drifting from 60% to 85% across four samples six minutes apart. The client retries a call whose first error path is `partnerPreferences`, and only that, up to 20 times with a short backoff, which leaves about 1 call in 410 failing at the measured rate and about 1 in 26 at the worst rate observed; an error naming the operation in its path is a real input or permission error and surfaces at once.
|
|
253
253
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"case-reference-data.d.ts","sourceRoot":"","sources":["../../src/fusion/case-reference-data.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,E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E,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAMpE,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAYnF,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAM7D,KAAK;CAoBpB;AAED,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,CAAC,SAAS,mBAAmB,EAC1D,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,CAAC,EAAE,EACV,WAAW,EAAE,MAAM,GAClB,CAAC,CAYH"}
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { CASE_REFERENCE_DATA } from "./queries/cases.js";
|
|
8
8
|
import { isUuid } from "./format.js";
|
|
9
|
-
const
|
|
9
|
+
export const CASE_REFERENCE_DATA_TTL_MS = 15 * 60_000;
|
|
10
10
|
export class CaseReferenceDataCache {
|
|
11
11
|
client;
|
|
12
12
|
ttlMs;
|
|
13
13
|
cache = new Map();
|
|
14
14
|
inflight = new Map();
|
|
15
|
-
constructor(client, ttlMs =
|
|
15
|
+
constructor(client, ttlMs = CASE_REFERENCE_DATA_TTL_MS) {
|
|
16
16
|
this.client = client;
|
|
17
17
|
this.ttlMs = ttlMs;
|
|
18
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"case-reference-data.js","sourceRoot":"","sources":["../../src/fusion/case-reference-data.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAerC,MAAM,
|
|
1
|
+
{"version":3,"file":"case-reference-data.js","sourceRoot":"","sources":["../../src/fusion/case-reference-data.ts"],"names":[],"mappings":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Ae,EAAE,IAAI,CAAC,mBAAoB,CAAC,eAAe;YAC1D,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC;IACJ,CAAC;CACF;AAED,oEAAoE;AACpE,MAAM,UAAU,cAAc,CAC5B,IAAY,EACZ,KAAU,EACV,WAAmB;IAEnB,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAChD,MAAM,KAAK,GACT,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC;QACxD,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,CAAC;IACpE,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC;QACtE,MAAM,IAAI,KAAK,CACb,WAAW,IAAI,KAAK,WAAW,iCAAiC,SAAS,qEAAqE,CAC/I,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -13,12 +13,18 @@
|
|
|
13
13
|
* unmigrated tenants and one migrated one, 22/09/2026). The lookup shares the
|
|
14
14
|
* 15 minute per-tenant cache, so a Classic call costs at most one extra
|
|
15
15
|
* GraphQL round trip per tenant per cache window.
|
|
16
|
+
*
|
|
17
|
+
* A tenant Fusion does not hold gets HTTP 503 "tenant <id> not found or not
|
|
18
|
+
* accessible" instead (FusionTenantNotOnFusionError, the same answer every
|
|
19
|
+
* time, 29/10/2026). That is a definite "not migrated". The reference data
|
|
20
|
+
* cache keeps only successes, so the guard holds this answer itself for the
|
|
21
|
+
* same 15 minutes. Any other failure is not held and yields a warning.
|
|
16
22
|
*/
|
|
17
|
-
import type
|
|
23
|
+
import { type CaseReferenceDataCache } from "./case-reference-data.js";
|
|
18
24
|
export declare const UPGRADE_CENTRE_URL = "https://community.sophos.com/sophos-xdr/sophos-xdr-mdr-expansion/upgrade-center";
|
|
19
25
|
export interface MigrationStatus {
|
|
20
26
|
tenantId: string;
|
|
21
|
-
/** true migrated, false not migrated, null when the check was skipped or Fusion could not be reached. */
|
|
27
|
+
/** true migrated, false not migrated (including a tenant Fusion does not hold), null when the check was skipped or Fusion could not be reached. */
|
|
22
28
|
migrated: boolean | null;
|
|
23
29
|
/** Fusion case type names the tenant exposes (empty when not migrated). */
|
|
24
30
|
caseTypes: string[];
|
|
@@ -27,7 +33,10 @@ export interface MigrationStatus {
|
|
|
27
33
|
export declare class FusionMigrationGuard {
|
|
28
34
|
private referenceData;
|
|
29
35
|
private enabled;
|
|
30
|
-
|
|
36
|
+
private notOnFusionTtlMs;
|
|
37
|
+
/** Tenants Fusion answered "not found or not accessible" for, and until when that answer holds. */
|
|
38
|
+
private notOnFusion;
|
|
39
|
+
constructor(referenceData: Pick<CaseReferenceDataCache, "get">, enabled?: boolean, notOnFusionTtlMs?: number);
|
|
31
40
|
status(tenantId: string): Promise<MigrationStatus>;
|
|
32
41
|
/**
|
|
33
42
|
* Gate for a Classic tool. Throws with a pointer to the Fusion replacement
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../src/fusion/migration.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../src/fusion/migration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,EAA8B,KAAK,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEnG,eAAO,MAAM,kBAAkB,oFACoD,CAAC;AAEpF,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,mJAAmJ;IACnJ,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IACzB,2EAA2E;IAC3E,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,oBAAoB;IAK7B,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,gBAAgB;IAN1B,mGAAmG;IACnG,OAAO,CAAC,WAAW,CAA6B;gBAGtC,aAAa,EAAE,IAAI,CAAC,sBAAsB,EAAE,KAAK,CAAC,EAClD,OAAO,GAAE,OAAiC,EAC1C,gBAAgB,GAAE,MAAmC;IAGzD,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAwCxD;;;;;OAKG;IACG,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAclG"}
|
package/dist/fusion/migration.js
CHANGED
|
@@ -13,15 +13,27 @@
|
|
|
13
13
|
* unmigrated tenants and one migrated one, 22/09/2026). The lookup shares the
|
|
14
14
|
* 15 minute per-tenant cache, so a Classic call costs at most one extra
|
|
15
15
|
* GraphQL round trip per tenant per cache window.
|
|
16
|
+
*
|
|
17
|
+
* A tenant Fusion does not hold gets HTTP 503 "tenant <id> not found or not
|
|
18
|
+
* accessible" instead (FusionTenantNotOnFusionError, the same answer every
|
|
19
|
+
* time, 29/10/2026). That is a definite "not migrated". The reference data
|
|
20
|
+
* cache keeps only successes, so the guard holds this answer itself for the
|
|
21
|
+
* same 15 minutes. Any other failure is not held and yields a warning.
|
|
16
22
|
*/
|
|
17
23
|
import { CLASSIC_MIGRATION_CHECK } from "../config/config.js";
|
|
24
|
+
import { FusionTenantNotOnFusionError } from "../client/fusion-client.js";
|
|
25
|
+
import { CASE_REFERENCE_DATA_TTL_MS } from "./case-reference-data.js";
|
|
18
26
|
export const UPGRADE_CENTRE_URL = "https://community.sophos.com/sophos-xdr/sophos-xdr-mdr-expansion/upgrade-center";
|
|
19
27
|
export class FusionMigrationGuard {
|
|
20
28
|
referenceData;
|
|
21
29
|
enabled;
|
|
22
|
-
|
|
30
|
+
notOnFusionTtlMs;
|
|
31
|
+
/** Tenants Fusion answered "not found or not accessible" for, and until when that answer holds. */
|
|
32
|
+
notOnFusion = new Map();
|
|
33
|
+
constructor(referenceData, enabled = CLASSIC_MIGRATION_CHECK, notOnFusionTtlMs = CASE_REFERENCE_DATA_TTL_MS) {
|
|
23
34
|
this.referenceData = referenceData;
|
|
24
35
|
this.enabled = enabled;
|
|
36
|
+
this.notOnFusionTtlMs = notOnFusionTtlMs;
|
|
25
37
|
}
|
|
26
38
|
async status(tenantId) {
|
|
27
39
|
if (!this.enabled) {
|
|
@@ -32,6 +44,10 @@ export class FusionMigrationGuard {
|
|
|
32
44
|
detail: "migration check disabled (SOPHOS_CLASSIC_MIGRATION_CHECK=off)",
|
|
33
45
|
};
|
|
34
46
|
}
|
|
47
|
+
const heldUntil = this.notOnFusion.get(tenantId);
|
|
48
|
+
if (heldUntil !== undefined && Date.now() < heldUntil) {
|
|
49
|
+
return notOnFusionStatus(tenantId);
|
|
50
|
+
}
|
|
35
51
|
try {
|
|
36
52
|
const { types } = await this.referenceData.get(tenantId);
|
|
37
53
|
const caseTypes = types.map((t) => t.name);
|
|
@@ -45,6 +61,10 @@ export class FusionMigrationGuard {
|
|
|
45
61
|
};
|
|
46
62
|
}
|
|
47
63
|
catch (error) {
|
|
64
|
+
if (error instanceof FusionTenantNotOnFusionError) {
|
|
65
|
+
this.notOnFusion.set(tenantId, Date.now() + this.notOnFusionTtlMs);
|
|
66
|
+
return notOnFusionStatus(tenantId);
|
|
67
|
+
}
|
|
48
68
|
const message = error instanceof Error ? error.message : String(error);
|
|
49
69
|
return {
|
|
50
70
|
tenantId,
|
|
@@ -73,4 +93,12 @@ export class FusionMigrationGuard {
|
|
|
73
93
|
return [];
|
|
74
94
|
}
|
|
75
95
|
}
|
|
96
|
+
function notOnFusionStatus(tenantId) {
|
|
97
|
+
return {
|
|
98
|
+
tenantId,
|
|
99
|
+
migrated: false,
|
|
100
|
+
caseTypes: [],
|
|
101
|
+
detail: "Fusion does not hold this tenant (HTTP 503 tenant not found or not accessible), so it is not on Sophos Fusion",
|
|
102
|
+
};
|
|
103
|
+
}
|
|
76
104
|
//# sourceMappingURL=migration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.js","sourceRoot":"","sources":["../../src/fusion/migration.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"migration.js","sourceRoot":"","sources":["../../src/fusion/migration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAA+B,MAAM,0BAA0B,CAAC;AAEnG,MAAM,CAAC,MAAM,kBAAkB,GAC7B,iFAAiF,CAAC;AAWpF,MAAM,OAAO,oBAAoB;IAKrB;IACA;IACA;IANV,mGAAmG;IAC3F,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEhD,YACU,aAAkD,EAClD,UAAmB,uBAAuB,EAC1C,mBAA2B,0BAA0B;QAFrD,kBAAa,GAAb,aAAa,CAAqC;QAClD,YAAO,GAAP,OAAO,CAAmC;QAC1C,qBAAgB,GAAhB,gBAAgB,CAAqC;IAC5D,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,QAAgB;QAC3B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO;gBACL,QAAQ;gBACR,QAAQ,EAAE,IAAI;gBACd,SAAS,EAAE,EAAE;gBACb,MAAM,EAAE,+DAA+D;aACxE,CAAC;QACJ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