@viberaven/mcp 1.9.0 → 1.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.
package/README.md CHANGED
@@ -1,8 +1,43 @@
1
+ <img src="https://raw.githubusercontent.com/ohad6k/VibeRaven/main/assets/favicon.svg" alt="VibeRaven" width="40" height="40" />
2
+
1
3
  # @viberaven/mcp
2
4
 
3
- A deployed app can still lack Supabase row level security (RLS). This MCP server lets an agent inspect repository evidence, read tasks and recheck after fixes.
5
+ VibeRaven gives AI-built apps production context and checks across Supabase, Vercel, Stripe and the other providers they use, read from the repo, locally, before launch and after a change.
6
+
7
+ ```sh
8
+ npx -y @viberaven/mcp@1.10.0
9
+ ```
10
+
11
+ Configure this as a **stdio server** in your MCP client. Node 20+ for repository checks; Node 24+ with JSPI and an installed matching CLI with `@viberaven/sessions` for `race`.
12
+
13
+ ## Two users at once
14
+
15
+ `race` tests your app’s database with two users at once, on real PostgreSQL, without Docker, and replays exactly what broke. It runs on `@viberaven/sessions`: several real PostgreSQL 18.6 sessions in one PGlite WebAssembly instance.
16
+
17
+ ```sh
18
+ npx -y viberaven race --example
19
+ ```
20
+
21
+ Recorded output from the bundled example (elapsed time varies):
22
+
23
+ ```text
24
+ At most 2 bookings per event: 60 orders, 24 broken, 0 waiting; 1.495s total
25
+ read committed: 12/20 broken
26
+ repeatable read: 12/20 broken
27
+ serializable: 0/20 broken
28
+ First broken order 001101 (read committed); COMMIT A=true, B=true
29
+ Replay record is byte-identical, including PostgreSQL protocol bytes.
30
+ ```
31
+
32
+ 122 of 124 PostgreSQL isolation specs; hidden tests: 199/200 new orders and 1,500/1,500 real-app interleavings, with native PostgreSQL at 100% through the same judge; 80/80 exact replays; 0 leaks between sessions in 60 isolation cases. [Method and limitations](https://github.com/ohad6k/VibeRaven/blob/main/docs/race.md#frozen-engine-proof).
4
33
 
5
- Check AI-built Vercel + Supabase apps before launch/handoff, after migration/policy changes, or for production RLS, environment, database connection, service-role or Stripe webhook failures. Findings include permissive policies, browser-exposed service-role keys, environment-template drift and unsigned Stripe handlers.
34
+ [Engine](https://viberaven.dev/engine) · [Race reference](https://github.com/ohad6k/VibeRaven/blob/main/docs/race.md)
35
+
36
+ 1. Call `viberaven_check_readiness` for repository risks.
37
+ 2. Call `viberaven_race` for a reviewed two-user test. Use `example: true` to start with the bundled test.
38
+ 3. Fix, run again, and call `viberaven_race` with `from` (the complete report path) and `replay` (its `firstBroken` index) to confirm the broken order.
39
+
40
+ The hosted endpoint at `https://viberaven.dev/mcp` provides guidance; it cannot run your local repository or race runtime. [Agent setup](https://viberaven.dev/connect/mcp).
6
41
 
7
42
  ## Connect Your Host
8
43
 
@@ -47,6 +82,7 @@ Use `C:/projects/your-app` on Windows. Omitted `cwd` means the server startup di
47
82
 
48
83
  | Tool | CLI operation |
49
84
  | --- | --- |
85
+ | `viberaven_race` | Local `race --json`; optional `example: true`, or `from` plus integer `replay` |
50
86
  | `viberaven_check_readiness` | `check --json`: fresh check, summary and artifact paths |
51
87
  | `viberaven_rls_test` | Experimental `rls-test --json --matrix <path>`; optional `migrations` directory |
52
88
  | `viberaven_verify` | `check --json`: recheck after a batch of fixes |
@@ -65,9 +101,9 @@ Use `C:/projects/your-app` on Windows. Omitted `cwd` means the server startup di
65
101
 
66
102
  Responses contain `exit N`, CLI output and parseable JSON objects as structured content. Blocker exit 1 can be normal tool content.
67
103
 
68
- ### Optional local behavioral RLS test (local candidate)
104
+ ### Optional local behavioral RLS test (preview)
69
105
 
70
- After reviewing the intended access in a permissions matrix, a local candidate host that lists `viberaven_rls_test` can run:
106
+ After reviewing the intended access in a permissions matrix, a local host that lists `viberaven_rls_test` can run:
71
107
 
72
108
  ```json
73
109
  {"name":"viberaven_rls_test","arguments":{"cwd":"/absolute/path/to/app","matrix":"reviewed.permissions.json"}}
@@ -79,7 +115,7 @@ Completed RLS results keep the complete receipt in both compact JSON text and `s
79
115
 
80
116
  RLS calls stop after 300 seconds or 8 MiB of combined child output. A stopped run terminates the CLI and returns a tool error without a partial passing receipt.
81
117
 
82
- Use an already installed matching candidate CLI with optional `@electric-sql/pglite@0.5.8` next to it, configured for this local MCP host as described below. Installing PGlite only in the target project may not make it visible to the host CLI. The RLS route requires this installed CLI and never falls back to npx. Missing host setup returns setup guidance without spawning; missing PGlite returns the existing CLI guidance. The tool does not install dependencies, accept SQL/credentials or access a provider. Obtain normal user authorization before installing dependencies. The installed CLI fallback is `viberaven rls-test --matrix PATH --json`; this candidate tool is not assumed to exist in the published MCP version shown above.
118
+ Use an already installed matching candidate CLI with optional `@electric-sql/pglite@0.5.8` next to it, configured for this local MCP host as described below. Installing PGlite only in the target project may not make it visible to the host CLI. The RLS route requires this installed CLI and never falls back to npx. Missing host setup returns setup guidance without spawning; missing PGlite returns the existing CLI guidance. The tool does not install dependencies, accept SQL/credentials or access a provider. Obtain normal user authorization before installing dependencies. The installed CLI fallback is `viberaven rls-test --matrix PATH --json`; this candidate tool requires the matching local MCP and CLI, rather than an older published version.
83
119
 
84
120
  ## Work The Result
85
121
 
@@ -111,4 +147,8 @@ The [RLS comparison](https://ohad6k.github.io/VibeRaven/examples/proof/rls-compa
111
147
 
112
148
  For `viberaven_work_report`, standalone MCP resolves an already installed `@viberaven/cli/package.json` from the MCP installation, and requires its name and exact version to match the MCP candidate. Alternatively, set the host process environment `VIBERAVEN_CLI_PATH` to an absolute matching `dist/cli.js` path. This is an operator-controlled local-candidate setting, not a tool argument. Keep the CLI installation outside the task repository. A regular canonical CLI entry and adjacent manifest are validated before execution.
113
149
 
114
- Report runs Node directly with `shell: false`, strips Node/npm environment steering and never invokes npm, npx, package installation or registry fallback. Install/configure the matching candidate separately; reporting fails until it is available. Missing/mismatched installations, process failures, malformed results, output over the bounded transport budget and the 30-second read timeout return a generic error without raw child diagnostics or local paths. Standalone MCP tools other than RLS tests and reports use the same installation validation and direct Node execution when a matching host CLI is available; otherwise they retain exact-version pinned npx fallback. An explicitly invalid `VIBERAVEN_CLI_PATH` fails without fallback. Task-local packages and symlinked entries are not trusted. Transport failures and missing/malformed JSON on JSON routes set MCP `isError`; completed checks with findings remain normal structured content. The source-level embedded MCP compatibility handler uses its own CLI entry with the same shared bounded report runner. It has parity/regression tests but is not exposed as a second installed CLI server entrypoint; the executable MCP route is `@viberaven/mcp`.
150
+ Report runs Node directly with `shell: false`, strips Node/npm environment steering and never invokes npm, npx, package installation or registry fallback. Install/configure the matching candidate separately; reporting fails until it is available. Missing/mismatched installations, process failures, malformed results, output over the bounded transport budget and the 30-second read timeout return a generic error without raw child diagnostics or local paths. Standalone MCP tools other than race, RLS tests and reports use the same installation validation and direct Node execution when a matching host CLI is available; otherwise they retain exact-version pinned npx fallback. An explicitly invalid `VIBERAVEN_CLI_PATH` fails without fallback. Task-local packages and symlinked entries are not trusted. Transport failures and missing/malformed JSON on JSON routes set MCP `isError`; completed checks with findings remain normal structured content. The source-level embedded MCP compatibility handler uses its own CLI entry with the same shared bounded report runner. It has parity/regression tests but is not exposed as a second installed CLI server entrypoint; the executable MCP route is `@viberaven/mcp`.
151
+
152
+ ## Third-party notices
153
+
154
+ See the included `THIRD_PARTY_NOTICES` for bundled-code attribution and the separately installed MCP SDK dependency.
@@ -0,0 +1,60 @@
1
+ THIRD-PARTY NOTICES — mcp 1.10.0
2
+
3
+ VibeRaven-owned code is licensed under MIT; see LICENSE.
4
+ Only generated esbuild helpers are bundled third-party code. @modelcontextprotocol/sdk
5
+ is an external npm dependency, not bundled; its license is also retained below. Its
6
+ separately installed transitive dependencies retain their own packaged licenses.
7
+
8
+ ==============================================================================
9
+ esbuild 0.25.12 (LICENSE.md)
10
+ License: MIT
11
+ ==============================================================================
12
+
13
+ MIT License
14
+
15
+ Copyright (c) 2020 Evan Wallace
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ of this software and associated documentation files (the "Software"), to deal
19
+ in the Software without restriction, including without limitation the rights
20
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ copies of the Software, and to permit persons to whom the Software is
22
+ furnished to do so, subject to the following conditions:
23
+
24
+ The above copyright notice and this permission notice shall be included in all
25
+ copies or substantial portions of the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ SOFTWARE.
34
+
35
+ ==============================================================================
36
+ @modelcontextprotocol/sdk 1.29.0 (LICENSE)
37
+ License: MIT
38
+ ==============================================================================
39
+
40
+ MIT License
41
+
42
+ Copyright (c) 2024 Anthropic, PBC
43
+
44
+ Permission is hereby granted, free of charge, to any person obtaining a copy
45
+ of this software and associated documentation files (the "Software"), to deal
46
+ in the Software without restriction, including without limitation the rights
47
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
48
+ copies of the Software, and to permit persons to whom the Software is
49
+ furnished to do so, subject to the following conditions:
50
+
51
+ The above copyright notice and this permission notice shall be included in all
52
+ copies or substantial portions of the Software.
53
+
54
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
55
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
56
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
57
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
58
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
59
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
60
+ SOFTWARE.
Binary file
@@ -362,7 +362,7 @@ var schemaPattern = "^(?!pg_)(?!(?:auth|storage|vault|information_schema)$)[a-z]
362
362
  var LIVE_TOOLS = [
363
363
  {
364
364
  name: "viberaven_live_start",
365
- description: "Local candidate feature: save a scoped metadata-verification request without provider reads or payment. Supabase catalog reads require a VibeRaven account and explicit human consent on resume. Vercel is deliberately blocked before network access. Local repository checks stay free without an account. Never pass credentials as tool arguments.",
365
+ description: "Preview feature: save a scoped metadata-verification request without provider reads or payment. Supabase catalog reads require a VibeRaven account and explicit human consent on resume. Vercel is deliberately blocked before network access. Local repository checks stay free without an account. Never pass credentials as tool arguments.",
366
366
  inputSchema: {
367
367
  type: "object",
368
368
  properties: {
@@ -382,17 +382,17 @@ var LIVE_TOOLS = [
382
382
  },
383
383
  {
384
384
  name: "viberaven_live_resume",
385
- description: "Local candidate feature: resume the SAME saved live step through account connection, allowance and metadata verification. Set approvedRead=true only after the person explicitly approves the named Supabase project/schema catalog read. Show any returned action URL and wait for the person; never approve sign-in or payment for them. Credentials stay local and are never tool arguments. Vercel stays blocked; local checks stay free.",
385
+ description: "Preview feature: resume the SAME saved live step through account connection, allowance and metadata verification. Set approvedRead=true only after the person explicitly approves the named Supabase project/schema catalog read. Show any returned action URL and wait for the person; never approve sign-in or payment for them. Credentials stay local and are never tool arguments. Vercel stays blocked; local checks stay free.",
386
386
  inputSchema: { type: "object", properties: { cwd: cwd2, stepId, approvedRead: { type: "boolean", description: "True only after explicit human approval of this saved provider/project/schema read." } }, required: ["stepId"], additionalProperties: false }
387
387
  },
388
388
  {
389
389
  name: "viberaven_live_status",
390
- description: "Local candidate feature: read the saved live-step receipt without provider reads, payment or another live-step charge. Evidence is historical and scoped, not proof of application security. Local checks stay free.",
390
+ description: "Preview feature: read the saved live-step receipt without provider reads, payment or another live-step charge. Evidence is historical and scoped, not proof of application security. Local checks stay free.",
391
391
  inputSchema: { type: "object", properties: { cwd: cwd2, stepId }, required: ["stepId"], additionalProperties: false }
392
392
  },
393
393
  {
394
394
  name: "viberaven_live_disconnect",
395
- description: "Local candidate feature: disconnect the saved live step and remove its locally retained provider credential and evidence. Does not alter provider settings or unrelated MCP credentials. Unfinished account reservations expire. Local checks stay free.",
395
+ description: "Preview feature: disconnect the saved live step and remove its locally retained provider credential and evidence. Does not alter provider settings or unrelated MCP credentials. Unfinished account reservations expire. Local checks stay free.",
396
396
  inputSchema: { type: "object", properties: { cwd: cwd2, stepId }, required: ["stepId"], additionalProperties: false }
397
397
  }
398
398
  ];
@@ -554,7 +554,7 @@ function mcpVersion() {
554
554
  } catch {
555
555
  }
556
556
  }
557
- found ??= true ? "1.9.0" : void 0;
557
+ found ??= true ? "1.11.0" : void 0;
558
558
  if (!found || !PLAIN_VERSION.test(found)) {
559
559
  throw new Error(`Could not read a valid ${MCP_PACKAGE} version (got ${JSON.stringify(found)}), so the matching ${CLI_PACKAGE} cannot be pinned.`);
560
560
  }
@@ -615,6 +615,19 @@ function buildToolArgs(name, args) {
615
615
  if (isLiveTool(name)) return buildLiveToolArgs(name, args);
616
616
  if (isWorkTool(name)) return buildWorkToolArgs(name, args);
617
617
  switch (name) {
618
+ case "viberaven_race": {
619
+ const allowed = /* @__PURE__ */ new Set(["cwd", "example", "spec", "from", "replay"]);
620
+ if (Object.keys(args).some((key) => !allowed.has(key))) throw new Error("Unsupported race argument");
621
+ if (args.example !== void 0 && typeof args.example !== "boolean") throw new Error("example must be boolean");
622
+ if (args.example && (args.spec !== void 0 || args.from !== void 0 || args.replay !== void 0)) throw new Error("example cannot be combined with spec or replay");
623
+ if (args.from !== void 0 !== (args.replay !== void 0)) throw new Error("from and replay are required together");
624
+ if (args.replay !== void 0 && (!Number.isSafeInteger(args.replay) || Number(args.replay) < 0)) throw new Error("replay must be a nonnegative integer");
625
+ const cliArgs = ["race", "--json"];
626
+ if (args.example) cliArgs.push("--example");
627
+ if (args.spec !== void 0) cliArgs.push("--spec", safeStringArg(args.spec, "spec"));
628
+ if (args.from !== void 0) cliArgs.push("--from", safeStringArg(args.from, "from"), "--replay", String(args.replay));
629
+ return cliArgs;
630
+ }
618
631
  case "viberaven_check_readiness":
619
632
  return ["check", "--json"];
620
633
  case "viberaven_verify":
@@ -681,6 +694,7 @@ function runVibeRavenDetailed(args, cwd3) {
681
694
  childCwd = resolveCwd(cwd3);
682
695
  const installed = resolveInstalledCli(mcpVersion(), childCwd);
683
696
  if (args[0] === "rls-test" && !installed) return Promise.resolve(transportFailure(new Error("RLS testing requires a matching installed CLI outside the task repository, with optional PGlite installed next to it. Configure the local MCP host installation or VIBERAVEN_CLI_PATH; this tool does not download or install dependencies.")));
697
+ if (args[0] === "race" && !installed) return Promise.resolve(transportFailure(new Error("Race testing requires Node 24+ and a matching installed CLI outside the task repository, with @viberaven/sessions installed next to it. Configure the local MCP host installation or VIBERAVEN_CLI_PATH; this tool does not download dependencies.")));
684
698
  built = installed ? { command: process.execPath, args: [installed, ...args], shell: false } : buildNpxCommand(cliNpxArgs(args));
685
699
  env = installed ? Object.fromEntries(Object.entries(process.env).filter(([key]) => !/^(?:node_|npm_)/i.test(key) && key.toLowerCase() !== "viberaven_cli_path")) : cliChildEnv();
686
700
  } catch (error) {
@@ -702,7 +716,7 @@ function runVibeRavenDetailed(args, cwd3) {
702
716
  }
703
717
  let stdout = "";
704
718
  let stderr = "";
705
- const boundedRls = args[0] === "rls-test";
719
+ const boundedRls = args[0] === "rls-test" || args[0] === "race";
706
720
  const rlsChunks = { stdout: [], stderr: [] };
707
721
  let outputBytes = 0;
708
722
  let settled = false;
package/dist/server.js CHANGED
@@ -156,7 +156,7 @@ var schemaPattern = "^(?!pg_)(?!(?:auth|storage|vault|information_schema)$)[a-z]
156
156
  var LIVE_TOOLS = [
157
157
  {
158
158
  name: "viberaven_live_start",
159
- description: "Local candidate feature: save a scoped metadata-verification request without provider reads or payment. Supabase catalog reads require a VibeRaven account and explicit human consent on resume. Vercel is deliberately blocked before network access. Local repository checks stay free without an account. Never pass credentials as tool arguments.",
159
+ description: "Preview feature: save a scoped metadata-verification request without provider reads or payment. Supabase catalog reads require a VibeRaven account and explicit human consent on resume. Vercel is deliberately blocked before network access. Local repository checks stay free without an account. Never pass credentials as tool arguments.",
160
160
  inputSchema: {
161
161
  type: "object",
162
162
  properties: {
@@ -176,17 +176,17 @@ var LIVE_TOOLS = [
176
176
  },
177
177
  {
178
178
  name: "viberaven_live_resume",
179
- description: "Local candidate feature: resume the SAME saved live step through account connection, allowance and metadata verification. Set approvedRead=true only after the person explicitly approves the named Supabase project/schema catalog read. Show any returned action URL and wait for the person; never approve sign-in or payment for them. Credentials stay local and are never tool arguments. Vercel stays blocked; local checks stay free.",
179
+ description: "Preview feature: resume the SAME saved live step through account connection, allowance and metadata verification. Set approvedRead=true only after the person explicitly approves the named Supabase project/schema catalog read. Show any returned action URL and wait for the person; never approve sign-in or payment for them. Credentials stay local and are never tool arguments. Vercel stays blocked; local checks stay free.",
180
180
  inputSchema: { type: "object", properties: { cwd, stepId, approvedRead: { type: "boolean", description: "True only after explicit human approval of this saved provider/project/schema read." } }, required: ["stepId"], additionalProperties: false }
181
181
  },
182
182
  {
183
183
  name: "viberaven_live_status",
184
- description: "Local candidate feature: read the saved live-step receipt without provider reads, payment or another live-step charge. Evidence is historical and scoped, not proof of application security. Local checks stay free.",
184
+ description: "Preview feature: read the saved live-step receipt without provider reads, payment or another live-step charge. Evidence is historical and scoped, not proof of application security. Local checks stay free.",
185
185
  inputSchema: { type: "object", properties: { cwd, stepId }, required: ["stepId"], additionalProperties: false }
186
186
  },
187
187
  {
188
188
  name: "viberaven_live_disconnect",
189
- description: "Local candidate feature: disconnect the saved live step and remove its locally retained provider credential and evidence. Does not alter provider settings or unrelated MCP credentials. Unfinished account reservations expire. Local checks stay free.",
189
+ description: "Preview feature: disconnect the saved live step and remove its locally retained provider credential and evidence. Does not alter provider settings or unrelated MCP credentials. Unfinished account reservations expire. Local checks stay free.",
190
190
  inputSchema: { type: "object", properties: { cwd, stepId }, required: ["stepId"], additionalProperties: false }
191
191
  }
192
192
  ];
@@ -1654,6 +1654,37 @@ function buildWorkToolArgs(name, raw) {
1654
1654
  return [...out, "--json"];
1655
1655
  }
1656
1656
 
1657
+ // src/tools/race.ts
1658
+ var RACE_TOOL = {
1659
+ name: "viberaven_race",
1660
+ description: "Use this when a PostgreSQL rule can break with two users at once, after a migration or transaction change. Runs the local VibeRaven race preview on real PostgreSQL 18.6 through @viberaven/sessions, without Docker. Use example:true for the bundled test, or a reviewed viberaven.race.json in the app. Returns bounded statement orders, the first broken order and report paths. Fix, rerun, then use from and replay to replay exactly what broke. Requires Node 24+ with JSPI and an already installed matching CLI with the sessions runtime. Writes local .viberaven artifacts and executes trusted repository SQL only; no hosted database access. An incomplete result is not a pass.",
1661
+ inputSchema: {
1662
+ type: "object",
1663
+ properties: {
1664
+ cwd: { type: "string", description: "Local app root. Defaults to the MCP server cwd." },
1665
+ example: { type: "boolean", description: "Run the bundled two-user example without changing app migrations." },
1666
+ spec: { type: "string", description: "Reviewed local JSON spec path; defaults to viberaven.race.json." },
1667
+ from: { type: "string", description: "Complete original report path, required with replay. Use the exact path returned by race." },
1668
+ replay: { type: "integer", minimum: 0, description: "Zero-based broken record index returned as firstBroken, required with from." }
1669
+ },
1670
+ additionalProperties: false
1671
+ }
1672
+ };
1673
+ function raceToolResponse(run) {
1674
+ let report;
1675
+ try {
1676
+ const parsed = JSON.parse(run.stdout.trim());
1677
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) report = parsed;
1678
+ } catch {
1679
+ }
1680
+ const completed = !run.transportError && report?.format === 1 && report.complete === true && Number.isInteger(report.tested) && Number(report.tested) > 0 && Number.isInteger(report.broken) && Number(report.broken) >= 0 && Number(report.broken) <= Number(report.tested) && (run.exitCode === 0 && report.exitCode === 0 && report.status === "passed" && report.broken === 0 || run.exitCode === 1 && report.exitCode === 1 && report.status === "broken" && Number(report.broken) > 0);
1681
+ return {
1682
+ content: [{ type: "text", text: run.text }],
1683
+ ...!completed ? { isError: true } : {},
1684
+ ...report ? { structuredContent: report } : {}
1685
+ };
1686
+ }
1687
+
1657
1688
  // src/tools/npm.ts
1658
1689
  var npmTools = [
1659
1690
  {
@@ -2161,7 +2192,7 @@ async function boundedJson2(response2) {
2161
2192
  }
2162
2193
 
2163
2194
  // ../cli/src/version.ts
2164
- var VERSION = "1.9.0";
2195
+ var VERSION = "1.11.0";
2165
2196
 
2166
2197
  // ../cli/src/commands/account.ts
2167
2198
  var loginNext = `npx -y viberaven@${VERSION} login --json`;
@@ -2506,7 +2537,7 @@ function mcpVersion() {
2506
2537
  } catch {
2507
2538
  }
2508
2539
  }
2509
- found ??= true ? "1.9.0" : void 0;
2540
+ found ??= true ? "1.11.0" : void 0;
2510
2541
  if (!found || !PLAIN_VERSION.test(found)) {
2511
2542
  throw new Error(`Could not read a valid ${MCP_PACKAGE} version (got ${JSON.stringify(found)}), so the matching ${CLI_PACKAGE} cannot be pinned.`);
2512
2543
  }
@@ -2561,6 +2592,19 @@ function buildToolArgs(name, args) {
2561
2592
  if (isLiveTool(name)) return buildLiveToolArgs(name, args);
2562
2593
  if (isWorkTool(name)) return buildWorkToolArgs(name, args);
2563
2594
  switch (name) {
2595
+ case "viberaven_race": {
2596
+ const allowed = /* @__PURE__ */ new Set(["cwd", "example", "spec", "from", "replay"]);
2597
+ if (Object.keys(args).some((key) => !allowed.has(key))) throw new Error("Unsupported race argument");
2598
+ if (args.example !== void 0 && typeof args.example !== "boolean") throw new Error("example must be boolean");
2599
+ if (args.example && (args.spec !== void 0 || args.from !== void 0 || args.replay !== void 0)) throw new Error("example cannot be combined with spec or replay");
2600
+ if (args.from !== void 0 !== (args.replay !== void 0)) throw new Error("from and replay are required together");
2601
+ if (args.replay !== void 0 && (!Number.isSafeInteger(args.replay) || Number(args.replay) < 0)) throw new Error("replay must be a nonnegative integer");
2602
+ const cliArgs = ["race", "--json"];
2603
+ if (args.example) cliArgs.push("--example");
2604
+ if (args.spec !== void 0) cliArgs.push("--spec", safeStringArg(args.spec, "spec"));
2605
+ if (args.from !== void 0) cliArgs.push("--from", safeStringArg(args.from, "from"), "--replay", String(args.replay));
2606
+ return cliArgs;
2607
+ }
2564
2608
  case "viberaven_check_readiness":
2565
2609
  return ["check", "--json"];
2566
2610
  case "viberaven_verify":
@@ -2624,6 +2668,7 @@ function runVibeRavenDetailed(args, cwd3) {
2624
2668
  childCwd = resolveCwd(cwd3);
2625
2669
  const installed = resolveInstalledCli(mcpVersion(), childCwd);
2626
2670
  if (args[0] === "rls-test" && !installed) return Promise.resolve(transportFailure(new Error("RLS testing requires a matching installed CLI outside the task repository, with optional PGlite installed next to it. Configure the local MCP host installation or VIBERAVEN_CLI_PATH; this tool does not download or install dependencies.")));
2671
+ if (args[0] === "race" && !installed) return Promise.resolve(transportFailure(new Error("Race testing requires Node 24+ and a matching installed CLI outside the task repository, with @viberaven/sessions installed next to it. Configure the local MCP host installation or VIBERAVEN_CLI_PATH; this tool does not download dependencies.")));
2627
2672
  built = installed ? { command: process.execPath, args: [installed, ...args], shell: false } : buildNpxCommand(cliNpxArgs(args));
2628
2673
  env = installed ? Object.fromEntries(Object.entries(process.env).filter(([key]) => !/^(?:node_|npm_)/i.test(key) && key.toLowerCase() !== "viberaven_cli_path")) : cliChildEnv();
2629
2674
  } catch (error) {
@@ -2645,7 +2690,7 @@ function runVibeRavenDetailed(args, cwd3) {
2645
2690
  }
2646
2691
  let stdout = "";
2647
2692
  let stderr = "";
2648
- const boundedRls = args[0] === "rls-test";
2693
+ const boundedRls = args[0] === "rls-test" || args[0] === "race";
2649
2694
  const rlsChunks = { stdout: [], stderr: [] };
2650
2695
  let outputBytes = 0;
2651
2696
  let settled = false;
@@ -2723,7 +2768,8 @@ var ALL_TOOLS = [
2723
2768
  PROVIDER_TOOL,
2724
2769
  RECENT_PROVIDER_CHANGES_TOOL,
2725
2770
  ...LIVE_TOOLS,
2726
- ...accountTools
2771
+ ...accountTools,
2772
+ RACE_TOOL
2727
2773
  ];
2728
2774
  function parseJsonObjectFromToolText(text) {
2729
2775
  const start = text.indexOf("{");
@@ -2756,6 +2802,7 @@ async function handleRequest(method, params) {
2756
2802
  const cliArgs = buildToolArgs(params.name, args);
2757
2803
  const run = await runVibeRavenDetailed(cliArgs, args.cwd);
2758
2804
  if (params.name === RLS_TOOL_NAME) return buildRlsToolResponse(run);
2805
+ if (params.name === "viberaven_race") return raceToolResponse(run);
2759
2806
  const { text, stdout, exitCode, transportError } = run;
2760
2807
  const parsed = parseJsonObjectFromToolText(stdout);
2761
2808
  const receipt = parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : void 0;
@@ -2774,9 +2821,10 @@ async function handleRequest(method, params) {
2774
2821
  }
2775
2822
 
2776
2823
  // src/server.ts
2777
- var SERVER_INFO = { name: "viberaven-mcp", version: "1.9.0" };
2824
+ var SERVER_INFO = { name: "viberaven-mcp", version: "1.11.0", icons: [{ src: "https://viberaven.dev/favicon-512.png", mimeType: "image/png", sizes: ["512x512"] }] };
2778
2825
  var INSTRUCTIONS = [
2779
2826
  "VibeRaven reads a repository and lists launch gaps for AI-built apps that deploy on Vercel and use Supabase.",
2827
+ "VibeRaven provides production context and checks across the app\u2019s providers. For two users at once, use viberaven_race: local real PostgreSQL 18.6 sessions, bounded statement orders and exact replay, without Docker. Start with example:true; then check, race, fix and replay in the repository.",
2780
2828
  "Suggest one viberaven_check_readiness run before such an app launches or is handed off, after a Supabase migration or policy change,",
2781
2829
  "or when the user pastes a production error about RLS, env vars, the database connection, the service role key or a Stripe webhook.",
2782
2830
  "This is advice, not a gate: the user decides when to ship.",
@@ -22,12 +22,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
22
22
  var tools_exports = {};
23
23
  __export(tools_exports, {
24
24
  ALL_TOOLS: () => ALL_TOOLS,
25
+ RACE_TOOL: () => RACE_TOOL,
25
26
  __resetSpawnForTest: () => __resetSpawnForTest,
26
27
  __setSpawnForTest: () => __setSpawnForTest,
27
28
  callTool: () => callTool,
28
29
  createAccountToolHandler: () => createAccountToolHandler,
29
30
  handleRequest: () => handleRequest,
30
- parseJsonObjectFromToolText: () => parseJsonObjectFromToolText
31
+ parseJsonObjectFromToolText: () => parseJsonObjectFromToolText,
32
+ raceToolResponse: () => raceToolResponse
31
33
  });
32
34
  module.exports = __toCommonJS(tools_exports);
33
35
 
@@ -157,7 +159,7 @@ var schemaPattern = "^(?!pg_)(?!(?:auth|storage|vault|information_schema)$)[a-z]
157
159
  var LIVE_TOOLS = [
158
160
  {
159
161
  name: "viberaven_live_start",
160
- description: "Local candidate feature: save a scoped metadata-verification request without provider reads or payment. Supabase catalog reads require a VibeRaven account and explicit human consent on resume. Vercel is deliberately blocked before network access. Local repository checks stay free without an account. Never pass credentials as tool arguments.",
162
+ description: "Preview feature: save a scoped metadata-verification request without provider reads or payment. Supabase catalog reads require a VibeRaven account and explicit human consent on resume. Vercel is deliberately blocked before network access. Local repository checks stay free without an account. Never pass credentials as tool arguments.",
161
163
  inputSchema: {
162
164
  type: "object",
163
165
  properties: {
@@ -177,17 +179,17 @@ var LIVE_TOOLS = [
177
179
  },
178
180
  {
179
181
  name: "viberaven_live_resume",
180
- description: "Local candidate feature: resume the SAME saved live step through account connection, allowance and metadata verification. Set approvedRead=true only after the person explicitly approves the named Supabase project/schema catalog read. Show any returned action URL and wait for the person; never approve sign-in or payment for them. Credentials stay local and are never tool arguments. Vercel stays blocked; local checks stay free.",
182
+ description: "Preview feature: resume the SAME saved live step through account connection, allowance and metadata verification. Set approvedRead=true only after the person explicitly approves the named Supabase project/schema catalog read. Show any returned action URL and wait for the person; never approve sign-in or payment for them. Credentials stay local and are never tool arguments. Vercel stays blocked; local checks stay free.",
181
183
  inputSchema: { type: "object", properties: { cwd, stepId, approvedRead: { type: "boolean", description: "True only after explicit human approval of this saved provider/project/schema read." } }, required: ["stepId"], additionalProperties: false }
182
184
  },
183
185
  {
184
186
  name: "viberaven_live_status",
185
- description: "Local candidate feature: read the saved live-step receipt without provider reads, payment or another live-step charge. Evidence is historical and scoped, not proof of application security. Local checks stay free.",
187
+ description: "Preview feature: read the saved live-step receipt without provider reads, payment or another live-step charge. Evidence is historical and scoped, not proof of application security. Local checks stay free.",
186
188
  inputSchema: { type: "object", properties: { cwd, stepId }, required: ["stepId"], additionalProperties: false }
187
189
  },
188
190
  {
189
191
  name: "viberaven_live_disconnect",
190
- description: "Local candidate feature: disconnect the saved live step and remove its locally retained provider credential and evidence. Does not alter provider settings or unrelated MCP credentials. Unfinished account reservations expire. Local checks stay free.",
192
+ description: "Preview feature: disconnect the saved live step and remove its locally retained provider credential and evidence. Does not alter provider settings or unrelated MCP credentials. Unfinished account reservations expire. Local checks stay free.",
191
193
  inputSchema: { type: "object", properties: { cwd, stepId }, required: ["stepId"], additionalProperties: false }
192
194
  }
193
195
  ];
@@ -1655,6 +1657,37 @@ function buildWorkToolArgs(name, raw) {
1655
1657
  return [...out, "--json"];
1656
1658
  }
1657
1659
 
1660
+ // src/tools/race.ts
1661
+ var RACE_TOOL = {
1662
+ name: "viberaven_race",
1663
+ description: "Use this when a PostgreSQL rule can break with two users at once, after a migration or transaction change. Runs the local VibeRaven race preview on real PostgreSQL 18.6 through @viberaven/sessions, without Docker. Use example:true for the bundled test, or a reviewed viberaven.race.json in the app. Returns bounded statement orders, the first broken order and report paths. Fix, rerun, then use from and replay to replay exactly what broke. Requires Node 24+ with JSPI and an already installed matching CLI with the sessions runtime. Writes local .viberaven artifacts and executes trusted repository SQL only; no hosted database access. An incomplete result is not a pass.",
1664
+ inputSchema: {
1665
+ type: "object",
1666
+ properties: {
1667
+ cwd: { type: "string", description: "Local app root. Defaults to the MCP server cwd." },
1668
+ example: { type: "boolean", description: "Run the bundled two-user example without changing app migrations." },
1669
+ spec: { type: "string", description: "Reviewed local JSON spec path; defaults to viberaven.race.json." },
1670
+ from: { type: "string", description: "Complete original report path, required with replay. Use the exact path returned by race." },
1671
+ replay: { type: "integer", minimum: 0, description: "Zero-based broken record index returned as firstBroken, required with from." }
1672
+ },
1673
+ additionalProperties: false
1674
+ }
1675
+ };
1676
+ function raceToolResponse(run) {
1677
+ let report;
1678
+ try {
1679
+ const parsed = JSON.parse(run.stdout.trim());
1680
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) report = parsed;
1681
+ } catch {
1682
+ }
1683
+ const completed = !run.transportError && report?.format === 1 && report.complete === true && Number.isInteger(report.tested) && Number(report.tested) > 0 && Number.isInteger(report.broken) && Number(report.broken) >= 0 && Number(report.broken) <= Number(report.tested) && (run.exitCode === 0 && report.exitCode === 0 && report.status === "passed" && report.broken === 0 || run.exitCode === 1 && report.exitCode === 1 && report.status === "broken" && Number(report.broken) > 0);
1684
+ return {
1685
+ content: [{ type: "text", text: run.text }],
1686
+ ...!completed ? { isError: true } : {},
1687
+ ...report ? { structuredContent: report } : {}
1688
+ };
1689
+ }
1690
+
1658
1691
  // src/tools/npm.ts
1659
1692
  var npmTools = [
1660
1693
  {
@@ -2162,7 +2195,7 @@ async function boundedJson2(response2) {
2162
2195
  }
2163
2196
 
2164
2197
  // ../cli/src/version.ts
2165
- var VERSION = "1.9.0";
2198
+ var VERSION = "1.11.0";
2166
2199
 
2167
2200
  // ../cli/src/commands/account.ts
2168
2201
  var loginNext = `npx -y viberaven@${VERSION} login --json`;
@@ -2507,7 +2540,7 @@ function mcpVersion() {
2507
2540
  } catch {
2508
2541
  }
2509
2542
  }
2510
- found ??= true ? "1.9.0" : void 0;
2543
+ found ??= true ? "1.11.0" : void 0;
2511
2544
  if (!found || !PLAIN_VERSION.test(found)) {
2512
2545
  throw new Error(`Could not read a valid ${MCP_PACKAGE} version (got ${JSON.stringify(found)}), so the matching ${CLI_PACKAGE} cannot be pinned.`);
2513
2546
  }
@@ -2568,6 +2601,19 @@ function buildToolArgs(name, args) {
2568
2601
  if (isLiveTool(name)) return buildLiveToolArgs(name, args);
2569
2602
  if (isWorkTool(name)) return buildWorkToolArgs(name, args);
2570
2603
  switch (name) {
2604
+ case "viberaven_race": {
2605
+ const allowed = /* @__PURE__ */ new Set(["cwd", "example", "spec", "from", "replay"]);
2606
+ if (Object.keys(args).some((key) => !allowed.has(key))) throw new Error("Unsupported race argument");
2607
+ if (args.example !== void 0 && typeof args.example !== "boolean") throw new Error("example must be boolean");
2608
+ if (args.example && (args.spec !== void 0 || args.from !== void 0 || args.replay !== void 0)) throw new Error("example cannot be combined with spec or replay");
2609
+ if (args.from !== void 0 !== (args.replay !== void 0)) throw new Error("from and replay are required together");
2610
+ if (args.replay !== void 0 && (!Number.isSafeInteger(args.replay) || Number(args.replay) < 0)) throw new Error("replay must be a nonnegative integer");
2611
+ const cliArgs = ["race", "--json"];
2612
+ if (args.example) cliArgs.push("--example");
2613
+ if (args.spec !== void 0) cliArgs.push("--spec", safeStringArg(args.spec, "spec"));
2614
+ if (args.from !== void 0) cliArgs.push("--from", safeStringArg(args.from, "from"), "--replay", String(args.replay));
2615
+ return cliArgs;
2616
+ }
2571
2617
  case "viberaven_check_readiness":
2572
2618
  return ["check", "--json"];
2573
2619
  case "viberaven_verify":
@@ -2634,6 +2680,7 @@ function runVibeRavenDetailed(args, cwd3) {
2634
2680
  childCwd = resolveCwd(cwd3);
2635
2681
  const installed = resolveInstalledCli(mcpVersion(), childCwd);
2636
2682
  if (args[0] === "rls-test" && !installed) return Promise.resolve(transportFailure(new Error("RLS testing requires a matching installed CLI outside the task repository, with optional PGlite installed next to it. Configure the local MCP host installation or VIBERAVEN_CLI_PATH; this tool does not download or install dependencies.")));
2683
+ if (args[0] === "race" && !installed) return Promise.resolve(transportFailure(new Error("Race testing requires Node 24+ and a matching installed CLI outside the task repository, with @viberaven/sessions installed next to it. Configure the local MCP host installation or VIBERAVEN_CLI_PATH; this tool does not download dependencies.")));
2637
2684
  built = installed ? { command: process.execPath, args: [installed, ...args], shell: false } : buildNpxCommand(cliNpxArgs(args));
2638
2685
  env = installed ? Object.fromEntries(Object.entries(process.env).filter(([key]) => !/^(?:node_|npm_)/i.test(key) && key.toLowerCase() !== "viberaven_cli_path")) : cliChildEnv();
2639
2686
  } catch (error) {
@@ -2655,7 +2702,7 @@ function runVibeRavenDetailed(args, cwd3) {
2655
2702
  }
2656
2703
  let stdout = "";
2657
2704
  let stderr = "";
2658
- const boundedRls = args[0] === "rls-test";
2705
+ const boundedRls = args[0] === "rls-test" || args[0] === "race";
2659
2706
  const rlsChunks = { stdout: [], stderr: [] };
2660
2707
  let outputBytes = 0;
2661
2708
  let settled = false;
@@ -2733,7 +2780,8 @@ var ALL_TOOLS = [
2733
2780
  PROVIDER_TOOL,
2734
2781
  RECENT_PROVIDER_CHANGES_TOOL,
2735
2782
  ...LIVE_TOOLS,
2736
- ...accountTools
2783
+ ...accountTools,
2784
+ RACE_TOOL
2737
2785
  ];
2738
2786
  function parseJsonObjectFromToolText(text) {
2739
2787
  const start = text.indexOf("{");
@@ -2772,6 +2820,7 @@ async function handleRequest(method, params) {
2772
2820
  const cliArgs = buildToolArgs(params.name, args);
2773
2821
  const run = await runVibeRavenDetailed(cliArgs, args.cwd);
2774
2822
  if (params.name === RLS_TOOL_NAME) return buildRlsToolResponse(run);
2823
+ if (params.name === "viberaven_race") return raceToolResponse(run);
2775
2824
  const { text, stdout, exitCode, transportError } = run;
2776
2825
  const parsed = parseJsonObjectFromToolText(stdout);
2777
2826
  const receipt = parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : void 0;
@@ -2791,10 +2840,12 @@ async function handleRequest(method, params) {
2791
2840
  // Annotate the CommonJS export names for ESM import in node:
2792
2841
  0 && (module.exports = {
2793
2842
  ALL_TOOLS,
2843
+ RACE_TOOL,
2794
2844
  __resetSpawnForTest,
2795
2845
  __setSpawnForTest,
2796
2846
  callTool,
2797
2847
  createAccountToolHandler,
2798
2848
  handleRequest,
2799
- parseJsonObjectFromToolText
2849
+ parseJsonObjectFromToolText,
2850
+ raceToolResponse
2800
2851
  });
package/package.json CHANGED
@@ -1,15 +1,14 @@
1
1
  {
2
2
  "name": "@viberaven/mcp",
3
- "version": "1.9.0",
4
- "description": "MCP server for VibeRaven: lets Claude Code, Cursor and Codex run the Supabase RLS and security check on an AI-built Vercel + Supabase app and read the findings.",
3
+ "version": "1.11.0",
4
+ "description": "Production context and checks for AI-built apps via MCP: Supabase repository findings and two-user PostgreSQL race tests with exact replay.",
5
5
  "license": "MIT",
6
6
  "author": "VibeRaven",
7
7
  "mcpName": "io.github.ohad6k/viberaven",
8
8
  "homepage": "https://viberaven.dev/mcp.md",
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "git+https://github.com/ohad6k/VibeRaven.git",
12
- "directory": "packages/mcp"
11
+ "url": "git+https://github.com/ohad6k/VibeRaven.git"
13
12
  },
14
13
  "bugs": {
15
14
  "url": "https://github.com/ohad6k/VibeRaven/issues"
@@ -17,24 +16,19 @@
17
16
  "keywords": [
18
17
  "viberaven",
19
18
  "mcp",
19
+ "model-context-protocol",
20
+ "ai-agent",
21
+ "supabase",
22
+ "postgres",
23
+ "rls",
24
+ "vercel",
25
+ "lovable",
20
26
  "claude-code",
21
27
  "codex",
22
28
  "cursor",
23
- "launch-readiness",
24
- "production",
25
- "supabase-rls",
26
- "row-level-security",
27
- "rls",
28
- "supabase-security",
29
- "security-scanner",
30
- "security",
31
- "lovable",
32
- "bolt",
33
- "secrets",
34
- "service-role-key",
35
- "stripe-webhook",
36
- "postgres",
37
- "migrations"
29
+ "migrations",
30
+ "testing",
31
+ "repository-check"
38
32
  ],
39
33
  "publishConfig": {
40
34
  "access": "public",
@@ -45,7 +39,10 @@
45
39
  },
46
40
  "files": [
47
41
  "dist",
48
- "README.md"
42
+ "README.md",
43
+ "LICENSE",
44
+ "THIRD_PARTY_NOTICES",
45
+ "assets"
49
46
  ],
50
47
  "engines": {
51
48
  "node": ">=20"