@hover-dev/mcp 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE 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
95
+ Derivative 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 describing the origin of the Work and
141
+ 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 Hyperyond Studio
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/dist/mcp.js ADDED
@@ -0,0 +1,289 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/mcp.ts
4
+ import { chromium } from "playwright-core";
5
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
+ import {
7
+ launchDebugChrome,
8
+ writeSpec,
9
+ writeFact,
10
+ loadMemory,
11
+ formatMemoryForPrompt
12
+ } from "@hover-dev/core/engine";
13
+
14
+ // src/mcp/controller.ts
15
+ import { groundedLocate } from "@hover-dev/core/engine";
16
+ function describe(g) {
17
+ if (g.role && g.name) return `${g.role} "${g.name}"`;
18
+ if (g.testId) return `testId "${g.testId}"`;
19
+ if (g.text) return `text "${g.text}"`;
20
+ return "(no target)";
21
+ }
22
+ var HoverMcpController = class {
23
+ constructor(deps) {
24
+ this.deps = deps;
25
+ }
26
+ deps;
27
+ /** The grounded-action buffer — sliced by `crystallize`. */
28
+ steps = [];
29
+ push(tool, input) {
30
+ this.steps.push({ kind: "step", tool, input });
31
+ }
32
+ async resolve(g) {
33
+ const page = await this.deps.getPage();
34
+ const loc = groundedLocate(page, g);
35
+ if (!loc) throw new Error(`pass role+name (preferred), or testId, or text \u2014 taken from the snapshot`);
36
+ return loc;
37
+ }
38
+ async navigate(url) {
39
+ const page = await this.deps.getPage();
40
+ await page.goto(url, { waitUntil: "domcontentloaded", timeout: 2e4 });
41
+ this.push("browser_navigate", { url });
42
+ return `navigated to ${url}`;
43
+ }
44
+ /** ARIA snapshot of the page — the agent reads role+name from here. */
45
+ async snapshot() {
46
+ const page = await this.deps.getPage();
47
+ return await page.locator("body").ariaSnapshot();
48
+ }
49
+ async click(g) {
50
+ const loc = await this.resolve(g);
51
+ await loc.click({ timeout: 8e3 });
52
+ this.push("click_control", g);
53
+ return `\u2713 clicked ${describe(g)}`;
54
+ }
55
+ async fill(g, value) {
56
+ const loc = await this.resolve(g);
57
+ await loc.fill(value, { timeout: 8e3 });
58
+ this.push("fill_control", { ...g, value });
59
+ return `\u2713 filled ${describe(g)}`;
60
+ }
61
+ async select(g, value) {
62
+ const loc = await this.resolve(g);
63
+ await loc.selectOption(value, { timeout: 8e3 });
64
+ this.push("select_control", { ...g, value });
65
+ return `\u2713 selected ${value} in ${describe(g)}`;
66
+ }
67
+ async check(g, checked) {
68
+ const loc = await this.resolve(g);
69
+ if (checked) await loc.check({ timeout: 8e3 });
70
+ else await loc.uncheck({ timeout: 8e3 });
71
+ this.push("check_control", { ...g, checked });
72
+ return `\u2713 ${checked ? "checked" : "unchecked"} ${describe(g)}`;
73
+ }
74
+ async assertVisible(g) {
75
+ const loc = await this.resolve(g);
76
+ const visible = await loc.first().isVisible();
77
+ if (!visible) throw new Error(`${describe(g)} is not visible`);
78
+ this.push("assert_visible", { ...g, matcher: "visible" });
79
+ return `\u2713 ${describe(g)} is visible`;
80
+ }
81
+ /** Recall what earlier runs learned about this app's business rules. */
82
+ async recall() {
83
+ if (!this.deps.recall) return "No business memory available.";
84
+ const known = await this.deps.recall();
85
+ return known || "No business knowledge recorded yet for this app.";
86
+ }
87
+ /** Persist a confirmed business RULE so future runs don't re-ask it. Rules
88
+ * only — never secrets / credentials / PII. */
89
+ async recordFact(title, rule, type = "business-rule") {
90
+ if (!this.deps.recordFact) return "Memory channel unavailable; continuing.";
91
+ const res = await this.deps.recordFact(title, rule, type);
92
+ return "error" in res ? `\u2717 could not save fact: ${res.error}` : `\u2713 remembered: ${title}`;
93
+ }
94
+ /** Crystallize the buffered flow → a plain Playwright spec, then clear the
95
+ * buffer for the next flow. */
96
+ async crystallize(name, description) {
97
+ if (this.steps.length === 0) return "Nothing to crystallize yet \u2014 actuate some controls first.";
98
+ const flow = [...this.steps];
99
+ const { path } = await this.deps.crystallize(name, description, flow);
100
+ this.steps.length = 0;
101
+ return `\u2713 wrote ${path} (${flow.length} step${flow.length === 1 ? "" : "s"})`;
102
+ }
103
+ };
104
+
105
+ // src/mcp/server.ts
106
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
107
+ import { z } from "zod";
108
+ var md = (text) => ({ content: [{ type: "text", text }] });
109
+ var errLine = (e) => e instanceof Error ? e.message.split("\n")[0] : String(e);
110
+ var GROUND = {
111
+ role: z.string().optional().describe("ARIA role from the snapshot, e.g. 'button', 'textbox', 'link'. Pair with `name`."),
112
+ name: z.string().optional().describe("Accessible name from the snapshot, exactly as shown. Pair with `role`."),
113
+ testId: z.string().optional().describe("A data-testid, if the element has one and no clean role+name."),
114
+ text: z.string().optional().describe("Real visible text on the element \u2014 last resort."),
115
+ within: z.object({ role: z.string(), name: z.string() }).optional().describe("Scope the search to a container first (role+name) when a label repeats across groups.")
116
+ };
117
+ function createHoverMcpServer(c) {
118
+ const server2 = new McpServer({ name: "hover", version: "0.1.0" });
119
+ const guard = (fn) => fn().then(md, (e) => md(`\u2717 ${errLine(e)}`));
120
+ server2.registerTool(
121
+ "browser_navigate",
122
+ { description: "Open a URL in the app under test (the debug Chrome).", inputSchema: { url: z.string() } },
123
+ ({ url }) => guard(() => c.navigate(url))
124
+ );
125
+ server2.registerTool(
126
+ "browser_snapshot",
127
+ {
128
+ description: "Read the current page as an ARIA snapshot (role + accessible-name tree). Call this BEFORE actuating to get the exact role+name to pass to the *_control tools.",
129
+ inputSchema: {}
130
+ },
131
+ () => guard(() => c.snapshot())
132
+ );
133
+ server2.registerTool(
134
+ "click_control",
135
+ {
136
+ description: "Click a control by a GROUNDED target read off the snapshot (role+name preferred \u2192 testId \u2192 text). Grounded so the saved spec replays exactly what you did.",
137
+ inputSchema: GROUND
138
+ },
139
+ (g) => guard(() => c.click(g))
140
+ );
141
+ server2.registerTool(
142
+ "fill_control",
143
+ { description: "Type a value into a textbox/field by a grounded target.", inputSchema: { ...GROUND, value: z.string() } },
144
+ ({ value, ...g }) => guard(() => c.fill(g, value))
145
+ );
146
+ server2.registerTool(
147
+ "select_control",
148
+ { description: "Choose an option in a <select> by a grounded target.", inputSchema: { ...GROUND, value: z.string() } },
149
+ ({ value, ...g }) => guard(() => c.select(g, value))
150
+ );
151
+ server2.registerTool(
152
+ "check_control",
153
+ {
154
+ description: "Check or uncheck a checkbox/radio by a grounded target (handles sr-only / hidden inputs).",
155
+ inputSchema: { ...GROUND, checked: z.boolean().optional().describe("true (default) = check; false = uncheck.") }
156
+ },
157
+ ({ checked, ...g }) => guard(() => c.check(g, checked !== false))
158
+ );
159
+ server2.registerTool(
160
+ "assert_visible",
161
+ {
162
+ description: "Assert a control/text is visible now \u2014 captures an expect(...).toBeVisible() into the saved spec.",
163
+ inputSchema: GROUND
164
+ },
165
+ (g) => guard(() => c.assertVisible(g))
166
+ );
167
+ server2.registerTool(
168
+ "recall_business_knowledge",
169
+ {
170
+ description: "Recall what earlier Hover runs learned about this app (business rules, expected behaviors, access policies). Call this at the START so you do not re-ask settled questions. Treat what it returns as ground truth.",
171
+ inputSchema: {}
172
+ },
173
+ () => guard(() => c.recall())
174
+ );
175
+ server2.registerTool(
176
+ "record_fact",
177
+ {
178
+ description: "Remember a durable BUSINESS RULE about this app so neither you nor a future run re-asks it \u2014 e.g. an expected behavior, a validation rule, an access policy, or the answer to a 'bug or by-design?' the user just confirmed. State it as a clean self-contained rule. RULES ONLY \u2014 never store secrets, passwords, tokens, or personal data.",
179
+ inputSchema: {
180
+ title: z.string().describe("Short title for the rule (becomes its memory filename + index entry)."),
181
+ rule: z.string().describe("The rule itself, stated clearly and self-contained (no secrets/PII)."),
182
+ type: z.enum(["business-rule", "expected-behavior", "validation", "access-policy"]).optional().describe("What kind of knowledge this is. Defaults to business-rule.")
183
+ }
184
+ },
185
+ ({ title, rule, type }) => guard(() => c.recordFact(title, rule, type ?? "business-rule"))
186
+ );
187
+ server2.registerTool(
188
+ "crystallize_spec",
189
+ {
190
+ description: 'Save the flow you JUST performed (the grounded click/fill/select/check/assert actions since the last crystallize) as a plain Playwright .spec.ts in __vibe_tests__/. Call it the moment you finish a coherent end-to-end flow. Name it in English, imperative (e.g. "Log in").',
191
+ inputSchema: {
192
+ name: z.string().describe("Short imperative flow name in English \u2014 becomes the spec filename + test name."),
193
+ description: z.string().optional().describe("One line on what this flow verifies.")
194
+ }
195
+ },
196
+ ({ name, description }) => guard(() => c.crystallize(name, description))
197
+ );
198
+ server2.registerPrompt(
199
+ "test_app",
200
+ {
201
+ title: "Hover \u2014 map & crystallize a test suite",
202
+ description: "Map this app's business lines and crystallize a Playwright suite (incremental, scales to large apps).",
203
+ argsSchema: { scope: z.string().optional().describe("An area/flow to focus on. Omit to cover the whole app.") }
204
+ },
205
+ ({ scope }) => ({
206
+ messages: [{ role: "user", content: { type: "text", text: workflowPrompt(scope) } }]
207
+ })
208
+ );
209
+ return server2;
210
+ }
211
+ function workflowPrompt(scope) {
212
+ const target = scope?.trim() ? scope.trim() : "the whole app";
213
+ return `Build (or extend) a Playwright test suite for this web app using the **Hover MCP tools**.
214
+ Drive the browser ONLY through these tools \u2014 they actuate via grounded selectors
215
+ (role+name \u2192 testId \u2192 text), so every spec you save replays EXACTLY what you did
216
+ (record==replay). Never write spec files yourself; only \`crystallize_spec\` does.
217
+
218
+ Tools: \`recall_business_knowledge\` \xB7 \`browser_navigate\` \xB7 \`browser_snapshot\` (ARIA
219
+ tree \u2014 read before acting) \xB7 \`click_control\` / \`fill_control\` / \`select_control\` /
220
+ \`check_control\` (grounded target from the snapshot) \xB7 \`assert_visible\` \xB7
221
+ \`record_fact\` \xB7 \`crystallize_spec(name, description?)\`.
222
+
223
+ Target: the app at HOVER_TARGET (set in the server's env). Scope: ${target}.
224
+
225
+ Work in PHASES \u2014 this is what lets it scale from a tiny app to a large one.
226
+
227
+ ## Phase 1 \u2014 Map the business lines (read the CODE, don't click around)
228
+ - FIRST call \`recall_business_knowledge\` \u2014 rules earlier runs learned (and read \`.hover/hover-map.md\` if it exists, the running map; CONTINUE it, don't start over). Treat both as ground truth; don't re-ask what they already answer.
229
+ - Use YOUR OWN file tools (read / grep / glob) to find the app's ROUTES + navigation: the router config, route/page files, the nav components. Enumerate the user-facing BUSINESS LINES (a coherent task a user performs), each with its entry route, grouped by area. Reading code is cheaper + more complete than clicking around, and finds areas behind auth / nav you'd otherwise miss.
230
+ - Write/update \`.hover/hover-map.md\` as a checklist (4-space indent = a code block):
231
+
232
+ # Business map \u2014 <app>
233
+ ## Auth
234
+ - [ ] Log in \u2014 /login
235
+ - [x] Checkout \u2014 /checkout \u2014 checkout.spec.ts
236
+
237
+ - Don't test yet. For a large app, this map IS the plan.
238
+
239
+ ## Phase 2 \u2014 Pick the scope
240
+ - If a scope was given, cover that. Otherwise show the uncovered lines and ask which to cover now (offer "all uncovered"). For a small app, just cover them all.
241
+
242
+ ## Phase 3 \u2014 Cover each chosen line, ONE AT A TIME
243
+ For each line: \`browser_navigate\` to its route \u2192 \`browser_snapshot\` \u2192 EXERCISE the real flow (click / fill / select / check \u2014 you are a tester, never just describe the page) \u2192 \`assert_visible\` on the OUTCOME (a success message, the new row, the next screen) \u2192 \`crystallize_spec("<short imperative English name>")\`. Crystallize the MOMENT each flow is done, before the next \u2014 the buffer is per-flow. The tools share ONE browser, so cover lines SEQUENTIALLY.
244
+
245
+ ## Phase 4 \u2014 Update coverage
246
+ - Mark each covered line \`[x]\` in \`.hover/hover-map.md\` with its spec filename. Report covered vs still-open. A LARGE app doesn't have to finish in one go \u2014 covering a batch + updating the map is a complete, resumable unit; re-invoke to continue the uncovered lines.
247
+
248
+ ## Understand the business \u2014 ASK, then REMEMBER
249
+ When you genuinely can't resolve something on your own \u2014 is this a bug or by-design? which flows matter? what does this domain term mean? \u2014 ASK the user (don't guess, don't stop). When they confirm a durable business RULE, call \`record_fact\` to persist it (RULES ONLY \u2014 never credentials/secrets/PII). Also ASK when blocked on something only they can provide (login credentials, a file). Stay on the app under test \u2014 never navigate to external origins.`;
250
+ }
251
+
252
+ // src/mcp.ts
253
+ var TARGET = process.env.HOVER_TARGET || "http://localhost:5173";
254
+ var PORT = Number(process.env.HOVER_CDP_PORT || 9222);
255
+ var DEV_ROOT = process.env.HOVER_PROJECT_ROOT || process.cwd();
256
+ var CDP_URL = `http://localhost:${PORT}`;
257
+ var originOf = (u) => {
258
+ try {
259
+ return new URL(u).origin;
260
+ } catch {
261
+ return null;
262
+ }
263
+ };
264
+ var browser = null;
265
+ async function getPage() {
266
+ if (!browser || !browser.isConnected()) {
267
+ await launchDebugChrome({ port: PORT, url: TARGET });
268
+ browser = await chromium.connectOverCDP(CDP_URL, { timeout: 8e3 });
269
+ }
270
+ const pages = browser.contexts().flatMap((ctx2) => ctx2.pages());
271
+ const want = originOf(TARGET);
272
+ const match = want ? pages.find((p) => originOf(p.url()) === want) : void 0;
273
+ if (match) return match;
274
+ if (pages.length) return pages[pages.length - 1];
275
+ const ctx = browser.contexts()[0] ?? await browser.newContext();
276
+ return ctx.newPage();
277
+ }
278
+ var controller = new HoverMcpController({
279
+ getPage,
280
+ crystallize: async (name, description, steps) => {
281
+ const res = await writeSpec({ devRoot: DEV_ROOT, name, description, steps, startUrl: TARGET, overwrite: true });
282
+ return { path: res.path };
283
+ },
284
+ recordFact: (title, rule, type) => writeFact(DEV_ROOT, { name: title, description: title, type, body: rule }),
285
+ recall: async () => formatMemoryForPrompt(await loadMemory(DEV_ROOT))
286
+ });
287
+ var server = createHoverMcpServer(controller);
288
+ await server.connect(new StdioServerTransport());
289
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/mcp.ts","../src/mcp/controller.ts","../src/mcp/server.ts"],"sourcesContent":["import { chromium, type Browser, type Page } from 'playwright-core';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport {\n launchDebugChrome,\n writeSpec,\n writeFact,\n loadMemory,\n formatMemoryForPrompt,\n type SkillStep,\n} from '@hover-dev/core/engine';\nimport { HoverMcpController } from './mcp/controller.js';\nimport { createHoverMcpServer } from './mcp/server.js';\n\n/*\n * `hover-mcp` — the MCP-first surface. Add it to your OWN agent (Claude Code,\n * Cursor, …); the agent drives the app through Hover's grounded tools and calls\n * crystallize_spec to save a plain Playwright spec. Hover spawns no agent here —\n * the calling agent IS the intelligence; Hover guarantees record==replay at the\n * output. Config via env: HOVER_TARGET, HOVER_CDP_PORT, HOVER_PROJECT_ROOT.\n *\n * NOTE: stdio is the MCP transport — never write to stdout from this process.\n */\n\nconst TARGET = process.env.HOVER_TARGET || 'http://localhost:5173';\nconst PORT = Number(process.env.HOVER_CDP_PORT || 9222);\nconst DEV_ROOT = process.env.HOVER_PROJECT_ROOT || process.cwd();\nconst CDP_URL = `http://localhost:${PORT}`;\n\nconst originOf = (u: string): string | null => {\n try {\n return new URL(u).origin;\n } catch {\n return null;\n }\n};\n\nlet browser: Browser | null = null;\n\n/** Launch/connect the debug Chrome lazily and return the page on the app. */\nasync function getPage(): Promise<Page> {\n if (!browser || !browser.isConnected()) {\n await launchDebugChrome({ port: PORT, url: TARGET });\n browser = await chromium.connectOverCDP(CDP_URL, { timeout: 8000 });\n }\n const pages = browser.contexts().flatMap((ctx) => ctx.pages());\n const want = originOf(TARGET);\n const match = want ? pages.find((p) => originOf(p.url()) === want) : undefined;\n if (match) return match;\n if (pages.length) return pages[pages.length - 1];\n const ctx = browser.contexts()[0] ?? (await browser.newContext());\n return ctx.newPage();\n}\n\nconst controller = new HoverMcpController({\n getPage,\n crystallize: async (name: string, description: string | undefined, steps: SkillStep[]) => {\n const res = await writeSpec({ devRoot: DEV_ROOT, name, description, steps, startUrl: TARGET, overwrite: true });\n return { path: res.path };\n },\n recordFact: (title, rule, type) =>\n writeFact(DEV_ROOT, { name: title, description: title, type, body: rule }),\n recall: async () => formatMemoryForPrompt(await loadMemory(DEV_ROOT)),\n});\n\nconst server = createHoverMcpServer(controller);\nawait server.connect(new StdioServerTransport());\n","import type { Page } from 'playwright-core';\nimport { groundedLocate, type GroundedTarget, type SkillStep } from '@hover-dev/core/engine';\n\n/*\n * The hover-mcp engine, decoupled from the MCP wire layer so it's testable with\n * a mock Page. The user's OWN agent (Claude Code / Cursor) calls these via MCP:\n * it reads the page (snapshot), actuates with GROUNDED targets (role+name →\n * testId → text), and Hover buffers each successful actuation as a SkillStep.\n * `crystallize` turns the buffer into a plain Playwright spec — record==replay,\n * because the buffered selectors ARE the ones that drove the page.\n */\n\nexport type FactType = 'business-rule' | 'expected-behavior' | 'validation' | 'access-policy';\n\nexport interface McpDeps {\n /** Resolve the live page on the app under test (launch/connect lazily). */\n getPage: () => Promise<Page>;\n /** Write the buffered steps to a spec; returns the written path. */\n crystallize: (name: string, description: string | undefined, steps: SkillStep[]) => Promise<{ path: string }>;\n /** Persist a learned business rule to .hover/memory/ (rules only — no secrets). */\n recordFact?: (title: string, rule: string, type: FactType) => Promise<{ path: string } | { error: string }>;\n /** Recall known business knowledge from .hover/memory/ as a prompt block ('' if none). */\n recall?: () => Promise<string>;\n}\n\nfunction describe(g: GroundedTarget): string {\n if (g.role && g.name) return `${g.role} \"${g.name}\"`;\n if (g.testId) return `testId \"${g.testId}\"`;\n if (g.text) return `text \"${g.text}\"`;\n return '(no target)';\n}\n\nexport class HoverMcpController {\n /** The grounded-action buffer — sliced by `crystallize`. */\n readonly steps: SkillStep[] = [];\n\n constructor(private readonly deps: McpDeps) {}\n\n private push(tool: string, input: unknown): void {\n this.steps.push({ kind: 'step', tool, input });\n }\n\n private async resolve(g: GroundedTarget) {\n const page = await this.deps.getPage();\n const loc = groundedLocate(page, g);\n if (!loc) throw new Error(`pass role+name (preferred), or testId, or text — taken from the snapshot`);\n return loc;\n }\n\n async navigate(url: string): Promise<string> {\n const page = await this.deps.getPage();\n await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 20000 });\n this.push('browser_navigate', { url });\n return `navigated to ${url}`;\n }\n\n /** ARIA snapshot of the page — the agent reads role+name from here. */\n async snapshot(): Promise<string> {\n const page = await this.deps.getPage();\n return await page.locator('body').ariaSnapshot();\n }\n\n async click(g: GroundedTarget): Promise<string> {\n const loc = await this.resolve(g);\n await loc.click({ timeout: 8000 });\n this.push('click_control', g);\n return `✓ clicked ${describe(g)}`;\n }\n\n async fill(g: GroundedTarget, value: string): Promise<string> {\n const loc = await this.resolve(g);\n await loc.fill(value, { timeout: 8000 });\n this.push('fill_control', { ...g, value });\n return `✓ filled ${describe(g)}`;\n }\n\n async select(g: GroundedTarget, value: string): Promise<string> {\n const loc = await this.resolve(g);\n await loc.selectOption(value, { timeout: 8000 });\n this.push('select_control', { ...g, value });\n return `✓ selected ${value} in ${describe(g)}`;\n }\n\n async check(g: GroundedTarget, checked: boolean): Promise<string> {\n const loc = await this.resolve(g);\n if (checked) await loc.check({ timeout: 8000 });\n else await loc.uncheck({ timeout: 8000 });\n this.push('check_control', { ...g, checked });\n return `✓ ${checked ? 'checked' : 'unchecked'} ${describe(g)}`;\n }\n\n async assertVisible(g: GroundedTarget): Promise<string> {\n const loc = await this.resolve(g);\n const visible = await loc.first().isVisible();\n if (!visible) throw new Error(`${describe(g)} is not visible`);\n this.push('assert_visible', { ...g, matcher: 'visible' });\n return `✓ ${describe(g)} is visible`;\n }\n\n /** Recall what earlier runs learned about this app's business rules. */\n async recall(): Promise<string> {\n if (!this.deps.recall) return 'No business memory available.';\n const known = await this.deps.recall();\n return known || 'No business knowledge recorded yet for this app.';\n }\n\n /** Persist a confirmed business RULE so future runs don't re-ask it. Rules\n * only — never secrets / credentials / PII. */\n async recordFact(title: string, rule: string, type: FactType = 'business-rule'): Promise<string> {\n if (!this.deps.recordFact) return 'Memory channel unavailable; continuing.';\n const res = await this.deps.recordFact(title, rule, type);\n return 'error' in res ? `✗ could not save fact: ${res.error}` : `✓ remembered: ${title}`;\n }\n\n /** Crystallize the buffered flow → a plain Playwright spec, then clear the\n * buffer for the next flow. */\n async crystallize(name: string, description?: string): Promise<string> {\n if (this.steps.length === 0) return 'Nothing to crystallize yet — actuate some controls first.';\n const flow = [...this.steps];\n const { path } = await this.deps.crystallize(name, description, flow);\n this.steps.length = 0;\n return `✓ wrote ${path} (${flow.length} step${flow.length === 1 ? '' : 's'})`;\n }\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\nimport type { HoverMcpController } from './controller.js';\n\n/* Wrap the controller as an MCP server. Tool names + the GROUNDED target shape\n * mirror Hover's control MCP so an agent that knows one knows the other. Every\n * handler returns text (✓/✗) and never throws — a failed locate/action becomes\n * a ✗ message the calling agent can react to, not an MCP transport error. */\n\nconst md = (text: string) => ({ content: [{ type: 'text' as const, text }] });\nconst errLine = (e: unknown) => (e instanceof Error ? e.message.split('\\n')[0] : String(e));\n\nconst GROUND = {\n role: z.string().optional().describe(\"ARIA role from the snapshot, e.g. 'button', 'textbox', 'link'. Pair with `name`.\"),\n name: z.string().optional().describe('Accessible name from the snapshot, exactly as shown. Pair with `role`.'),\n testId: z.string().optional().describe('A data-testid, if the element has one and no clean role+name.'),\n text: z.string().optional().describe('Real visible text on the element — last resort.'),\n within: z\n .object({ role: z.string(), name: z.string() })\n .optional()\n .describe('Scope the search to a container first (role+name) when a label repeats across groups.'),\n};\n\nexport function createHoverMcpServer(c: HoverMcpController): McpServer {\n const server = new McpServer({ name: 'hover', version: '0.1.0' });\n const guard = (fn: () => Promise<string>) => fn().then(md, (e) => md(`✗ ${errLine(e)}`));\n\n server.registerTool(\n 'browser_navigate',\n { description: 'Open a URL in the app under test (the debug Chrome).', inputSchema: { url: z.string() } },\n ({ url }) => guard(() => c.navigate(url)),\n );\n\n server.registerTool(\n 'browser_snapshot',\n {\n description:\n 'Read the current page as an ARIA snapshot (role + accessible-name tree). Call this BEFORE actuating to get the exact role+name to pass to the *_control tools.',\n inputSchema: {},\n },\n () => guard(() => c.snapshot()),\n );\n\n server.registerTool(\n 'click_control',\n {\n description:\n 'Click a control by a GROUNDED target read off the snapshot (role+name preferred → testId → text). Grounded so the saved spec replays exactly what you did.',\n inputSchema: GROUND,\n },\n (g) => guard(() => c.click(g)),\n );\n\n server.registerTool(\n 'fill_control',\n { description: 'Type a value into a textbox/field by a grounded target.', inputSchema: { ...GROUND, value: z.string() } },\n ({ value, ...g }) => guard(() => c.fill(g, value)),\n );\n\n server.registerTool(\n 'select_control',\n { description: 'Choose an option in a <select> by a grounded target.', inputSchema: { ...GROUND, value: z.string() } },\n ({ value, ...g }) => guard(() => c.select(g, value)),\n );\n\n server.registerTool(\n 'check_control',\n {\n description: 'Check or uncheck a checkbox/radio by a grounded target (handles sr-only / hidden inputs).',\n inputSchema: { ...GROUND, checked: z.boolean().optional().describe('true (default) = check; false = uncheck.') },\n },\n ({ checked, ...g }) => guard(() => c.check(g, checked !== false)),\n );\n\n server.registerTool(\n 'assert_visible',\n {\n description: 'Assert a control/text is visible now — captures an expect(...).toBeVisible() into the saved spec.',\n inputSchema: GROUND,\n },\n (g) => guard(() => c.assertVisible(g)),\n );\n\n server.registerTool(\n 'recall_business_knowledge',\n {\n description:\n 'Recall what earlier Hover runs learned about this app (business rules, expected behaviors, access policies). Call this at the START so you do not re-ask settled questions. Treat what it returns as ground truth.',\n inputSchema: {},\n },\n () => guard(() => c.recall()),\n );\n\n server.registerTool(\n 'record_fact',\n {\n description:\n \"Remember a durable BUSINESS RULE about this app so neither you nor a future run re-asks it — e.g. an expected behavior, a validation rule, an access policy, or the answer to a 'bug or by-design?' the user just confirmed. State it as a clean self-contained rule. RULES ONLY — never store secrets, passwords, tokens, or personal data.\",\n inputSchema: {\n title: z.string().describe('Short title for the rule (becomes its memory filename + index entry).'),\n rule: z.string().describe('The rule itself, stated clearly and self-contained (no secrets/PII).'),\n type: z\n .enum(['business-rule', 'expected-behavior', 'validation', 'access-policy'])\n .optional()\n .describe('What kind of knowledge this is. Defaults to business-rule.'),\n },\n },\n ({ title, rule, type }) => guard(() => c.recordFact(title, rule, type ?? 'business-rule')),\n );\n\n server.registerTool(\n 'crystallize_spec',\n {\n description:\n 'Save the flow you JUST performed (the grounded click/fill/select/check/assert actions since the last crystallize) as a plain Playwright .spec.ts in __vibe_tests__/. Call it the moment you finish a coherent end-to-end flow. Name it in English, imperative (e.g. \"Log in\").',\n inputSchema: {\n name: z.string().describe('Short imperative flow name in English — becomes the spec filename + test name.'),\n description: z.string().optional().describe('One line on what this flow verifies.'),\n },\n },\n ({ name, description }) => guard(() => c.crystallize(name, description)),\n );\n\n // The workflow ships WITH the server as an MCP prompt — Claude Code surfaces\n // it as `/mcp__hover__test_app`, so adding the server brings both the tools\n // AND the command. No project scaffolding needed.\n server.registerPrompt(\n 'test_app',\n {\n title: 'Hover — map & crystallize a test suite',\n description: 'Map this app\\'s business lines and crystallize a Playwright suite (incremental, scales to large apps).',\n argsSchema: { scope: z.string().optional().describe('An area/flow to focus on. Omit to cover the whole app.') },\n },\n ({ scope }) => ({\n messages: [{ role: 'user', content: { type: 'text', text: workflowPrompt(scope) } }],\n }),\n );\n\n return server;\n}\n\n/** The phased, scale-aware workflow, delivered as the prompt body. Mirrors the\n * hover-mcp tool surface; the agent's own file tools do the code-reading. */\nfunction workflowPrompt(scope?: string): string {\n const target = scope?.trim() ? scope.trim() : 'the whole app';\n return `Build (or extend) a Playwright test suite for this web app using the **Hover MCP tools**.\nDrive the browser ONLY through these tools — they actuate via grounded selectors\n(role+name → testId → text), so every spec you save replays EXACTLY what you did\n(record==replay). Never write spec files yourself; only \\`crystallize_spec\\` does.\n\nTools: \\`recall_business_knowledge\\` · \\`browser_navigate\\` · \\`browser_snapshot\\` (ARIA\ntree — read before acting) · \\`click_control\\` / \\`fill_control\\` / \\`select_control\\` /\n\\`check_control\\` (grounded target from the snapshot) · \\`assert_visible\\` ·\n\\`record_fact\\` · \\`crystallize_spec(name, description?)\\`.\n\nTarget: the app at HOVER_TARGET (set in the server's env). Scope: ${target}.\n\nWork in PHASES — this is what lets it scale from a tiny app to a large one.\n\n## Phase 1 — Map the business lines (read the CODE, don't click around)\n- FIRST call \\`recall_business_knowledge\\` — rules earlier runs learned (and read \\`.hover/hover-map.md\\` if it exists, the running map; CONTINUE it, don't start over). Treat both as ground truth; don't re-ask what they already answer.\n- Use YOUR OWN file tools (read / grep / glob) to find the app's ROUTES + navigation: the router config, route/page files, the nav components. Enumerate the user-facing BUSINESS LINES (a coherent task a user performs), each with its entry route, grouped by area. Reading code is cheaper + more complete than clicking around, and finds areas behind auth / nav you'd otherwise miss.\n- Write/update \\`.hover/hover-map.md\\` as a checklist (4-space indent = a code block):\n\n # Business map — <app>\n ## Auth\n - [ ] Log in — /login\n - [x] Checkout — /checkout — checkout.spec.ts\n\n- Don't test yet. For a large app, this map IS the plan.\n\n## Phase 2 — Pick the scope\n- If a scope was given, cover that. Otherwise show the uncovered lines and ask which to cover now (offer \"all uncovered\"). For a small app, just cover them all.\n\n## Phase 3 — Cover each chosen line, ONE AT A TIME\nFor each line: \\`browser_navigate\\` to its route → \\`browser_snapshot\\` → EXERCISE the real flow (click / fill / select / check — you are a tester, never just describe the page) → \\`assert_visible\\` on the OUTCOME (a success message, the new row, the next screen) → \\`crystallize_spec(\"<short imperative English name>\")\\`. Crystallize the MOMENT each flow is done, before the next — the buffer is per-flow. The tools share ONE browser, so cover lines SEQUENTIALLY.\n\n## Phase 4 — Update coverage\n- Mark each covered line \\`[x]\\` in \\`.hover/hover-map.md\\` with its spec filename. Report covered vs still-open. A LARGE app doesn't have to finish in one go — covering a batch + updating the map is a complete, resumable unit; re-invoke to continue the uncovered lines.\n\n## Understand the business — ASK, then REMEMBER\nWhen you genuinely can't resolve something on your own — is this a bug or by-design? which flows matter? what does this domain term mean? — ASK the user (don't guess, don't stop). When they confirm a durable business RULE, call \\`record_fact\\` to persist it (RULES ONLY — never credentials/secrets/PII). Also ASK when blocked on something only they can provide (login credentials, a file). Stay on the app under test — never navigate to external origins.`;\n}\n"],"mappings":";;;AAAA,SAAS,gBAAyC;AAClD,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;;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Q,SAAS,EAAE,QAAQ,CAACC,SAAQA,KAAI,MAAM,CAAC;AAC7D,QAAM,OAAO,SAAS,MAAM;AAC5B,QAAM,QAAQ,OAAO,MAAM,KAAK,CAAC,MAAM,SAAS,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI;AACrE,MAAI,MAAO,QAAO;AAClB,MAAI,MAAM,OAAQ,QAAO,MAAM,MAAM,SAAS,CAAC;AAC/C,QAAM,MAAM,QAAQ,SAAS,EAAE,CAAC,KAAM,MAAM,QAAQ,WAAW;AAC/D,SAAO,IAAI,QAAQ;AACrB;AAEA,IAAM,aAAa,IAAI,mBAAmB;AAAA,EACxC;AAAA,EACA,aAAa,OAAO,MAAc,aAAiC,UAAuB;AACxF,UAAM,MAAM,MAAM,UAAU,EAAE,SAAS,UAAU,MAAM,aAAa,OAAO,UAAU,QAAQ,WAAW,KAAK,CAAC;AAC9G,WAAO,EAAE,MAAM,IAAI,KAAK;AAAA,EAC1B;AAAA,EACA,YAAY,CAAC,OAAO,MAAM,SACxB,UAAU,UAAU,EAAE,MAAM,OAAO,aAAa,OAAO,MAAM,MAAM,KAAK,CAAC;AAAA,EAC3E,QAAQ,YAAY,sBAAsB,MAAM,WAAW,QAAQ,CAAC;AACtE,CAAC;AAED,IAAM,SAAS,qBAAqB,UAAU;AAC9C,MAAM,OAAO,QAAQ,IAAI,qBAAqB,CAAC;","names":["server","ctx"]}
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@hover-dev/mcp",
3
+ "version": "0.17.0",
4
+ "description": "Hover MCP server — grounded browser actuation + crystallize a Playwright suite, for your own coding agent",
5
+ "license": "Apache-2.0",
6
+ "author": "Hyperyond",
7
+ "homepage": "https://github.com/Hyperyond/Hover#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Hyperyond/Hover.git",
11
+ "directory": "packages/mcp"
12
+ },
13
+ "keywords": [
14
+ "hover",
15
+ "mcp",
16
+ "playwright",
17
+ "browser-testing",
18
+ "claude",
19
+ "model-context-protocol"
20
+ ],
21
+ "type": "module",
22
+ "publishConfig": {
23
+ "registry": "https://registry.npmjs.org",
24
+ "access": "public"
25
+ },
26
+ "bin": {
27
+ "hover-mcp": "./dist/mcp.js"
28
+ },
29
+ "files": [
30
+ "dist"
31
+ ],
32
+ "engines": {
33
+ "node": ">=20"
34
+ },
35
+ "dependencies": {
36
+ "@modelcontextprotocol/sdk": "^1.29.0",
37
+ "playwright-core": "^1.50.0",
38
+ "zod": "^4.4.3",
39
+ "@hover-dev/core": "0.17.0"
40
+ },
41
+ "devDependencies": {
42
+ "@types/node": "^22.0.0",
43
+ "tsup": "^8.0.0",
44
+ "typescript": "^5.9.0",
45
+ "vitest": "^3.0.0"
46
+ },
47
+ "scripts": {
48
+ "build": "tsup",
49
+ "dev": "tsup --watch",
50
+ "typecheck": "tsc --noEmit",
51
+ "test": "vitest run",
52
+ "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""
53
+ }
54
+ }