sophos-central-mcp-server 0.4.2 → 0.5.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.
Files changed (2) hide show
  1. package/README.md +108 -57
  2. package/package.json +3 -1
package/README.md CHANGED
@@ -1,56 +1,49 @@
1
1
  # Sophos Central MCP Server
2
2
 
3
- MCP (Model Context Protocol) server for interacting with Sophos Central APIs. Supports partner, organisation, and single-tenant credential types with automatic region routing. **288 tools** covering 20 Sophos API namespaces.
3
+ MCP (Model Context Protocol) server for interacting with Sophos Central APIs. Supports partner, organisation, and single-tenant credential types with automatic region routing. **288 tools** covering 20 Sophos API namespaces. Install it as a Claude Desktop extension (`.mcpb`), run it with npx, or host it yourself over streamable HTTP.
4
4
 
5
- ## Quick Start
5
+ ## Prerequisites
6
6
 
7
- ### Claude Desktop
7
+ You need these before any of the install options below.
8
8
 
9
- No installation needed. Open your `claude_desktop_config.json` (File > Settings > Developer > Edit Config) and add the `sophos-central` block inside `mcpServers`:
9
+ ### Sophos Central API credentials
10
10
 
11
- **macOS / Linux:**
11
+ Every install method needs a Client ID and Client Secret. The credential type decides what the server can see:
12
12
 
13
- ```json
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
+ - **Tenant-level**: In Sophos Central, go to **Settings > API Credentials Management** and create a new credential. The server operates on that one tenant.
14
+ - **Partner-level**: In the Sophos Partner Dashboard, create API credentials under **Settings > API Credentials**. The server can query every tenant the partner manages.
15
+ - **Organisation-level**: In Sophos Central Enterprise, use **Global Settings > API Credentials Management**. Same cross-tenant behaviour as partner credentials.
28
16
 
29
- **Windows:**
30
-
31
- ```json
32
- {
33
- "mcpServers": {
34
- "sophos-central": {
35
- "command": "cmd",
36
- "args": ["/c", "npx", "-y", "sophos-central-mcp-server"],
37
- "env": {
38
- "SOPHOS_CLIENT_ID": "your-client-id",
39
- "SOPHOS_CLIENT_SECRET": "your-client-secret",
40
- "TRANSPORT": "stdio"
41
- }
42
- }
43
- }
44
- }
45
- ```
17
+ ### Node.js 20 or later (npm and self-hosted installs only)
18
+
19
+ 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.
20
+
21
+ ## Install
22
+
23
+ Pick one:
46
24
 
47
- > **If you already have other MCP servers configured**, don't replace the whole file — just add the `"sophos-central": { ... }` entry alongside your existing servers inside the `"mcpServers"` object.
25
+ | Option | Best for | Needs Node.js? |
26
+ |--------|----------|----------------|
27
+ | [Claude Desktop extension (.mcpb)](#option-1-claude-desktop-extension-mcpb-recommended) | Claude Desktop users who want a two-minute install | No |
28
+ | [Claude Code](#option-2-claude-code) | Terminal use with Claude Code | Yes |
29
+ | [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 |
48
30
 
49
- Replace `your-client-id` and `your-client-secret` with your [Sophos Central API credentials](#creating-api-credentials). Restart Claude Desktop after saving — it will download and run the server automatically on first use.
31
+ ### Option 1: Claude Desktop extension (.mcpb, recommended)
50
32
 
51
- ### Claude Code
33
+ 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.
52
34
 
53
- 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:
35
+ 1. Download `sophos-central-mcp-server-<version>.mcpb` from the [latest GitHub release](https://github.com/Aaronjacobs000/sophos-central-mcp/releases/latest).
36
+ 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.
37
+ 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.
38
+ 4. Click **Install**, make sure the extension is enabled, then start a new chat. The `sophos_*` tools are available straight away.
39
+
40
+ To update, download the newer `.mcpb` and install it the same way. To remove it, open **Settings > Extensions** and uninstall the extension.
41
+
42
+ 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.
43
+
44
+ ### Option 2: Claude Code
45
+
46
+ 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
47
 
55
48
  **macOS / Linux:**
56
49
 
@@ -72,16 +65,82 @@ claude mcp add sophos-central ^
72
65
  -- cmd /c npx -y sophos-central-mcp-server
73
66
  ```
74
67
 
68
+ ### Option 3: Self-hosted with npm (streamable HTTP or stdio)
69
+
70
+ 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.
71
+
72
+ **Install from npm:**
73
+
74
+ ```bash
75
+ npm install -g sophos-central-mcp-server
76
+ ```
77
+
78
+ **Or from source:**
79
+
80
+ ```bash
81
+ git clone https://github.com/Aaronjacobs000/sophos-central-mcp.git
82
+ cd sophos-central-mcp
83
+ npm install
84
+ npm run build
85
+ ```
86
+
87
+ **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).
88
+
89
+ ```
90
+ SOPHOS_CLIENT_ID=your-client-id
91
+ SOPHOS_CLIENT_SECRET=your-client-secret
92
+ PORT=3100
93
+ TRANSPORT=http
94
+ ```
95
+
96
+ **Run:**
97
+
98
+ ```bash
99
+ sophos-central-mcp # global npm install
100
+ npm start # from a source checkout
101
+ ```
102
+
103
+ 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:
104
+
105
+ ```bash
106
+ claude mcp add --transport http sophos-central http://127.0.0.1:3100/mcp
107
+ ```
108
+
109
+ 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.
110
+
111
+ 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.
112
+
113
+ ### Build the .mcpb yourself (maintainers)
114
+
115
+ The bundle is produced by `scripts/build-mcpb.mjs` using the `mcpb` CLI, which is a dev dependency. From a source checkout:
116
+
117
+ ```bash
118
+ npm install
119
+ npm run build:mcpb
120
+ ```
121
+
122
+ The script:
123
+
124
+ 1. Compiles TypeScript to `dist/` (via `npm run build`).
125
+ 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.
126
+ 3. Validates the manifest with `mcpb validate`.
127
+ 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.
128
+ 5. Packs the staging directory into `release/sophos-central-mcp-server-<version>.mcpb`.
129
+
130
+ `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.
131
+
132
+ **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
133
 
76
134
  ## Features
77
135
 
78
136
  - **Universal caller support**: Works with partner, organisation, and tenant-level API credentials
79
137
  - **Multi-tenant**: Partner/org callers can query across all managed tenants
80
- - **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
138
+ - **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
139
  - **Auto region routing**: Discovers tenant data regions via `/whoami/v1` and routes requests to the correct regional API host
82
140
  - **Token lifecycle**: Automatic OAuth2 token refresh before expiry
83
141
  - **Rate limit handling**: Retry with backoff on 429 responses
84
- - **Dual transport**: Streamable HTTP (for Claude Desktop / Claude Code) or stdio
142
+ - **Dual transport**: stdio (Claude Desktop, Claude Code, and the `.mcpb` bundle) or streamable HTTP (self-hosted)
143
+ - **One-click install**: Ships as a Claude Desktop extension (`.mcpb`) with credentials held in the OS secure store
85
144
  - **Full API coverage**: 288 tools across endpoints, alerts, policies, firewalls, web filtering, licensing, audit events, email, mobile, XDR, cases, SIEM, and more
86
145
 
87
146
  ## Screenshots
@@ -96,21 +155,10 @@ claude mcp add sophos-central ^
96
155
 
97
156
  ![Tenant health detail and endpoints](docs/screenshots/tenant-health-detail.png)
98
157
 
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
158
  ## Configuration
113
159
 
160
+ 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.
161
+
114
162
  Copy `.env.example` to `.env` and set your credentials:
115
163
 
116
164
  ```
@@ -124,9 +172,9 @@ TRANSPORT=http
124
172
  |----------|----------|---------|-------------|
125
173
  | `SOPHOS_CLIENT_ID` | Yes | - | OAuth2 client ID |
126
174
  | `SOPHOS_CLIENT_SECRET` | Yes | - | OAuth2 client secret |
127
- | `SOPHOS_TENANT_ID` | No | - | Lock to a single tenant (useful for tenant-level creds) |
128
175
  | `PORT` | No | 3100 | HTTP server port |
129
176
  | `TRANSPORT` | No | http | `http` for streamable HTTP, `stdio` for subprocess mode |
177
+ | `CHARACTER_LIMIT` | No | 50000 | Maximum characters per tool response before truncation (minimum 10000) |
130
178
 
131
179
  ## Tools
132
180
 
@@ -652,6 +700,8 @@ src/
652
700
  └── types/sophos.ts # Sophos API response types
653
701
  ```
654
702
 
703
+ 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).
704
+
655
705
  ## Security
656
706
 
657
707
  - Credentials are read from environment variables only, never logged
@@ -659,6 +709,7 @@ src/
659
709
  - HTTP server binds to `127.0.0.1` (localhost only)
660
710
  - Write actions have `destructiveHint` annotations so clients can warn users
661
711
  - Partner/org callers require explicit `tenant_id` on every call
712
+ - 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
713
 
663
714
  ## License
664
715
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sophos-central-mcp-server",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "docs"
@@ -14,6 +14,7 @@
14
14
  },
15
15
  "scripts": {
16
16
  "build": "tsc",
17
+ "build:mcpb": "npm run build && node scripts/build-mcpb.mjs",
17
18
  "start": "node dist/index.js",
18
19
  "dev": "tsc --watch",
19
20
  "prepublishOnly": "npm run build"
@@ -38,6 +39,7 @@
38
39
  "zod": "^3.25.67"
39
40
  },
40
41
  "devDependencies": {
42
+ "@anthropic-ai/mcpb": "^2.1.2",
41
43
  "@types/express": "^5.0.3",
42
44
  "@types/node": "^22.15.32",
43
45
  "typescript": "^5.8.3"