mcp-cohesity 2.0.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 (53) hide show
  1. package/LICENSE +77 -0
  2. package/README.md +494 -0
  3. package/dist/cohesity-client.d.ts +47 -0
  4. package/dist/cohesity-client.js +126 -0
  5. package/dist/index.d.ts +6 -0
  6. package/dist/index.js +149 -0
  7. package/dist/tools/active-directory.d.ts +11 -0
  8. package/dist/tools/active-directory.js +82 -0
  9. package/dist/tools/alerts.d.ts +6 -0
  10. package/dist/tools/alerts.js +111 -0
  11. package/dist/tools/antivirus.d.ts +24 -0
  12. package/dist/tools/antivirus.js +180 -0
  13. package/dist/tools/audit-logs.d.ts +10 -0
  14. package/dist/tools/audit-logs.js +161 -0
  15. package/dist/tools/clones.d.ts +24 -0
  16. package/dist/tools/clones.js +107 -0
  17. package/dist/tools/cluster-reports.d.ts +10 -0
  18. package/dist/tools/cluster-reports.js +224 -0
  19. package/dist/tools/cluster.d.ts +6 -0
  20. package/dist/tools/cluster.js +33 -0
  21. package/dist/tools/external-targets.d.ts +3 -0
  22. package/dist/tools/external-targets.js +145 -0
  23. package/dist/tools/kms.d.ts +14 -0
  24. package/dist/tools/kms.js +164 -0
  25. package/dist/tools/notifications.d.ts +3 -0
  26. package/dist/tools/notifications.js +156 -0
  27. package/dist/tools/protection.d.ts +3 -0
  28. package/dist/tools/protection.js +514 -0
  29. package/dist/tools/recovery.d.ts +6 -0
  30. package/dist/tools/recovery.js +101 -0
  31. package/dist/tools/reports.d.ts +3 -0
  32. package/dist/tools/reports.js +346 -0
  33. package/dist/tools/restore.d.ts +3 -0
  34. package/dist/tools/restore.js +220 -0
  35. package/dist/tools/roles.d.ts +11 -0
  36. package/dist/tools/roles.js +95 -0
  37. package/dist/tools/run-actions.d.ts +17 -0
  38. package/dist/tools/run-actions.js +190 -0
  39. package/dist/tools/runs.d.ts +6 -0
  40. package/dist/tools/runs.js +94 -0
  41. package/dist/tools/source-registration.d.ts +11 -0
  42. package/dist/tools/source-registration.js +456 -0
  43. package/dist/tools/sources.d.ts +3 -0
  44. package/dist/tools/sources.js +161 -0
  45. package/dist/tools/stats.d.ts +3 -0
  46. package/dist/tools/stats.js +164 -0
  47. package/dist/tools/storage.d.ts +3 -0
  48. package/dist/tools/storage.js +191 -0
  49. package/dist/tools/tiering.d.ts +3 -0
  50. package/dist/tools/tiering.js +132 -0
  51. package/dist/tools/users.d.ts +13 -0
  52. package/dist/tools/users.js +203 -0
  53. package/package.json +57 -0
package/LICENSE ADDED
@@ -0,0 +1,77 @@
1
+ Source-Available Non-Commercial License
2
+
3
+ Copyright (c) 2026 Deepak Verma. All rights reserved.
4
+
5
+ Inspired by the original mcp-cohesity project by Fredrik Karlsson
6
+ (fredriksknese/mcp-cohesity), which demonstrated the concept of an MCP
7
+ server for Cohesity. This project has been entirely rewritten from scratch
8
+ with 56 tools, new API integrations, and a new architecture — no original
9
+ code remains.
10
+
11
+ 1. GRANT OF RIGHTS
12
+
13
+ Permission is hereby granted, free of charge, to any individual obtaining
14
+ a copy of this software and associated documentation files (the
15
+ "Software"), to:
16
+
17
+ (a) View, study, and learn from the source code;
18
+ (b) Fork, modify, and experiment with the Software for personal,
19
+ educational, or non-commercial research purposes;
20
+ (c) Use the Software in home lab, personal, or non-commercial
21
+ environments without restriction;
22
+ (d) Share and reference this work with attribution to the author.
23
+
24
+ 2. COMMERCIAL USE PROHIBITED
25
+
26
+ Without the prior written consent of the copyright holder (Deepak Verma),
27
+ no person, company, organization, or entity may:
28
+
29
+ (a) Use the Software, in whole or in part, for any commercial purpose,
30
+ including but not limited to integrating it into commercial products,
31
+ offering it as part of a paid service, or using it in production
32
+ environments that generate revenue;
33
+ (b) Sell, sublicense, lease, or otherwise commercialize the Software;
34
+ (c) Use the Software to provide managed services, consulting services,
35
+ or SaaS offerings to third parties;
36
+ (d) Incorporate the Software into proprietary products or platforms.
37
+
38
+ This restriction applies to all entities without exception.
39
+
40
+ 3. ATTRIBUTION
41
+
42
+ Any permitted use, distribution, or derivative work must:
43
+
44
+ (a) Retain this license in its entirety;
45
+ (b) Clearly attribute the work to Deepak Verma as the primary author;
46
+ (c) Acknowledge the original foundation by Fredrik Karlsson.
47
+
48
+ 4. CONTRIBUTIONS
49
+
50
+ By submitting contributions (pull requests, patches, issues) to this
51
+ repository, contributors agree that their contributions are licensed
52
+ under the same terms as this license and assign copyright to the
53
+ copyright holder.
54
+
55
+ 5. NO WARRANTY
56
+
57
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
58
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
59
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
60
+
61
+ 6. LIMITATION OF LIABILITY
62
+
63
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES,
64
+ OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE,
65
+ ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
66
+ OTHER DEALINGS IN THE SOFTWARE.
67
+
68
+ 7. TERMINATION
69
+
70
+ This license is automatically terminated if you violate any of its terms.
71
+ Upon termination, you must cease all use of the Software and destroy all
72
+ copies in your possession.
73
+
74
+ 8. COMMERCIAL LICENSING
75
+
76
+ To obtain a commercial license, contact: Deepak Verma
77
+ GitHub: https://github.com/dvermagithub
package/README.md ADDED
@@ -0,0 +1,494 @@
1
+ # mcp-cohesity
2
+
3
+ A [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server for **Cohesity DataProtect**, providing AI assistants with deep coverage of Cohesity's REST API: registration, backup, recovery, retention/WORM, archival, monitoring, reporting, identity, and audit.
4
+
5
+ > Inspired by [fredriksknese/mcp-cohesity](https://github.com/fredriksknese/mcp-cohesity). Entirely rewritten from scratch.
6
+
7
+ **108 tools across 23 categories**, every tool driven by the cluster's OpenAPI v2 spec and live-validated against a real cluster.
8
+
9
+ A full QA test report covering every tool is checked into [tests/TEST_REPORT.md](tests/TEST_REPORT.md), and the harness that produced it ([tests/qa-harness.mjs](tests/qa-harness.mjs)) can be re-run against any cluster.
10
+
11
+ ---
12
+
13
+ ## Quick Tool Index
14
+
15
+ | Category | Tools |
16
+ |---|---|
17
+ | [Cluster](#cluster-2-tools) | 2 |
18
+ | [Source Registration](#source-registration-9-tools) | 9 |
19
+ | [Protection Sources](#protection-sources-4-tools) | 4 |
20
+ | [Protection Policies](#protection-policies-4-tools) | 4 |
21
+ | [Protection Groups](#protection-groups-8-tools) | 8 |
22
+ | [Backup Runs](#backup-runs-2-tools) | 2 |
23
+ | [Run Actions & Snapshot Management](#run-actions--snapshot-management-6-tools) | 6 |
24
+ | [Storage & Objects](#storage--objects-4-tools) | 4 |
25
+ | [Recovery & File Restore](#recovery--file-restore-6-tools) | 6 |
26
+ | [Alerts](#alerts-2-tools) | 2 |
27
+ | [Alert Notification Rules](#alert-notification-rules-4-tools) | 4 |
28
+ | [External Targets](#external-targets-5-tools) | 5 |
29
+ | [Data Tiering](#data-tiering-6-tools) | 6 |
30
+ | [Reports](#reports-3-tools) | 3 |
31
+ | [Cluster-Local Reports](#cluster-local-reports-6-tools) | 6 |
32
+ | [Stats](#stats-6-tools) | 6 |
33
+ | [Audit Logs](#audit-logs-3-tools) | 3 |
34
+ | [Users](#users-6-tools) | 6 |
35
+ | [Roles](#roles-4-tools) | 4 |
36
+ | [Active Directory](#active-directory-3-tools) | 3 |
37
+ | [Antivirus / Threat Detection](#antivirus--threat-detection-7-tools) | 7 |
38
+ | [KMS / Encryption Keys](#kms--encryption-keys-6-tools) | 6 |
39
+ | [Clones](#clones-3-tools) | 3 |
40
+
41
+ ---
42
+
43
+ ## Tool Reference
44
+
45
+ ### Cluster (2 tools)
46
+
47
+ | Tool | Description |
48
+ |---|---|
49
+ | `get_cluster_info` | Cluster name, ID, software version, node count |
50
+ | `get_cluster_stats` | Storage capacity and throughput statistics |
51
+
52
+ ### Source Registration (9 tools)
53
+
54
+ Register new backup sources end-to-end — every shape verified against the cluster's `SourceRegistrationRequestParams` schema.
55
+
56
+ | Tool | Description |
57
+ |---|---|
58
+ | `register_vmware_source` | Register a vCenter, ESXi standalone host, or vCloud Director endpoint |
59
+ | `register_physical_source` | Register a physical Linux / Windows / AIX / Solaris / SAP HANA server |
60
+ | `register_azure_source` | Register an Azure tenant or subscription (VM, SQL, Files, Blob, etc.) |
61
+ | `register_aws_source` | Register an AWS account for IaaS workloads (EC2, RDS, DynamoDB) |
62
+ | `register_s3_compatible_source` | Register an S3-compatible endpoint (AWS S3, MinIO, Ceph, Wasabi, on-prem ECS) — separate code path from AWS IaaS |
63
+ | `register_m365_source` | Register a Microsoft 365 tenant (Exchange, OneDrive, SharePoint, Teams, Groups) |
64
+ | `register_nas_source` | Register a generic NAS mount (NFS3, NFS4.1, SMB/CIFS) |
65
+ | `update_source_registration` | Rotate credentials or change endpoint on an existing registration |
66
+ | `unregister_source` | Delete a source registration (does not delete backups) |
67
+
68
+ ### Protection Sources (4 tools)
69
+
70
+ | Tool | Description |
71
+ |---|---|
72
+ | `list_sources` | List all registered sources |
73
+ | `get_source` | Get full object hierarchy details for a source |
74
+ | `search_objects` | Search for protectable objects across all sources (auto-refreshes first) |
75
+ | `refresh_source` | Re-discover inventory from a registered source (e.g. vCenter) |
76
+
77
+ ### Protection Policies (4 tools)
78
+
79
+ | Tool | Description |
80
+ |---|---|
81
+ | `list_protection_policies` | List all data protection policies |
82
+ | `create_protection_policy` | Create a policy with incremental/full schedules, GFS retention, DataLock |
83
+ | `update_protection_policy` | Update an existing policy |
84
+ | `delete_protection_policy` | Delete a policy |
85
+
86
+ ### Protection Groups (8 tools)
87
+
88
+ | Tool | Description |
89
+ |---|---|
90
+ | `list_protection_groups` | List protection groups (backup jobs) with status and schedule |
91
+ | `get_protection_group` | Get detailed configuration of a specific group |
92
+ | `create_protection_group` | Create a new protection group for VMware, Physical, SQL, etc. |
93
+ | `update_protection_group` | Update a group (add/remove VMs, change policy, enable indexing) |
94
+ | `delete_protection_group` | Delete a group and optionally its snapshots |
95
+ | `run_protection_group` | Trigger an on-demand backup run |
96
+ | `pause_protection_group` | Pause scheduled backups |
97
+ | `resume_protection_group` | Resume a paused group |
98
+
99
+ ### Backup Runs (2 tools)
100
+
101
+ | Tool | Description |
102
+ |---|---|
103
+ | `list_protection_runs` | List recent backup runs with status, duration, and data size |
104
+ | `get_protection_run` | Get detailed information about a specific run |
105
+
106
+ ### Run Actions & Snapshot Management (6 tools)
107
+
108
+ WORM, legal hold, retention adjustments, and run cancellation.
109
+
110
+ | Tool | Description |
111
+ |---|---|
112
+ | `cancel_protection_run` | Cancel a running protection group run (whole or per-object/copy) |
113
+ | `cancel_recovery_task` | Cancel an in-flight recovery task |
114
+ | `set_snapshot_datalock` | Apply DataLock (Compliance or Administrative WORM) to a snapshot |
115
+ | `set_snapshot_legal_hold` | Place a snapshot on legal hold or release it (requires Data Security Role) |
116
+ | `extend_snapshot_retention` | Extend or shorten a snapshot's retention by N days |
117
+ | `delete_snapshot` | Delete a snapshot immediately (irreversible, blocked by DataLock/Legal Hold) |
118
+
119
+ ### Storage & Objects (4 tools)
120
+
121
+ | Tool | Description |
122
+ |---|---|
123
+ | `list_storage_domains` | List storage domains (view boxes) |
124
+ | `list_objects` | List protectable objects under a source |
125
+ | `list_snapshots` | List available snapshots for an object |
126
+ | `browse_snapshot_files` | Browse files inside a VM snapshot via V2 indexed search |
127
+
128
+ ### Recovery & File Restore (6 tools)
129
+
130
+ | Tool | Description |
131
+ |---|---|
132
+ | `list_recovery_tasks` | List recovery tasks with status |
133
+ | `get_recovery_task` | Get detailed info about a recovery task |
134
+ | `recover_vm` | Recover a VM from a snapshot (instant recovery or full clone) |
135
+ | `search_files` | Search for files across all indexed backups |
136
+ | `recover_files` | Recover specific files to original or alternate location (LVM-aware) |
137
+ | `cancel_recovery_task` | *(see Run Actions above)* |
138
+
139
+ ### Alerts (2 tools)
140
+
141
+ | Tool | Description |
142
+ |---|---|
143
+ | `list_alerts` | List alerts filtered by severity, category, state |
144
+ | `resolve_alert` | Mark an alert as resolved with resolution notes |
145
+
146
+ ### Alert Notification Rules (4 tools)
147
+
148
+ | Tool | Description |
149
+ |---|---|
150
+ | `list_notification_rules` | List all alert notification rules |
151
+ | `create_notification_rule` | Create an email / webhook / SNMP / syslog rule |
152
+ | `update_notification_rule` | Update a notification rule |
153
+ | `delete_notification_rule` | Delete a notification rule |
154
+
155
+ ### External Targets (5 tools)
156
+
157
+ | Tool | Description |
158
+ |---|---|
159
+ | `list_external_targets` | List registered external targets (S3, Azure Blob, NAS, tape) |
160
+ | `get_external_target` | Get details of a specific target |
161
+ | `create_external_target_aws` | Register an AWS S3 external target |
162
+ | `create_external_target_azure` | Register an Azure Blob Storage external target |
163
+ | `delete_external_target` | Delete an external target |
164
+
165
+ ### Data Tiering (6 tools)
166
+
167
+ | Tool | Description |
168
+ |---|---|
169
+ | `list_tiering_tasks` | List all data tiering tasks |
170
+ | `get_tiering_task` | Get details of a tiering task |
171
+ | `create_tiering_task` | Create a task to move cold data to external target |
172
+ | `run_tiering_task` | Trigger an on-demand tiering run |
173
+ | `update_tiering_task_state` | Pause or resume a tiering task |
174
+ | `delete_tiering_task` | Delete a tiering task |
175
+
176
+ ### Reports (3 tools)
177
+
178
+ V2 protection summary reports.
179
+
180
+ | Tool | Description |
181
+ |---|---|
182
+ | `get_protection_heatmap` | Per-VM per-day protection status grid (matches GUI heatmap) |
183
+ | `get_protection_summary` | Overall protection run statistics |
184
+ | `get_recovery_summary` | Recovery task statistics for a time range |
185
+
186
+ ### Cluster-Local Reports (6 tools)
187
+
188
+ Reports derived from V1 cluster-local endpoints plus synthesized Markdown reports — **no Helios required**.
189
+
190
+ | Tool | Description |
191
+ |---|---|
192
+ | `get_protected_objects_trend_report` | Per-object backup success/failure trends with daily/weekly rollups |
193
+ | `get_sources_jobs_summary_report` | Sources × jobs matrix |
194
+ | `get_archival_transfer_report` | Data transferred to external archival targets |
195
+ | `generate_protection_summary_report` | Synthesized Markdown report of protection groups + active alerts |
196
+ | `generate_failed_backups_report` | Markdown list of protection groups whose last run failed/missed |
197
+ | `generate_capacity_report` | Markdown capacity report (cluster storage, dedup, data reduction) |
198
+
199
+ ### Stats (6 tools)
200
+
201
+ | Tool | Description |
202
+ |---|---|
203
+ | `get_cluster_storage_stats` | Detailed storage breakdown including data reduction ratios |
204
+ | `get_workload_stats` | Data volumes and counts per workload (VMware, Physical, NAS, SQL) |
205
+ | `get_replication_backlog` | Pending replication data to remote clusters |
206
+ | `get_replication_clusters` | List replication partner clusters with total replicated |
207
+ | `get_replication_data_trend` | Time-series replication throughput |
208
+ | `get_replication_objects` | Objects replicated to/from remote clusters in a time range |
209
+
210
+ ### Audit Logs (3 tools)
211
+
212
+ | Tool | Description |
213
+ |---|---|
214
+ | `list_audit_logs` | Query the cluster audit log (users, actions, entity types, time window, search) |
215
+ | `list_audit_log_actions` | List all action types recognized by the audit log |
216
+ | `list_audit_log_entity_types` | List all entity types tracked in the audit log |
217
+
218
+ ### Users (6 tools)
219
+
220
+ | Tool | Description |
221
+ |---|---|
222
+ | `list_users` | List Cohesity users (filter by domain, sid, username, email, role) |
223
+ | `get_user` | Get a single user by SID |
224
+ | `create_local_user` | Create a LOCAL Cohesity user with a password |
225
+ | `create_ad_user` | Map an existing AD / IdP principal as a Cohesity user |
226
+ | `update_user` | Update user roles, description, password, or restricted flag |
227
+ | `delete_users` | Delete one or more users by SID |
228
+
229
+ ### Roles (4 tools)
230
+
231
+ | Tool | Description |
232
+ |---|---|
233
+ | `list_roles` | List built-in and custom Cohesity roles |
234
+ | `create_role` | Create a custom role with a privilege set |
235
+ | `update_role` | Update a role's privileges (replace, not merge) |
236
+ | `delete_role` | Delete a custom role (built-in roles cannot be deleted) |
237
+
238
+ ### Active Directory (3 tools)
239
+
240
+ | Tool | Description |
241
+ |---|---|
242
+ | `list_active_directories` | List AD domains joined to the cluster |
243
+ | `join_active_directory` | Join the cluster to an AD domain |
244
+ | `leave_active_directory` | Remove an AD from the cluster |
245
+
246
+ ### Antivirus / Threat Detection (7 tools)
247
+
248
+ On-prem ICAP-based antivirus. (Anomaly / ransomware behavioural detection is a Helios-only SaaS feature and is not exposed on standalone clusters.)
249
+
250
+ | Tool | Description |
251
+ |---|---|
252
+ | `list_antivirus_groups` | List antivirus service groups (each bundles ICAP servers) |
253
+ | `create_antivirus_group` | Create a new antivirus group with one or more ICAP services |
254
+ | `get_antivirus_group` | Get a single antivirus group by ID |
255
+ | `update_antivirus_group` | Update an antivirus group's name, services, or state |
256
+ | `delete_antivirus_group` | Delete an antivirus group |
257
+ | `check_icap_connection` | Probe an ICAP URI and return reachability |
258
+ | `list_infected_files` | List files an antivirus service has flagged as infected |
259
+
260
+ ### KMS / Encryption Keys (6 tools)
261
+
262
+ | Tool | Description |
263
+ |---|---|
264
+ | `list_kms_configurations` | List Key Management Systems (Internal, AWS, KMIP, IBM, GCP) |
265
+ | `add_aws_kms` | Register an AWS KMS as an encryption key source |
266
+ | `add_kmip_kms` | Register a KMIP-compliant KMS (Thales, Fortanix, etc.) |
267
+ | `update_kms` | Update assignments or rename an existing KMS |
268
+ | `delete_kms` | Delete a KMS configuration (internal KMS cannot be deleted) |
269
+ | `get_external_target_encryption_key` | Get the encryption key associated with an external target |
270
+
271
+ ### Clones (3 tools)
272
+
273
+ | Tool | Description |
274
+ |---|---|
275
+ | `list_clone_tasks` | List active and historical clone tasks (CloneVMs, CloneView, CloneAppView) |
276
+ | `clone_view` | Clone a file-services View into a new space-efficient View |
277
+ | `delete_clone_task` | Delete a restore clone task and release its space |
278
+
279
+ ---
280
+
281
+ ## Key Engineering Notes
282
+
283
+ - **Spec-driven** — every tool's request/response shape is modeled directly from the cluster's OpenAPI v2 spec (`SourceRegistrationRequestParams`, `AuditLog`, `UpdateLocalSnapshotConfig`, etc.), not guessed.
284
+
285
+ ### Known cluster-side bug — Azure source registration
286
+
287
+ Some Cohesity cluster builds (observed on 7.x as of mid-2026) have a broken V2 handler for `kAzure` source registration. `POST /v2/data-protect/sources/registrations` returns
288
+
289
+ ```
290
+ HTTP 403 {"errorCode":"KInvalidRequest","message":"Azure credentials does not have Subscription Id"}
291
+ ```
292
+
293
+ for any payload — even one that perfectly matches the documented OpenAPI v2 spec, with credentials independently proven valid against Azure (OAuth token works, SP has Contributor role on the subscription, can list resources). The error is hardcoded and returned in <300ms; the cluster never contacts Azure. The exact same V2 endpoint works correctly for **kAWS**, **kS3Compatible**, and **kVMware** on the same cluster.
294
+
295
+ This MCP server's `register_azure_source` tool stays on the documented V2 path (correct, future-proof). On affected cluster builds:
296
+
297
+ - **Workaround:** register the Azure source through the Cohesity GUI (Sources → Register → Virtual Machines → Azure → Azure Subscription)
298
+ - All other Azure tools (`list_sources`, `search_objects`, `refresh_source`, `create_protection_group` with `environment=kAzure`, `run_protection_group`, etc.) work normally on the GUI-created source.
299
+ - **Live-validated** — write tools were probed against a real cluster to confirm the cluster accepts the payload shape before shipping.
300
+ - **Auto source refresh** — all CRUD operations (create/update/delete groups, search objects, register source) automatically refresh registered sources so the cluster sees current inventory.
301
+ - **LVM volume path handling** — `recover_files` to original path on LVM-based Linux VMs works correctly by transparently using `alternatePath` to handle Cohesity's `lvol_N/` prefix.
302
+ - **Indexed file browsing** — `browse_snapshot_files` uses V2 `search/indexed-objects` with `objectIds` scoping to a single VM, and auto-derives search terms from the last path segment (requires indexing enabled on the protection group).
303
+ - **GFS + DataLock policies** — full support for Grandfather-Father-Son extended retention with weekly/monthly/yearly tiers and WORM DataLock.
304
+ - **No Helios dependency** — every report tool works on a standalone on-prem cluster; synthesized Markdown reports are composed from cluster-local V1 + V2 endpoints.
305
+
306
+ ---
307
+
308
+ ## Installation
309
+
310
+ **From npm** (recommended):
311
+
312
+ ```bash
313
+ npm install -g mcp-cohesity
314
+ ```
315
+
316
+ **From source** (development):
317
+
318
+ ```bash
319
+ git clone https://github.com/dvermagithub/mcp-cohesity.git
320
+ cd mcp-cohesity
321
+ npm install
322
+ npm run build
323
+ npm link
324
+ ```
325
+
326
+ ## Configuration
327
+
328
+ The server reads credentials in this precedence order:
329
+
330
+ 1. **JSON config file** at `~/.cohesity-mcp/config.json` (or wherever `COHESITY_CONFIG_FILE` env var points)
331
+ 2. **Direct environment variables** (override file values if both are set)
332
+
333
+ ### Recommended — JSON file
334
+
335
+ Create `~/.cohesity-mcp/config.json` (Linux/macOS: `chmod 600`; Windows: `icacls /inheritance:r /grant:r "$USER:R"`):
336
+
337
+ ```json
338
+ {
339
+ "cluster": "your-cohesity-cluster.example.com",
340
+ "username": "admin",
341
+ "password": "your-password",
342
+ "domain": "LOCAL",
343
+ "allowSelfSigned": true
344
+ }
345
+ ```
346
+
347
+ | Field | Required | Default | Description |
348
+ |---|---|---|---|
349
+ | `cluster` | Yes | — | Cohesity cluster hostname or IP |
350
+ | `username` | Yes | — | Username |
351
+ | `password` | Yes | — | Password |
352
+ | `domain` | No | `LOCAL` | Authentication domain |
353
+ | `allowSelfSigned` | No | `true` | Accept self-signed SSL certs |
354
+
355
+ ### Alternative — environment variables
356
+
357
+ Same fields, set as `COHESITY_CLUSTER`, `COHESITY_USERNAME`, `COHESITY_PASSWORD`, `COHESITY_DOMAIN`, `COHESITY_ALLOW_SELF_SIGNED`. Useful for Docker, CI, or if you'd rather not put a file on disk.
358
+
359
+ ## Usage with Claude Desktop
360
+
361
+ After `npm install -g mcp-cohesity` (or `npm link` from source) and creating the credentials file above, add to your `claude_desktop_config.json`:
362
+
363
+ ```json
364
+ {
365
+ "mcpServers": {
366
+ "cohesity": {
367
+ "command": "mcp-cohesity"
368
+ }
369
+ }
370
+ }
371
+ ```
372
+
373
+ That's it — no credentials in the Claude config. On Windows you may need to use the full path to the `.cmd` shim:
374
+
375
+ ```json
376
+ {
377
+ "mcpServers": {
378
+ "cohesity": {
379
+ "command": "C:\\Users\\<you>\\AppData\\Roaming\\npm\\mcp-cohesity.cmd"
380
+ }
381
+ }
382
+ }
383
+ ```
384
+
385
+ ## Usage with Claude Code
386
+
387
+ ```bash
388
+ claude mcp add cohesity mcp-cohesity
389
+ ```
390
+
391
+ ## Example Prompts
392
+
393
+ Day-1 setup:
394
+
395
+ - *"Register the vCenter at vcsa.prod.local with admin user administrator@vsphere.local"*
396
+ - *"Register our AWS commercial account using the IAM user with these credentials"*
397
+ - *"Join the cluster to our corp.example.com Active Directory"*
398
+ - *"Create a custom role called BackupOperator with PROTECTION_VIEW and PROTECTION_MODIFY privileges"*
399
+
400
+ Day-2 operations:
401
+
402
+ - *"Show me which protection groups failed their last backup"*
403
+ - *"Trigger an on-demand backup for the prod-vms group"*
404
+ - *"Browse the files in /home/zerto on deepak-vm's latest snapshot"*
405
+ - *"Recover /home/zerto/script.sh from yesterday's backup to its original location"*
406
+ - *"What are the critical alerts on the cluster right now?"*
407
+ - *"Cancel the recovery task that's been stuck for 30 minutes"*
408
+
409
+ Day-3 governance:
410
+
411
+ - *"Apply a 90-day Compliance DataLock to the most recent backup of the finance VMs"*
412
+ - *"Place a legal hold on every snapshot of the legal-review protection group"*
413
+ - *"Show me every Delete action in the audit log from the last 7 days"*
414
+ - *"Generate a Markdown capacity report for our weekly ops review"*
415
+ - *"Generate a failed-backups report for last night"*
416
+
417
+ ## Development
418
+
419
+ ```bash
420
+ npm run dev # Run with tsx (auto-reloads)
421
+ npm run build # Compile TypeScript to dist/
422
+ npm start # Run compiled output
423
+ ```
424
+
425
+ ## QA Harness
426
+
427
+ A self-contained QA harness in [tests/qa-harness.mjs](tests/qa-harness.mjs) exercises every tool against a live cluster across three suites:
428
+
429
+ 1. **CONNECTIVITY** — auth + cluster reachability
430
+ 2. **DIRECT_API** — every backing HTTP endpoint, with safe probes for write operations
431
+ 3. **MCP_TRANSPORT** — spawns the compiled server, verifies `tools/list`, and invokes a representative subset of read-only tools through the actual MCP protocol
432
+
433
+ Run it:
434
+
435
+ ```bash
436
+ COHESITY_CLUSTER=192.0.2.10 \
437
+ COHESITY_USERNAME=admin \
438
+ COHESITY_PASSWORD=... \
439
+ node tests/qa-harness.mjs
440
+ ```
441
+
442
+ The harness writes [tests/TEST_REPORT.md](tests/TEST_REPORT.md) and `tests/test-results.json` on every run.
443
+
444
+ ## Architecture
445
+
446
+ ```
447
+ src/
448
+ ├── index.ts # MCP server bootstrap + STDIO transport
449
+ ├── cohesity-client.ts # HTTP client with V1/V2 auth, retry, auto-refresh
450
+ └── tools/
451
+ ├── cluster.ts # Cluster info (2 tools)
452
+ ├── source-registration.ts # Register/update/unregister sources (8 tools)
453
+ ├── sources.ts # Source listing, search, refresh (4 tools)
454
+ ├── protection.ts # Policies + groups CRUD + run/pause/resume (12 tools)
455
+ ├── runs.ts # Backup run listing (2 tools)
456
+ ├── run-actions.ts # Cancel, DataLock, legal hold, retention (6 tools)
457
+ ├── storage.ts # Storage domains, objects, snapshots, file browse (4 tools)
458
+ ├── recovery.ts # Recovery task listing (2 tools)
459
+ ├── restore.ts # VM recovery, file search, file restore (4 tools)
460
+ ├── alerts.ts # Alert listing and resolution (2 tools)
461
+ ├── notifications.ts # Alert notification rules (4 tools)
462
+ ├── external-targets.ts # External archival targets (5 tools)
463
+ ├── tiering.ts # Data tiering tasks (6 tools)
464
+ ├── reports.ts # Heatmap + protection/recovery summaries (3 tools)
465
+ ├── cluster-reports.ts # Cluster-local + synthesized Markdown reports (6 tools)
466
+ ├── stats.ts # Storage, workload, replication stats (6 tools)
467
+ ├── audit-logs.ts # Audit log queries (3 tools)
468
+ ├── users.ts # User management (6 tools)
469
+ ├── roles.ts # Role management (4 tools)
470
+ ├── active-directory.ts # AD join/leave (3 tools)
471
+ ├── antivirus.ts # ICAP antivirus + infected files (7 tools)
472
+ ├── kms.ts # KMS / encryption keys (6 tools)
473
+ └── clones.ts # View clones + clone tasks (3 tools)
474
+ ```
475
+
476
+ ## API Details
477
+
478
+ This server uses two Cohesity API versions:
479
+
480
+ - **V2 API** (`/v2/`) — Most operations: registration, protection groups, runs, sources, recoveries, policies, external targets, tiering, alerts, audit logs, users, roles, AD.
481
+ - **V1 API** (`/irisservices/api/v1/public/`) — Cluster-local reports (`protectedObjectsTrends`, `protectionSourcesJobsSummary`, `dataTransferToVaults`) and source hierarchy details. Used because some cluster-local reports are not exposed on V2.
482
+
483
+ Authentication uses `POST /v2/access-tokens` (Bearer token), with auto-refresh on 401 responses.
484
+
485
+ ## Requirements
486
+
487
+ - Node.js 18+
488
+ - Cohesity DataProtect cluster with REST API access (tested with Cohesity 7.x)
489
+
490
+ ## License
491
+
492
+ Source-Available Non-Commercial License. Free for personal, educational, and non-commercial use. Commercial use requires written permission from the author. See [LICENSE](LICENSE) for full terms.
493
+
494
+ Originally inspired by [Fredrik Karlsson's mcp-cohesity](https://github.com/fredriksknese/mcp-cohesity). Entirely rewritten by [Deepak Verma](https://github.com/dvermagithub).
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Cohesity REST API client supporting V1 and V2 endpoints
3
+ * with automatic bearer token authentication and retry on expiry.
4
+ */
5
+ export interface CohesityConfig {
6
+ cluster: string;
7
+ username: string;
8
+ password: string;
9
+ domain: string;
10
+ allowSelfSigned: boolean;
11
+ }
12
+ export declare class CohesityClient {
13
+ private readonly v2Base;
14
+ private readonly v1Base;
15
+ private readonly cfg;
16
+ private bearer;
17
+ constructor(cfg: CohesityConfig);
18
+ /** Obtain a bearer token from the V2 access-tokens endpoint. */
19
+ authenticate(): Promise<void>;
20
+ /** Return current token, authenticating first if needed. */
21
+ private token;
22
+ /** Build headers for an authenticated request. */
23
+ private authHeaders;
24
+ /** Parse a fetch Response into JSON, text, or null (for 204). */
25
+ private parseResponse;
26
+ /**
27
+ * Core HTTP method. Builds URL with query params, attaches auth,
28
+ * and retries once on 401 (token expiry).
29
+ */
30
+ private http;
31
+ getV2(path: string, params?: Record<string, string>): Promise<unknown>;
32
+ postV2(path: string, body?: unknown, params?: Record<string, string>): Promise<unknown>;
33
+ putV2(path: string, body?: unknown): Promise<unknown>;
34
+ patchV2(path: string, body?: unknown): Promise<unknown>;
35
+ deleteV2(path: string): Promise<unknown>;
36
+ getV1(path: string, params?: Record<string, string>): Promise<unknown>;
37
+ postV1(path: string, body?: unknown): Promise<unknown>;
38
+ putV1(path: string, body?: unknown): Promise<unknown>;
39
+ /**
40
+ * Refresh every registered protection source in parallel.
41
+ * Called automatically before CRUD operations to ensure current inventory.
42
+ */
43
+ refreshAllSources(): Promise<{
44
+ refreshed: number;
45
+ sourceIds: number[];
46
+ }>;
47
+ }