@viberaven/mcp 1.1.8 → 1.2.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 +1 -0
- package/dist/lib/attribution.js +35 -0
- package/dist/lib/cli-runner.js +150 -0
- package/dist/server.js +342 -0
- package/dist/tools/index.js +331 -0
- package/package.json +15 -3
- package/bin/server.js +0 -407
- package/bin/viberaven-mcp.js +0 -175
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/tools/index.ts
|
|
22
|
+
var tools_exports = {};
|
|
23
|
+
__export(tools_exports, {
|
|
24
|
+
ALL_TOOLS: () => ALL_TOOLS,
|
|
25
|
+
__resetSpawnForTest: () => __resetSpawnForTest,
|
|
26
|
+
__setSpawnForTest: () => __setSpawnForTest,
|
|
27
|
+
callTool: () => callTool,
|
|
28
|
+
handleRequest: () => handleRequest,
|
|
29
|
+
parseJsonObjectFromToolText: () => parseJsonObjectFromToolText
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(tools_exports);
|
|
32
|
+
|
|
33
|
+
// src/tools/readiness.ts
|
|
34
|
+
var cwdSchema = {
|
|
35
|
+
type: "object",
|
|
36
|
+
properties: { cwd: { type: "string", description: "Project root. Defaults to the MCP server cwd." } },
|
|
37
|
+
additionalProperties: false
|
|
38
|
+
};
|
|
39
|
+
var readinessTools = [
|
|
40
|
+
{
|
|
41
|
+
name: "viberaven_check_readiness",
|
|
42
|
+
description: "Run BEFORE deploying, shipping to real users, or touching auth, database/RLS, billing, webhooks, or environment variables. Scans the repo for launch blockers (missing RLS, leaked secrets, unbounded queries, unsigned webhooks) and writes a prioritized task list to .viberaven/agent-tasklist.md plus a machine verdict to .viberaven/gate-result.json. Returns the gate status and the single next fix. Calling this first avoids wasted code-generation re-runs by surfacing production risks before you write code.",
|
|
43
|
+
inputSchema: cwdSchema
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "viberaven_verify",
|
|
47
|
+
description: "Re-scan and refresh VibeRaven readiness artifacts after you apply one fix. Call this once per batch of fixes (not after every edit) to update .viberaven/gate-result.json and confirm whether the gate moved toward clear.",
|
|
48
|
+
inputSchema: cwdSchema
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "viberaven_strict_gate",
|
|
52
|
+
description: 'Run the strict production gate and return the machine verdict. Call this right before a deploy or CI pass to confirm gate.status === "clear". Returns JSON suitable for blocking a pipeline.',
|
|
53
|
+
inputSchema: cwdSchema
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "viberaven_gate_result",
|
|
57
|
+
description: "Return the current contents of .viberaven/gate-result.json without re-scanning. Use this to read the last machine verdict before deciding whether to deploy.",
|
|
58
|
+
inputSchema: cwdSchema
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "viberaven_context_map",
|
|
62
|
+
description: "Refresh and return .viberaven/context-map.json \u2014 a compact summary of the last scan for the next agent step. Use this to load minimal context before acting on a gap.",
|
|
63
|
+
inputSchema: cwdSchema
|
|
64
|
+
}
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
// src/tools/audit.ts
|
|
68
|
+
var auditTools = [
|
|
69
|
+
{
|
|
70
|
+
name: "viberaven_audit",
|
|
71
|
+
description: "Run local Vercel + Supabase production checks: table RLS presence, policy quality, view/function boundaries, service-role boundaries, and Vercel pooler usage. Call this when the project uses Supabase or Vercel and you need a focused infra audit beyond the general readiness gate. Pass json: true for machine-readable output.",
|
|
72
|
+
inputSchema: {
|
|
73
|
+
type: "object",
|
|
74
|
+
properties: {
|
|
75
|
+
cwd: { type: "string", description: "Project root. Defaults to current working directory." },
|
|
76
|
+
json: { type: "boolean", description: "Return JSON output." }
|
|
77
|
+
},
|
|
78
|
+
additionalProperties: false
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
// src/tools/heal.ts
|
|
84
|
+
var healSchema = {
|
|
85
|
+
type: "object",
|
|
86
|
+
properties: {
|
|
87
|
+
cwd: { type: "string" },
|
|
88
|
+
target: { type: "string", description: "Target file path for the heal." },
|
|
89
|
+
gap: { type: "string", description: "Gap ID from .viberaven/agent-tasklist.md." },
|
|
90
|
+
yes: { type: "boolean", description: "Skip confirmation for apply." }
|
|
91
|
+
},
|
|
92
|
+
additionalProperties: false
|
|
93
|
+
};
|
|
94
|
+
var healTools = [
|
|
95
|
+
{
|
|
96
|
+
name: "viberaven_heal_plan",
|
|
97
|
+
description: "Write a non-destructive heal plan for a specific gap or target file. Call this BEFORE viberaven_heal_apply to preview the exact repo-code change. Does not modify files.",
|
|
98
|
+
inputSchema: healSchema
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: "viberaven_heal_prompt",
|
|
102
|
+
description: "Return an agent-ready prompt that fixes a specific gap. Use this when you want a coding agent to apply the fix itself rather than using the guarded recipe.",
|
|
103
|
+
inputSchema: healSchema
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "viberaven_heal_apply",
|
|
107
|
+
description: "Apply a guarded, low-risk repo-code heal recipe for a supported gap. Only call this after viberaven_heal_plan. Pass yes: true to skip confirmation. Returns the applied change summary.",
|
|
108
|
+
inputSchema: healSchema
|
|
109
|
+
}
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
// src/tools/rules.ts
|
|
113
|
+
var rulesTools = [
|
|
114
|
+
{
|
|
115
|
+
name: "viberaven_init_rules",
|
|
116
|
+
description: "Install bounded VibeRaven agent-instruction rules into native AI instruction files (CLAUDE.md / AGENTS.md / .cursor/rules). Call this once per project so coding agents pull VibeRaven into the deploy/auth/RLS workflow. Use dryRun: true to preview first.",
|
|
117
|
+
inputSchema: {
|
|
118
|
+
type: "object",
|
|
119
|
+
properties: {
|
|
120
|
+
cwd: { type: "string", description: "Project root. Defaults to current working directory." },
|
|
121
|
+
agents: { type: "string", description: "Comma-separated agent targets, or all." },
|
|
122
|
+
dryRun: { type: "boolean", description: "Preview changes without writing files." }
|
|
123
|
+
},
|
|
124
|
+
additionalProperties: false
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "viberaven_clean_plan",
|
|
129
|
+
description: "Write a non-destructive cleanup plan for generated .viberaven artifacts and logs. Call this when the .viberaven directory has grown stale. Does not delete anything \u2014 it only produces a reviewable plan.",
|
|
130
|
+
inputSchema: {
|
|
131
|
+
type: "object",
|
|
132
|
+
properties: { cwd: { type: "string", description: "Project root. Defaults to current working directory." } },
|
|
133
|
+
additionalProperties: false
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
];
|
|
137
|
+
|
|
138
|
+
// src/tools/actions.ts
|
|
139
|
+
var actionTools = [
|
|
140
|
+
{
|
|
141
|
+
name: "viberaven_actions",
|
|
142
|
+
description: "Read the current chat-native action surface from .viberaven/actions.json. Use this to list stable, referenceable action IDs the user can verify or refer to by name.",
|
|
143
|
+
inputSchema: {
|
|
144
|
+
type: "object",
|
|
145
|
+
properties: { cwd: { type: "string", description: "Project root. Defaults to current working directory." } },
|
|
146
|
+
additionalProperties: false
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: "viberaven_verify_action",
|
|
151
|
+
description: "Verify or explain the lifecycle state of a stable VibeRaven action ID (format VR-A<number>). Use this when the user references a specific action and you need its current state.",
|
|
152
|
+
inputSchema: {
|
|
153
|
+
type: "object",
|
|
154
|
+
properties: { cwd: { type: "string" }, actionId: { type: "string", description: "Action ID like VR-A1." } },
|
|
155
|
+
required: ["actionId"],
|
|
156
|
+
additionalProperties: false
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
];
|
|
160
|
+
|
|
161
|
+
// src/tools/npm.ts
|
|
162
|
+
var npmTools = [
|
|
163
|
+
{
|
|
164
|
+
name: "viberaven_validate_npm_package",
|
|
165
|
+
description: "Check whether an npm package name exists and looks safe before installing it. Call this BEFORE adding any new dependency. After installing, run viberaven_check_readiness to re-gate the change.",
|
|
166
|
+
inputSchema: {
|
|
167
|
+
type: "object",
|
|
168
|
+
properties: {
|
|
169
|
+
packageName: { type: "string", description: "Single npm package name to validate." },
|
|
170
|
+
packageNames: { type: "array", items: { type: "string" }, description: "Multiple package names to validate in one call." }
|
|
171
|
+
},
|
|
172
|
+
additionalProperties: false
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
];
|
|
176
|
+
|
|
177
|
+
// src/lib/cli-runner.ts
|
|
178
|
+
var import_node_child_process = require("node:child_process");
|
|
179
|
+
var CLI_PACKAGE = "@viberaven/cli";
|
|
180
|
+
var spawnFn = import_node_child_process.spawn;
|
|
181
|
+
function __setSpawnForTest(fn) {
|
|
182
|
+
spawnFn = fn;
|
|
183
|
+
}
|
|
184
|
+
function __resetSpawnForTest() {
|
|
185
|
+
spawnFn = import_node_child_process.spawn;
|
|
186
|
+
}
|
|
187
|
+
function safeStringArg(value, label) {
|
|
188
|
+
if (typeof value !== "string") throw new Error(`Invalid ${label}: expected string`);
|
|
189
|
+
if (!value.trim()) throw new Error(`Invalid ${label}: expected non-empty string`);
|
|
190
|
+
if (/[&|<>^%!"\r\n]/.test(value)) throw new Error(`Unsafe characters in ${label}`);
|
|
191
|
+
return value;
|
|
192
|
+
}
|
|
193
|
+
function resolveCwd(cwd) {
|
|
194
|
+
if (cwd === void 0 || cwd === null) return process.cwd();
|
|
195
|
+
if (typeof cwd !== "string") throw new Error("Invalid cwd: expected string");
|
|
196
|
+
if (!cwd.trim()) throw new Error("Invalid cwd: expected non-empty string");
|
|
197
|
+
return cwd;
|
|
198
|
+
}
|
|
199
|
+
function buildNpxCommand(args) {
|
|
200
|
+
if (process.platform === "win32") {
|
|
201
|
+
return { command: "cmd.exe", args: ["/d", "/s", "/c", "npx", ...args], shell: false };
|
|
202
|
+
}
|
|
203
|
+
return { command: "npx", args, shell: false };
|
|
204
|
+
}
|
|
205
|
+
function buildHealArgs(prefix, args) {
|
|
206
|
+
const cliArgs = [...prefix];
|
|
207
|
+
if (args.target) cliArgs.push("--target", safeStringArg(args.target, "target"));
|
|
208
|
+
if (args.gap) cliArgs.push("--gap", safeStringArg(args.gap, "gap"));
|
|
209
|
+
return cliArgs;
|
|
210
|
+
}
|
|
211
|
+
function buildToolArgs(name, args) {
|
|
212
|
+
switch (name) {
|
|
213
|
+
case "viberaven_check_readiness":
|
|
214
|
+
return ["--agent-mode"];
|
|
215
|
+
case "viberaven_verify":
|
|
216
|
+
return ["--verify"];
|
|
217
|
+
case "viberaven_audit":
|
|
218
|
+
return ["audit", "--vercel-supabase", ...args.json ? ["--json"] : []];
|
|
219
|
+
case "viberaven_init_rules": {
|
|
220
|
+
const cliArgs = ["init"];
|
|
221
|
+
if (args.agents) cliArgs.push("--agents", safeStringArg(args.agents, "agents"));
|
|
222
|
+
if (args.dryRun) cliArgs.push("--dry-run");
|
|
223
|
+
return cliArgs;
|
|
224
|
+
}
|
|
225
|
+
case "viberaven_clean_plan":
|
|
226
|
+
return ["clean", "--plan"];
|
|
227
|
+
case "viberaven_strict_gate":
|
|
228
|
+
return ["--agent-mode", "--strict", "--json"];
|
|
229
|
+
case "viberaven_gate_result":
|
|
230
|
+
return ["--agent-mode", "--json"];
|
|
231
|
+
case "viberaven_context_map":
|
|
232
|
+
return ["--condense"];
|
|
233
|
+
case "viberaven_actions":
|
|
234
|
+
return ["actions"];
|
|
235
|
+
case "viberaven_verify_action":
|
|
236
|
+
return ["--verify", "--action", safeStringArg(args.actionId, "actionId")];
|
|
237
|
+
case "viberaven_heal_plan":
|
|
238
|
+
return buildHealArgs(["--heal", "--plan"], args);
|
|
239
|
+
case "viberaven_heal_prompt":
|
|
240
|
+
return buildHealArgs(["--heal", "--prompt"], args);
|
|
241
|
+
case "viberaven_heal_apply": {
|
|
242
|
+
const cliArgs = buildHealArgs(["--heal", "--apply"], args);
|
|
243
|
+
if (args.yes === true) cliArgs.push("--yes");
|
|
244
|
+
return cliArgs;
|
|
245
|
+
}
|
|
246
|
+
case "viberaven_validate_npm_package": {
|
|
247
|
+
const names = [];
|
|
248
|
+
if (args.packageName) names.push(safeStringArg(args.packageName, "packageName"));
|
|
249
|
+
if (Array.isArray(args.packageNames)) {
|
|
250
|
+
for (const entry of args.packageNames) names.push(safeStringArg(entry, "packageName"));
|
|
251
|
+
}
|
|
252
|
+
if (names.length === 0) throw new Error("packageName or packageNames is required");
|
|
253
|
+
return ["validate-npm-package", "--json", ...names];
|
|
254
|
+
}
|
|
255
|
+
default:
|
|
256
|
+
throw new Error(`Unknown VibeRaven tool: ${name}`);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
function runVibeRaven(args, cwd) {
|
|
260
|
+
return new Promise((resolve) => {
|
|
261
|
+
const built = buildNpxCommand(["-y", CLI_PACKAGE, ...args]);
|
|
262
|
+
const child = spawnFn(built.command, built.args, {
|
|
263
|
+
cwd: resolveCwd(cwd),
|
|
264
|
+
env: process.env,
|
|
265
|
+
shell: built.shell,
|
|
266
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
267
|
+
});
|
|
268
|
+
let stdout = "";
|
|
269
|
+
let stderr = "";
|
|
270
|
+
child.stdout?.on("data", (chunk) => {
|
|
271
|
+
stdout += chunk.toString();
|
|
272
|
+
});
|
|
273
|
+
child.stderr?.on("data", (chunk) => {
|
|
274
|
+
stderr += chunk.toString();
|
|
275
|
+
});
|
|
276
|
+
child.on("error", (error) => resolve(`ERROR: ${error.message}`));
|
|
277
|
+
child.on("close", (code) => {
|
|
278
|
+
const combined = `${stdout}${stderr}`.trim();
|
|
279
|
+
resolve(`exit ${code ?? 1}${combined ? `
|
|
280
|
+
${combined}` : ""}`);
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// src/tools/index.ts
|
|
286
|
+
var [checkReadiness, verify, strictGate, gateResult, contextMap] = readinessTools;
|
|
287
|
+
var ALL_TOOLS = [
|
|
288
|
+
checkReadiness,
|
|
289
|
+
verify,
|
|
290
|
+
...auditTools,
|
|
291
|
+
...rulesTools,
|
|
292
|
+
strictGate,
|
|
293
|
+
gateResult,
|
|
294
|
+
contextMap,
|
|
295
|
+
...actionTools,
|
|
296
|
+
...healTools,
|
|
297
|
+
...npmTools
|
|
298
|
+
];
|
|
299
|
+
function parseJsonObjectFromToolText(text) {
|
|
300
|
+
const start = text.indexOf("{");
|
|
301
|
+
if (start === -1) return void 0;
|
|
302
|
+
try {
|
|
303
|
+
return JSON.parse(text.slice(start));
|
|
304
|
+
} catch {
|
|
305
|
+
return void 0;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
async function callTool(name, args) {
|
|
309
|
+
return runVibeRaven(buildToolArgs(name, args || {}), args?.cwd);
|
|
310
|
+
}
|
|
311
|
+
async function handleRequest(method, params) {
|
|
312
|
+
if (method === "tools/list") return { tools: ALL_TOOLS };
|
|
313
|
+
if (method === "tools/call") {
|
|
314
|
+
const text = await callTool(params.name, params.arguments || {});
|
|
315
|
+
const parsed = parseJsonObjectFromToolText(text);
|
|
316
|
+
return {
|
|
317
|
+
content: [{ type: "text", text }],
|
|
318
|
+
...parsed ? { structuredContent: parsed } : {}
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
throw new Error(`Unsupported MCP method: ${method}`);
|
|
322
|
+
}
|
|
323
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
324
|
+
0 && (module.exports = {
|
|
325
|
+
ALL_TOOLS,
|
|
326
|
+
__resetSpawnForTest,
|
|
327
|
+
__setSpawnForTest,
|
|
328
|
+
callTool,
|
|
329
|
+
handleRequest,
|
|
330
|
+
parseJsonObjectFromToolText
|
|
331
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viberaven/mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "MCP server for VibeRaven production-readiness: check_readiness, verify, heal, audit, and strict gate tools for Cursor, Claude Code, and Codex.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "VibeRaven",
|
|
@@ -28,17 +28,29 @@
|
|
|
28
28
|
"tag": "latest"
|
|
29
29
|
},
|
|
30
30
|
"bin": {
|
|
31
|
-
"viberaven-mcp": "
|
|
31
|
+
"viberaven-mcp": "dist/server.js"
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
34
|
-
"
|
|
34
|
+
"dist",
|
|
35
35
|
"README.md"
|
|
36
36
|
],
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=20"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
|
+
"build": "node scripts/build.mjs",
|
|
42
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
43
|
+
"presmoke": "npm run build",
|
|
41
44
|
"smoke": "node scripts/smoke.mjs",
|
|
45
|
+
"pretest": "npm run build",
|
|
42
46
|
"test": "vitest run"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"esbuild": "^0.25.0",
|
|
53
|
+
"typescript": "^5.8.0",
|
|
54
|
+
"vitest": "^3.2.0"
|
|
43
55
|
}
|
|
44
56
|
}
|