@revfleet/hscli 0.9.8 → 0.11.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 (140) hide show
  1. package/CHANGELOG.md +132 -0
  2. package/README.md +142 -13
  3. package/SECURITY.md +14 -3
  4. package/dist/cli.js +3 -3
  5. package/dist/cli.js.map +1 -1
  6. package/dist/cloud/cloud-run-caller-contract.d.ts +28 -0
  7. package/dist/cloud/cloud-run-caller-contract.js +35 -0
  8. package/dist/cloud/cloud-run-caller-contract.js.map +1 -0
  9. package/dist/cloud/main.d.ts +1 -0
  10. package/dist/cloud/main.js +15 -0
  11. package/dist/cloud/main.js.map +1 -0
  12. package/dist/cloud/server.d.ts +5 -0
  13. package/dist/cloud/server.js +133 -0
  14. package/dist/cloud/server.js.map +1 -0
  15. package/dist/commands/agent/access-baseline.d.ts +47 -0
  16. package/dist/commands/agent/access-baseline.js +238 -0
  17. package/dist/commands/agent/access-baseline.js.map +1 -0
  18. package/dist/commands/agent/index.js +99 -11
  19. package/dist/commands/agent/index.js.map +1 -1
  20. package/dist/commands/agent/recipes.d.ts +7 -1
  21. package/dist/commands/agent/recipes.js +57 -1
  22. package/dist/commands/agent/recipes.js.map +1 -1
  23. package/dist/commands/agent/reporting-joinability.d.ts +129 -0
  24. package/dist/commands/agent/reporting-joinability.js +412 -0
  25. package/dist/commands/agent/reporting-joinability.js.map +1 -0
  26. package/dist/commands/agent/runner.d.ts +1 -0
  27. package/dist/commands/agent/runner.js +181 -27
  28. package/dist/commands/agent/runner.js.map +1 -1
  29. package/dist/commands/audit/index.js +2 -1
  30. package/dist/commands/audit/index.js.map +1 -1
  31. package/dist/commands/auth/index.d.ts +6 -2
  32. package/dist/commands/auth/index.js +172 -57
  33. package/dist/commands/auth/index.js.map +1 -1
  34. package/dist/commands/backup/index.js +6 -8
  35. package/dist/commands/backup/index.js.map +1 -1
  36. package/dist/commands/crm/describe.js +3 -3
  37. package/dist/commands/crm/describe.js.map +1 -1
  38. package/dist/commands/crm/index.js +2 -0
  39. package/dist/commands/crm/index.js.map +1 -1
  40. package/dist/commands/crm/record-layouts.d.ts +3 -0
  41. package/dist/commands/crm/record-layouts.js +246 -0
  42. package/dist/commands/crm/record-layouts.js.map +1 -0
  43. package/dist/commands/crm/shared.d.ts +1 -0
  44. package/dist/commands/crm/shared.js +7 -3
  45. package/dist/commands/crm/shared.js.map +1 -1
  46. package/dist/commands/crm/sync.js +170 -27
  47. package/dist/commands/crm/sync.js.map +1 -1
  48. package/dist/commands/doctor/index.js +5 -5
  49. package/dist/commands/doctor/index.js.map +1 -1
  50. package/dist/commands/internal/index.js +20 -6
  51. package/dist/commands/internal/index.js.map +1 -1
  52. package/dist/commands/internal-session.d.ts +4 -0
  53. package/dist/commands/internal-session.js +27 -0
  54. package/dist/commands/internal-session.js.map +1 -1
  55. package/dist/commands/lists/index.js +18 -0
  56. package/dist/commands/lists/index.js.map +1 -1
  57. package/dist/commands/marketing/index.js +5 -5
  58. package/dist/commands/marketing/index.js.map +1 -1
  59. package/dist/commands/mcp.d.ts +2 -1
  60. package/dist/commands/mcp.js +49 -5
  61. package/dist/commands/mcp.js.map +1 -1
  62. package/dist/commands/sales/index.js +2 -0
  63. package/dist/commands/sales/index.js.map +1 -1
  64. package/dist/commands/sales/views.d.ts +3 -0
  65. package/dist/commands/sales/views.js +263 -0
  66. package/dist/commands/sales/views.js.map +1 -0
  67. package/dist/commands/settings/index.js +20 -0
  68. package/dist/commands/settings/index.js.map +1 -1
  69. package/dist/commands/trace/index.js +11 -4
  70. package/dist/commands/trace/index.js.map +1 -1
  71. package/dist/commands/workflows/index.js +2 -0
  72. package/dist/commands/workflows/index.js.map +1 -1
  73. package/dist/commands/workflows/internal.d.ts +3 -0
  74. package/dist/commands/workflows/internal.js +332 -0
  75. package/dist/commands/workflows/internal.js.map +1 -0
  76. package/dist/core/auth.d.ts +18 -2
  77. package/dist/core/auth.js +96 -3
  78. package/dist/core/auth.js.map +1 -1
  79. package/dist/core/bounded-response.d.ts +2 -0
  80. package/dist/core/bounded-response.js +37 -0
  81. package/dist/core/bounded-response.js.map +1 -0
  82. package/dist/core/capabilities.d.ts +8 -0
  83. package/dist/core/capabilities.js +31 -3
  84. package/dist/core/capabilities.js.map +1 -1
  85. package/dist/core/http.d.ts +16 -0
  86. package/dist/core/http.js +151 -35
  87. package/dist/core/http.js.map +1 -1
  88. package/dist/core/output.js +20 -4
  89. package/dist/core/output.js.map +1 -1
  90. package/dist/core/permissions.js +15 -1
  91. package/dist/core/permissions.js.map +1 -1
  92. package/dist/core/policy.js +8 -0
  93. package/dist/core/policy.js.map +1 -1
  94. package/dist/core/request-path.d.ts +13 -0
  95. package/dist/core/request-path.js +90 -0
  96. package/dist/core/request-path.js.map +1 -0
  97. package/dist/core/schema-cache.js +6 -2
  98. package/dist/core/schema-cache.js.map +1 -1
  99. package/dist/core/vault.js +10 -5
  100. package/dist/core/vault.js.map +1 -1
  101. package/dist/core/version.d.ts +1 -0
  102. package/dist/core/version.js +3 -0
  103. package/dist/core/version.js.map +1 -0
  104. package/dist/mcp/compat-hubspot.d.ts +5 -14
  105. package/dist/mcp/compat-hubspot.js +19 -16
  106. package/dist/mcp/compat-hubspot.js.map +1 -1
  107. package/dist/mcp/diagnostics.d.ts +157 -0
  108. package/dist/mcp/diagnostics.js +200 -0
  109. package/dist/mcp/diagnostics.js.map +1 -0
  110. package/dist/mcp/ecosystem.d.ts +107 -0
  111. package/dist/mcp/ecosystem.js +127 -0
  112. package/dist/mcp/ecosystem.js.map +1 -0
  113. package/dist/mcp/ext-tools.d.ts +4 -3
  114. package/dist/mcp/ext-tools.js +20 -8
  115. package/dist/mcp/ext-tools.js.map +1 -1
  116. package/dist/mcp/profiles.d.ts +9 -0
  117. package/dist/mcp/profiles.js +38 -4
  118. package/dist/mcp/profiles.js.map +1 -1
  119. package/dist/mcp/server.d.ts +118 -1
  120. package/dist/mcp/server.js +67 -10
  121. package/dist/mcp/server.js.map +1 -1
  122. package/docs/CAPABILITY_LIBRARY.md +7 -1
  123. package/docs/CLOUD_RUN.md +188 -0
  124. package/docs/COMMAND_TREE.md +20 -6
  125. package/docs/COMPARISON.md +14 -6
  126. package/docs/COOKBOOK.md +46 -2
  127. package/docs/INTERNAL-ENDPOINTS-DISCOVERY.md +59 -0
  128. package/docs/INTERNAL-ENDPOINTS.md +13 -0
  129. package/docs/INTERNAL_ENDPOINTS.md +23 -5
  130. package/docs/MCP.md +48 -6
  131. package/docs/MCP_TOOL_CATALOG.md +188 -186
  132. package/docs/OPERATIONAL_PLAYBOOKS.md +9 -8
  133. package/docs/PORTAL_BACKUP.md +26 -2
  134. package/docs/RELEASE_GOVERNANCE.md +7 -0
  135. package/docs/SAFETY_MODEL.md +23 -4
  136. package/docs/TUTORIALS/secure-agent-writes.md +3 -2
  137. package/docs/VALIDATION_BOUNDARIES.md +101 -0
  138. package/docs/policy-templates/compliance-strict.json +7 -0
  139. package/examples/cloud-run-mcp-caller.mjs +71 -0
  140. package/package.json +11 -8
@@ -21,7 +21,7 @@ High-level map of every hscli command. For detailed args and examples per comman
21
21
 
22
22
  ## Auth
23
23
 
24
- - `hscli auth login [--token-stdin|--token <token>]` `[--hublet eu1|na1|na2|ap1]` — with no token flag in an interactive terminal, hscli prompts without echoing the token; use `--token-stdin` for CI
24
+ - `hscli auth login [--auth-type private-app|service-key|personal-access-key] [--token-stdin|--token <token>] [--portal-id <id>] [--hublet eu1|na1|na2|ap1]` — credential type is explicit and never inferred from a `pat-*` prefix; with no token flag, hscli uses a hidden prompt; use `--token-stdin` for CI
25
25
  - `hscli auth logout [--profile <name>]`
26
26
  - `hscli auth profiles` — list profiles
27
27
  - `hscli auth profile-show [--profile <name>]`
@@ -31,8 +31,8 @@ High-level map of every hscli command. For detailed args and examples per comman
31
31
  - `hscli auth set-hublet <profile> <hublet>` — persist hublet-aware API routing
32
32
  - `hscli auth oauth-url --client-id <id> --redirect-uri <uri> --scope <scopes>`
33
33
  - `hscli auth oauth-exchange --client-id <id> --client-secret-env <env> --redirect-uri <uri> --code <code>`
34
- - `hscli auth refresh [--profile <name>]` — refresh an OAuth profile immediately; normal requests refresh automatically before expiry
35
- - `hscli auth vault-encrypt` | `vault-decrypt` | `vault-rotate`encrypted token vault
34
+ - `hscli auth refresh [--profile <name>]` — refresh an OAuth or Personal Access Key profile when it is expired or near expiry; normal requests perform the same check automatically
35
+ - `hscli auth encrypt` | `hscli auth decrypt` — encrypt or decrypt the local token vault with `HSCLI_VAULT_PASSPHRASE`
36
36
 
37
37
  ## Doctor
38
38
 
@@ -59,9 +59,15 @@ High-level map of every hscli command. For detailed args and examples per comman
59
59
  ## Agent
60
60
 
61
61
  - `hscli baseline [--output <dir>] [--resume] [--fail-fast] [--submit] [--backend-url <origin>] [--api-key-env <name>]` — run the 12-signal read-only Portal Baseline and write `portal-baseline.md`, SHA-256 integrity-checked aggregate `revfleet-evidence.json`, and the local audit ledger; `--submit` explicitly sends only that aggregate contract to a configured HTTPS RevFleet origin after local artifacts are written
62
- - `hscli agent list` — list deterministic operator recipes (`portal-baseline`, `data-cleanup`, `pipeline-risk`, `automation-risk`)
62
+ - `hscli agent list` — list deterministic operator recipes (`portal-baseline`, `access-baseline`, `reporting-joinability`, `data-cleanup`, `pipeline-risk`, `automation-risk`)
63
63
  - `hscli agent plan <recipe>` — render a public-API-first, audit-friendly runbook without executing HubSpot requests
64
- - `hscli agent run <recipe> [--output <dir>] [--resume] [--continue-on-error]` — execute a read-only runbook into a resumable local evidence directory
64
+ - `hscli agent run <recipe> [--output <dir>] [--resume] [--continue-on-error]` — execute a read-only runbook into a resumable local evidence directory; resume requires existing run-ID-bound manifest/checkpoint and completed-step files plus ledger events, preserves the original run ID/start time, and records `run-resumed`; use a new directory without `--resume` for a fresh run (except one-shot `reporting-joinability`, which rejects resume/continue)
65
+ - `hscli agent plan access-baseline` — render the no-network Integration and Access Readiness plan for the existing public capability probes.
66
+ - `hscli agent run access-baseline --confirm-read-only [--output <dir>]` — after explicit human acknowledgement, run only `doctor capabilities --refresh` and write local aggregate-status `access-baseline.json` and `access-baseline.md`; unschedulable and not submit-capable.
67
+ - `hscli agent access-baseline report <run-directory> [--output <file>]` — regenerate the local report with no HubSpot or RevFleet request.
68
+ - `hscli agent plan reporting-joinability` — render the no-network, aggregate-only `sequence → meeting → deal` public-read plan; it does not inspect HubSpot native report/dashboard UI.
69
+ - `hscli agent run reporting-joinability --confirm-read-only [--output <dir>]` — after explicit human acknowledgement, write only `reporting-joinability.json` and `reporting-joinability.md` from three public-read status probes; the sequence surface remains explicitly not probed because the documented list request requires an identity that this contract never derives, stores, or sends. No CRM rows, IDs, response bodies, scheduling, MCP, submission, or remediation.
70
+ - `hscli agent reporting-joinability report <run-directory> [--output <file>]` — regenerate the local reporting joinability report without calling HubSpot; native report inventory and attribution correctness remain unavailable.
65
71
  - `hscli agent evidence export <run-directory> [--output <file>]` — create SHA-256 integrity-checked aggregate-only `revfleet.hscli-evidence/v1` JSON; raw steps and identities remain local
66
72
  - `hscli agent evidence report <run-directory> [--output <file>]` — render the deterministic Markdown report from aggregate evidence only
67
73
  - `hscli agent evidence submit <run-directory> [--backend-url <origin>] [--api-key-env <name>]` — submit integrity-checked aggregate evidence to an explicit RevFleet origin (`REVFLEET_BACKEND_URL` is the fallback); does not create a full scan score
@@ -264,7 +270,11 @@ Per-email open+click tracking via the internal edit-publish buffer — flips `di
264
270
 
265
271
  ## MCP server
266
272
 
267
- - `hscli mcp [--surface minimal|crm|migration|full]` — start the profile-isolated stdio MCP server. Defaults to 29 essential tools; `full` exposes all 180 tools, including raw API access. Use `HSCLI_MCP_PROFILE` and `HSCLI_MCP_SURFACE` when the client cannot pass flags.
273
+ - `hscli --profile <name> mcp [serve] [--surface minimal|crm|migration|full] [--allow-writes] [--allow-cross-profile]` — start the stdio MCP server, locked to the startup profile and unable to execute live writes by default. The default exposes 31 read/diagnostic tools; `full` exposes 182 tools and includes raw API access.
274
+ - `hscli --json mcp manifest [--surface ...]` — print the packaged MCP version, protocol/transport support, and tool safety coverage without accessing HubSpot.
275
+ - `hscli --profile <name> --json mcp doctor [--surface ...] [--all]` — inspect local read/dry-run/write readiness; `--all` adds explicit client-managed checks for both official HubSpot MCP products.
276
+ - `hscli --profile <name> --json mcp setup --client <client> [--surface ...]` — print a secret-free, plan-only side-by-side setup for HubSpot Remote MCP, Developer MCP, and hscli.
277
+ - `hscli --json mcp matrix` — compare transport, authentication boundary, intended use, and compatibility status.
268
278
 
269
279
  Full tool catalog and Claude Desktop / Cursor config in [MCP.md](MCP.md).
270
280
 
@@ -272,6 +282,10 @@ Full tool catalog and Claude Desktop / Cursor config in [MCP.md](MCP.md).
272
282
 
273
283
  - `hscli agent run portal-baseline --output <dir> [--continue-on-error]` — first-run evidence bundle covering identity, capabilities, users, teams, deal pipelines, CRM data readiness, workflows, and request telemetry.
274
284
  - `hscli agent run data-cleanup|pipeline-risk|automation-risk --output <dir>` — focused recurring evidence runbooks.
285
+ - `hscli agent run access-baseline --confirm-read-only [--output <dir>]` — one explicit, local-only availability matrix from the existing public capability probes; it cannot be scheduled or submitted.
286
+ - `hscli agent access-baseline report <run-directory> [--output <file>]` — regenerate the local access matrix without calling HubSpot or RevFleet.
287
+ - `hscli agent run reporting-joinability --confirm-read-only [--output <dir>]` — one explicit, local-only aggregate evidence contract for the operational `sequence → meeting → deal` chain; it cannot be scheduled, submitted, or exposed through MCP.
288
+ - `hscli agent reporting-joinability report <run-directory> [--output <file>]` — regenerate the local joinability report without calling HubSpot; it never audits native report/dashboard UI.
275
289
  - `hscli agent plan <recipe>` — render exact commands without calling HubSpot.
276
290
  - `hscli agent contract create|inspect|verify|apply` — seal and verify approved write argument arrays; execution still requires `--execute` plus global `--force`.
277
291
 
@@ -2,14 +2,14 @@
2
2
 
3
3
  A factual inventory of what `hscli` exposes via its CLI and MCP server surface, and the HubSpot operations it covers. No comparisons, no marketing framing — just what's in the box.
4
4
 
5
- Last updated: 2026-07-09 (v0.9.0)
5
+ Last updated: 2026-07-31 (unreleased)
6
6
 
7
7
  ## MCP tool surface
8
8
 
9
9
  `hscli mcp` exposes native, HubSpot-compatible, and hscli extension tool
10
10
  families over stdio. Registration is filtered through the `minimal`, `crm`,
11
11
  `migration`, or `full` surface; see the generated
12
- [MCP tool catalog](MCP_TOOL_CATALOG.md) for the authoritative 180-tool matrix.
12
+ [MCP tool catalog](MCP_TOOL_CATALOG.md) for the authoritative 182-tool matrix.
13
13
 
14
14
  ### Native tool family (per-object)
15
15
 
@@ -28,9 +28,13 @@ families over stdio. Registration is filtered through the `minimal`, `crm`,
28
28
  | reporting | `reporting_dashboards_{list,get}` |
29
29
  | raw | `hub_api_request` |
30
30
 
31
- ### HubSpot Remote MCP compatibility family
31
+ ### HubSpot Remote MCP name-compatible subset
32
32
 
33
- `hscli mcp` also registers the 11 tool names used by HubSpot's hosted Remote MCP server at `mcp.hubspot.com`. An agent built against the HubSpot Remote MCP can point at `hscli mcp` without modification:
33
+ `hscli mcp` registers an 11-tool snapshot of familiar names from HubSpot's
34
+ hosted Remote MCP. This is a name-compatible subset, not endpoint-level
35
+ interchangeability: hscli uses local stdio + local profiles, while Remote MCP
36
+ uses Streamable HTTP + client-managed OAuth and the authenticated HubSpot
37
+ user's permissions. Compare the current products with `hscli --json mcp matrix`.
34
38
 
35
39
  | Tool | Scope | Notes |
36
40
  |---|---|---|
@@ -46,9 +50,11 @@ families over stdio. Registration is filtered through the `minimal`, `crm`,
46
50
  | `get_campaign_asset_types` | Read | Supported asset types |
47
51
  | `get_campaign_asset_metrics` | Read | Per-asset metrics |
48
52
 
49
- ### Extension tool family (hscli-only)
53
+ ### Supplemental operator tool family
50
54
 
51
- Tools for surfaces not exposed by HubSpot's hosted Remote MCP:
55
+ Additional hscli operator tools. Some product areas can overlap with the
56
+ evolving official service, but hscli keeps deterministic bulk, migration,
57
+ backup, policy, and audit semantics:
52
58
 
53
59
  | Area | Tools |
54
60
  |---|---|
@@ -121,6 +127,8 @@ Per-endpoint tier mapping: [docs/TIERS.md](TIERS.md).
121
127
  | Method | Supported | Notes |
122
128
  |---|:---:|---|
123
129
  | HubSpot Private App token | ✅ | Primary. Scriptable / machine-to-machine / CI. |
130
+ | HubSpot Service Key | ✅ | Account-level REST credential for system-to-system automation and MCP; availability follows HubSpot's current Service Key rollout. |
131
+ | HubSpot Personal Access Key | ✅ | Local user-bound CLI credential; exchanged and refreshed five minutes before expiry. |
124
132
  | OAuth authorization code | ✅ | Available for developer apps via `hscli auth oauth-url` + `hscli auth oauth-exchange` |
125
133
  | OAuth refresh-token rotation | ✅ | Automatic before expiry; persisted in `~/.revfleet/auth.json` (or encrypted `auth.enc`) |
126
134
  | Legacy `hapikey` | ❌ | Retired by HubSpot (June 2023) |
package/docs/COOKBOOK.md CHANGED
@@ -17,6 +17,43 @@ hscli auth login
17
17
  `auth login` uses a hidden terminal prompt, so the token never enters shell
18
18
  history. Use stdin only for CI or non-interactive shells.
19
19
 
20
+ The default auth type is `private-app`. Keep it explicit in runbooks:
21
+
22
+ ```bash
23
+ hscli auth login --auth-type private-app --profile production
24
+ ```
25
+
26
+ ### Login with an account Service Key
27
+
28
+ Service Keys are stable, scoped account credentials for REST API operations.
29
+ They are not Personal Access Keys and hscli does not infer the type from their
30
+ prefix.
31
+
32
+ ```bash
33
+ hscli auth login --auth-type service-key --profile automation
34
+ hscli --profile automation auth whoami
35
+ ```
36
+
37
+ `whoami` reports `restOnly: true` for Service Key profiles. Webhooks, UI
38
+ extensions, and other app-platform features need their own supported auth path.
39
+
40
+ ### Login with a Personal Access Key
41
+
42
+ Personal Access Keys are tied to one HubSpot user and account. hscli exchanges
43
+ the key for a short-lived access token and refreshes it automatically five
44
+ minutes before expiry.
45
+
46
+ ```bash
47
+ hscli auth login \
48
+ --auth-type personal-access-key \
49
+ --portal-id 123456 \
50
+ --profile local-dev
51
+ ```
52
+
53
+ The expected portal ID is checked before the profile is saved and again during
54
+ refresh. Use `hscli auth encrypt` because the PAK must remain available locally
55
+ to mint replacement access tokens.
56
+
20
57
  Hublet is auto-detected from the token prefix (e.g. `pat-eu1-...` routes to `api-eu1.hubapi.com`).
21
58
  If the token does not expose enough metadata, force routing explicitly:
22
59
 
@@ -30,6 +67,13 @@ hscli --hublet eu1 --profile live account info
30
67
 
31
68
  ```bash
32
69
  echo "$HUBSPOT_TOKEN" | hscli auth login --token-stdin --profile production
70
+
71
+ printf '%s' "$HUBSPOT_SERVICE_KEY" | hscli auth login \
72
+ --auth-type service-key --token-stdin --profile automation
73
+
74
+ printf '%s' "$HUBSPOT_PERSONAL_ACCESS_KEY" | hscli auth login \
75
+ --auth-type personal-access-key --portal-id 123456 \
76
+ --token-stdin --profile local-dev
33
77
  ```
34
78
 
35
79
  ### Switch between profiles
@@ -95,8 +139,8 @@ hscli --profile oauth-prod auth whoami
95
139
 
96
140
  The access token refreshes automatically before expiry. hscli stores the
97
141
  refresh token and the client-secret environment variable name, never the
98
- client secret itself. Use `hscli --profile oauth-prod auth refresh` to force a
99
- rotation while diagnosing an OAuth installation.
142
+ client secret itself. Use `hscli --profile oauth-prod auth refresh` to run the
143
+ same expiry check explicitly while diagnosing an OAuth installation.
100
144
 
101
145
  ---
102
146
 
@@ -811,3 +811,62 @@ Asset Body export Notes
811
811
  Sequence ✅ Full GET /api/sequences/v3/sequences/{id} — includes steps, settings, email templates by ID, send window, unenrollment rules, dependencies
812
812
  Playbook ✅ Full listPlaybooks RPC returns body + htmlBody inline. Plus questions via separate RPC.
813
813
  Caveat: Sequence steps reference templates by ID; full fidelity requires also fetching template bodies. Same for playbook questions.
814
+
815
+ ## Iteration 16 — promoted operator commands and guarded workflow replacement
816
+
817
+ The following contracts were promoted from discovery notes into explicit hscli
818
+ commands. They are intentionally not exposed as arbitrary internal HTTP calls:
819
+
820
+ | Command | Endpoint | Evidence semantics |
821
+ |---|---|---|
822
+ | `workflows inspect <flowId>` | `GET /api/automationplatform/v1/flows/{flowId}?portalId={portalId}` | Current full editor definition; internal browser-session source. |
823
+ | `workflows revisions <flowId>` | `GET /api/automationplatform/v1/hybrid/revisions/{flowId}?portalId={portalId}&limit=100&after=...` | Revision definitions and authors; paginated completeness is reported. |
824
+ | `workflows errors <flowId>` | `GET /api/automationapps/v1/insights/canvas/errors/{flowId}` | Rolling seven-day canvas evidence; explicitly marked incomplete outside that window. |
825
+ | `lists inspect-filters <listId>` | `GET /api/inbounddb-lists/v1/lists/{listId}` | Internal filter tree. |
826
+ | `crm record-layouts ...` | `/api/crm-record-cards/v4/...` | Record-page layouts and card property configuration. |
827
+
828
+ `POST /api/automationplatform/v1/hybrid/batch` is a full workflow replacement,
829
+ not a normal CRUD update. It is available only through the CLI command
830
+ `workflows update-internal` and is forbidden in generic `internal capture` and
831
+ MCP. The command is plan-only by default and execution requires a disabled
832
+ single flow, exact ID match, fresh live version, HubSpot validation, same-session
833
+ portal proof, a private pre-write snapshot, `version = live + 1`, a sealed
834
+ action contract, change ticket, global `--force`, experimental opt-in, and the
835
+ exact acknowledgement `REPLACE WORKFLOW <flowId>`. The non-idempotent save is
836
+ sent once with retries disabled, then reconciled against both current state and
837
+ revision history. Any ambiguous result fails closed and instructs the operator
838
+ not to retry automatically.
839
+
840
+ `PUT /api/crm-record-cards/v4/crm-cards/{cardId}` is also a full replacement,
841
+ even when the intended edit is only one property list. The promoted command
842
+ `crm record-layouts update-card` therefore accepts only an ordered CSV of
843
+ `propertyNames`, merges it into the freshly-read full card, and uses the same
844
+ plan-first, portal-proof, private snapshot, sealed contract, ticket, explicit
845
+ acknowledgement, no-retry, and post-write verification model. It is CLI-only
846
+ and absent from the generic internal capture catalogue and MCP.
847
+
848
+ The public seat-history companion is:
849
+
850
+ ```text
851
+ GET /crm/v3/objects/0-115/{userId}
852
+ ?properties=hs_assigned_seats
853
+ &propertiesWithHistory=hs_assigned_seats
854
+ &archived=false
855
+ ```
856
+
857
+ It is exposed as `settings users seat-history <userId>` and does not use
858
+ browser credentials.
859
+
860
+ Two discoveries remain documentation-only because the supplied evidence does
861
+ not include a complete executable RPC contract:
862
+
863
+ - `CrmUsagesUiService/getPageOfFilteredUsagesForDependencyNodeAndAssetDisplayType`
864
+ needs the exact fully-qualified Chirp service name and a redacted request
865
+ fixture before it can be allowlisted.
866
+ - `UserPermissionAuditLogsRpc/getPagedLogs` needs the exact fully-qualified
867
+ Chirp service name. Its known body uses `{ userId, offset: {}, limit }`, and
868
+ the pagination cursor is an object rather than an integer.
869
+
870
+ No live write was used to validate this iteration. The workflow replacement is
871
+ covered by mocked contract and safety tests; its internal HubSpot contract must
872
+ still be treated as unstable.
@@ -69,6 +69,19 @@ Workflows
69
69
  Method Path Status Notes
70
70
  GET /api/automation/v4/flows ✅ List flows. Hard cap limit=100; paginate via after.
71
71
  GET /api/automation/v4/flows/{id} ❌ 401 from in-tab JS.
72
+ GET /api/automationplatform/v1/flows/{id}?portalId={portalId} ✅ Current editor definition in hybrid format; `hscli workflows inspect`.
73
+ GET /api/automationplatform/v1/hybrid/{id} ✅ Full hybrid action graph.
74
+ GET /api/automationplatform/v1/hybrid/revisions/{id}?portalId={portalId}&limit=100&after={cursor} ✅ Full revision history with definitions and authors; `after` is optional.
75
+ POST /api/automationplatform/v1/validation?portalId={portalId} ✅ Read-like validation preview before save.
76
+ GET /api/automationapps/v1/insights/canvas/errors/{id} ✅ Rolling canvas execution/enrollment errors.
77
+ POST /api/automationplatform/v1/hybrid/batch ⚠️ Undocumented full-flow replacement. CLI-only via `workflows update-internal`; disabled flows only, plan-first, snapshot, no retry, post-save verification, and high-risk acknowledgement. Forbidden in generic internal capture and MCP.
78
+ PUT /api/crm-record-cards/v4/crm-cards/{cardId} ⚠️ Undocumented full-card replacement. CLI-only via `crm record-layouts update-card`; propertyNames-only delta, plan-first, snapshot, no retry, exact post-save order verification. Forbidden in generic internal capture and MCP.
79
+
80
+ Public seat-history companion: `GET /crm/v3/objects/0-115/{userId}` with
81
+ `properties=hs_assigned_seats` and
82
+ `propertiesWithHistory=hs_assigned_seats`, exposed as
83
+ `hscli settings users seat-history <userId>`. This does not require a browser
84
+ session.
72
85
  POST /api/automation/v4/flows ✅ Create flow.
73
86
  PUT/PATCH /api/automation/v4/flows/{id} ✅ Update.
74
87
  DELETE /api/automation/v4/flows/{id} ✅ Soft delete; recoverable from Deleted view.
@@ -58,7 +58,7 @@ read-like surfaces into JSON backup assets:
58
58
  | `permission-access` | App users, teams, permission sets, assignment maps, roles, seats, templates, FLP, and access-audit RPCs |
59
59
  | `datasets-reporting` | Data Studio datasets, reportable sources, joins, formulas, previews, async resolve calls, and async result polling |
60
60
  | `reports-dashboards` | Report definitions, favorites, report audit/history, record-view metadata, report permissions, report template discovery, dashboard layouts, widgets, dashboard grants, and report-list views |
61
- | `workflows-hybrid` | Workflow inventories, hybrid action graphs, validation, output fields, action catalog, CRM object context, canvas errors, access checks, filter-description previews, and card-position RPCs |
61
+ | `workflows-hybrid` | Workflow inventories, current hybrid action graphs, full revision history, validation previews, output fields, action catalog, CRM object context, canvas errors, access checks, filter-description previews, and card-position RPCs |
62
62
  | `properties-metadata` | Internal property metadata, legacy v1/v2 fallbacks, property groups, grouped-property listings, named property reads, recycled properties, quotas, fill rates, validation, dynamic options, and conditional options |
63
63
  | `crm-search` | Read-only CRM search, CRM GraphQL, object preview, and single-object UI payload helpers used by report builders, help desk, quotes, and object indexes |
64
64
  | `object-metadata` | Schema metadata, framework-builder metadata, portal-scoped object types, event object types, and object-type batch reads |
@@ -107,6 +107,24 @@ for research and migration design, but they are not included in
107
107
  be implemented as explicit product commands with policy checks, dry-run,
108
108
  `--force`, and audit trails.
109
109
 
110
+ The sole promoted workflow write adapter is
111
+ `hscli workflows update-internal <flowId>`. It targets the undocumented
112
+ `POST /api/automationplatform/v1/hybrid/batch` editor endpoint and is never
113
+ part of `internal capture` or MCP. It is plan-only by default and adds stronger
114
+ gates than normal writes: one disabled flow, matching requested/input/live ID,
115
+ same-session portal proof, live-version optimistic locking, validation,
116
+ owner-only snapshot, one request with retries disabled, and post-save proof
117
+ from both current state and revision history. Operators must also provide a
118
+ change ticket, sealed action contract, explicit experimental opt-in, `--force`,
119
+ and an ID-bound acknowledgement.
120
+
121
+ Record-card writes are similarly promoted only through
122
+ `crm record-layouts update-card`. The command reads the live card, replaces
123
+ only `configuration.propertyNames`, snapshots the full before/after payload,
124
+ uses one non-retried `PUT /api/crm-record-cards/v4/crm-cards/{cardId}`, and
125
+ verifies the exact ordered property list. It is not available to generic
126
+ capture or MCP.
127
+
110
128
  ## Browser Session Auth Pattern
111
129
 
112
130
  Most internal endpoints require the HubSpot browser cookies plus the modern
@@ -189,15 +207,15 @@ commands. hscli exposes only the allowlisted reads below through
189
207
  | Reports | `/api/dashboard/v2/reports/*`, `/reporting-migration/v2/reports/migrate` |
190
208
  | Reporting data | `/api/reporting/v3/dataset/resolve/async` |
191
209
  | Datasets | `/sql-reporting/v1/datasets/*`, `/sql-reporting/v1/extended-reportable-options/*` |
192
- | Workflows | `/api/automationplatform/v1/hybrid/{flowId}`, validation, output fields, action catalog |
210
+ | Workflows | `/api/automationplatform/v1/flows/{flowId}`, `/api/automationplatform/v1/hybrid/{flowId}`, `/api/automationplatform/v1/hybrid/revisions/{flowId}`, validation, canvas errors, output fields, action catalog; guarded CLI-only full replacement via `/api/automationplatform/v1/hybrid/batch` |
193
211
  | Properties | `/api/properties/v4/{typeId}`, `/api/properties/v4/groups/{typeId}`, v2 fallbacks |
194
- | Lists / segments | Legacy contacts lists, ILS segments, list search, and UI list views |
212
+ | Lists / segments | Legacy contacts lists, ILS segments, list search, UI list views, and `/api/inbounddb-lists/v1/lists/{listId}` complete filter trees |
195
213
  | Sales content | `/api/templates/v1`, `/api/sales-content/v1`, `/api/sales-content-libraries/v2` |
196
214
  | Sequences | `/api/salescontentsearch/v2/search`, `/api/sequences/v3/sequences/{id}` |
197
215
  | Playbooks | Chirp RPC `com.hubspot.playbooks.rpc.PlaybooksRpc` |
198
216
  | Audit logs | `/api/audit-log/v1`, `/api/audit-log/v3`, `/api/security-audit-logs/v1` |
199
217
  | Object metadata | `/api/data-model/v3`, `/api/framework-builder/v1`, `/api/schemas-metadata/v1` |
200
- | CRM views | `/api/sales/v4/views/{typeId}`, legacy v2/v3 views, visualization settings |
218
+ | Saved contacts views | Captured contacts surface: `POST /api/sales/v4/views/by-category/search/0-1`, `POST /api/sales/v4/views/with-visualization-settings`, and `DELETE /api/sales/v4/views/{viewId}`. Exposed as `hscli sales views list|create|delete`; create/delete require browser-session portal proof, explicit acknowledgement, `--execute`, global `--force`, and a change ticket. `PUT /api/sales/v4/views/{viewId}` is unverified and deliberately not exposed. |
201
219
  | Owners | `/api/owners/v2/owners`, `/owners-aether-search/v1/owners-search` |
202
220
  | Branding | `/api/branding/v1/*`, `/api/business-units/v1/*`, `/api/multi-brand/v1/*` |
203
221
  | Forms and marketing | `/forms/v2/forms`, `/marketing/v3/forms`, `/api/cosemail/v1/*` |
@@ -206,7 +224,7 @@ commands. hscli exposes only the allowlisted reads below through
206
224
  | Social and ads | `/api/broadcast/v2/*` plus read-only `com.hubspot.ads.rpc.*` Chirp RPCs |
207
225
  | CRM search and previews | `/api/crm-search/*`, `/api/graphql/crm`, and `/inbounddb-objects/v1/*` |
208
226
  | Conditional properties | `/api/conditional-properties/v2/rules/*` plus unified RPC reads |
209
- | Record cards | `/api/crm-record-cards/v4/container-views/*` |
227
+ | Record cards | `/api/crm-record-cards/v4/container-views/search`, `/get-view/CRM_RECORD_PAGE/{layoutId}`, `/api/crm-record-cards/v4/crm-cards/all`, and `/crm-cards/{cardId}` |
210
228
  | Conversations / help desk | Custom views and Chirp RPC help desk services |
211
229
  | Chatflows | Chirp RPC `com.hubspot.chatflows.rpc.*` |
212
230
  | Payments / quotes / forecast | Feature-gated internal setup and eligibility endpoints |
package/docs/MCP.md CHANGED
@@ -18,6 +18,11 @@ hscli mcp # minimal: essential CRM reads
18
18
  hscli mcp --surface crm # curated CRM reads + writes
19
19
  hscli mcp --surface migration # cross-product migration tools
20
20
  hscli mcp --surface full # all tools, including raw API
21
+ hscli --json mcp manifest --surface minimal # protocol + transport + tool metadata
22
+ hscli --profile prod --json mcp doctor # local profile and safety diagnostics
23
+ hscli --profile prod --json mcp doctor --all # external checks, clearly marked not live-run
24
+ hscli --profile prod --json mcp setup --client codex # plan only; no credential/config write
25
+ hscli --json mcp matrix # intended use + trust boundaries
21
26
  ```
22
27
 
23
28
  The default `minimal` surface keeps agent context and write exposure small.
@@ -26,10 +31,12 @@ pass command arguments.
26
31
 
27
32
  ## Profile isolation and safety defaults
28
33
 
29
- - **Profile isolation**: set `HSCLI_MCP_PROFILE=<profile>` to hard-lock the MCP server to one auth profile.
34
+ - **Profile isolation**: `hscli --profile <profile> mcp serve` hard-locks the server to that startup profile by default.
30
35
  - If a tool call requests a different profile, the server rejects it.
36
+ - Cross-profile selection is available only with the operator-controlled `--allow-cross-profile` startup flag.
31
37
  - **Write tools are dry-run by default**:
32
- - `force: true` is required to execute actual writes.
38
+ - `force: true` on the tool call is necessary but not sufficient.
39
+ - The operator must also start the server with `--allow-writes` (or explicitly set `HSCLI_MCP_ALLOW_WRITES=1`).
33
40
  - Without `force`, write tools return a dry-run payload (`{ dryRun: true, method, path, body }`).
34
41
  - **Lifecycle coverage for CRM objects**:
35
42
  - standard object tools now include delete, merge, batch read/upsert/archive.
@@ -39,6 +46,20 @@ pass command arguments.
39
46
  - Pipeline object types: `deals`, `tickets`
40
47
  - **Secrets redaction**:
41
48
  - Token-like fields and bearer strings are redacted in MCP tool outputs and errors.
49
+ - **Conservative tool annotations**:
50
+ - Every registered tool publishes `readOnlyHint`, `destructiveHint`,
51
+ `idempotentHint`, and `openWorldHint`.
52
+ - Unknown or mixed-operation tools default to write/destructive metadata.
53
+ - `manage_crm_objects` and raw `hub_api_request` are destructive because
54
+ their runtime arguments can select delete operations.
55
+ - **Stable diagnostic schemas**:
56
+ - `hscli_mcp_manifest` and `hscli_mcp_doctor` publish MCP `outputSchema`
57
+ declarations and return validated structured content.
58
+ - The 11-tool HubSpot name-compatible subset also publishes object-level
59
+ output schemas so clients can rely on structured content without assuming
60
+ HubSpot Remote MCP authorization or transport equivalence.
61
+ - Raw HubSpot tools deliberately do not claim stable output schemas because
62
+ their response shapes vary by endpoint, product tier, and portal state.
42
63
 
43
64
  ## Claude Desktop setup
44
65
 
@@ -84,14 +105,29 @@ If your client accepts env vars, set:
84
105
  - `HSCLI_HOME` to the auth profile directory containing `auth.json`
85
106
  - `HSCLI_MCP_PROFILE` to force strict profile isolation
86
107
 
108
+ ## Three-server setup
109
+
110
+ The products are complementary and should be configured side by side:
111
+
112
+ | Server | Transport / auth | Best use |
113
+ |---|---|---|
114
+ | HubSpot Remote MCP | Streamable HTTP, OAuth 2.1 + PKCE, HubSpot user permissions | User-authorized CRM, activities, content, and marketing operations |
115
+ | HubSpot Developer MCP | stdio via HubSpot CLI 8.2+ | HubSpot app and CMS development (`hs mcp setup`) |
116
+ | hscli MCP | local stdio, hscli profile | Bulk operations, migrations, backups, internal adapters, policy, tickets, audit evidence |
117
+
118
+ Run `hscli --profile <name> --json mcp setup --client <client>` for a
119
+ secret-free plan. The command does not perform OAuth, write client config, or
120
+ store credentials. Run `mcp doctor --all` afterward; external checks remain
121
+ `external-check-required` until the owning client completes them.
122
+
87
123
  ## Tool surfaces
88
124
 
89
125
  | Surface | Tools | Intended use | Raw API |
90
126
  |---|---:|---|---|
91
- | `minimal` | 29 | Agent discovery and essential CRM reads | No |
92
- | `crm` | 136 | CRM objects, schemas, properties, associations, imports | No |
93
- | `migration` | 179 | Curated cross-product backup and migration work | No |
94
- | `full` | 180 | Explicit operator access to every registered tool | Yes |
127
+ | `minimal` | 31 | Agent diagnostics, discovery, and essential CRM reads | No |
128
+ | `crm` | 138 | CRM objects, schemas, properties, associations, imports | No |
129
+ | `migration` | 181 | Curated cross-product backup and migration work | No |
130
+ | `full` | 182 | Explicit operator access to every registered tool | Yes |
95
131
 
96
132
  The exact catalog is generated from runtime registration metadata, including
97
133
  domain, inferred risk, surfaces, and description:
@@ -107,5 +143,11 @@ npm run docs:mcp:check
107
143
  ## Notes
108
144
 
109
145
  - MCP transport is stdio only in this implementation.
146
+ - The packaged SDK currently negotiates MCP `2025-11-25`. Streamable HTTP,
147
+ MCP Tasks, MCP Apps, and explicit `2026-07-28` opt-in are not enabled.
148
+ They require a separate SDK-v2 migration and transport compatibility gate.
110
149
  - Existing auth + HTTP core logic is reused (`getToken`, `HubSpotClient`, `maybeWrite`, redaction).
111
150
  - `hub_api_request` is exposed only by `--surface full`.
151
+ - MCP writes use the startup write gate, dry-run, force, policy, portal-pin, and change-ticket gates,
152
+ but are not yet bound to sealed `hscli agent contract` prepare/apply/verify
153
+ workflows. `mcp doctor` reports this limitation explicitly.