sackville-mcp 0.0.1-alpha.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 (73) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +215 -0
  3. package/dist/api-CwbKGPdx.mjs +344 -0
  4. package/dist/api-CwbKGPdx.mjs.map +1 -0
  5. package/dist/bin-api-B2yOz1Ss.d.mts +65 -0
  6. package/dist/bin-api-B2yOz1Ss.d.mts.map +1 -0
  7. package/dist/bin-api-DtWpAS3l.mjs +114 -0
  8. package/dist/bin-api-DtWpAS3l.mjs.map +1 -0
  9. package/dist/bin-api.d.mts +2 -0
  10. package/dist/bin-api.mjs +3 -0
  11. package/dist/bin-browser.d.mts +140 -0
  12. package/dist/bin-browser.d.mts.map +1 -0
  13. package/dist/bin-browser.mjs +293 -0
  14. package/dist/bin-browser.mjs.map +1 -0
  15. package/dist/bin-coverage.d.mts +38 -0
  16. package/dist/bin-coverage.d.mts.map +1 -0
  17. package/dist/bin-coverage.mjs +65 -0
  18. package/dist/bin-coverage.mjs.map +1 -0
  19. package/dist/bin-deps-cyZV0wIN.mjs +175 -0
  20. package/dist/bin-deps-cyZV0wIN.mjs.map +1 -0
  21. package/dist/bin-deps.d.mts +66 -0
  22. package/dist/bin-deps.d.mts.map +1 -0
  23. package/dist/bin-deps.mjs +3 -0
  24. package/dist/bin-docs.d.mts +1 -0
  25. package/dist/bin-docs.mjs +19 -0
  26. package/dist/bin-docs.mjs.map +1 -0
  27. package/dist/bin-flake.d.mts +48 -0
  28. package/dist/bin-flake.d.mts.map +1 -0
  29. package/dist/bin-flake.mjs +97 -0
  30. package/dist/bin-flake.mjs.map +1 -0
  31. package/dist/bin-lsp.d.mts +71 -0
  32. package/dist/bin-lsp.d.mts.map +1 -0
  33. package/dist/bin-lsp.mjs +192 -0
  34. package/dist/bin-lsp.mjs.map +1 -0
  35. package/dist/bin-mutate.d.mts +40 -0
  36. package/dist/bin-mutate.d.mts.map +1 -0
  37. package/dist/bin-mutate.mjs +67 -0
  38. package/dist/bin-mutate.mjs.map +1 -0
  39. package/dist/bin-verify.d.mts +41 -0
  40. package/dist/bin-verify.d.mts.map +1 -0
  41. package/dist/bin-verify.mjs +286 -0
  42. package/dist/bin-verify.mjs.map +1 -0
  43. package/dist/bin.d.mts +1 -0
  44. package/dist/bin.mjs +176 -0
  45. package/dist/bin.mjs.map +1 -0
  46. package/dist/browser-CqinhYxE.mjs +780 -0
  47. package/dist/browser-CqinhYxE.mjs.map +1 -0
  48. package/dist/coverage-CAVVlVSW.mjs +135 -0
  49. package/dist/coverage-CAVVlVSW.mjs.map +1 -0
  50. package/dist/deps-DEAQKSE-.mjs +275 -0
  51. package/dist/deps-DEAQKSE-.mjs.map +1 -0
  52. package/dist/deps-DGYsm5hn.d.mts +39 -0
  53. package/dist/deps-DGYsm5hn.d.mts.map +1 -0
  54. package/dist/docs-B74m1Jw3.d.mts +163 -0
  55. package/dist/docs-B74m1Jw3.d.mts.map +1 -0
  56. package/dist/docs-C38YXAWZ.mjs +253 -0
  57. package/dist/docs-C38YXAWZ.mjs.map +1 -0
  58. package/dist/docs.d.mts +2 -0
  59. package/dist/docs.mjs +2 -0
  60. package/dist/flake-w7D3RS7c.mjs +197 -0
  61. package/dist/flake-w7D3RS7c.mjs.map +1 -0
  62. package/dist/index.d.mts +352 -0
  63. package/dist/index.d.mts.map +1 -0
  64. package/dist/index.mjs +10 -0
  65. package/dist/lsp-kaX9mftb.mjs +427 -0
  66. package/dist/lsp-kaX9mftb.mjs.map +1 -0
  67. package/dist/mutate-v1XTFXRa.mjs +106 -0
  68. package/dist/mutate-v1XTFXRa.mjs.map +1 -0
  69. package/dist/pillars-2KKNotp3.d.mts +26 -0
  70. package/dist/pillars-2KKNotp3.d.mts.map +1 -0
  71. package/dist/verify-BnZBssVR.mjs +209 -0
  72. package/dist/verify-BnZBssVR.mjs.map +1 -0
  73. package/package.json +90 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Curtis Autery
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,215 @@
1
+ # sackville-mcp
2
+
3
+ The Sackville MCP server — exposes Sackville's pillars to an LLM agent as MCP tools
4
+ and resources. **`sackville-mcp` is the AGGREGATE server**: one stdio process that
5
+ serves every *enabled* pillar (docs, api, browser, coverage, deps, flake, lsp,
6
+ mutate, verify). Narrow single-pillar bins also ship for minimal deployments
7
+ (`sackville-docs-mcp`, `sackville-api-mcp`, `sackville-browser-mcp`, …).
8
+
9
+ ## Quickstart — the aggregate server
10
+
11
+ Add one block to your MCP client config (see [`examples/mcp/.mcp.json`](../../examples/mcp/.mcp.json)):
12
+
13
+ ```jsonc
14
+ {
15
+ "mcpServers": {
16
+ "sackville-mcp": {
17
+ "command": "npx",
18
+ "args": ["-y", "sackville-mcp"],
19
+ "env": {
20
+ // Pick which pillars to expose (unset ⇒ the curated default docs+api+deps+verify).
21
+ "SACKVILLE_TOOLSETS": "api,deps,verify",
22
+ // Each pillar reads its OWN operator gate; run/write tools appear only when set.
23
+ "SACKVILLE_API_ALLOWED_HOSTS": "api.example.com"
24
+ }
25
+ }
26
+ }
27
+ }
28
+ ```
29
+
30
+ - **Selecting pillars** — `SACKVILLE_TOOLSETS` is a comma list of pillar names; unset
31
+ enables the curated read-heavy default. It only *selects* — it never grants a
32
+ capability (each pillar still reads its own `SACKVILLE_<PILLAR>_*` gate).
33
+ - **Install isolation** — a bare `npm i sackville-mcp` is **native-free**. The heavy
34
+ engines (`@sackville-mcp/browser` → playwright, `@sackville-mcp/core`/`@sackville-mcp/embed` → the
35
+ docs index, `@sackville-mcp/flake` → SQLite) are **optional peers**: install the ones whose
36
+ pillars you enable. A pillar whose engine isn't installed (or, for docs, whose
37
+ `SACKVILLE_INDEX` is unset) is *loud-disabled* at startup — the server still starts.
38
+ - **Compose, never widen** — in the aggregate the api + verify pillars read the prefixed
39
+ `SACKVILLE_API_*` / `SACKVILLE_API_SECRET_*` namespace, so no bare flag unlocks two
40
+ pillars at once. Safety config is always operator-set, never an agent input.
41
+
42
+ ## Docs tools
43
+
44
+ - **`search_docs`** — **hybrid** search: FTS5/bm25 fused with vector KNN via
45
+ reciprocal rank fusion. Inputs: `query`, optional `library`/`version`/`type`/
46
+ `limit` (default 8, max 25). Returns **compact** results (`id`, `title`,
47
+ `symbol`, `type`, `library`, `version`, `score`, `snippet`, `resourceUri`) as
48
+ `structuredContent` — never full bodies. The query is embedded in-process with
49
+ transformers.js (`Xenova/bge-small-en-v1.5`), matching the indexed vectors
50
+ (ADR 0003); the model (~130 MB) downloads once on first query.
51
+ - **`get_doc`** — inputs: `id`. Returns the full fragment (the one place bodies
52
+ are returned). Errors if the id is unknown.
53
+
54
+ ## Docs resource
55
+
56
+ - **`sackville://doc/{id}`** — the same full fragment as `get_doc`, so agents can
57
+ follow a search hit's `resourceUri` without a tool call.
58
+
59
+ ## API tools (`sackville-api-mcp`)
60
+
61
+ Over a Bruno `.bru` collection directory (passed as the `dir` tool argument, so
62
+ one server serves many collections):
63
+
64
+ - **`list_requests`** — `{ dir }` → each request's `name`/`method`/`url`.
65
+ - **`get_request`** — `{ dir, name }` → method/url/headers, counts, and
66
+ **`requiredSecrets`** — the secret **names** referenced as `{{secret:NAME}}`,
67
+ never values.
68
+ - **`run_request`** — `{ dir, name, vars?, env? }` → the redacted run result
69
+ (status, assertions, scriptTests, captured, `bodyHandle`).
70
+ - **`run_collection`** — `{ dir, names[], vars?, env?, stopOnFailure? }` → a
71
+ compact per-step summary + threaded `captured`.
72
+ - **`validate_response`** — OpenAPI 3.1 (`openapiSpec`,`method`,`path`,`status`,
73
+ `body`) **or** GraphQL (`graphqlSchema`,`query`,`body`, + optional `variables` to
74
+ type-check the request variables against the operation's declared types) → contract findings.
75
+ - **`validate_request`** — validate a request's **body + path/query/header params**
76
+ against an OpenAPI 3.1 operation (`openapiSpec`,`method`,`path`,`body?`,`query?`,
77
+ `headers?`) → contract findings (message + path redacted). Scalar params, array params
78
+ (query form/space/pipe-delimited + path/header `simple`, non-string-scalar items), and
79
+ object params (query `deepObject` + `form/explode=false`); ambiguous serializations
80
+ (e.g. `form/explode=true` objects, string-item delimited arrays, fractional `multipleOf`
81
+ numbers) are skipped as uncheckable, never a false finding (ADR 0016). A GraphQL envelope
82
+ is refused, not schema-failed.
83
+ - Resource **`sackville://run/{runId}/body`** — fetch a stored response body by
84
+ its handle (bodies are never inlined).
85
+
86
+ **Safety:** `allowUnsafe` / `allowedHosts` are **operator-controlled** — set on
87
+ the bin via env, never exposed as tool inputs (an agent can't authorize its own
88
+ mutating requests). Mutations dry-run unless both are set (ADR 0004).
89
+
90
+ ## Browser tools (`sackville-browser-mcp`)
91
+
92
+ Stateful, session-oriented (open → drive → close); all large artifacts by handle:
93
+
94
+ - **`browser_open_session`** / **`browser_list_sessions`** / **`browser_close_session`**
95
+ — lifecycle. Open mints a server-side `sessionId` + `runId` (never agent inputs)
96
+ and reports `capturing` + `sessionCount`/`maxContexts`; close flushes and returns
97
+ the run artifact handles.
98
+ - **`browser_navigate`** / **`browser_snapshot`** — drive + (re)capture a
99
+ token-capped ARIA snapshot whose elements carry `[ref=…]` ids.
100
+ - **`browser_click`/`fill`/`fill_form`/`select`/`press`** — interact by ref;
101
+ mutations **dry-run** (redacted would-be-request preview) unless the operator
102
+ unlocked execution. `fill` resolves `{{secret:NAME}}` server-side (fail-closed).
103
+ - **`browser_wait_for`** / **`browser_get_text`/`get_value`/`get_attribute`** —
104
+ read-like; reads are redacted and don't invalidate refs.
105
+ - **`browser_assert`** — evaluate declarative assertions against the live page
106
+ (a free read). Page sources `url`/`title`/`ariaSnapshot`; element sources
107
+ `text`/`value`/`visible`/`count` (by ref or role+name); the shared `@sackville-mcp/assert`
108
+ operator set (`equals`/`contains`/`matches`/`gt`/…). Each **auto-waits** to its
109
+ timeout; observed values are redacted. Returns `{pass, results}`.
110
+ - **`browser_audit_a11y`** — axe-core audit; compact summary + report by handle.
111
+ - **`browser_perf_audit`** — Lighthouse performance audit of a URL (allowlist-gated;
112
+ spawns a fresh proxied Chrome, independent of any session). Score + core web-vitals
113
+ inline; full LHR JSON + HTML by handle. Assert shape/thresholds, never exact scores.
114
+ - **`browser_trace_query`** — parse a captured trace.zip (by `runId`; needs trace
115
+ capture on) into an action timeline (API calls + timing + errors), console, and an
116
+ errors list. No live session needed — query after the session closed; the trace is
117
+ already redacted. `apiFilter`/`errorsOnly`/`limit`/`includeParams` narrow it.
118
+ - **`browser_screenshot`** — operator-gated (off by default; pixels can't be
119
+ redacted, like the trace.zip); captures a PNG to a `screenshot-s<n>` handle
120
+ (summary only, never inlined) and does not invalidate refs.
121
+ - **`browser_vision_click`** / **`browser_vision_move`** — drive the pointer at a
122
+ viewport coordinate (CSS pixels, e.g. from a screenshot) for canvas / non-AX-tree
123
+ UI the snapshot can't address. Operator-gated **off by default** (`ALLOW_VISION`) —
124
+ a blind click on a *point* sidesteps the accessible-tree safety story; the click
125
+ still goes through the mutation gate. Prefer ref-based `browser_click` whenever the
126
+ element is in the snapshot.
127
+ - **`browser_visual_compare`** — visual regression: capture the current page
128
+ (animations frozen, caret hidden) and pixel-diff it against a stored baseline (by
129
+ name) via pixelmatch. Returns pass + diff pixel count/ratio; the diff PNG is stored
130
+ by `visual-diff-s<n>` handle on a mismatch. `maxDiffPixelRatio`/`maxDiffPixels` set
131
+ the budget, `mask[]` ignores dynamic regions. Operator-gated (`BASELINE_DIR`);
132
+ `update:true` records the baseline only when `ALLOW_BASELINE_UPDATE` is set (an
133
+ agent can't rewrite the golden). Assert on a diff budget, not exact pixels.
134
+ - **`browser_upload`** — set file(s) on a file-input ref. Deny-by-default: requires
135
+ an operator upload-allowlist dir and confines every path within it (no traversal/
136
+ absolute escape), so an agent can't upload arbitrary local files.
137
+ - **`browser_downloads`** — collect file downloads since the last call (a free read).
138
+ Downloads are denied by default (cancelled); with an operator quarantine dir set
139
+ they're saved there under a sanitized name and reported as filename/path/size —
140
+ the bytes are never served. `waitMs` waits briefly for a download a click just started.
141
+ - **`browser_save_storage_state`** — operator-gated; writes the password-equivalent
142
+ storageState to an operator-path artifact (handle + counts only, never inlined).
143
+ - **`browser_replay_har`** — "network heavy mode" replay: serve the session from a
144
+ recorded HAR instead of the network (`routeFromHAR`, unmatched requests aborted —
145
+ deterministic, zero egress). Call before navigating. Operator-gated + deny-by-default
146
+ (requires a replay dir; the HAR must resolve within it). **HAR capture** is the flip
147
+ side: with an operator `HAR_DIR` set, each session records a full HAR (bodies
148
+ attached) that `browser_close_session` finalizes — redacted, by `har` handle, with a
149
+ compact summary.
150
+ - **`browser_list_flows`** / **`browser_run_flow`** — list the persisted `.bru`
151
+ flows the operator made available (by name + step count) and replay one (by name)
152
+ on a session. Steps drive through the SAME gate (navigation allowlist + dry-run-vs-
153
+ execute) and redactor as the live step tools; `{{var}}` values are caller-supplied
154
+ (non-secret), `{{secret:NAME}}` resolves server-side (fail-closed, never echoed).
155
+ Operator-gated + deny-by-default (requires a `FLOWS_DIR`; the flow is named, never a
156
+ caller-supplied path). The human-CLI counterpart is `sackville browser run`.
157
+ - **Video capture** — with an operator `VIDEO_DIR` set, each session records a
158
+ `.webm`; `browser_close_session` finalizes it (written on context close) and
159
+ surfaces it by `video` handle. Operator-gated off by default — video is
160
+ unredactable pixels (same posture as the trace/screenshots); an optional size cap
161
+ (`VIDEO_WIDTH`/`VIDEO_HEIGHT`) bounds the frame size, the session wall-clock cap
162
+ bounds duration.
163
+ - Resource **`sackville://browser/run/{runId}/{kind}`** — fetch a stored artifact
164
+ (`snapshot-s<gen>` / `a11y-s<n>` / `screenshot-s<n>` / `trace` / `console` /
165
+ `network` / `har` / `video`) by handle; binary kinds (trace.zip, screenshot PNG,
166
+ HAR .zip, video webm) come back as a base64 blob. The password-equivalent
167
+ `storage-state` kind is **refused** (operator-path only).
168
+
169
+ **Safety (all operator-set via `SACKVILLE_BROWSER_*` env, never tool inputs):**
170
+ navigation/mutation deny-by-default (`ALLOW_UNSAFE`, `ALLOWED_HOSTS`); a **mandatory**
171
+ DNS-pinning SSRF proxy (loopback forced through it; `ALLOW_PRIVATE` opt-in);
172
+ service-workers blocked + WebRTC egress neutralized; JS dialogs dismissed by
173
+ default (`ALLOW_DIALOGS` to accept; each recorded, redacted, on the step result);
174
+ downloads cancelled unless an operator quarantine dir (`DOWNLOAD_DIR`) is set;
175
+ uploads confined to an operator allowlist dir (`UPLOAD_DIR`, denied when unset);
176
+ HAR capture off unless an operator output dir (`HAR_DIR`) is set + HAR replay off
177
+ unless a replay dir (`REPLAY_HAR_DIR`) is set, both deny-by-default; persisted-flow
178
+ replay off unless a flows dir (`FLOWS_DIR`) is set; video capture off unless a video
179
+ dir (`VIDEO_DIR`) is set; visual-regression compare off unless a baseline dir
180
+ (`BASELINE_DIR`) is set + baseline writes gated behind `ALLOW_BASELINE_UPDATE`; secret
181
+ redaction across every artifact + the trace.zip + the HAR; `{{secret:NAME}}` fill +
182
+ origin-scoped `httpCredentials` (`HTTP_USERNAME/PASSWORD/ORIGIN`); caps
183
+ `MAX_SESSIONS`/`SESSION_MS`/`MAX_PAGES`/
184
+ `IDLE_TTL_MS`; trace capture + `storageState` capture (`ALLOW_STORAGE_STATE`) +
185
+ screenshot capture (`ALLOW_SCREENSHOTS`) + vision/coordinate input (`ALLOW_VISION`)
186
+ all off unless explicitly enabled.
187
+
188
+ ## Run
189
+
190
+ ```bash
191
+ sackville-mcp <index.sqlite> # docs; or: SACKVILLE_INDEX=… sackville-mcp
192
+
193
+ # API testing — mutations dry-run unless explicitly unlocked:
194
+ sackville-api-mcp
195
+ SACKVILLE_ALLOW_UNSAFE=1 SACKVILLE_ALLOWED_HOSTS=api.example.com sackville-api-mcp
196
+
197
+ # Browser testing — deny-by-default; unlock + allowlist per operator policy:
198
+ SACKVILLE_BROWSER_ALLOWED_HOSTS=app.test,127.0.0.1 sackville-browser-mcp
199
+ ```
200
+
201
+ All three speak MCP over stdio.
202
+
203
+ ### Register with Claude Code
204
+
205
+ ```bash
206
+ claude mcp add sackville -- sackville-mcp /path/to/index.sqlite
207
+ claude mcp add sackville-api -- sackville-api-mcp
208
+ claude mcp add sackville-browser -- sackville-browser-mcp
209
+ ```
210
+
211
+ ## Token economy
212
+
213
+ Search returns summaries + resource links, not bodies; the agent fetches full
214
+ text only when it follows a link. This keeps results well under Claude Code's
215
+ ~10k-token warning threshold. See `ARCHITECTURE.md` §4.