sophos-central-mcp-server 0.4.2 → 0.6.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/LICENSE +0 -0
- package/README.md +204 -64
- package/dist/auth/token-manager.d.ts +0 -0
- package/dist/auth/token-manager.d.ts.map +0 -0
- package/dist/auth/token-manager.js +0 -0
- package/dist/auth/token-manager.js.map +0 -0
- package/dist/client/fusion-client.d.ts +132 -0
- package/dist/client/fusion-client.d.ts.map +1 -0
- package/dist/client/fusion-client.js +258 -0
- package/dist/client/fusion-client.js.map +1 -0
- package/dist/client/sophos-client.d.ts +0 -0
- package/dist/client/sophos-client.d.ts.map +0 -0
- package/dist/client/sophos-client.js +0 -0
- package/dist/client/sophos-client.js.map +0 -0
- package/dist/client/tenant-resolver.d.ts +0 -0
- package/dist/client/tenant-resolver.d.ts.map +0 -0
- package/dist/client/tenant-resolver.js +0 -0
- package/dist/client/tenant-resolver.js.map +0 -0
- package/dist/config/config.d.ts +2 -0
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +10 -0
- package/dist/config/config.js.map +1 -1
- package/dist/fusion/case-reference-data.d.ts +34 -0
- package/dist/fusion/case-reference-data.d.ts.map +1 -0
- package/dist/fusion/case-reference-data.js +97 -0
- package/dist/fusion/case-reference-data.js.map +1 -0
- package/dist/fusion/cases-ql.d.ts +28 -0
- package/dist/fusion/cases-ql.d.ts.map +1 -0
- package/dist/fusion/cases-ql.js +77 -0
- package/dist/fusion/cases-ql.js.map +1 -0
- package/dist/fusion/format.d.ts +95 -0
- package/dist/fusion/format.d.ts.map +1 -0
- package/dist/fusion/format.js +142 -0
- package/dist/fusion/format.js.map +1 -0
- package/dist/fusion/migration.d.ts +40 -0
- package/dist/fusion/migration.d.ts.map +1 -0
- package/dist/fusion/migration.js +76 -0
- package/dist/fusion/migration.js.map +1 -0
- package/dist/fusion/queries/cases.d.ts +40 -0
- package/dist/fusion/queries/cases.d.ts.map +1 -0
- package/dist/fusion/queries/cases.js +243 -0
- package/dist/fusion/queries/cases.js.map +1 -0
- package/dist/fusion/queries/detections.d.ts +21 -0
- package/dist/fusion/queries/detections.d.ts.map +1 -0
- package/dist/fusion/queries/detections.js +64 -0
- package/dist/fusion/queries/detections.js.map +1 -0
- package/dist/fusion/types.d.ts +322 -0
- package/dist/fusion/types.d.ts.map +1 -0
- package/dist/fusion/types.js +7 -0
- package/dist/fusion/types.js.map +1 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.d.ts.map +0 -0
- package/dist/index.js +16 -4
- package/dist/index.js.map +1 -1
- package/dist/tools/accounts.d.ts +0 -0
- package/dist/tools/accounts.d.ts.map +0 -0
- package/dist/tools/accounts.js +0 -0
- package/dist/tools/accounts.js.map +0 -0
- package/dist/tools/admin-management.d.ts +0 -0
- package/dist/tools/admin-management.d.ts.map +0 -0
- package/dist/tools/admin-management.js +0 -0
- package/dist/tools/admin-management.js.map +0 -0
- package/dist/tools/alerts.d.ts +0 -0
- package/dist/tools/alerts.d.ts.map +0 -0
- package/dist/tools/alerts.js +0 -0
- package/dist/tools/alerts.js.map +0 -0
- package/dist/tools/audit-events.d.ts +0 -0
- package/dist/tools/audit-events.d.ts.map +0 -0
- package/dist/tools/audit-events.js +0 -0
- package/dist/tools/audit-events.js.map +0 -0
- package/dist/tools/business-automation.d.ts +0 -0
- package/dist/tools/business-automation.d.ts.map +0 -0
- package/dist/tools/business-automation.js +0 -0
- package/dist/tools/business-automation.js.map +0 -0
- package/dist/tools/cases.d.ts +2 -1
- package/dist/tools/cases.d.ts.map +1 -1
- package/dist/tools/cases.js +46 -19
- package/dist/tools/cases.js.map +1 -1
- package/dist/tools/cloud-security.d.ts +0 -0
- package/dist/tools/cloud-security.d.ts.map +0 -0
- package/dist/tools/cloud-security.js +0 -0
- package/dist/tools/cloud-security.js.map +0 -0
- package/dist/tools/detections.d.ts +2 -1
- package/dist/tools/detections.d.ts.map +1 -1
- package/dist/tools/detections.js +32 -14
- package/dist/tools/detections.js.map +1 -1
- package/dist/tools/directory.d.ts +0 -0
- package/dist/tools/directory.d.ts.map +0 -0
- package/dist/tools/directory.js +0 -0
- package/dist/tools/directory.js.map +0 -0
- package/dist/tools/dns-protection.d.ts +0 -0
- package/dist/tools/dns-protection.d.ts.map +0 -0
- package/dist/tools/dns-protection.js +0 -0
- package/dist/tools/dns-protection.js.map +0 -0
- package/dist/tools/email.d.ts +0 -0
- package/dist/tools/email.d.ts.map +0 -0
- package/dist/tools/email.js +0 -0
- package/dist/tools/email.js.map +0 -0
- package/dist/tools/endpoint-migrations.d.ts +0 -0
- package/dist/tools/endpoint-migrations.d.ts.map +0 -0
- package/dist/tools/endpoint-migrations.js +0 -0
- package/dist/tools/endpoint-migrations.js.map +0 -0
- package/dist/tools/endpoint-settings.d.ts +0 -0
- package/dist/tools/endpoint-settings.d.ts.map +0 -0
- package/dist/tools/endpoint-settings.js +0 -0
- package/dist/tools/endpoint-settings.js.map +0 -0
- package/dist/tools/endpoints.d.ts +0 -0
- package/dist/tools/endpoints.d.ts.map +0 -0
- package/dist/tools/endpoints.js +0 -0
- package/dist/tools/endpoints.js.map +0 -0
- package/dist/tools/exclusions.d.ts +0 -0
- package/dist/tools/exclusions.d.ts.map +0 -0
- package/dist/tools/exclusions.js +0 -0
- package/dist/tools/exclusions.js.map +0 -0
- package/dist/tools/firewall.d.ts +0 -0
- package/dist/tools/firewall.d.ts.map +0 -0
- package/dist/tools/firewall.js +0 -0
- package/dist/tools/firewall.js.map +0 -0
- package/dist/tools/fusion-cases.d.ts +50 -0
- package/dist/tools/fusion-cases.d.ts.map +1 -0
- package/dist/tools/fusion-cases.js +1809 -0
- package/dist/tools/fusion-cases.js.map +1 -0
- package/dist/tools/fusion-detections.d.ts +14 -0
- package/dist/tools/fusion-detections.d.ts.map +1 -0
- package/dist/tools/fusion-detections.js +75 -0
- package/dist/tools/fusion-detections.js.map +1 -0
- package/dist/tools/groups.d.ts +0 -0
- package/dist/tools/groups.d.ts.map +0 -0
- package/dist/tools/groups.js +0 -0
- package/dist/tools/groups.js.map +0 -0
- package/dist/tools/health.d.ts +0 -0
- package/dist/tools/health.d.ts.map +0 -0
- package/dist/tools/health.js +0 -0
- package/dist/tools/health.js.map +0 -0
- package/dist/tools/helpers.d.ts +7 -0
- package/dist/tools/helpers.d.ts.map +1 -1
- package/dist/tools/helpers.js +7 -0
- package/dist/tools/helpers.js.map +1 -1
- package/dist/tools/licensing.d.ts +0 -0
- package/dist/tools/licensing.d.ts.map +0 -0
- package/dist/tools/licensing.js +0 -0
- package/dist/tools/licensing.js.map +0 -0
- package/dist/tools/live-discover.d.ts +0 -0
- package/dist/tools/live-discover.d.ts.map +0 -0
- package/dist/tools/live-discover.js +0 -0
- package/dist/tools/live-discover.js.map +0 -0
- package/dist/tools/mobile.d.ts +0 -0
- package/dist/tools/mobile.d.ts.map +0 -0
- package/dist/tools/mobile.js +0 -0
- package/dist/tools/mobile.js.map +0 -0
- package/dist/tools/partner.d.ts +0 -0
- package/dist/tools/partner.d.ts.map +0 -0
- package/dist/tools/partner.js +0 -0
- package/dist/tools/partner.js.map +0 -0
- package/dist/tools/policies.d.ts +0 -0
- package/dist/tools/policies.d.ts.map +0 -0
- package/dist/tools/policies.js +0 -0
- package/dist/tools/policies.js.map +0 -0
- package/dist/tools/siem.d.ts +0 -0
- package/dist/tools/siem.d.ts.map +0 -0
- package/dist/tools/siem.js +0 -0
- package/dist/tools/siem.js.map +0 -0
- package/dist/tools/switch.d.ts +0 -0
- package/dist/tools/switch.d.ts.map +0 -0
- package/dist/tools/switch.js +0 -0
- package/dist/tools/switch.js.map +0 -0
- package/dist/tools/tenants.d.ts +0 -0
- package/dist/tools/tenants.d.ts.map +0 -0
- package/dist/tools/tenants.js +0 -0
- package/dist/tools/tenants.js.map +0 -0
- package/dist/tools/user-activity.d.ts +0 -0
- package/dist/tools/user-activity.d.ts.map +0 -0
- package/dist/tools/user-activity.js +0 -0
- package/dist/tools/user-activity.js.map +0 -0
- package/dist/tools/web-filtering.d.ts +0 -0
- package/dist/tools/web-filtering.d.ts.map +0 -0
- package/dist/tools/web-filtering.js +0 -0
- package/dist/tools/web-filtering.js.map +0 -0
- package/dist/tools/wifi.d.ts +0 -0
- package/dist/tools/wifi.d.ts.map +0 -0
- package/dist/tools/wifi.js +0 -0
- package/dist/tools/wifi.js.map +0 -0
- package/dist/tools/xdr.d.ts +0 -0
- package/dist/tools/xdr.d.ts.map +0 -0
- package/dist/tools/xdr.js +0 -0
- package/dist/tools/xdr.js.map +0 -0
- package/dist/types/sophos.d.ts +0 -0
- package/dist/types/sophos.d.ts.map +0 -0
- package/dist/types/sophos.js +0 -0
- package/dist/types/sophos.js.map +0 -0
- package/docs/screenshots/tenant-health-detail.png +0 -0
- package/docs/screenshots/tenant-health-overview.png +0 -0
- package/docs/screenshots/tenant-listing.png +0 -0
- package/package.json +18 -4
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -1,56 +1,51 @@
|
|
|
1
|
-
# Sophos
|
|
1
|
+
# Sophos Fusion MCP Server (formerly Sophos Central)
|
|
2
2
|
|
|
3
|
-
MCP (Model Context Protocol) server for
|
|
3
|
+
MCP (Model Context Protocol) server for the Sophos Fusion and Sophos Central APIs. Supports partner, organisation, and single-tenant credential types with automatic region routing. **310 tools** covering 22 Sophos API namespaces: the Sophos Central REST APIs plus the Sophos Fusion GraphQL APIs (`sophos_fusion_*`). Install it as a Claude Desktop extension (`.mcpb`), run it with npx, or host it yourself over streamable HTTP.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The npm package, the `.mcpb` bundle and the binaries keep the `sophos-central-mcp-server` name so existing installs update in place.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Prerequisites
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
You need these before any of the install options below.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
### Sophos Central API credentials
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
{
|
|
15
|
-
"mcpServers": {
|
|
16
|
-
"sophos-central": {
|
|
17
|
-
"command": "npx",
|
|
18
|
-
"args": ["-y", "sophos-central-mcp-server"],
|
|
19
|
-
"env": {
|
|
20
|
-
"SOPHOS_CLIENT_ID": "your-client-id",
|
|
21
|
-
"SOPHOS_CLIENT_SECRET": "your-client-secret",
|
|
22
|
-
"TRANSPORT": "stdio"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
```
|
|
13
|
+
Every install method needs a Client ID and Client Secret. The same credential authorises both the Sophos Central REST tools and the Sophos Fusion GraphQL tools; there is no second credential. The credential type decides what the server can see:
|
|
28
14
|
|
|
29
|
-
**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
15
|
+
- **Tenant-level**: In Sophos Central, go to **Settings > API Credentials Management** and create a new credential. The server operates on that one tenant.
|
|
16
|
+
- **Partner-level**: In the Sophos Partner Dashboard, create API credentials under **Settings > API Credentials**. The server can query every tenant the partner manages.
|
|
17
|
+
- **Organisation-level**: In Sophos Central Enterprise, use **Global Settings > API Credentials Management**. Same cross-tenant behaviour as partner credentials.
|
|
18
|
+
|
|
19
|
+
### Node.js 20 or later (npm and self-hosted installs only)
|
|
20
|
+
|
|
21
|
+
The `.mcpb` bundle for Claude Desktop does not need Node.js on your machine: Claude Desktop ships its own Node.js runtime and the bundle carries the server and all of its dependencies. Install Node.js 20+ only if you use the Claude Code or self-hosted options.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
Pick one:
|
|
26
|
+
|
|
27
|
+
| Option | Best for | Needs Node.js? |
|
|
28
|
+
|--------|----------|----------------|
|
|
29
|
+
| [Claude Desktop extension (.mcpb)](#option-1-claude-desktop-extension-mcpb-recommended) | Claude Desktop users who want a two-minute install | No |
|
|
30
|
+
| [Claude Code](#option-2-claude-code) | Terminal use with Claude Code | Yes |
|
|
31
|
+
| [Self-hosted with npm](#option-3-self-hosted-with-npm-streamable-http-or-stdio) | Running the server yourself for any MCP client, over streamable HTTP or stdio | Yes |
|
|
32
|
+
|
|
33
|
+
### Option 1: Claude Desktop extension (.mcpb, recommended)
|
|
34
|
+
|
|
35
|
+
The `.mcpb` file is an [MCP Bundle](https://github.com/modelcontextprotocol/mcpb): a zip containing the built server, its production dependencies, and a manifest that tells Claude Desktop how to run it and which settings to ask for. No terminal and no config file edits.
|
|
46
36
|
|
|
47
|
-
|
|
37
|
+
1. Download `sophos-central-mcp-server-<version>.mcpb` from the [latest GitHub release](https://github.com/Aaronjacobs000/sophos-central-mcp/releases/latest).
|
|
38
|
+
2. Open the file with Claude Desktop. Double-clicking it works on macOS and Windows. You can also go to **Settings > Extensions > Advanced settings**, find the **Extension Developer** section, click **Install Extension...** and pick the file.
|
|
39
|
+
3. Claude Desktop shows the extension details and asks for your **Sophos Central Client ID** and **Client Secret**. Both fields are marked sensitive in the manifest, so Claude Desktop keeps them in the operating system's secure storage instead of a config file.
|
|
40
|
+
4. Click **Install**, make sure the extension is enabled, then start a new chat. The `sophos_*` tools are available straight away.
|
|
48
41
|
|
|
49
|
-
|
|
42
|
+
To update, download the newer `.mcpb` and install it the same way. To remove it, open **Settings > Extensions** and uninstall the extension.
|
|
50
43
|
|
|
51
|
-
|
|
44
|
+
The bundle runs the server in stdio mode and sets `TRANSPORT=stdio` for you. Which tools you get depends on the credential type, exactly as with the other install options: partner and organisation credentials unlock the cross-tenant tools, tenant credentials do not.
|
|
52
45
|
|
|
53
|
-
|
|
46
|
+
### Option 2: Claude Code
|
|
47
|
+
|
|
48
|
+
Requires Node.js. Run this once in your terminal. The `-e` flags save the credentials permanently to Claude Code's MCP config so you don't need to re-export them each session:
|
|
54
49
|
|
|
55
50
|
**macOS / Linux:**
|
|
56
51
|
|
|
@@ -72,17 +67,105 @@ claude mcp add sophos-central ^
|
|
|
72
67
|
-- cmd /c npx -y sophos-central-mcp-server
|
|
73
68
|
```
|
|
74
69
|
|
|
70
|
+
### Option 3: Self-hosted with npm (streamable HTTP or stdio)
|
|
71
|
+
|
|
72
|
+
Use this when you want to run the server yourself, on a workstation, a jump box, or in a container, for any MCP client that speaks streamable HTTP or can spawn a stdio process. Nothing here depends on the `.mcpb` bundle.
|
|
73
|
+
|
|
74
|
+
**Install from npm:**
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm install -g sophos-central-mcp-server
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Or from source:**
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
git clone https://github.com/Aaronjacobs000/sophos-central-mcp.git
|
|
84
|
+
cd sophos-central-mcp
|
|
85
|
+
npm install
|
|
86
|
+
npm run build
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Configure.** Either export the variables in your shell or put them in a `.env` file in the directory you start the server from. The full table is under [Configuration](#configuration).
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
SOPHOS_CLIENT_ID=your-client-id
|
|
93
|
+
SOPHOS_CLIENT_SECRET=your-client-secret
|
|
94
|
+
PORT=3100
|
|
95
|
+
TRANSPORT=http
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Run:**
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
sophos-central-mcp # global npm install
|
|
102
|
+
npm start # from a source checkout
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
With `TRANSPORT=http` (the default) the server listens on `http://127.0.0.1:3100/mcp` and answers `GET /health` with `{"status":"ok"}`. The MCP endpoint is stateless: every request gets a fresh transport. Point any streamable HTTP client at it, for example Claude Code:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
claude mcp add --transport http sophos-central http://127.0.0.1:3100/mcp
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
With `TRANSPORT=stdio` the server speaks MCP over stdin/stdout and is meant to be spawned by the client, which is what Options 1 and 2 do for you.
|
|
112
|
+
|
|
113
|
+
The HTTP server binds to `127.0.0.1` only and has no authentication of its own. If it needs to be reachable from another host, put it behind something that adds TLS and auth (an SSH tunnel or an authenticating reverse proxy) rather than changing the bind address.
|
|
114
|
+
|
|
115
|
+
### Build the .mcpb yourself (maintainers)
|
|
116
|
+
|
|
117
|
+
The bundle is produced by `scripts/build-mcpb.mjs` using the `mcpb` CLI, which is a dev dependency. From a source checkout:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npm install
|
|
121
|
+
npm run build:mcpb
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The script:
|
|
125
|
+
|
|
126
|
+
1. Compiles TypeScript to `dist/` (via `npm run build`).
|
|
127
|
+
2. Rewrites `manifest.json` so its `version` matches `package.json` and its `tools` list matches every `registerTool` call in `src/tools/`. Commit the result. The manifest in git is always the one that was last built.
|
|
128
|
+
3. Validates the manifest with `mcpb validate`.
|
|
129
|
+
4. Stages `dist/`, `package.json`, `LICENSE`, and `manifest.json` in `build/mcpb/` and runs `npm ci --omit=dev` there, so only production dependencies are bundled. `.mcpbignore` adds a few exclusions on top of the CLI's defaults.
|
|
130
|
+
5. Packs the staging directory into `release/sophos-central-mcp-server-<version>.mcpb`.
|
|
131
|
+
|
|
132
|
+
`build/` and `release/` are git-ignored. To inspect a bundle without installing it, `npx mcpb info release/<file>.mcpb` prints its size and signature state, and `npx mcpb unpack release/<file>.mcpb <dir>` extracts it. Signing is optional; `npx mcpb sign --self-signed release/<file>.mcpb` adds a self-signed signature if you want one.
|
|
133
|
+
|
|
134
|
+
### Tests (maintainers)
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
npm test
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Builds, then runs the `node:test` suites in `test/` with `fetch` stubbed: the Fusion GraphQL transport (including the HTTP 200 with `errors` case), the QL builder, the reference-data cache, and the path-keyed retry for the intermittent case-write fault, the migration guard, and a registration check that lists all 310 tools over an in-memory transport and checks the descriptions for the measured warnings. Nothing in `npm test` reaches Sophos.
|
|
141
|
+
|
|
142
|
+
To exercise the Fusion tools against a live tenant, put credentials in `.env` (or export them) and run:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
node scripts/fusion-smoke.mjs # read-only, tenant credential
|
|
146
|
+
node scripts/fusion-smoke.mjs <tenant-id> # read-only, partner or organisation credential
|
|
147
|
+
node scripts/fusion-smoke.mjs --write # plus the Fusion write tools on one new case
|
|
148
|
+
node scripts/fusion-smoke.mjs --write-classic # plus the Classic case tools on one new case
|
|
149
|
+
node scripts/fusion-smoke.mjs --all # everything
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
It spawns the built server over stdio and calls the tools through an MCP client, so what runs is what a host runs. Read-only mode covers the reference data, the case list with filter and cursor variants, the newest case by short ID, its evidence, summary, comments and files, the detection search, the not-found and legacy-ID refusals, and the Classic side: on a migrated tenant the migration refusal, otherwise the six Classic read tools. `--write` creates one case titled `MCP smoke test <timestamp>` (managed_by CUSTOMER), exercises comment add, edit and delete with the mention read-back, link create, update and delete, tag merge and replace, evidence add and remove_all, file upload, list and soft delete, the verdict clear on reopen, the one way door on new and the closed-case freeze, then closes it with a verdict and archives it (Fusion has no delete). `--write-classic` creates, updates and deletes one Classic case; the Cases API requires an assignee and a detection that still exists, so set `SMOKE_CLASSIC_ASSIGNEE` (a tenant admin email) and, if needed, `SMOKE_CLASSIC_DETECTION_ID` (a recent detection ID). Every write is listed at the end. Existing cases are never modified.
|
|
153
|
+
|
|
154
|
+
**Cutting a release:** bump `version` in `package.json`, run `npm run build:mcpb`, commit `package.json`, `package-lock.json`, and `manifest.json`, tag, and attach the `.mcpb` from `release/` to the GitHub release. Publish to npm as before so the Claude Code and self-hosted options pick up the same version.
|
|
75
155
|
|
|
76
156
|
## Features
|
|
77
157
|
|
|
78
158
|
- **Universal caller support**: Works with partner, organisation, and tenant-level API credentials
|
|
79
159
|
- **Multi-tenant**: Partner/org callers can query across all managed tenants
|
|
80
|
-
- **Partner gap analysis**: Single-call sales opportunity report across all managed tenants
|
|
160
|
+
- **Partner gap analysis**: Single-call sales opportunity report across all managed tenants. Fetches health data in parallel and returns a compact ranked list of security gaps per customer
|
|
81
161
|
- **Auto region routing**: Discovers tenant data regions via `/whoami/v1` and routes requests to the correct regional API host
|
|
82
162
|
- **Token lifecycle**: Automatic OAuth2 token refresh before expiry
|
|
83
163
|
- **Rate limit handling**: Retry with backoff on 429 responses
|
|
84
|
-
- **Dual transport**:
|
|
85
|
-
- **
|
|
164
|
+
- **Dual transport**: stdio (Claude Desktop, Claude Code, and the `.mcpb` bundle) or streamable HTTP (self-hosted)
|
|
165
|
+
- **One-click install**: Ships as a Claude Desktop extension (`.mcpb`) with credentials held in the OS secure store
|
|
166
|
+
- **Two API generations**: the Sophos Central REST APIs and the Sophos Fusion GraphQL APIs on one credential, with `sophos_fusion_*` tools for the GraphQL side
|
|
167
|
+
- **Migration aware**: the Classic case and detection tools refuse a tenant that has moved to Sophos Fusion and name the `sophos_fusion_*` tool to use instead
|
|
168
|
+
- **Full API coverage**: 310 tools across endpoints, alerts, policies, firewalls, web filtering, licensing, audit events, email, mobile, XDR, cases, SIEM, and more
|
|
86
169
|
|
|
87
170
|
## Screenshots
|
|
88
171
|
|
|
@@ -96,21 +179,10 @@ claude mcp add sophos-central ^
|
|
|
96
179
|
|
|
97
180
|

|
|
98
181
|
|
|
99
|
-
## Prerequisites
|
|
100
|
-
|
|
101
|
-
- Node.js 20 or later
|
|
102
|
-
- Sophos Central API credentials (Client ID + Client Secret)
|
|
103
|
-
|
|
104
|
-
### Creating API Credentials
|
|
105
|
-
|
|
106
|
-
**Tenant-level**: In Sophos Central, go to **Settings > API Credentials Management** and create a new credential.
|
|
107
|
-
|
|
108
|
-
**Partner-level**: In the Sophos Partner Dashboard, create API credentials under **Settings > API Credentials**.
|
|
109
|
-
|
|
110
|
-
**Organisation-level**: In Sophos Central Enterprise, use **Global Settings > API Credentials Management**.
|
|
111
|
-
|
|
112
182
|
## Configuration
|
|
113
183
|
|
|
184
|
+
Applies to the Claude Code and self-hosted options. The Claude Desktop extension asks for the credentials in its install dialog and sets `TRANSPORT=stdio` itself.
|
|
185
|
+
|
|
114
186
|
Copy `.env.example` to `.env` and set your credentials:
|
|
115
187
|
|
|
116
188
|
```
|
|
@@ -124,12 +196,25 @@ TRANSPORT=http
|
|
|
124
196
|
|----------|----------|---------|-------------|
|
|
125
197
|
| `SOPHOS_CLIENT_ID` | Yes | - | OAuth2 client ID |
|
|
126
198
|
| `SOPHOS_CLIENT_SECRET` | Yes | - | OAuth2 client secret |
|
|
127
|
-
| `SOPHOS_TENANT_ID` | No | - | Lock to a single tenant (useful for tenant-level creds) |
|
|
128
199
|
| `PORT` | No | 3100 | HTTP server port |
|
|
129
200
|
| `TRANSPORT` | No | http | `http` for streamable HTTP, `stdio` for subprocess mode |
|
|
201
|
+
| `CHARACTER_LIMIT` | No | 50000 | Maximum characters per tool response before truncation (minimum 10000) |
|
|
202
|
+
| `SOPHOS_FUSION_GRAPHQL_URL` | No | `https://api.taegis.sophos.com/graphql` | Sophos Fusion GraphQL endpoint. Override when the Fusion branded hostnames ship |
|
|
203
|
+
| `SOPHOS_CLASSIC_MIGRATION_CHECK` | No | on | `off` skips the migration check on the Classic case and detection tools (they then run for every tenant) |
|
|
130
204
|
|
|
131
205
|
## Tools
|
|
132
206
|
|
|
207
|
+
### Two API generations
|
|
208
|
+
|
|
209
|
+
The server speaks to two Sophos API generations on one credential:
|
|
210
|
+
|
|
211
|
+
- **Sophos Central REST APIs** (retained). Every tool without the `fusion` prefix. Regional hosts, discovered from `/whoami/v1`.
|
|
212
|
+
- **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.
|
|
213
|
+
|
|
214
|
+
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 has not shipped (Sophos says October 2026), so `sophos_run_xdr_query` stays on the SQL XDR Query API. Fusion tools for events, threat timeline and live endpoint search are planned.
|
|
215
|
+
|
|
216
|
+
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.
|
|
217
|
+
|
|
133
218
|
### Partner & Organisation (18 tools)
|
|
134
219
|
|
|
135
220
|
> These tools are only available with **partner or organisation-level** credentials. They operate across all managed tenants.
|
|
@@ -321,11 +406,13 @@ TRANSPORT=http
|
|
|
321
406
|
|
|
322
407
|
### Cases (9 tools)
|
|
323
408
|
|
|
409
|
+
Sophos Central Cases REST API. Correct for a tenant that has not moved to Fusion, and the only way to read its legacy cases (IDs like `1-598868`). Refused for a tenant that has moved, with a pointer to the `sophos_fusion_*` tool to use (see "Two API generations").
|
|
410
|
+
|
|
324
411
|
| Tool | Description |
|
|
325
412
|
|------|-------------|
|
|
326
413
|
| `sophos_list_cases` | List investigation cases |
|
|
327
414
|
| `sophos_get_case` | Get full case details |
|
|
328
|
-
| `sophos_create_case` | Create a new investigation case |
|
|
415
|
+
| `sophos_create_case` | Create a new investigation case (the API requires an assignee and a detection that still exists) |
|
|
329
416
|
| `sophos_update_case` | Update case status, severity, assignee |
|
|
330
417
|
| `sophos_delete_case` | Delete a case |
|
|
331
418
|
| `sophos_list_case_detections` | List detections linked to a case |
|
|
@@ -333,9 +420,47 @@ TRANSPORT=http
|
|
|
333
420
|
| `sophos_list_case_impacted_entities` | List impacted entities for a case |
|
|
334
421
|
| `sophos_get_case_mitre_summary` | Get MITRE ATT&CK breakdown for a case |
|
|
335
422
|
|
|
423
|
+
### Fusion Cases (21 tools)
|
|
424
|
+
|
|
425
|
+
Sophos Fusion Cases GraphQL API v2. Case IDs are UUIDs; short IDs (`CSE00001`) are accepted and resolved. Severity is 2 informational, 4 low, 6 medium, 8 high, 10 critical. Detection severity inside the case summary is a 0 to 1 float, a different scale from both the case severity and the Classic REST 0 to 10 detection severity; none of them convert. There is no delete: close the case (with a verdict when its type needs one), then archive it.
|
|
426
|
+
|
|
427
|
+
`managed_by` is required on create and decides who works the case: `PROVIDER` hands it to Sophos MDR, `CUSTOMER` keeps it self managed. It cannot be changed afterwards, and a case created without it is unclaimed, so the tool never omits it. Detection and event IDs on the evidence tools are six section resource names (`alert://priv:event-filter:123456:1789526908712:<uuid>`), which `sophos_fusion_search_detections` returns. Evidence writes are queued jobs that land category by category (an add showed after about 5 seconds, a three category removal took about 25 seconds), so read the evidence back with a poll; adding a detection also attaches its linked asset and events, and removing it does not retract them (`remove_all` does). Comment @mentions (`@authorized_contacts`, `@customer`, `@sophos`) fire wherever they appear, including in prose, and an unrecognised token is dropped silently, so the comment tools read the stored mentions back. Tags are merged on update unless `replace_tags` is set. File deletion is soft. Split and merge are irreversible and need a confirmation argument.
|
|
428
|
+
|
|
429
|
+
| Tool | Description |
|
|
430
|
+
|------|-------------|
|
|
431
|
+
| `sophos_fusion_list_cases` | List cases with QL filters (type, status, verdict resolved to IDs), offset or cursor pagination |
|
|
432
|
+
| `sophos_fusion_get_case` | Full case detail including key findings, verdict, links and processing status |
|
|
433
|
+
| `sophos_fusion_get_case_evidence` | Detection, event, asset and saved-search source IDs attached to a case |
|
|
434
|
+
| `sophos_fusion_get_case_summary` | Case plus its detections resolved in one batched call and a MITRE ATT&CK roll-up |
|
|
435
|
+
| `sophos_fusion_list_case_reference_data` | The tenant's case types, primary statuses and verdicts (15 minute cache) |
|
|
436
|
+
| `sophos_fusion_create_case` | Create a case: required managed_by, type and status by name or ID, integer severity, Markdown key findings, genesis evidence |
|
|
437
|
+
| `sophos_fusion_update_case` | Update fields, merge or replace tags, close with a verdict, reopen (verdict cleared), archive or unarchive; refuses frozen fields on a closed case rather than reopening it |
|
|
438
|
+
| `sophos_fusion_split_case` | Move named evidence into a new case (irreversible, confirm_split) |
|
|
439
|
+
| `sophos_fusion_merge_cases` | Merge source cases into a target and close them (asynchronous, irreversible, confirm_merge) |
|
|
440
|
+
| `sophos_fusion_list_case_comments` | List comments (raw author IDs, resolved mentions, read state) |
|
|
441
|
+
| `sophos_fusion_add_case_comment` | Add a comment and report which @mentions actually fired |
|
|
442
|
+
| `sophos_fusion_update_case_comment` | Edit a comment or mark it read |
|
|
443
|
+
| `sophos_fusion_delete_case_comment` | Delete a comment |
|
|
444
|
+
| `sophos_fusion_add_case_evidence` | Attach detections, events, hosts or saved searches (asynchronous, RNs checked) |
|
|
445
|
+
| `sophos_fusion_remove_case_evidence` | Detach evidence by source ID, or everything with remove_all (asynchronous) |
|
|
446
|
+
| `sophos_fusion_list_case_files` | List a case's files (deleted hidden by default, download URLs on request) |
|
|
447
|
+
| `sophos_fusion_upload_case_file` | Attach a file: register, PUT to the presigned URL, poll to UPLOADED |
|
|
448
|
+
| `sophos_fusion_delete_case_file` | Soft delete a file |
|
|
449
|
+
| `sophos_fusion_create_case_link` | Attach an external link (ServiceNow ticket, report) |
|
|
450
|
+
| `sophos_fusion_update_case_link` | Change a link's URL, title, type or reference |
|
|
451
|
+
| `sophos_fusion_delete_case_link` | Remove a link |
|
|
452
|
+
|
|
453
|
+
### Fusion Detections (1 tool)
|
|
454
|
+
|
|
455
|
+
Sophos Fusion Detections GraphQL API v2. One QL search replaces the Classic run, poll, results triple. Source keyword `alert`; working example `from alert severity >= 0.1 EARLIEST=-90d`. Severity is a 0 to 1 float.
|
|
456
|
+
|
|
457
|
+
| Tool | Description |
|
|
458
|
+
|------|-------------|
|
|
459
|
+
| `sophos_fusion_search_detections` | Search detections with QL; returns the resource-name IDs the case evidence tools take |
|
|
460
|
+
|
|
336
461
|
### Detections (6 tools)
|
|
337
462
|
|
|
338
|
-
|
|
463
|
+
Sophos Central Detections REST API, async: start a query, poll for completion, then fetch results. Refused for a tenant that has moved to Fusion, with a pointer to `sophos_fusion_search_detections`.
|
|
339
464
|
|
|
340
465
|
| Tool | Description |
|
|
341
466
|
|------|-------------|
|
|
@@ -355,7 +480,7 @@ Async API — start a query, poll for completion, then fetch results.
|
|
|
355
480
|
|
|
356
481
|
### XDR Data Lake (9 tools)
|
|
357
482
|
|
|
358
|
-
Async API
|
|
483
|
+
Async API: submit SQL queries against historical telemetry.
|
|
359
484
|
|
|
360
485
|
| Tool | Description |
|
|
361
486
|
|------|-------------|
|
|
@@ -371,7 +496,7 @@ Async API — submit SQL queries against historical telemetry.
|
|
|
371
496
|
|
|
372
497
|
### Live Discover (4 tools)
|
|
373
498
|
|
|
374
|
-
Async API
|
|
499
|
+
Async API: run OSquery SQL on live endpoints. Rate limited to 10 runs/minute, 500/day.
|
|
375
500
|
|
|
376
501
|
| Tool | Description |
|
|
377
502
|
|------|-------------|
|
|
@@ -604,6 +729,7 @@ Register tools based on identity type
|
|
|
604
729
|
|
|
|
605
730
|
v
|
|
606
731
|
Per tool call: resolve tenant -> regional API host -> execute request
|
|
732
|
+
Per sophos_fusion_* call: resolve tenant -> POST api.taegis.sophos.com/graphql -> inspect data and errors
|
|
607
733
|
```
|
|
608
734
|
|
|
609
735
|
### Key decisions
|
|
@@ -621,10 +747,21 @@ src/
|
|
|
621
747
|
├── config/config.ts # Environment config
|
|
622
748
|
├── auth/token-manager.ts # OAuth2 token lifecycle
|
|
623
749
|
├── client/
|
|
624
|
-
│ ├── sophos-client.ts #
|
|
750
|
+
│ ├── sophos-client.ts # REST client with region routing (Sophos Central)
|
|
751
|
+
│ ├── fusion-client.ts # GraphQL client (Sophos Fusion), 200-with-errors handling, path-keyed retry
|
|
625
752
|
│ └── tenant-resolver.ts # Whoami + tenant cache
|
|
753
|
+
├── fusion/
|
|
754
|
+
│ ├── queries/cases.ts # Cases v2 GraphQL documents
|
|
755
|
+
│ ├── queries/detections.ts # Detections v2 documents: the case summary lookup and the QL search
|
|
756
|
+
│ ├── case-reference-data.ts # Per-tenant cache of case types, statuses, verdicts
|
|
757
|
+
│ ├── cases-ql.ts # QL builder for the cases search
|
|
758
|
+
│ ├── format.ts # Severity scales, timestamps, ID checks, mentions, tags, detection rows
|
|
759
|
+
│ ├── migration.ts # Has this tenant moved to Fusion? Gates the Classic case and detection tools
|
|
760
|
+
│ └── types.ts # Fusion response types
|
|
626
761
|
├── tools/
|
|
627
762
|
│ ├── helpers.ts # Shared response formatting
|
|
763
|
+
│ ├── fusion-cases.ts # Sophos Fusion cases (GraphQL)
|
|
764
|
+
│ ├── fusion-detections.ts # Sophos Fusion detection search (GraphQL)
|
|
628
765
|
│ ├── tenants.ts # Tenant listing (partner/org only)
|
|
629
766
|
│ ├── partner.ts # Partner admin, roles, billing (partner/org only)
|
|
630
767
|
│ ├── alerts.ts # Alert list, get, acknowledge, search
|
|
@@ -652,6 +789,8 @@ src/
|
|
|
652
789
|
└── types/sophos.ts # Sophos API response types
|
|
653
790
|
```
|
|
654
791
|
|
|
792
|
+
Packaging files at the repo root: `manifest.json` (MCPB manifest, regenerated by the build), `scripts/build-mcpb.mjs` (bundle builder), and `.mcpbignore` (extra exclusions applied when packing). `schemas/fusion/` holds the five Fusion GraphQL schemas as downloaded from `https://developer.sophos.com/assets/graphql/<api>.graphql` on 21/09/2026, unmodified, for reference and for diffing when Sophos changes them. `test/` holds the `node:test` suites and `scripts/fusion-smoke.mjs` the live check.
|
|
793
|
+
|
|
655
794
|
## Security
|
|
656
795
|
|
|
657
796
|
- Credentials are read from environment variables only, never logged
|
|
@@ -659,6 +798,7 @@ src/
|
|
|
659
798
|
- HTTP server binds to `127.0.0.1` (localhost only)
|
|
660
799
|
- Write actions have `destructiveHint` annotations so clients can warn users
|
|
661
800
|
- Partner/org callers require explicit `tenant_id` on every call
|
|
801
|
+
- With the `.mcpb` install, Claude Desktop holds the credentials in the OS secure store (they are `sensitive` in `manifest.json`) and hands them to the server as environment variables when it starts the process
|
|
662
802
|
|
|
663
803
|
## License
|
|
664
804
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphQL client for the Sophos Fusion APIs (Cases v2, Detections v2, Threat
|
|
3
|
+
* Timeline v2, Events v1, Live Endpoint Search v1). Sits beside SophosClient,
|
|
4
|
+
* which keeps serving the Sophos Central REST APIs.
|
|
5
|
+
*
|
|
6
|
+
* One endpoint for every tenant, no regional host lookup. Auth is unchanged:
|
|
7
|
+
* the same bearer token from TokenManager and the same X-Tenant-ID header the
|
|
8
|
+
* REST client sends.
|
|
9
|
+
*
|
|
10
|
+
* The rule that shapes this file: a GraphQL-layer failure comes back as HTTP
|
|
11
|
+
* 200 with an `errors` array beside `data`. A 200 is not success until the
|
|
12
|
+
* body has been read. Transport failures (expired token, 429, 5xx) use the
|
|
13
|
+
* usual non-2xx status and the standard Sophos error object, and those are
|
|
14
|
+
* retried the same way SophosClient retries them. GraphQL-layer errors are
|
|
15
|
+
* not retried, with one measured exception: the intermittent
|
|
16
|
+
* partnerPreferences fault on the case write path, which is keyed on the
|
|
17
|
+
* error path and bounded (see FusionGraphQLError.isTransientPartnerPreferences).
|
|
18
|
+
*/
|
|
19
|
+
import type { TokenManager } from "../auth/token-manager.js";
|
|
20
|
+
/** One entry of a GraphQL response `errors` array. */
|
|
21
|
+
export interface GraphQLErrorEntry {
|
|
22
|
+
message: string;
|
|
23
|
+
path?: Array<string | number>;
|
|
24
|
+
locations?: Array<{
|
|
25
|
+
line: number;
|
|
26
|
+
column: number;
|
|
27
|
+
}>;
|
|
28
|
+
extensions?: Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
interface GraphQLResponseBody<T> {
|
|
31
|
+
data?: T | null;
|
|
32
|
+
errors?: GraphQLErrorEntry[];
|
|
33
|
+
}
|
|
34
|
+
export interface FusionQueryResult<T> {
|
|
35
|
+
/** The response `data` object. Never null: a response with no usable data throws. */
|
|
36
|
+
data: T;
|
|
37
|
+
/**
|
|
38
|
+
* GraphQL errors that arrived beside usable data (a partial response, for
|
|
39
|
+
* example a federated field that could not be resolved). Empty on a clean
|
|
40
|
+
* response. Tools must surface these; they are not silently dropped.
|
|
41
|
+
*/
|
|
42
|
+
warnings: string[];
|
|
43
|
+
}
|
|
44
|
+
export interface FusionClientOptions {
|
|
45
|
+
/** GraphQL endpoint. Defaults to SOPHOS_FUSION_GRAPHQL_URL. */
|
|
46
|
+
url?: string;
|
|
47
|
+
/** Per-attempt timeout. Default 30 s, matching SophosClient. */
|
|
48
|
+
timeoutMs?: number;
|
|
49
|
+
/** Retries after the first attempt for 429, 5xx and network errors. Default 2. */
|
|
50
|
+
retries?: number;
|
|
51
|
+
/** Base for the full-jitter exponential backoff. Default 1000 ms. */
|
|
52
|
+
backoffBaseMs?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Total attempts for a call that hits the transient partnerPreferences
|
|
55
|
+
* fault, which affects createCase and addEvidenceToCase. Measured on a live
|
|
56
|
+
* tenant 22/09/2026: 111 faults in 150 calls, so 74%, and it drifts, with
|
|
57
|
+
* four samples over six minutes running 60%, 85%, 72.5% and 80%. Default 20:
|
|
58
|
+
* about 1 call in 410 fails at the measured 74%, and about 1 in 26 at the
|
|
59
|
+
* worst rate observed. updateCase does not carry the fault at all, 0 in 30
|
|
60
|
+
* in the same minute addEvidenceToCase was 24 in 30, so the defect is in the
|
|
61
|
+
* two resolvers that read partner preferences.
|
|
62
|
+
*/
|
|
63
|
+
transientAttempts?: number;
|
|
64
|
+
/** Base for the short full-jitter backoff between those attempts. Default 300 ms, capped at 2 s. */
|
|
65
|
+
transientBackoffMs?: number;
|
|
66
|
+
}
|
|
67
|
+
/** Thrown when the GraphQL layer returns errors and no usable data. */
|
|
68
|
+
export declare class FusionGraphQLError extends Error {
|
|
69
|
+
readonly errors: GraphQLErrorEntry[];
|
|
70
|
+
constructor(message: string, errors: GraphQLErrorEntry[]);
|
|
71
|
+
/**
|
|
72
|
+
* True when every error says the record does not exist. Fusion reports an
|
|
73
|
+
* unknown case ID this way, as HTTP 200 with "record not found" beside a
|
|
74
|
+
* null root field, rather than as a bare null (live tenant, 21/09/2026).
|
|
75
|
+
*/
|
|
76
|
+
get notFound(): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* True for the intermittent investigations-v2 fault on the case write
|
|
79
|
+
* path: `errors[0].path[0]` is "partnerPreferences" ("not allowed",
|
|
80
|
+
* DOWNSTREAM_SERVICE_ERROR). It is not an authorisation failure: the
|
|
81
|
+
* identical call with identical input succeeds on retry. Keyed on the path
|
|
82
|
+
* and nothing else, because `extensions.code` is DOWNSTREAM_SERVICE_ERROR
|
|
83
|
+
* for transient faults, not found and malformed queries alike, while a
|
|
84
|
+
* genuine input or permission error carries the operation name in the path
|
|
85
|
+
* (createCase, addEvidenceToCase, tdrusers) with a specific message.
|
|
86
|
+
*/
|
|
87
|
+
get isTransientPartnerPreferences(): boolean;
|
|
88
|
+
}
|
|
89
|
+
export declare class FusionClient {
|
|
90
|
+
private tokenManager;
|
|
91
|
+
private readonly url;
|
|
92
|
+
private readonly timeoutMs;
|
|
93
|
+
private readonly retries;
|
|
94
|
+
private readonly backoffBaseMs;
|
|
95
|
+
private readonly transientAttempts;
|
|
96
|
+
private readonly transientBackoffMs;
|
|
97
|
+
constructor(tokenManager: TokenManager, options?: FusionClientOptions);
|
|
98
|
+
/** The endpoint this client posts to. */
|
|
99
|
+
get endpoint(): string;
|
|
100
|
+
/**
|
|
101
|
+
* Run a GraphQL query or mutation for a tenant.
|
|
102
|
+
*
|
|
103
|
+
* Returns the `data` object plus any partial-response warnings. Throws
|
|
104
|
+
* FusionGraphQLError when the response carries errors and no usable data,
|
|
105
|
+
* and a plain Error for transport failures. The transient partnerPreferences
|
|
106
|
+
* fault is retried up to transientAttempts times; every other GraphQL-layer
|
|
107
|
+
* error surfaces at once.
|
|
108
|
+
*/
|
|
109
|
+
query<T extends object>(tenantId: string, document: string, variables?: Record<string, unknown>): Promise<FusionQueryResult<T>>;
|
|
110
|
+
/**
|
|
111
|
+
* PUT raw bytes to a presigned upload URL (case files). The signature lives
|
|
112
|
+
* in the URL, so no bearer token is sent, and the Content-Type must match
|
|
113
|
+
* what startCaseFileUpload was told. One attempt, no retry.
|
|
114
|
+
*/
|
|
115
|
+
putPresigned(url: string, body: Uint8Array, contentType: string): Promise<void>;
|
|
116
|
+
private executeWithRetry;
|
|
117
|
+
private sleep;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Decide what a 200 response actually means.
|
|
121
|
+
*
|
|
122
|
+
* - errors present, no usable data: throw with every message joined.
|
|
123
|
+
* - errors present beside usable data: return the data with the errors as warnings.
|
|
124
|
+
* - no errors, data present: clean result. A root field that is null with no
|
|
125
|
+
* error (for example `case` for an unknown ID) is legitimate and passes
|
|
126
|
+
* through for the tool to report.
|
|
127
|
+
* - no errors, no data: malformed, throw.
|
|
128
|
+
*/
|
|
129
|
+
export declare function interpretGraphQLBody<T extends object>(body: GraphQLResponseBody<T> | null | undefined): FusionQueryResult<T>;
|
|
130
|
+
export declare function formatGraphQLError(error: GraphQLErrorEntry): string;
|
|
131
|
+
export {};
|
|
132
|
+
//# sourceMappingURL=fusion-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fusion-client.d.ts","sourceRoot":"","sources":["../../src/client/fusion-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG7D,sDAAsD;AACtD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,UAAU,mBAAmB,CAAC,CAAC;IAC7B,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;IAChB,MAAM,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,qFAAqF;IACrF,IAAI,EAAE,CAAC,CAAC;IACR;;;;OAIG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;OASG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oGAAoG;IACpG,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAID,uEAAuE;AACvE,qBAAa,kBAAmB,SAAQ,KAAK;IAGzC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,EAAE;gBADpC,OAAO,EAAE,MAAM,EACN,MAAM,EAAE,iBAAiB,EAAE;IAMtC;;;;OAIG;IACH,IAAI,QAAQ,IAAI,OAAO,CAKtB;IAED;;;;;;;;;OASG;IACH,IAAI,6BAA6B,IAAI,OAAO,CAE3C;CACF;AAED,qBAAa,YAAY;IASrB,OAAO,CAAC,YAAY;IARtB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAS;gBAGlC,YAAY,EAAE,YAAY,EAClC,OAAO,GAAE,mBAAwB;IAUnC,yCAAyC;IACzC,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;;;;;;;OAQG;IACG,KAAK,CAAC,CAAC,SAAS,MAAM,EAC1B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACtC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAsChC;;;;OAIG;IACG,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YA2BvE,gBAAgB;IAqF9B,OAAO,CAAC,KAAK;CAGd;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,EACnD,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,GAC9C,iBAAiB,CAAC,CAAC,CAAC,CAqBtB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAUnE"}
|