@splithub/mcp 0.1.9 → 0.2.1
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/dist/index.js +189 -44
- package/dist/index.js.map +1 -1
- package/package.json +11 -3
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
5
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
|
+
import { createRequire as createRequire2 } from "module";
|
|
6
7
|
import { z } from "zod";
|
|
7
8
|
|
|
8
9
|
// src/cli.ts
|
|
@@ -18,16 +19,17 @@ function projectDir() {
|
|
|
18
19
|
}
|
|
19
20
|
function parseJson(text) {
|
|
20
21
|
const lines = text.split("\n").map((l) => l.trim()).filter((l) => l.startsWith("{") || l.startsWith("["));
|
|
21
|
-
|
|
22
|
-
try {
|
|
23
|
-
return JSON.parse(lines[lines.length - 1]);
|
|
24
|
-
} catch {
|
|
22
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
25
23
|
try {
|
|
26
|
-
return JSON.parse(
|
|
24
|
+
return JSON.parse(lines[i]);
|
|
27
25
|
} catch {
|
|
28
|
-
return null;
|
|
29
26
|
}
|
|
30
27
|
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
function errorBody(json) {
|
|
31
|
+
const j = json;
|
|
32
|
+
return j && typeof j.error === "string" && typeof j.code === "string" ? j : null;
|
|
31
33
|
}
|
|
32
34
|
function runCli(args, options = {}) {
|
|
33
35
|
const extra = [];
|
|
@@ -65,6 +67,9 @@ function startLogin() {
|
|
|
65
67
|
} else if (j.alreadyLoggedIn) {
|
|
66
68
|
done = true;
|
|
67
69
|
resolve({ error: "already logged in" });
|
|
70
|
+
} else if (typeof j.error === "string") {
|
|
71
|
+
done = true;
|
|
72
|
+
resolve({ error: j.error, ...j.code ? { code: j.code } : {} });
|
|
68
73
|
}
|
|
69
74
|
} catch {
|
|
70
75
|
}
|
|
@@ -78,32 +83,120 @@ function startLogin() {
|
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
// src/index.ts
|
|
81
|
-
var
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
var pkg = createRequire2(import.meta.url)("../package.json");
|
|
87
|
+
var server = new McpServer({ name: "splithub", version: pkg.version });
|
|
88
|
+
var NEXT_BY_CODE = {
|
|
89
|
+
NOT_LOGGED_IN: "This folder is not connected to SplitHub Cloud: call splithub_login, show the link to the user, wait for their approval, then retry.",
|
|
90
|
+
NO_CONFIG: "No splithub.config.ts here: call splithub_init first (or set SPLITHUB_PROJECT_DIR to the app folder).",
|
|
91
|
+
EXPERIMENT_NOT_FOUND: "Call splithub_status for the experiment ids.",
|
|
92
|
+
CONFIG_UNSAFE: "Edit splithub.config.ts by hand where the experiment is defined, then call splithub_doctor.",
|
|
93
|
+
CONFIG_WRITE: "The config file was restored as it was. Make the change by hand, then call splithub_doctor.",
|
|
94
|
+
CONFIG_PARSE: "Fix the error in splithub.config.ts, then call splithub_doctor.",
|
|
95
|
+
INSUFFICIENT_SCOPE: "This API key can only read. Ask the user for a key with the write scope (dashboard, Settings, API keys) or call splithub_login again."
|
|
96
|
+
};
|
|
97
|
+
function reply(r, options = {}) {
|
|
98
|
+
const err = errorBody(r.json);
|
|
99
|
+
if (r.code !== 0 || err) {
|
|
100
|
+
const body = err ?? { error: (r.stderr || r.stdout || "the splithub CLI failed").trim(), code: "INTERNAL" };
|
|
101
|
+
const next = NEXT_BY_CODE[body.code];
|
|
102
|
+
return { content: [{ type: "text", text: JSON.stringify({ ...body, ...next ? { next } : {} }) }], isError: true };
|
|
87
103
|
}
|
|
88
|
-
|
|
104
|
+
const text = r.json ? JSON.stringify(r.json, null, 2) : r.stdout.trim();
|
|
105
|
+
const structured = options.structured && r.json && typeof r.json === "object" && !Array.isArray(r.json) ? r.json : void 0;
|
|
106
|
+
return { content: [{ type: "text", text }], ...structured ? { structuredContent: structured } : {} };
|
|
89
107
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
108
|
+
var verdictShape = z.object({ status: z.string(), message: z.string(), winner: z.string().nullable().optional(), notes: z.array(z.string()).optional() }).passthrough();
|
|
109
|
+
var statusOutput = z.object({
|
|
110
|
+
project: z.string(),
|
|
111
|
+
experiments: z.array(z.object({ experiment: z.string(), kind: z.string(), status: z.string(), visitors: z.number(), days: z.number(), verdict: z.string().nullable(), headline: z.string().nullable(), sample: z.enum(["small", "ok", "good"]).nullable().optional(), stars: z.number().nullable().optional(), daysToVerdict: z.number().nullable().optional() }).passthrough()),
|
|
112
|
+
next: z.string().optional()
|
|
113
|
+
}).passthrough();
|
|
114
|
+
var resultsOutput = z.object({
|
|
115
|
+
experiment: z.string(),
|
|
116
|
+
kind: z.string(),
|
|
117
|
+
status: z.string(),
|
|
118
|
+
goal: z.string().nullable(),
|
|
119
|
+
verdict: verdictShape,
|
|
120
|
+
daysToVerdict: z.number().nullable().optional().describe("days until a verdict at the current traffic; schedule the next check then"),
|
|
121
|
+
next: z.string().optional()
|
|
122
|
+
}).passthrough();
|
|
123
|
+
var refsOutput = z.object({
|
|
124
|
+
experiment: z.string(),
|
|
125
|
+
goal: z.string().nullable(),
|
|
126
|
+
goalShared: z.boolean(),
|
|
127
|
+
inConfig: z.boolean(),
|
|
128
|
+
count: z.number(),
|
|
129
|
+
refs: z.array(z.object({ file: z.string(), line: z.number(), column: z.number(), text: z.string(), match: z.enum(["experiment", "goal"]) }).passthrough())
|
|
130
|
+
}).passthrough();
|
|
131
|
+
var shipOutput = z.object({
|
|
132
|
+
experiment: z.string(),
|
|
133
|
+
kept: z.string(),
|
|
134
|
+
kind: z.string(),
|
|
135
|
+
dryRun: z.boolean(),
|
|
136
|
+
live: z.string(),
|
|
137
|
+
configFile: z.string(),
|
|
138
|
+
files: z.array(z.string()),
|
|
139
|
+
diff: z.string().describe("unified diff of the config and the source files"),
|
|
140
|
+
leftovers: z.array(z.object({ file: z.string(), line: z.number(), text: z.string(), reason: z.string() }).passthrough()),
|
|
141
|
+
next: z.array(z.string())
|
|
142
|
+
}).passthrough();
|
|
143
|
+
var LOOP = "The loop: splithub_plan \u2192 splithub_create_experiment \u2192 wire the code \u2192 splithub_doctor \u2192 splithub_push (cloud) \u2192 splithub_results (re-check after daysToVerdict days) \u2192 splithub_set_status finished \u2192 splithub_ship.";
|
|
144
|
+
server.registerTool(
|
|
145
|
+
"splithub_status",
|
|
146
|
+
{
|
|
147
|
+
description: `Every experiment of this project with status, visitors, days, the verdict headline, sample (verdict.sample.quality: small | ok | good), stars (verdict.sample.stars, data quality 0..5) and daysToVerdict (days until a verdict at the current traffic: schedule the next check then, do not poll). verdict guardrail_breached = do not ship that variant. The __holdout row is the project holdout (long-term impact). Start here. A finished experiment is over but its variants are still in the code: report its verdict, ask the user which variant to keep and whether to remove the test, then call splithub_ship. ${LOOP}`,
|
|
148
|
+
outputSchema: statusOutput
|
|
149
|
+
},
|
|
150
|
+
async () => reply(await runCli(["status"]), { structured: true })
|
|
151
|
+
);
|
|
152
|
+
server.registerTool(
|
|
153
|
+
"splithub_results",
|
|
154
|
+
{
|
|
155
|
+
description: "Full verdict for one experiment: sample per variant, lift, P(beat), SRM, winner; mvt adds factors[]. verdict.status guardrail_breached means do not ship: a variant made a guardrail metric worse (verdict.guardrailBreached[]); say what broke. verdict.metrics[] has secondary metrics and guardrails. The experiment __holdout is the project holdout (long-term impact of all tests). Verdicts are sequential (always-valid, safe to check any time) and depend on sample size, not days. verdict.sample.quality is small (below the minimums), ok, or good (every variant has its share of verdict.sample.goodSample, default 5000 visitors): say it next to the verdict; it never changes the decision. verdict.sample.stars (0..5) is a data-quality score from verdict.sample.checks[] (minimum, split, goodSample, power, week; each { met, label }): report the stars and the unmet labels, never as a reason to override the verdict. Quote verdict.message verbatim, use comparisons[].sequential.pValue / sequential.ci (the plain pValue is fixed-horizon, display only: p = 0.01 there can be not significant) and relay verdict.notes[]. daysToVerdict says when to check again. If finished, ask which variant to keep, then splithub_ship.",
|
|
156
|
+
inputSchema: { experiment: z.string().describe("experiment id (key)") },
|
|
157
|
+
outputSchema: resultsOutput
|
|
158
|
+
},
|
|
159
|
+
async ({ experiment }) => reply(await runCli(["results", experiment]), { structured: true })
|
|
160
|
+
);
|
|
161
|
+
server.registerTool(
|
|
162
|
+
"splithub_plan",
|
|
163
|
+
{
|
|
164
|
+
description: "Before creating a test: visitors per variant (and in all) to detect a relative lift `mde` on a `baseline` conversion rate, sized for the sequential verdict. With an experiment id, also the days left at its current traffic. If it takes months, suggest a bigger change or a busier page.",
|
|
165
|
+
inputSchema: {
|
|
166
|
+
baseline: z.number().gt(0).lt(1).describe("conversion rate today, e.g. 0.05"),
|
|
167
|
+
mde: z.number().gt(0).describe("smallest relative lift worth finding, e.g. 0.1 for +10%"),
|
|
168
|
+
variants: z.number().int().min(2).optional().describe("number of variants including the control (default 2)"),
|
|
169
|
+
experiment: z.string().optional().describe("experiment id: adds days at its traffic")
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
async ({ baseline, mde, variants, experiment }) => reply(await runCli(["plan", ...experiment ? [experiment] : [], "--baseline", String(baseline), "--mde", String(mde), ...variants ? ["--variants", String(variants)] : []]))
|
|
173
|
+
);
|
|
174
|
+
server.registerTool(
|
|
93
175
|
"splithub_create_experiment",
|
|
94
|
-
"Add an experiment to splithub.config.ts. It is written as running: it goes live when the code is deployed (and pushed in cloud mode). Afterwards tell the user that, and that splithub_set_status paused holds it. Pass status draft only when the user asks to hold it. kind: value (text/number/URL read with useValue), component (<Experiment>/<Variant> markup), redirect (match path + per-variant destination), mvt (multivariate: factors instead of variants, every combination tested, read with useValue as { factor: value }). First variant / first level is the control.",
|
|
95
176
|
{
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
177
|
+
description: `Add an experiment to splithub.config.ts (checked by reloading the file). It is written as running: it goes live when the code is deployed (and pushed in cloud mode). Tell the user that, and that splithub_set_status paused holds it. Pass status draft only when the user asks to hold it. kind: value (text/number/URL read with useValue), component (<Experiment>/<Variant> markup), redirect (match path + per-variant destination), mvt (factors instead of variants, every combination tested, read with useValue as { factor: value }). First variant / first level is the control. goodSample: total visitors at which the sample counts as good (default 5000). minDays: opt-in fewest days before a verdict (default 0 = none). Then wire the returned snippet, call splithub_doctor and splithub_refs. ${LOOP}`,
|
|
178
|
+
inputSchema: {
|
|
179
|
+
id: z.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).describe("experiment key, lowercase"),
|
|
180
|
+
kind: z.enum(["value", "component", "redirect", "mvt"]),
|
|
181
|
+
variants: z.array(z.string()).min(2).optional().describe("variant keys, first = control (not for mvt)"),
|
|
182
|
+
factors: z.record(z.record(z.string())).optional().describe('mvt only: factor \u2192 level \u2192 value, e.g. { headline: { old: "Old", new: "New" }, button: { blue: "#2563eb", green: "#16a34a" } }; first level = control; at most 4 factors \xD7 4 levels'),
|
|
183
|
+
weights: z.array(z.number().min(0)).optional().describe("relative weights, same order as variants (not for mvt)"),
|
|
184
|
+
goal: z.string().optional().describe("goal key from the config"),
|
|
185
|
+
values: z.record(z.string()).optional().describe("value experiments: variant \u2192 value"),
|
|
186
|
+
match: z.string().optional().describe("redirect experiments: path to test, e.g. /"),
|
|
187
|
+
to: z.record(z.string()).optional().describe("redirect experiments: variant \u2192 destination path"),
|
|
188
|
+
status: z.enum(["draft", "running"]).optional(),
|
|
189
|
+
description: z.string().optional(),
|
|
190
|
+
traffic: z.number().gt(0).max(100).optional().describe("percent of visitors in the test (default 100)"),
|
|
191
|
+
maxVisitors: z.number().int().positive().optional().describe("stop counting after this many visitors"),
|
|
192
|
+
minDays: z.number().int().min(0).max(30).optional().describe("opt-in fewest days before a verdict (default 0 = none); verdicts otherwise depend on sample size"),
|
|
193
|
+
goodSample: z.number().int().min(100).max(1e7).optional().describe("total visitors at which verdict.sample.quality turns good (default 5000); informational, never changes the verdict"),
|
|
194
|
+
start: z.string().optional().describe("ISO date the test starts"),
|
|
195
|
+
end: z.string().optional().describe("ISO date the test ends"),
|
|
196
|
+
secondary: z.array(z.string()).optional().describe("goals to watch next to the primary goal"),
|
|
197
|
+
guardrails: z.array(z.union([z.string(), z.object({ goal: z.string(), worse: z.enum(["lower", "higher"]) })])).optional().describe('goals that must not get worse; { goal, worse: "higher" } when a rise is bad (refunds, errors). A breach makes the verdict guardrail_breached: do not ship'),
|
|
198
|
+
layer: z.object({ key: z.string(), start: z.number().int().min(0).max(99), end: z.number().int().min(1).max(100) }).optional().describe("mutual exclusion: tests in one layer never share a visitor; bucket ranges [start, end) must not overlap")
|
|
199
|
+
}
|
|
107
200
|
},
|
|
108
201
|
async (a) => {
|
|
109
202
|
const args = ["create", "--kind", a.kind, "--id", a.id, "--yes"];
|
|
@@ -117,30 +210,82 @@ server.tool(
|
|
|
117
210
|
if (a.to) for (const [k, v] of Object.entries(a.to)) args.push("--to", `${k}=${v}`);
|
|
118
211
|
if (a.status) args.push("--status", a.status);
|
|
119
212
|
if (a.description) args.push("--description", a.description);
|
|
213
|
+
if (a.traffic !== void 0) args.push("--traffic", String(a.traffic));
|
|
214
|
+
if (a.maxVisitors !== void 0) args.push("--max-visitors", String(a.maxVisitors));
|
|
215
|
+
if (a.minDays !== void 0) args.push("--min-days", String(a.minDays));
|
|
216
|
+
if (a.goodSample !== void 0) args.push("--good-sample", String(a.goodSample));
|
|
217
|
+
if (a.start) args.push("--start", a.start);
|
|
218
|
+
if (a.end) args.push("--end", a.end);
|
|
219
|
+
if (a.secondary?.length) args.push("--secondary", a.secondary.join(","));
|
|
220
|
+
if (a.guardrails?.length) args.push("--guardrail", a.guardrails.map((g) => typeof g === "string" ? g : `${g.goal}:${g.worse}`).join(","));
|
|
221
|
+
if (a.layer) args.push("--layer", `${a.layer.key}:${a.layer.start}-${a.layer.end}`);
|
|
120
222
|
return reply(await runCli(args));
|
|
121
223
|
}
|
|
122
224
|
);
|
|
123
|
-
server.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
225
|
+
server.registerTool(
|
|
226
|
+
"splithub_set_status",
|
|
227
|
+
{
|
|
228
|
+
description: "Start, pause or finish an experiment. The config file is updated (and checked); in cloud mode it applies live within a minute. After finishing, the variants are still in the code: ask the user which variant to keep, then call splithub_ship.",
|
|
229
|
+
inputSchema: { experiment: z.string(), status: z.enum(["running", "paused", "finished"]) }
|
|
230
|
+
},
|
|
231
|
+
async ({ experiment, status }) => {
|
|
232
|
+
const cmd = status === "running" ? "start" : status === "paused" ? "pause" : "finish";
|
|
233
|
+
return reply(await runCli([cmd, experiment]));
|
|
234
|
+
}
|
|
235
|
+
);
|
|
236
|
+
server.registerTool(
|
|
237
|
+
"splithub_refs",
|
|
238
|
+
{
|
|
239
|
+
description: "Files and lines that use an experiment id or its goal. Use after wiring code (is it referenced?) and after splithub_ship (count should be 0 for the experiment).",
|
|
240
|
+
inputSchema: { experiment: z.string() },
|
|
241
|
+
outputSchema: refsOutput
|
|
242
|
+
},
|
|
243
|
+
async ({ experiment }) => reply(await runCli(["refs", experiment]), { structured: true })
|
|
244
|
+
);
|
|
245
|
+
server.registerTool(
|
|
246
|
+
"splithub_ship",
|
|
247
|
+
{
|
|
248
|
+
description: "Keep one variant and take the test out: archives it in the cloud (numbers stay readable), removes it from splithub.config.ts and rewrites the code (<Experiment> \u2192 the kept <Variant>, useValue \u2192 the kept literal, useVariant branches folded, unused imports dropped). Ask the user which variant to keep first (recommend verdict.winner; never a variant listed in verdict.guardrailBreached). Call with dryRun: true, show the diff, then without. Fix leftovers[] by hand, then follow next[] (push, doctor, tests).",
|
|
249
|
+
inputSchema: { experiment: z.string(), keep: z.string().describe("variant key to keep"), dryRun: z.boolean().optional().describe("only return the diff") },
|
|
250
|
+
outputSchema: shipOutput
|
|
251
|
+
},
|
|
252
|
+
async ({ experiment, keep, dryRun }) => reply(await runCli(["ship", experiment, "--keep", keep, ...dryRun ? ["--dry-run"] : []]), { structured: true })
|
|
253
|
+
);
|
|
254
|
+
server.registerTool(
|
|
255
|
+
"splithub_remove",
|
|
256
|
+
{
|
|
257
|
+
description: "Remove an experiment from splithub.config.ts (and archive it in the cloud when connected) without touching the code. Prefer splithub_ship, which also cleans the code. Returns refs still in the code.",
|
|
258
|
+
inputSchema: { experiment: z.string() }
|
|
259
|
+
},
|
|
260
|
+
async ({ experiment }) => reply(await runCli(["remove", experiment]))
|
|
261
|
+
);
|
|
262
|
+
server.registerTool(
|
|
263
|
+
"splithub_review",
|
|
264
|
+
{ description: "AI reviews of an experiment stored in SplitHub Cloud (Pro): written at the start, when the verdict changes while it runs, when it finishes, or on demand in the dashboard. Newest first. Quote them as an opinion; the verdict stays the source of truth.", inputSchema: { experiment: z.string().optional().describe("experiment id; omit for every experiment of the project") } },
|
|
265
|
+
async ({ experiment }) => reply(await runCli(experiment ? ["review", experiment] : ["review"]))
|
|
266
|
+
);
|
|
267
|
+
server.registerTool("splithub_push", { description: "Upload splithub.config.ts to SplitHub Cloud (cloud mode). Returns experiments created in the dashboard that were written into the file. dryRun: only check the config and show what would change.", inputSchema: { dryRun: z.boolean().optional() } }, async ({ dryRun }) => reply(await runCli(dryRun ? ["push", "--dry-run"] : ["push"])));
|
|
268
|
+
server.registerTool("splithub_pull", { description: "Fetch the cloud config and write dashboard-created experiments into splithub.config.ts." }, async () => reply(await runCli(["pull"])));
|
|
269
|
+
server.registerTool("splithub_doctor", { description: "Check the installation: config, provider, middleware, routes, code references, endpoint. Run after wiring code; ok: false lists what to fix." }, async () => reply(await runCli(["doctor"])));
|
|
270
|
+
server.registerTool("splithub_whoami", { description: "Which cloud project this folder is connected to, and its public key." }, async () => reply(await runCli(["whoami"])));
|
|
271
|
+
server.registerTool("splithub_projects", { description: "Every folder on this machine connected to a SplitHub Cloud project, the current one marked (current)." }, async () => reply(await runCli(["projects"])));
|
|
272
|
+
server.registerTool("splithub_login", { description: "Connect this folder to SplitHub Cloud. Returns a sign-in link and a code: show them to the user, who approves in the browser (and can create a project there). The CLI then stores a project API key for this folder. Call splithub_whoami afterwards." }, async () => {
|
|
133
273
|
const r = await startLogin();
|
|
134
|
-
if ("error" in r) return { content: [{ type: "text", text: r
|
|
274
|
+
if ("error" in r) return { content: [{ type: "text", text: JSON.stringify(r) }], isError: r.error !== "already logged in" };
|
|
135
275
|
return { content: [{ type: "text", text: `Open this link to connect: ${r.verifyUrl}
|
|
136
276
|
Code: ${r.userCode} (expires in ${Math.round(r.expiresIn / 60)} min)
|
|
137
277
|
Waiting for the approval in the background; call splithub_whoami to check.` }] };
|
|
138
278
|
});
|
|
139
|
-
server.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
279
|
+
server.registerTool(
|
|
280
|
+
"splithub_init",
|
|
281
|
+
{ description: "Set up SplitHub in this project: config file, framework files, agent skills; in cloud mode see splithub_login to connect. Use once per project. githubAction: also write a GitHub workflow (checks on PRs, results comment on a schedule).", inputSchema: { mode: z.enum(["cloud", "self"]).default("cloud"), key: z.string().optional().describe("public key pk_\u2026 when known"), githubAction: z.boolean().optional() } },
|
|
282
|
+
async ({ mode, key, githubAction }) => {
|
|
283
|
+
const args = ["init", "--mode", mode, "--yes", "--no-install", "--no-login"];
|
|
284
|
+
if (key) args.push("--key", key);
|
|
285
|
+
if (githubAction) args.push("--github-action");
|
|
286
|
+
return reply(await runCli(args, { timeoutMs: 12e4 }));
|
|
287
|
+
}
|
|
288
|
+
);
|
|
144
289
|
var transport = new StdioServerTransport();
|
|
145
290
|
await server.connect(transport);
|
|
146
291
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/cli.ts"],"sourcesContent":["// @splithub/mcp — stdio MCP server exposing the splithub CLI as tools.\n//\n// { \"mcpServers\": { \"splithub\": { \"command\": \"npx\", \"args\": [\"-y\", \"@splithub/mcp\"] } } }\n//\n// Every tool runs `splithub <command> --json` in SPLITHUB_PROJECT_DIR (default:\n// the client's working directory), so the agent sees exactly what a human\n// would get from the terminal, with the same config file and credentials.\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { z } from 'zod';\nimport { runCli, startLogin, type CliResult } from './cli.js';\n\nconst server = new McpServer({ name: 'splithub', version: '0.1.0' });\n\ntype ToolReply = { content: Array<{ type: 'text'; text: string }>; isError?: boolean };\n\nfunction reply(r: CliResult, fallback = ''): ToolReply {\n if (r.code !== 0) {\n const text = (r.stderr || r.stdout || fallback).trim();\n const hint = /not logged in|API key required|login/i.test(text) ? '\\n\\nThis folder is not connected to SplitHub Cloud: call splithub_login, show the link to the user, wait for their approval, then retry.' : '';\n return { content: [{ type: 'text', text: `${text}${hint}` }], isError: true };\n }\n return { content: [{ type: 'text', text: r.json ? JSON.stringify(r.json, null, 2) : r.stdout.trim() || fallback }] };\n}\n\nserver.tool('splithub_status', 'Every experiment of this project with status, visitors, days and the verdict headline. Start here. A finished experiment is over but its variants are still in the code: report its verdict, ask the user which variant to keep and whether to remove the test from the code, then follow the splithub-ship skill.', {}, async () => reply(await runCli(['status'])));\n\nserver.tool('splithub_results', 'Full verdict for one experiment: sample per variant, lift, p-value, confidence interval, P(beat), SRM, winner; multivariate experiments add factors[] (each factor on its own). Report verdict.message verbatim. If status is finished, ask the user which variant to keep and whether to clean the test out of the code (splithub-ship skill).', { experiment: z.string().describe('experiment id (key)') }, async ({ experiment }) => reply(await runCli(['results', experiment])));\n\nserver.tool(\n 'splithub_create_experiment',\n 'Add an experiment to splithub.config.ts. It is written as running: it goes live when the code is deployed (and pushed in cloud mode). Afterwards tell the user that, and that splithub_set_status paused holds it. Pass status draft only when the user asks to hold it. kind: value (text/number/URL read with useValue), component (<Experiment>/<Variant> markup), redirect (match path + per-variant destination), mvt (multivariate: factors instead of variants, every combination tested, read with useValue as { factor: value }). First variant / first level is the control.',\n {\n id: z.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).describe('experiment key, lowercase'),\n kind: z.enum(['value', 'component', 'redirect', 'mvt']),\n variants: z.array(z.string()).min(2).optional().describe('variant keys, first = control (not for mvt)'),\n factors: z.record(z.record(z.string())).optional().describe('mvt only: factor → level → value, e.g. { headline: { old: \"Old\", new: \"New\" }, button: { blue: \"#2563eb\", green: \"#16a34a\" } }; first level = control; at most 4 factors × 4 levels'),\n weights: z.array(z.number()).optional().describe('relative weights, same order as variants'),\n goal: z.string().optional().describe('goal key from the config'),\n values: z.record(z.string()).optional().describe('value experiments: variant → value'),\n match: z.string().optional().describe('redirect experiments: path to test, e.g. /'),\n to: z.record(z.string()).optional().describe('redirect experiments: variant → destination path'),\n status: z.enum(['draft', 'running']).optional(),\n description: z.string().optional(),\n },\n async (a) => {\n const args = ['create', '--kind', a.kind, '--id', a.id, '--yes'];\n if (a.kind === 'mvt') {\n for (const [factor, levels] of Object.entries(a.factors ?? {})) args.push('--factor', `${factor}=${Object.entries(levels).map(([l, v]) => `${l}:${v}`).join(',')}`);\n } else args.push('--variants', (a.variants ?? ['control', 'b']).join(','));\n if (a.weights) args.push('--weights', a.weights.join(','));\n if (a.goal) args.push('--goal', a.goal);\n if (a.values) for (const [k, v] of Object.entries(a.values)) args.push('--value', `${k}=${v}`);\n if (a.match) args.push('--match', a.match);\n if (a.to) for (const [k, v] of Object.entries(a.to)) args.push('--to', `${k}=${v}`);\n if (a.status) args.push('--status', a.status);\n if (a.description) args.push('--description', a.description);\n return reply(await runCli(args));\n }\n);\n\nserver.tool('splithub_set_status', 'Start, pause or finish an experiment. In cloud mode it applies live within a minute; the config file is updated too. After finishing, the variants are still in the code: ask the user which variant to keep and whether to remove the test from the code, then follow the splithub-ship skill.', { experiment: z.string(), status: z.enum(['running', 'paused', 'finished']) }, async ({ experiment, status }) => {\n const cmd = status === 'running' ? 'start' : status === 'paused' ? 'pause' : 'finish';\n return reply(await runCli([cmd, experiment]));\n});\n\nserver.tool('splithub_review', 'AI reviews of an experiment stored in SplitHub Cloud (Pro): written at the start, when the verdict changes while it runs, when it finishes, or on demand in the dashboard. Newest first.', { experiment: z.string().optional().describe('experiment id; omit for every experiment of the project') }, async ({ experiment }) => reply(await runCli(experiment ? ['review', experiment] : ['review'])));\n\nserver.tool('splithub_push', 'Upload splithub.config.ts to SplitHub Cloud (cloud mode). Returns experiments created in the dashboard that were written into the file.', {}, async () => reply(await runCli(['push'])));\nserver.tool('splithub_pull', 'Fetch the cloud config and write dashboard-created experiments into splithub.config.ts.', {}, async () => reply(await runCli(['pull'])));\nserver.tool('splithub_doctor', 'Check the installation: config, provider, middleware, routes, code references, endpoint.', {}, async () => reply(await runCli(['doctor'])));\nserver.tool('splithub_whoami', 'Which cloud project this folder is connected to, and its public key.', {}, async () => reply(await runCli(['whoami'])));\n\nserver.tool('splithub_login', 'Connect this folder to SplitHub Cloud. Returns a sign-in link and a code: show them to the user, who approves in the browser (and can create a project there). The CLI then stores a project API key for this folder. Call splithub_whoami afterwards.', {}, async () => {\n const r = await startLogin();\n if ('error' in r) return { content: [{ type: 'text', text: r.error }], isError: r.error !== 'already logged in' };\n return { content: [{ type: 'text', text: `Open this link to connect: ${r.verifyUrl}\\nCode: ${r.userCode} (expires in ${Math.round(r.expiresIn / 60)} min)\\nWaiting for the approval in the background; call splithub_whoami to check.` }] };\n});\n\nserver.tool('splithub_init', 'Set up SplitHub in this project: config file, framework files, agent skills; in cloud mode also prints a sign-in link (see splithub_login). Use once per project.', { mode: z.enum(['cloud', 'self']).default('cloud'), key: z.string().optional().describe('public key pk_… when known') }, async ({ mode, key }) => {\n const args = ['init', '--mode', mode, '--yes', '--no-install', '--no-login'];\n if (key) args.push('--key', key);\n return reply(await runCli(args, { timeoutMs: 120_000 }));\n});\n\nconst transport = new StdioServerTransport();\nawait server.connect(transport);\n","// Runs the splithub CLI as a child process with --json and parses the reply.\n// The MCP server is a thin layer: credentials, config parsing and the cloud\n// protocol stay in one place (the CLI).\nimport { spawn } from 'node:child_process';\nimport { createRequire } from 'node:module';\n\nconst require = createRequire(import.meta.url);\n\nexport function cliPath(): string {\n if (process.env.SPLITHUB_CLI) return process.env.SPLITHUB_CLI;\n return require.resolve('splithub/dist/index.js');\n}\n\nexport function projectDir(): string {\n return process.env.SPLITHUB_PROJECT_DIR || process.cwd();\n}\n\nexport interface CliResult {\n code: number;\n stdout: string;\n stderr: string;\n json: unknown;\n}\n\nfunction parseJson(text: string): unknown {\n // The CLI may print one JSON document; init/login print several lines (one per step).\n const lines = text\n .split('\\n')\n .map((l) => l.trim())\n .filter((l) => l.startsWith('{') || l.startsWith('['));\n if (lines.length === 0) return null;\n try {\n return JSON.parse(lines[lines.length - 1]!);\n } catch {\n try {\n return JSON.parse(text);\n } catch {\n return null;\n }\n }\n}\n\nexport function runCli(args: string[], options: { timeoutMs?: number } = {}): Promise<CliResult> {\n const extra: string[] = [];\n if (process.env.SPLITHUB_API) extra.push('--api', process.env.SPLITHUB_API);\n return new Promise((resolve) => {\n const child = spawn(process.execPath, [cliPath(), ...args, ...extra, '--json'], { cwd: projectDir(), env: { ...process.env, NO_COLOR: '1' }, stdio: ['ignore', 'pipe', 'pipe'] });\n let stdout = '';\n let stderr = '';\n child.stdout.on('data', (d) => (stdout += d));\n child.stderr.on('data', (d) => (stderr += d));\n const timer = setTimeout(() => child.kill(), options.timeoutMs ?? 60_000);\n child.on('close', (code) => {\n clearTimeout(timer);\n resolve({ code: code ?? 1, stdout, stderr, json: parseJson(stdout) });\n });\n });\n}\n\n/**\n * `login` prints the sign-in link first and then waits (up to 10 min) for the\n * approval. Return the link at once and let the process finish on its own.\n */\nexport function startLogin(): Promise<{ verifyUrl: string; userCode: string; expiresIn: number } | { error: string }> {\n const extra: string[] = [];\n if (process.env.SPLITHUB_API) extra.push('--api', process.env.SPLITHUB_API);\n return new Promise((resolve) => {\n const child = spawn(process.execPath, [cliPath(), 'login', '--yes', ...extra, '--json'], { cwd: projectDir(), env: { ...process.env, NO_COLOR: '1' }, stdio: ['ignore', 'pipe', 'pipe'], detached: false });\n let buf = '';\n let done = false;\n child.stdout.on('data', (d) => {\n buf += d;\n if (done) return;\n for (const line of buf.split('\\n')) {\n if (!line.trim().startsWith('{')) continue;\n try {\n const j = JSON.parse(line) as { step?: string; verifyUrl?: string; userCode?: string; expiresIn?: number; alreadyLoggedIn?: boolean; error?: string };\n if (j.step === 'approve' && j.verifyUrl) {\n done = true;\n resolve({ verifyUrl: j.verifyUrl, userCode: j.userCode ?? '', expiresIn: j.expiresIn ?? 600 });\n } else if (j.alreadyLoggedIn) {\n done = true;\n resolve({ error: 'already logged in' });\n }\n } catch {\n // partial line\n }\n }\n });\n child.on('close', (code) => {\n if (!done) resolve({ error: `login exited with code ${code}: ${buf.slice(0, 300)}` });\n });\n child.unref();\n });\n}\n"],"mappings":";;;AAQA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,SAAS;;;ACPlB,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAE9B,IAAMA,WAAU,cAAc,YAAY,GAAG;AAEtC,SAAS,UAAkB;AAChC,MAAI,QAAQ,IAAI,aAAc,QAAO,QAAQ,IAAI;AACjD,SAAOA,SAAQ,QAAQ,wBAAwB;AACjD;AAEO,SAAS,aAAqB;AACnC,SAAO,QAAQ,IAAI,wBAAwB,QAAQ,IAAI;AACzD;AASA,SAAS,UAAU,MAAuB;AAExC,QAAM,QAAQ,KACX,MAAM,IAAI,EACV,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,OAAO,CAAC,MAAM,EAAE,WAAW,GAAG,KAAK,EAAE,WAAW,GAAG,CAAC;AACvD,MAAI,MAAM,WAAW,EAAG,QAAO;AAC/B,MAAI;AACF,WAAO,KAAK,MA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M,EAAE,KAAK,CAAC,SAAS,MAAM,CAAC,EAAE,QAAQ,OAAO,GAAG,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,iCAA4B,EAAE,GAAG,OAAO,EAAE,MAAM,IAAI,MAAM;AAClV,QAAM,OAAO,CAAC,QAAQ,UAAU,MAAM,SAAS,gBAAgB,YAAY;AAC3E,MAAI,IAAK,MAAK,KAAK,SAAS,GAAG;AAC/B,SAAO,MAAM,MAAM,OAAO,MAAM,EAAE,WAAW,KAAQ,CAAC,CAAC;AACzD,CAAC;AAED,IAAM,YAAY,IAAI,qBAAqB;AAC3C,MAAM,OAAO,QAAQ,SAAS;","names":["require"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/cli.ts"],"sourcesContent":["// @splithub/mcp — stdio MCP server exposing the splithub CLI as tools.\n//\n// { \"mcpServers\": { \"splithub\": { \"command\": \"npx\", \"args\": [\"-y\", \"@splithub/mcp\"] } } }\n//\n// Every tool runs `splithub <command> --json` in SPLITHUB_PROJECT_DIR (default:\n// the client's working directory), so the agent sees exactly what a human\n// would get from the terminal, with the same config file and credentials.\n// Errors come back with the CLI's stable `code` (NOT_LOGGED_IN, NO_CONFIG, ...).\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { createRequire } from 'node:module';\nimport { z } from 'zod';\nimport { errorBody, runCli, startLogin, type CliResult } from './cli.js';\n\nconst pkg = createRequire(import.meta.url)('../package.json') as { version: string };\nconst server = new McpServer({ name: 'splithub', version: pkg.version });\n\ntype ToolReply = { content: Array<{ type: 'text'; text: string }>; structuredContent?: Record<string, unknown>; isError?: boolean };\n\n/** What to do next for each CLI error code. */\nconst NEXT_BY_CODE: Record<string, string> = {\n NOT_LOGGED_IN: 'This folder is not connected to SplitHub Cloud: call splithub_login, show the link to the user, wait for their approval, then retry.',\n NO_CONFIG: 'No splithub.config.ts here: call splithub_init first (or set SPLITHUB_PROJECT_DIR to the app folder).',\n EXPERIMENT_NOT_FOUND: 'Call splithub_status for the experiment ids.',\n CONFIG_UNSAFE: 'Edit splithub.config.ts by hand where the experiment is defined, then call splithub_doctor.',\n CONFIG_WRITE: 'The config file was restored as it was. Make the change by hand, then call splithub_doctor.',\n CONFIG_PARSE: 'Fix the error in splithub.config.ts, then call splithub_doctor.',\n INSUFFICIENT_SCOPE: 'This API key can only read. Ask the user for a key with the write scope (dashboard, Settings, API keys) or call splithub_login again.',\n};\n\nfunction reply(r: CliResult, options: { structured?: boolean } = {}): ToolReply {\n const err = errorBody(r.json);\n if (r.code !== 0 || err) {\n const body = err ?? { error: (r.stderr || r.stdout || 'the splithub CLI failed').trim(), code: 'INTERNAL' };\n const next = NEXT_BY_CODE[body.code];\n return { content: [{ type: 'text', text: JSON.stringify({ ...body, ...(next ? { next } : {}) }) }], isError: true };\n }\n const text = r.json ? JSON.stringify(r.json, null, 2) : r.stdout.trim();\n const structured = options.structured && r.json && typeof r.json === 'object' && !Array.isArray(r.json) ? (r.json as Record<string, unknown>) : undefined;\n return { content: [{ type: 'text', text }], ...(structured ? { structuredContent: structured } : {}) };\n}\n\n// Output schemas mirror the CLI --json shapes (key fields; the rest passes through).\nconst verdictShape = z.object({ status: z.string(), message: z.string(), winner: z.string().nullable().optional(), notes: z.array(z.string()).optional() }).passthrough();\nconst statusOutput = z.object({\n project: z.string(),\n experiments: z.array(z.object({ experiment: z.string(), kind: z.string(), status: z.string(), visitors: z.number(), days: z.number(), verdict: z.string().nullable(), headline: z.string().nullable(), sample: z.enum(['small', 'ok', 'good']).nullable().optional(), stars: z.number().nullable().optional(), daysToVerdict: z.number().nullable().optional() }).passthrough()),\n next: z.string().optional(),\n}).passthrough();\nconst resultsOutput = z.object({\n experiment: z.string(),\n kind: z.string(),\n status: z.string(),\n goal: z.string().nullable(),\n verdict: verdictShape,\n daysToVerdict: z.number().nullable().optional().describe('days until a verdict at the current traffic; schedule the next check then'),\n next: z.string().optional(),\n}).passthrough();\nconst refsOutput = z.object({\n experiment: z.string(),\n goal: z.string().nullable(),\n goalShared: z.boolean(),\n inConfig: z.boolean(),\n count: z.number(),\n refs: z.array(z.object({ file: z.string(), line: z.number(), column: z.number(), text: z.string(), match: z.enum(['experiment', 'goal']) }).passthrough()),\n}).passthrough();\nconst shipOutput = z.object({\n experiment: z.string(),\n kept: z.string(),\n kind: z.string(),\n dryRun: z.boolean(),\n live: z.string(),\n configFile: z.string(),\n files: z.array(z.string()),\n diff: z.string().describe('unified diff of the config and the source files'),\n leftovers: z.array(z.object({ file: z.string(), line: z.number(), text: z.string(), reason: z.string() }).passthrough()),\n next: z.array(z.string()),\n}).passthrough();\n\nconst LOOP = 'The loop: splithub_plan → splithub_create_experiment → wire the code → splithub_doctor → splithub_push (cloud) → splithub_results (re-check after daysToVerdict days) → splithub_set_status finished → splithub_ship.';\n\nserver.registerTool(\n 'splithub_status',\n {\n description: `Every experiment of this project with status, visitors, days, the verdict headline, sample (verdict.sample.quality: small | ok | good), stars (verdict.sample.stars, data quality 0..5) and daysToVerdict (days until a verdict at the current traffic: schedule the next check then, do not poll). verdict guardrail_breached = do not ship that variant. The __holdout row is the project holdout (long-term impact). Start here. A finished experiment is over but its variants are still in the code: report its verdict, ask the user which variant to keep and whether to remove the test, then call splithub_ship. ${LOOP}`,\n outputSchema: statusOutput,\n },\n async () => reply(await runCli(['status']), { structured: true })\n);\n\nserver.registerTool(\n 'splithub_results',\n {\n description: 'Full verdict for one experiment: sample per variant, lift, P(beat), SRM, winner; mvt adds factors[]. verdict.status guardrail_breached means do not ship: a variant made a guardrail metric worse (verdict.guardrailBreached[]); say what broke. verdict.metrics[] has secondary metrics and guardrails. The experiment __holdout is the project holdout (long-term impact of all tests). Verdicts are sequential (always-valid, safe to check any time) and depend on sample size, not days. verdict.sample.quality is small (below the minimums), ok, or good (every variant has its share of verdict.sample.goodSample, default 5000 visitors): say it next to the verdict; it never changes the decision. verdict.sample.stars (0..5) is a data-quality score from verdict.sample.checks[] (minimum, split, goodSample, power, week; each { met, label }): report the stars and the unmet labels, never as a reason to override the verdict. Quote verdict.message verbatim, use comparisons[].sequential.pValue / sequential.ci (the plain pValue is fixed-horizon, display only: p = 0.01 there can be not significant) and relay verdict.notes[]. daysToVerdict says when to check again. If finished, ask which variant to keep, then splithub_ship.',\n inputSchema: { experiment: z.string().describe('experiment id (key)') },\n outputSchema: resultsOutput,\n },\n async ({ experiment }) => reply(await runCli(['results', experiment]), { structured: true })\n);\n\nserver.registerTool(\n 'splithub_plan',\n {\n description: 'Before creating a test: visitors per variant (and in all) to detect a relative lift `mde` on a `baseline` conversion rate, sized for the sequential verdict. With an experiment id, also the days left at its current traffic. If it takes months, suggest a bigger change or a busier page.',\n inputSchema: {\n baseline: z.number().gt(0).lt(1).describe('conversion rate today, e.g. 0.05'),\n mde: z.number().gt(0).describe('smallest relative lift worth finding, e.g. 0.1 for +10%'),\n variants: z.number().int().min(2).optional().describe('number of variants including the control (default 2)'),\n experiment: z.string().optional().describe('experiment id: adds days at its traffic'),\n },\n },\n async ({ baseline, mde, variants, experiment }) => reply(await runCli(['plan', ...(experiment ? [experiment] : []), '--baseline', String(baseline), '--mde', String(mde), ...(variants ? ['--variants', String(variants)] : [])]))\n);\n\nserver.registerTool(\n 'splithub_create_experiment',\n {\n description: `Add an experiment to splithub.config.ts (checked by reloading the file). It is written as running: it goes live when the code is deployed (and pushed in cloud mode). Tell the user that, and that splithub_set_status paused holds it. Pass status draft only when the user asks to hold it. kind: value (text/number/URL read with useValue), component (<Experiment>/<Variant> markup), redirect (match path + per-variant destination), mvt (factors instead of variants, every combination tested, read with useValue as { factor: value }). First variant / first level is the control. goodSample: total visitors at which the sample counts as good (default 5000). minDays: opt-in fewest days before a verdict (default 0 = none). Then wire the returned snippet, call splithub_doctor and splithub_refs. ${LOOP}`,\n inputSchema: {\n id: z.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).describe('experiment key, lowercase'),\n kind: z.enum(['value', 'component', 'redirect', 'mvt']),\n variants: z.array(z.string()).min(2).optional().describe('variant keys, first = control (not for mvt)'),\n factors: z.record(z.record(z.string())).optional().describe('mvt only: factor → level → value, e.g. { headline: { old: \"Old\", new: \"New\" }, button: { blue: \"#2563eb\", green: \"#16a34a\" } }; first level = control; at most 4 factors × 4 levels'),\n weights: z.array(z.number().min(0)).optional().describe('relative weights, same order as variants (not for mvt)'),\n goal: z.string().optional().describe('goal key from the config'),\n values: z.record(z.string()).optional().describe('value experiments: variant → value'),\n match: z.string().optional().describe('redirect experiments: path to test, e.g. /'),\n to: z.record(z.string()).optional().describe('redirect experiments: variant → destination path'),\n status: z.enum(['draft', 'running']).optional(),\n description: z.string().optional(),\n traffic: z.number().gt(0).max(100).optional().describe('percent of visitors in the test (default 100)'),\n maxVisitors: z.number().int().positive().optional().describe('stop counting after this many visitors'),\n minDays: z.number().int().min(0).max(30).optional().describe('opt-in fewest days before a verdict (default 0 = none); verdicts otherwise depend on sample size'),\n goodSample: z.number().int().min(100).max(10_000_000).optional().describe('total visitors at which verdict.sample.quality turns good (default 5000); informational, never changes the verdict'),\n start: z.string().optional().describe('ISO date the test starts'),\n end: z.string().optional().describe('ISO date the test ends'),\n secondary: z.array(z.string()).optional().describe('goals to watch next to the primary goal'),\n guardrails: z.array(z.union([z.string(), z.object({ goal: z.string(), worse: z.enum(['lower', 'higher']) })])).optional().describe('goals that must not get worse; { goal, worse: \"higher\" } when a rise is bad (refunds, errors). A breach makes the verdict guardrail_breached: do not ship'),\n layer: z.object({ key: z.string(), start: z.number().int().min(0).max(99), end: z.number().int().min(1).max(100) }).optional().describe('mutual exclusion: tests in one layer never share a visitor; bucket ranges [start, end) must not overlap'),\n },\n },\n async (a) => {\n const args = ['create', '--kind', a.kind, '--id', a.id, '--yes'];\n if (a.kind === 'mvt') {\n for (const [factor, levels] of Object.entries(a.factors ?? {})) args.push('--factor', `${factor}=${Object.entries(levels).map(([l, v]) => `${l}:${v}`).join(',')}`);\n } else args.push('--variants', (a.variants ?? ['control', 'b']).join(','));\n if (a.weights) args.push('--weights', a.weights.join(','));\n if (a.goal) args.push('--goal', a.goal);\n if (a.values) for (const [k, v] of Object.entries(a.values)) args.push('--value', `${k}=${v}`);\n if (a.match) args.push('--match', a.match);\n if (a.to) for (const [k, v] of Object.entries(a.to)) args.push('--to', `${k}=${v}`);\n if (a.status) args.push('--status', a.status);\n if (a.description) args.push('--description', a.description);\n if (a.traffic !== undefined) args.push('--traffic', String(a.traffic));\n if (a.maxVisitors !== undefined) args.push('--max-visitors', String(a.maxVisitors));\n if (a.minDays !== undefined) args.push('--min-days', String(a.minDays));\n if (a.goodSample !== undefined) args.push('--good-sample', String(a.goodSample));\n if (a.start) args.push('--start', a.start);\n if (a.end) args.push('--end', a.end);\n if (a.secondary?.length) args.push('--secondary', a.secondary.join(','));\n if (a.guardrails?.length) args.push('--guardrail', a.guardrails.map((g) => (typeof g === 'string' ? g : `${g.goal}:${g.worse}`)).join(','));\n if (a.layer) args.push('--layer', `${a.layer.key}:${a.layer.start}-${a.layer.end}`);\n return reply(await runCli(args));\n }\n);\n\nserver.registerTool(\n 'splithub_set_status',\n {\n description: 'Start, pause or finish an experiment. The config file is updated (and checked); in cloud mode it applies live within a minute. After finishing, the variants are still in the code: ask the user which variant to keep, then call splithub_ship.',\n inputSchema: { experiment: z.string(), status: z.enum(['running', 'paused', 'finished']) },\n },\n async ({ experiment, status }) => {\n const cmd = status === 'running' ? 'start' : status === 'paused' ? 'pause' : 'finish';\n return reply(await runCli([cmd, experiment]));\n }\n);\n\nserver.registerTool(\n 'splithub_refs',\n {\n description: 'Files and lines that use an experiment id or its goal. Use after wiring code (is it referenced?) and after splithub_ship (count should be 0 for the experiment).',\n inputSchema: { experiment: z.string() },\n outputSchema: refsOutput,\n },\n async ({ experiment }) => reply(await runCli(['refs', experiment]), { structured: true })\n);\n\nserver.registerTool(\n 'splithub_ship',\n {\n description: 'Keep one variant and take the test out: archives it in the cloud (numbers stay readable), removes it from splithub.config.ts and rewrites the code (<Experiment> → the kept <Variant>, useValue → the kept literal, useVariant branches folded, unused imports dropped). Ask the user which variant to keep first (recommend verdict.winner; never a variant listed in verdict.guardrailBreached). Call with dryRun: true, show the diff, then without. Fix leftovers[] by hand, then follow next[] (push, doctor, tests).',\n inputSchema: { experiment: z.string(), keep: z.string().describe('variant key to keep'), dryRun: z.boolean().optional().describe('only return the diff') },\n outputSchema: shipOutput,\n },\n async ({ experiment, keep, dryRun }) => reply(await runCli(['ship', experiment, '--keep', keep, ...(dryRun ? ['--dry-run'] : [])]), { structured: true })\n);\n\nserver.registerTool(\n 'splithub_remove',\n {\n description: 'Remove an experiment from splithub.config.ts (and archive it in the cloud when connected) without touching the code. Prefer splithub_ship, which also cleans the code. Returns refs still in the code.',\n inputSchema: { experiment: z.string() },\n },\n async ({ experiment }) => reply(await runCli(['remove', experiment]))\n);\n\nserver.registerTool(\n 'splithub_review',\n { description: 'AI reviews of an experiment stored in SplitHub Cloud (Pro): written at the start, when the verdict changes while it runs, when it finishes, or on demand in the dashboard. Newest first. Quote them as an opinion; the verdict stays the source of truth.', inputSchema: { experiment: z.string().optional().describe('experiment id; omit for every experiment of the project') } },\n async ({ experiment }) => reply(await runCli(experiment ? ['review', experiment] : ['review']))\n);\n\nserver.registerTool('splithub_push', { description: 'Upload splithub.config.ts to SplitHub Cloud (cloud mode). Returns experiments created in the dashboard that were written into the file. dryRun: only check the config and show what would change.', inputSchema: { dryRun: z.boolean().optional() } }, async ({ dryRun }) => reply(await runCli(dryRun ? ['push', '--dry-run'] : ['push'])));\nserver.registerTool('splithub_pull', { description: 'Fetch the cloud config and write dashboard-created experiments into splithub.config.ts.' }, async () => reply(await runCli(['pull'])));\nserver.registerTool('splithub_doctor', { description: 'Check the installation: config, provider, middleware, routes, code references, endpoint. Run after wiring code; ok: false lists what to fix.' }, async () => reply(await runCli(['doctor'])));\nserver.registerTool('splithub_whoami', { description: 'Which cloud project this folder is connected to, and its public key.' }, async () => reply(await runCli(['whoami'])));\nserver.registerTool('splithub_projects', { description: 'Every folder on this machine connected to a SplitHub Cloud project, the current one marked (current).' }, async () => reply(await runCli(['projects'])));\n\nserver.registerTool('splithub_login', { description: 'Connect this folder to SplitHub Cloud. Returns a sign-in link and a code: show them to the user, who approves in the browser (and can create a project there). The CLI then stores a project API key for this folder. Call splithub_whoami afterwards.' }, async () => {\n const r = await startLogin();\n if ('error' in r) return { content: [{ type: 'text' as const, text: JSON.stringify(r) }], isError: r.error !== 'already logged in' };\n return { content: [{ type: 'text' as const, text: `Open this link to connect: ${r.verifyUrl}\\nCode: ${r.userCode} (expires in ${Math.round(r.expiresIn / 60)} min)\\nWaiting for the approval in the background; call splithub_whoami to check.` }] };\n});\n\nserver.registerTool(\n 'splithub_init',\n { description: 'Set up SplitHub in this project: config file, framework files, agent skills; in cloud mode see splithub_login to connect. Use once per project. githubAction: also write a GitHub workflow (checks on PRs, results comment on a schedule).', inputSchema: { mode: z.enum(['cloud', 'self']).default('cloud'), key: z.string().optional().describe('public key pk_… when known'), githubAction: z.boolean().optional() } },\n async ({ mode, key, githubAction }) => {\n const args = ['init', '--mode', mode, '--yes', '--no-install', '--no-login'];\n if (key) args.push('--key', key);\n if (githubAction) args.push('--github-action');\n return reply(await runCli(args, { timeoutMs: 120_000 }));\n }\n);\n\nconst transport = new StdioServerTransport();\nawait server.connect(transport);\n","// Runs the splithub CLI as a child process with --json and parses the reply.\n// The MCP server is a thin layer: credentials, config parsing and the cloud\n// protocol stay in one place (the CLI).\nimport { spawn } from 'node:child_process';\nimport { createRequire } from 'node:module';\n\nconst require = createRequire(import.meta.url);\n\nexport function cliPath(): string {\n if (process.env.SPLITHUB_CLI) return process.env.SPLITHUB_CLI;\n return require.resolve('splithub/dist/index.js');\n}\n\nexport function projectDir(): string {\n return process.env.SPLITHUB_PROJECT_DIR || process.cwd();\n}\n\n/** What the CLI prints with --json when a command fails. */\nexport interface CliErrorBody {\n error: string;\n code: string;\n hint?: string;\n}\n\nexport interface CliResult {\n code: number;\n stdout: string;\n stderr: string;\n json: unknown;\n}\n\n/**\n * The CLI prints one line of JSON per --json command; init and login print a step\n * line first (the sign-in link), so the result is the last JSON line.\n */\nexport function parseJson(text: string): unknown {\n const lines = text\n .split('\\n')\n .map((l) => l.trim())\n .filter((l) => l.startsWith('{') || l.startsWith('['));\n for (let i = lines.length - 1; i >= 0; i--) {\n try {\n return JSON.parse(lines[i]!);\n } catch {\n // not JSON after all; try the line before\n }\n }\n return null;\n}\n\nexport function errorBody(json: unknown): CliErrorBody | null {\n const j = json as Partial<CliErrorBody> | null;\n return j && typeof j.error === 'string' && typeof j.code === 'string' ? (j as CliErrorBody) : null;\n}\n\nexport function runCli(args: string[], options: { timeoutMs?: number } = {}): Promise<CliResult> {\n const extra: string[] = [];\n if (process.env.SPLITHUB_API) extra.push('--api', process.env.SPLITHUB_API);\n return new Promise((resolve) => {\n const child = spawn(process.execPath, [cliPath(), ...args, ...extra, '--json'], { cwd: projectDir(), env: { ...process.env, NO_COLOR: '1' }, stdio: ['ignore', 'pipe', 'pipe'] });\n let stdout = '';\n let stderr = '';\n child.stdout.on('data', (d) => (stdout += d));\n child.stderr.on('data', (d) => (stderr += d));\n const timer = setTimeout(() => child.kill(), options.timeoutMs ?? 60_000);\n child.on('close', (code) => {\n clearTimeout(timer);\n resolve({ code: code ?? 1, stdout, stderr, json: parseJson(stdout) });\n });\n });\n}\n\n/**\n * `login` prints the sign-in link first and then waits (up to 10 min) for the\n * approval. Return the link at once and let the process finish on its own.\n */\nexport function startLogin(): Promise<{ verifyUrl: string; userCode: string; expiresIn: number } | { error: string; code?: string }> {\n const extra: string[] = [];\n if (process.env.SPLITHUB_API) extra.push('--api', process.env.SPLITHUB_API);\n return new Promise((resolve) => {\n const child = spawn(process.execPath, [cliPath(), 'login', '--yes', ...extra, '--json'], { cwd: projectDir(), env: { ...process.env, NO_COLOR: '1' }, stdio: ['ignore', 'pipe', 'pipe'], detached: false });\n let buf = '';\n let done = false;\n child.stdout.on('data', (d) => {\n buf += d;\n if (done) return;\n for (const line of buf.split('\\n')) {\n if (!line.trim().startsWith('{')) continue;\n try {\n const j = JSON.parse(line) as { step?: string; verifyUrl?: string; userCode?: string; expiresIn?: number; alreadyLoggedIn?: boolean; error?: string; code?: string };\n if (j.step === 'approve' && j.verifyUrl) {\n done = true;\n resolve({ verifyUrl: j.verifyUrl, userCode: j.userCode ?? '', expiresIn: j.expiresIn ?? 600 });\n } else if (j.alreadyLoggedIn) {\n done = true;\n resolve({ error: 'already logged in' });\n } else if (typeof j.error === 'string') {\n done = true;\n resolve({ error: j.error, ...(j.code ? { code: j.code } : {}) });\n }\n } catch {\n // partial line\n }\n }\n });\n child.on('close', (code) => {\n if (!done) resolve({ error: `login exited with code ${code}: ${buf.slice(0, 300)}` });\n });\n child.unref();\n });\n}\n"],"mappings":";;;AASA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,iBAAAA,sBAAqB;AAC9B,SAAS,SAAS;;;ACTlB,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAE9B,IAAMC,WAAU,cAAc,YAAY,GAAG;AAEtC,SAAS,UAAkB;AAChC,MAAI,QAAQ,IAAI,aAAc,QAAO,QAAQ,IAAI;AACjD,SAAOA,SAAQ,QAAQ,wBAAwB;AACjD;AAEO,SAAS,aAAqB;AACnC,SAAO,QAAQ,IAAI,wBAAwB,QAAQ,IAAI;AACzD;AAoBO,SAAS,UAAU,MAAuB;AAC/C,QAAM,QAAQ,KACX,MAAM,IAAI,EACV,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,OAAO,CAAC,MAAM,EAAE,WAAW,GAAG,KAAK,EAAE,WAAW,GAAG,CAAC;AACvD,WAAS,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK;AAC1C,QAAI;AACF,aAAO,KAAK,MAAM,MAAM,CAAC,CAAE;AAAA,IAC7B,QAAQ;AAAA,IAER;AAAA,EACF;AACA,SAAO;AACT;AAEO,SAAS,UAAU,MAAoC;AAC5D,QA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plitHub as MCP tools for Claude Code, Cursor and Codex: create tests, start and finish them, read verdicts.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/splithub-io/splithub-sdk.git",
|
|
9
|
+
"directory": "packages/mcp"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://splithub.io",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/splithub-io/splithub-sdk/issues"
|
|
14
|
+
},
|
|
6
15
|
"type": "module",
|
|
7
16
|
"bin": {
|
|
8
17
|
"splithub-mcp": "./dist/index.js"
|
|
@@ -16,7 +25,7 @@
|
|
|
16
25
|
"dependencies": {
|
|
17
26
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
18
27
|
"zod": "^3.23.8",
|
|
19
|
-
"splithub": "0.1
|
|
28
|
+
"splithub": "0.2.1"
|
|
20
29
|
},
|
|
21
30
|
"devDependencies": {
|
|
22
31
|
"@types/node": "^22.13.0",
|
|
@@ -27,7 +36,6 @@
|
|
|
27
36
|
"publishConfig": {
|
|
28
37
|
"access": "public"
|
|
29
38
|
},
|
|
30
|
-
"homepage": "https://splithub.io",
|
|
31
39
|
"scripts": {
|
|
32
40
|
"build": "tsup",
|
|
33
41
|
"test": "vitest run",
|