@splithub/mcp 0.5.0 → 0.6.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 +4 -4
- package/dist/index.js +112 -26
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @splithub/mcp
|
|
2
2
|
|
|
3
|
-
MCP server for
|
|
3
|
+
MCP server for sh2. Lets Claude Code, Cursor, Codex or any MCP client run experiments
|
|
4
4
|
(create, start, pause, finish, read verdicts, ship the winner) and read analytics (traffic,
|
|
5
5
|
sources, funnels, paths, retention, realtime) through tools, on websites and in apps (React
|
|
6
6
|
Native, Expo, iOS, Android), with the same config file and credentials as the `splithub` CLI.
|
|
@@ -37,10 +37,10 @@ Apps:
|
|
|
37
37
|
The old names `splithub_create_experiment`, `splithub_set_status`, `splithub_create_property` and
|
|
38
38
|
`splithub_set_property_status` still work for one release.
|
|
39
39
|
|
|
40
|
-
With
|
|
40
|
+
With sh2 Cloud, results carry the verdict (`verdict.message`), a friendly line (`voice.line`)
|
|
41
41
|
and ready-to-show text (`display`). Self-hosted projects get raw numbers only
|
|
42
|
-
(`analysis.available: false`): the agent reports them and says verdicts come with
|
|
43
|
-
`splithub_plan` asks
|
|
42
|
+
(`analysis.available: false`): the agent reports them and says verdicts come with sh2 Cloud.
|
|
43
|
+
`splithub_plan` asks sh2 Cloud for the sample size; no account needed.
|
|
44
44
|
|
|
45
45
|
Env: `SPLITHUB_PROJECT_DIR` (defaults to the client's cwd), `SPLITHUB_API` (staging / self-hosted cloud),
|
|
46
46
|
`SPLITHUB_API_KEY` (CI), `SPLITHUB_CLI` (path to a specific CLI build).
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,93 @@ function errorBody(json) {
|
|
|
31
31
|
const j = json;
|
|
32
32
|
return j && typeof j.error === "string" && typeof j.code === "string" ? j : null;
|
|
33
33
|
}
|
|
34
|
+
var TOOL_FLAGS = new Set([
|
|
35
|
+
"baseline",
|
|
36
|
+
"before",
|
|
37
|
+
"by",
|
|
38
|
+
"compare",
|
|
39
|
+
"conversions",
|
|
40
|
+
"cooldown",
|
|
41
|
+
"count",
|
|
42
|
+
"day",
|
|
43
|
+
"days",
|
|
44
|
+
"delete",
|
|
45
|
+
"description",
|
|
46
|
+
"disabled",
|
|
47
|
+
"drop-loser",
|
|
48
|
+
"dry-run",
|
|
49
|
+
"end",
|
|
50
|
+
"engagement",
|
|
51
|
+
"event",
|
|
52
|
+
"events",
|
|
53
|
+
"every",
|
|
54
|
+
"experiment",
|
|
55
|
+
"factor",
|
|
56
|
+
"filter",
|
|
57
|
+
"finish",
|
|
58
|
+
"force",
|
|
59
|
+
"from",
|
|
60
|
+
"funnel",
|
|
61
|
+
"github-action",
|
|
62
|
+
"goal",
|
|
63
|
+
"goals",
|
|
64
|
+
"good-sample",
|
|
65
|
+
"guardrail",
|
|
66
|
+
"hours",
|
|
67
|
+
"id",
|
|
68
|
+
"keep",
|
|
69
|
+
"key",
|
|
70
|
+
"kind",
|
|
71
|
+
"layer",
|
|
72
|
+
"lift",
|
|
73
|
+
"limit",
|
|
74
|
+
"match",
|
|
75
|
+
"max-visitors",
|
|
76
|
+
"mde",
|
|
77
|
+
"min-days",
|
|
78
|
+
"min-visitors",
|
|
79
|
+
"mode",
|
|
80
|
+
"name",
|
|
81
|
+
"no-install",
|
|
82
|
+
"no-login",
|
|
83
|
+
"page",
|
|
84
|
+
"pause",
|
|
85
|
+
"percent",
|
|
86
|
+
"period",
|
|
87
|
+
"prev",
|
|
88
|
+
"property",
|
|
89
|
+
"prune",
|
|
90
|
+
"repeat",
|
|
91
|
+
"replace",
|
|
92
|
+
"return",
|
|
93
|
+
"same",
|
|
94
|
+
"save",
|
|
95
|
+
"secondary",
|
|
96
|
+
"segment",
|
|
97
|
+
"slug",
|
|
98
|
+
"start",
|
|
99
|
+
"status",
|
|
100
|
+
"steps",
|
|
101
|
+
"timeline",
|
|
102
|
+
"to",
|
|
103
|
+
"traffic",
|
|
104
|
+
"type",
|
|
105
|
+
"value",
|
|
106
|
+
"variants",
|
|
107
|
+
"visitors",
|
|
108
|
+
"weights",
|
|
109
|
+
"within",
|
|
110
|
+
"yes"
|
|
111
|
+
].map((f) => `--${f}`));
|
|
112
|
+
function unsafeArg(args) {
|
|
113
|
+
return args.find((a) => a.startsWith("-") && !TOOL_FLAGS.has(a)) ?? null;
|
|
114
|
+
}
|
|
34
115
|
function runCli(args, options = {}) {
|
|
116
|
+
const bad = unsafeArg(args);
|
|
117
|
+
if (bad !== null) {
|
|
118
|
+
const json = { error: `"${bad.slice(0, 80)}" is not a value the tool can pass on: values cannot start with "-".`, code: "INVALID_ARGUMENT", hint: "Use the id, host or text without a leading dash." };
|
|
119
|
+
return Promise.resolve({ code: 1, stdout: JSON.stringify(json), stderr: "", json });
|
|
120
|
+
}
|
|
35
121
|
const extra = [];
|
|
36
122
|
if (process.env.SPLITHUB_API) extra.push("--api", process.env.SPLITHUB_API);
|
|
37
123
|
return new Promise((resolve) => {
|
|
@@ -86,7 +172,7 @@ function startLogin() {
|
|
|
86
172
|
var pkg = createRequire2(import.meta.url)("../package.json");
|
|
87
173
|
var server = new McpServer({ name: "splithub", version: pkg.version });
|
|
88
174
|
var NEXT_BY_CODE = {
|
|
89
|
-
NOT_LOGGED_IN: "This folder is not connected to
|
|
175
|
+
NOT_LOGGED_IN: "This folder is not connected to sh2 Cloud: call splithub_login, show the link to the user, wait for their approval, then retry.",
|
|
90
176
|
NO_CONFIG: "No splithub.config.ts here: call splithub_init first (or set SPLITHUB_PROJECT_DIR to the app folder).",
|
|
91
177
|
EXPERIMENT_NOT_FOUND: "Call splithub_status for the experiment ids.",
|
|
92
178
|
CONFIG_UNSAFE: "Edit splithub.config.ts by hand where the experiment is defined, then call splithub_doctor.",
|
|
@@ -94,7 +180,7 @@ var NEXT_BY_CODE = {
|
|
|
94
180
|
CONFIG_PARSE: "Fix the error in splithub.config.ts, then call splithub_doctor.",
|
|
95
181
|
KEY_CONFLICT: "The key already belongs to another experiment in the cloud. Ask the user whether this is a new experiment (rename the key, or splithub_push with replace: the old numbers are cleared) or the same experiment (splithub_push with same). Never pick for them.",
|
|
96
182
|
KEY_DELETED: "A deleted experiment used this key. Rename the experiment key in splithub.config.ts (and in the code), then call splithub_push again.",
|
|
97
|
-
NOT_CLOUD: "This project stores events in its own database (self-hosted). Experiment slices, breakdowns, timelines, engagement, events by variant and raw events, push, funnels, paths, retention, realtime, segments, notes, links and alerts come with
|
|
183
|
+
NOT_CLOUD: "This project stores events in its own database (self-hosted). Experiment slices, breakdowns, timelines, engagement, events by variant and raw events, push, funnels, paths, retention, realtime, segments, notes, links and alerts come with sh2 Cloud: tell the user; splithub_analytics still reads raw counts.",
|
|
98
184
|
PRO_REQUIRED: "Alert rules fire on Pro. Tell the user; they upgrade in the dashboard (Billing), then the rule can be turned on.",
|
|
99
185
|
NOT_FOUND: "Call the same tool with action list for the ids.",
|
|
100
186
|
INSUFFICIENT_SCOPE: "This API key lacks the scope named in `scope` (e.g. notes:write). Ask the user for a key with it (dashboard, Settings, API keys) or call splithub_login again."
|
|
@@ -112,12 +198,12 @@ function reply(r, options = {}) {
|
|
|
112
198
|
}
|
|
113
199
|
var voiceShape = z.object({ scenario: z.string(), line: z.string(), advice: z.enum(["wait", "ship", "keep_control", "move_on", "fix_setup", "hold"]) }).passthrough().describe("friendly line for humans; quote verdict.message for facts. advice move_on = suggest finishing and starting the next experiment");
|
|
114
200
|
var displayShape = z.object({ label: z.string(), lines: z.array(z.string()), next: z.string().optional() }).passthrough().describe("ready-to-print label (WINNER, TOO EARLY, ...), lines and next step, for showing the result");
|
|
115
|
-
var analysisShape = z.object({ available: z.literal(false), message: z.string(), url: z.string() }).passthrough().describe("self-hosted: raw numbers only. Tell the user verdicts come with
|
|
201
|
+
var analysisShape = z.object({ available: z.literal(false), message: z.string(), url: z.string() }).passthrough().describe("self-hosted: raw numbers only. Tell the user verdicts come with sh2 Cloud; never invent one");
|
|
116
202
|
var verdictShape = z.object({ status: z.string(), message: z.string(), winner: z.string().nullable().optional(), notes: z.array(z.string()).optional() }).passthrough();
|
|
117
203
|
var statusOutput = z.object({
|
|
118
204
|
project: z.string(),
|
|
119
205
|
experiments: z.array(z.object({ experiment: z.string(), kind: z.string(), status: z.string(), visitors: z.number(), days: z.number(), verdict: z.string().nullable().optional(), headline: z.string().nullable().optional(), sample: z.enum(["small", "ok", "good"]).nullable().optional(), stars: z.number().nullable().optional(), daysToVerdict: z.number().nullable().optional(), voice: voiceShape.nullable().optional(), display: displayShape.optional() }).passthrough()),
|
|
120
|
-
properties: z.array(z.object({ property: z.string(), name: z.string(), status: z.string(), visitors: z.number(), previousVisitors: z.number(), change: z.number().nullable(), conversions: z.array(z.object({ goal: z.string(), conversions: z.number(), change: z.number().nullable() }).passthrough()) }).passthrough()).optional().describe("
|
|
206
|
+
properties: z.array(z.object({ property: z.string(), name: z.string(), status: z.string(), visitors: z.number(), previousVisitors: z.number(), change: z.number().nullable(), conversions: z.array(z.object({ goal: z.string(), conversions: z.number(), change: z.number().nullable() }).passthrough()) }).passthrough()).optional().describe("sh2 Cloud: analytics properties, last 7 days (propertiesRange) against the 7 before; change is relative, null = no visitors before"),
|
|
121
207
|
propertiesRange: z.object({ from: z.string(), to: z.string() }).optional(),
|
|
122
208
|
analysis: analysisShape.optional(),
|
|
123
209
|
next: z.string().optional()
|
|
@@ -130,7 +216,7 @@ var resultsOutput = z.object({
|
|
|
130
216
|
status: z.string().optional(),
|
|
131
217
|
goal: z.string().nullable().optional(),
|
|
132
218
|
scope: scopeShape.optional(),
|
|
133
|
-
verdict: verdictShape.optional().describe("
|
|
219
|
+
verdict: verdictShape.optional().describe("sh2 Cloud only"),
|
|
134
220
|
daysToVerdict: z.number().nullable().optional().describe("days until a verdict at the current traffic; schedule the next check then"),
|
|
135
221
|
voice: voiceShape.nullable().optional(),
|
|
136
222
|
display: displayShape.optional(),
|
|
@@ -173,7 +259,7 @@ var LOOP = "The loop: splithub_plan \u2192 splithub_experiment_create \u2192 wir
|
|
|
173
259
|
server.registerTool(
|
|
174
260
|
"splithub_status",
|
|
175
261
|
{
|
|
176
|
-
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). properties[] (
|
|
262
|
+
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). properties[] (sh2 Cloud) is each analytics property's last 7 days against the 7 before (visitors, change, goal conversions): mention a big move; splithub_analytics has the details. 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 experiment, then call splithub_ship. display { label, lines, next } is ready to show; voice.line is the friendly line for humans; voice.advice move_on means suggest finishing the experiment and starting the next one. If analysis.available is false the project is self-hosted: report the raw numbers as they are, say verdicts come with sh2 Cloud (analysis.url), and never call a winner from raw rates. ${LOOP}`,
|
|
177
263
|
outputSchema: statusOutput
|
|
178
264
|
},
|
|
179
265
|
async () => reply(await runCli(["status"]), { structured: true })
|
|
@@ -181,7 +267,7 @@ server.registerTool(
|
|
|
181
267
|
server.registerTool(
|
|
182
268
|
"splithub_results",
|
|
183
269
|
{
|
|
184
|
-
description: "Results of one experiment.
|
|
270
|
+
description: "Results of one experiment. sh2 Cloud gives the full verdict: 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 experiments). 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. Facts are in verdict.message; voice.line is the friendly line for humans (voice.advice move_on = suggest finishing the experiment and starting the next one); display { label, lines, next } is ready to show. If analysis.available is false the project is self-hosted: report the raw numbers as they are, say verdicts come with sh2 Cloud (analysis.url), and never call a winner from raw rates. If finished, ask which variant to keep, then splithub_ship. SLICE (sh2 Cloud): from / to (YYYY-MM-DD, project time zone) keep the visitors first exposed on those days, filters keep visitors by country, device, platform (ios, android, web\u2026), app_version, source, channel, landing page, UTM\u2026; the answer carries scope and the verdict is computed on that slice only: say so and quote scope.note, the decision stays with the unfiltered verdict. A slice carries no voice and no advice (numbers only): never suggest shipping or finishing from one. VIEWS (one at a time, same from / to / filters; the answer has view set): by splits visitors by a dimension, segments[] each with cells per variant (order[] = variants, control first) and comparisons[] (lift vs the control inside the segment, pValue, significant, better; small = too few visitors); timeline gives exposures[] and conversions[] per day and variant (a day = visitors first seen that day, conversions whenever they happened); engagement gives bounce rate, pages per visit and avgVisit (ms) per variant from the analytics property on the same visitors (property null = no analytics there); events gives rows[] for every goal (measured goal / metric / guardrail first) and event of these visitors, each with perVariant visitors and rate and comparisons[] against the control (property null = goals only, other events need analytics on the same site). Segments, engagement and events are for exploring: never call a winner from one segment or one event.",
|
|
185
271
|
inputSchema: {
|
|
186
272
|
experiment: z.string().describe("experiment id (key)"),
|
|
187
273
|
from: z.string().regex(DAY).optional().describe("first-exposure day, from (inclusive)"),
|
|
@@ -199,7 +285,7 @@ server.registerTool(
|
|
|
199
285
|
server.registerTool(
|
|
200
286
|
"splithub_experiment_events",
|
|
201
287
|
{
|
|
202
|
-
description: "The latest raw events of one experiment (
|
|
288
|
+
description: "The latest raw events of one experiment (sh2 Cloud, newest first): exposures (type exposure, the variant a visitor saw) and goals (type goal) with time, visitor, url, country. Same from / to / filters as splithub_results; type keeps one kind; nextBefore pages to older ones (pass it as before). Raw events stay 7 days (30 on Pro); the key needs events:read. Use to check that exposures and goals arrive after wiring code.",
|
|
203
289
|
inputSchema: {
|
|
204
290
|
experiment: z.string().describe("experiment id (key)"),
|
|
205
291
|
type: z.enum(["exposure", "goal"]).optional(),
|
|
@@ -215,7 +301,7 @@ server.registerTool(
|
|
|
215
301
|
server.registerTool(
|
|
216
302
|
"splithub_plan",
|
|
217
303
|
{
|
|
218
|
-
description: "Before creating an experiment: visitors per variant (and in all) to detect a relative lift `mde` on a `baseline` conversion rate, sized by
|
|
304
|
+
description: "Before creating an experiment: visitors per variant (and in all) to detect a relative lift `mde` on a `baseline` conversion rate, sized by sh2 Cloud for its sequential verdict (no account needed; fails with UNREACHABLE offline). With an experiment id, also the days left at its current traffic when its numbers are readable. If it takes months, suggest a bigger change or a busier page.",
|
|
219
305
|
inputSchema: {
|
|
220
306
|
baseline: z.number().gt(0).lt(1).describe("conversion rate today, e.g. 0.05"),
|
|
221
307
|
mde: z.number().gt(0).describe("smallest relative lift worth finding, e.g. 0.1 for +10%"),
|
|
@@ -313,7 +399,7 @@ var BY = ["source", "referrer", "channel", "utm_source", "utm_medium", "utm_camp
|
|
|
313
399
|
server.registerTool(
|
|
314
400
|
"splithub_analytics",
|
|
315
401
|
{
|
|
316
|
-
description: `Analytics properties (pageviews or app screens, and custom events, no variants). A property is kind site or app; in an app a screen is a page (url /ScreenName) and platform / app_version are dimensions for by and filters. Without property: every property with visitors, visits, pageviews and bounce for the last 30 days. With property: totals (visitors, newVisitors, sessions = visits, pageviews, events, bounces, duration in ms; bounce rate = bounces / sessions), goals (conversions = unique visitors who reached it in the range, completions = how many times, revenue), topPages and topSources (value "(none)" = direct). With by: rows grouped by a visit dimension, page, event or goal; goal adds that goal's conversions per row; variant (needs experiment) splits visits by the variant each visitor saw, trait (needs key) by an identify() trait. Range: days (last N days) or from / to (YYYY-MM-DD, project time zone). filters narrow the visits, e.g. { country: "DE,FR", source: "(none)" }. Self-hosted projects get raw counts only (analysis.available false): report them as they are and say full reports come with
|
|
402
|
+
description: `Analytics properties (pageviews or app screens, and custom events, no variants). A property is kind site or app; in an app a screen is a page (url /ScreenName) and platform / app_version are dimensions for by and filters. Without property: every property with visitors, visits, pageviews and bounce for the last 30 days. With property: totals (visitors, newVisitors, sessions = visits, pageviews, events, bounces, duration in ms; bounce rate = bounces / sessions), goals (conversions = unique visitors who reached it in the range, completions = how many times, revenue), topPages and topSources (value "(none)" = direct). With by: rows grouped by a visit dimension, page, event or goal; goal adds that goal's conversions per row; variant (needs experiment) splits visits by the variant each visitor saw, trait (needs key) by an identify() trait. Range: days (last N days) or from / to (YYYY-MM-DD, project time zone). filters narrow the visits, e.g. { country: "DE,FR", source: "(none)" }. Self-hosted projects get raw counts only (analysis.available false): report them as they are and say full reports come with sh2 Cloud. compare adds previous (the compared range, with its dates in previous.range) for change against it: 'previous' (the same-length range right before), 'year' (the same days a year earlier) or 'YYYY-MM-DD..YYYY-MM-DD'. segment applies a saved segment (splithub_segments) by name or id. These are counts, not experiments: no verdicts, never call a winner from them.`,
|
|
317
403
|
inputSchema: {
|
|
318
404
|
property: z.string().optional().describe("property id; omit to list every property"),
|
|
319
405
|
by: z.enum(BY).optional(),
|
|
@@ -343,7 +429,7 @@ server.registerTool(
|
|
|
343
429
|
server.registerTool(
|
|
344
430
|
"splithub_analytics_funnel",
|
|
345
431
|
{
|
|
346
|
-
description: `Funnel of an analytics property (
|
|
432
|
+
description: `Funnel of an analytics property (sh2 Cloud): visitors who reached each step in order. Steps: page:/path (patterns like page:/blog/* work), event:<name>, goal:<key>; 2 to 8. Or funnel: a saved funnel's name or id (splithub_analytics_funnels), which brings its steps and within. within: visit (same visit, default), 7d or 30d (from the first step). Answers steps[] with visitors, conversion (share of the first step) and dropoff (share lost since the step before); by splits it by a visit dimension. rolledUp: days older than 90 count nothing. Counts, not an experiment: never call a winner from it.`,
|
|
347
433
|
inputSchema: {
|
|
348
434
|
property: z.string(),
|
|
349
435
|
steps: z.array(z.string()).min(2).max(8).optional().describe('e.g. ["page:/", "event:Signup", "goal:paid"]; omit with funnel'),
|
|
@@ -358,7 +444,7 @@ server.registerTool(
|
|
|
358
444
|
server.registerTool(
|
|
359
445
|
"splithub_analytics_funnels",
|
|
360
446
|
{
|
|
361
|
-
description: "Saved funnels of an analytics property (
|
|
447
|
+
description: "Saved funnels of an analytics property (sh2 Cloud), shown on its Funnels tab for the whole team. Without save or delete: the list (id, name, steps, within). save + steps: save one under that name (a name already saved updates it; steps and within as in splithub_analytics_funnel). delete: remove one by id or name. Run one with splithub_analytics_funnel { funnel }.",
|
|
362
448
|
inputSchema: {
|
|
363
449
|
property: z.string(),
|
|
364
450
|
save: z.string().max(60).optional().describe("name of the funnel to save or update"),
|
|
@@ -376,7 +462,7 @@ server.registerTool(
|
|
|
376
462
|
server.registerTool(
|
|
377
463
|
"splithub_analytics_paths",
|
|
378
464
|
{
|
|
379
|
-
description: "Where visits went right after a page (or, with direction prev, where they came from), within the visit (
|
|
465
|
+
description: "Where visits went right after a page (or, with direction prev, where they came from), within the visit (sh2 Cloud). rows[] { value, visits }; (exit) = left the site, (entrance) = landed on the page.",
|
|
380
466
|
inputSchema: { property: z.string(), page: z.string().describe("a path like /pricing or /blog/*"), direction: z.enum(["next", "prev"]).optional(), ...RANGE }
|
|
381
467
|
},
|
|
382
468
|
async (a) => reply(await runCli(["analytics", "paths", a.property, "--page", a.page, ...a.direction === "prev" ? ["--prev"] : [], ...rangeArgs(a)]))
|
|
@@ -384,7 +470,7 @@ server.registerTool(
|
|
|
384
470
|
server.registerTool(
|
|
385
471
|
"splithub_analytics_retention",
|
|
386
472
|
{
|
|
387
|
-
description: "Retention cohorts of an analytics property (
|
|
473
|
+
description: "Retention cohorts of an analytics property (sh2 Cloud), the key report for apps: users grouped by the day or week they started (start: visit, event:<name> or goal:<key>), and how many came back (return: visit or event:<name>) in period 0, 1, 2\u2026 cohorts[] { start, users, retained[] }; retained[0] is the cohort period itself, retained[i] / users is the share. Ranges longer than 90 days / 26 weeks are cut (clamped: true). Default: start visit, return visit, period week. filters take platform (ios, android, web\u2026) and app_version too. Counts, not an experiment.",
|
|
388
474
|
inputSchema: {
|
|
389
475
|
property: z.string(),
|
|
390
476
|
start: z.string().optional().describe("visit | event:<name> | goal:<key>"),
|
|
@@ -398,7 +484,7 @@ server.registerTool(
|
|
|
398
484
|
server.registerTool(
|
|
399
485
|
"splithub_analytics_realtime",
|
|
400
486
|
{
|
|
401
|
-
description: "Who is on an analytics property right now (
|
|
487
|
+
description: "Who is on an analytics property right now (sh2 Cloud): activeVisitors5m, pageviews and events per minute over the last 30 minutes, top pages and sources. Use to confirm tracking works after a deploy.",
|
|
402
488
|
inputSchema: { property: z.string() }
|
|
403
489
|
},
|
|
404
490
|
async ({ property }) => reply(await runCli(["analytics", "realtime", property]))
|
|
@@ -406,7 +492,7 @@ server.registerTool(
|
|
|
406
492
|
server.registerTool(
|
|
407
493
|
"splithub_segments",
|
|
408
494
|
{
|
|
409
|
-
description: 'Saved segments: named report filters every report can apply (segment on splithub_analytics, funnel, paths, retention). Without arguments: the list. save + filters: save one (filters like { country: "DE,FR", channel: "Paid Search" }; property limits it to one property). delete: remove one by id or name.
|
|
495
|
+
description: 'Saved segments: named report filters every report can apply (segment on splithub_analytics, funnel, paths, retention). Without arguments: the list. save + filters: save one (filters like { country: "DE,FR", channel: "Paid Search" }; property limits it to one property). delete: remove one by id or name. sh2 Cloud.',
|
|
410
496
|
inputSchema: {
|
|
411
497
|
save: z.string().max(60).optional().describe("name of the segment to save"),
|
|
412
498
|
filters: z.record(z.string()).optional().describe("dimension \u2192 comma-separated values"),
|
|
@@ -424,7 +510,7 @@ server.registerTool(
|
|
|
424
510
|
server.registerTool(
|
|
425
511
|
"splithub_notes",
|
|
426
512
|
{
|
|
427
|
-
description: "Notes: what happened on a day (a launch, an outage, a campaign), shown on experiment timelines and analytics charts (
|
|
513
|
+
description: "Notes: what happened on a day (a launch, an outage, a campaign), shown on experiment timelines and analytics charts (sh2 Cloud). action list (default): newest first; experiment or property narrows it (project-wide notes come too), kind filters, days / from / to set the range. add: text (day defaults to today in the project time zone; kind note | issue | win; experiment or property ties it to one, none = the whole project). edit: id + text / kind / day. delete: id. Add one when you ship something that may move the numbers.",
|
|
428
514
|
inputSchema: {
|
|
429
515
|
action: z.enum(["list", "add", "edit", "delete"]).optional(),
|
|
430
516
|
id: z.string().optional().describe("note id (edit, delete)"),
|
|
@@ -451,7 +537,7 @@ server.registerTool(
|
|
|
451
537
|
server.registerTool(
|
|
452
538
|
"splithub_links",
|
|
453
539
|
{
|
|
454
|
-
description: "Short links (
|
|
540
|
+
description: "Short links (sh2 Cloud): one short URL that redirects to one or more destinations split by weight (split visitors between landing pages without code), clicks counted. action list (default): every link with totalClicks. stats: one link (id or slug): clicks per day (30 days), per destination, country, device, referrer, unique visitors. create: urls (one or more full http(s) URLs), slug (3-32 letters, digits, - _; random when omitted), name, weights (one per URL). edit: name / slug / description. pause, resume, delete: by id or slug. Targeting by country, device or a flow is done in the dashboard.",
|
|
455
541
|
inputSchema: {
|
|
456
542
|
action: z.enum(["list", "stats", "create", "edit", "pause", "resume", "delete"]).optional(),
|
|
457
543
|
link: z.string().optional().describe("link id or slug (stats, edit, pause, resume, delete)"),
|
|
@@ -474,7 +560,7 @@ server.registerTool(
|
|
|
474
560
|
server.registerTool(
|
|
475
561
|
"splithub_alerts",
|
|
476
562
|
{
|
|
477
|
-
description: "Alert rules (
|
|
563
|
+
description: "Alert rules (sh2 Cloud; they fire on Pro, a rule added on another plan is saved switched off). action list (default): rules with condition, params (params.progress { total, fired, month? } on usage and event_count is read-only), enabled; channels; history (recent alerts). add: condition + params. Experiment conditions (experiment = one key, omit for every running one): srm (broken split), winner (minVisitors?), loser (lift %, minVisitors?), exposures (visitors), conversions (conversions), duration (days), no_events (hours). Account: quota (percent of the monthly allowance), usage (every: alert each time this month's billed events cross another multiple, e.g. 1000). Analytics (property required): traffic_drop / traffic_spike (percent vs the same 24 hours a week before), goal_silent (goal, hours), event_count (event, any event when omitted; count; repeat = every count instead of once). Experiment rules may also pause, finish or dropLoser (winner / loser). enable, disable, delete, test (dry run: what would fire now, nothing sent): rule = id, the start of it, or the name. Where alerts go (email, Slack, Discord, webhook) is set in the dashboard.",
|
|
478
564
|
inputSchema: {
|
|
479
565
|
action: z.enum(["list", "add", "enable", "disable", "delete", "test"]).optional(),
|
|
480
566
|
rule: z.string().optional().describe("rule id, id prefix or name (enable, disable, delete, test)"),
|
|
@@ -576,7 +662,7 @@ for (const [name, old] of [["splithub_property_status", false], ["splithub_set_p
|
|
|
576
662
|
server.registerTool(
|
|
577
663
|
name,
|
|
578
664
|
{
|
|
579
|
-
description: old ? oldName("splithub_property_status") : "Pause or resume an analytics property (paused: its pageviews and events are dropped and not billed). Updates splithub.config.ts; in cloud mode it applies live within a minute. archived (
|
|
665
|
+
description: old ? oldName("splithub_property_status") : "Pause or resume an analytics property (paused: its pageviews and events are dropped and not billed). Updates splithub.config.ts; in cloud mode it applies live within a minute. archived (sh2 Cloud) stops collecting and hides it like the dashboard Archive, numbers kept; restored brings it back paused. removed takes it out of the config (a dashboard-made property is deleted in the cloud with its numbers).",
|
|
580
666
|
inputSchema: { property: z.string(), status: z.enum(["running", "paused", "archived", "restored", "removed"]) }
|
|
581
667
|
},
|
|
582
668
|
async ({ property, status }) => reply(await runCli(["analytics", PROPERTY_STATUS_CMD[status], property]))
|
|
@@ -584,7 +670,7 @@ for (const [name, old] of [["splithub_property_status", false], ["splithub_set_p
|
|
|
584
670
|
server.registerTool(
|
|
585
671
|
"splithub_domains",
|
|
586
672
|
{
|
|
587
|
-
description: `Allowed domains, per experiment and per analytics property (
|
|
673
|
+
description: `Allowed domains, per experiment and per analytics property (sh2 Cloud). Without arguments: every allowed domain with where it applies, which experiments / properties accept any origin, and the origins seen sending events. With kind + id + hosts: replace that experiment's or property's list (subdomains included; an empty list accepts any origin again). Events from an origin outside the list are dropped (403 when nothing in the batch is allowed).`,
|
|
588
674
|
inputSchema: {
|
|
589
675
|
kind: z.enum(["experiment", "property", "test"]).optional().describe("experiment or property (test is an old name for experiment)"),
|
|
590
676
|
id: z.string().optional(),
|
|
@@ -624,13 +710,13 @@ server.registerTool(
|
|
|
624
710
|
);
|
|
625
711
|
server.registerTool(
|
|
626
712
|
"splithub_review",
|
|
627
|
-
{ description: "AI reviews of an experiment stored in
|
|
713
|
+
{ description: "AI reviews of an experiment stored in sh2 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") } },
|
|
628
714
|
async ({ experiment }) => reply(await runCli(experiment ? ["review", experiment] : ["review"]))
|
|
629
715
|
);
|
|
630
716
|
server.registerTool(
|
|
631
717
|
"splithub_push",
|
|
632
718
|
{
|
|
633
|
-
description: "Upload splithub.config.ts to
|
|
719
|
+
description: "Upload splithub.config.ts to sh2 Cloud (cloud mode). Also returns kept: experiments the cloud has from an earlier push that this file lacks, left as they are. prune removes those: only when the user asked for it. Returns experiments created in the dashboard that were written into the file. dryRun: only check the config and show what would change. A key that already belonged to another experiment fails with KEY_CONFLICT: ask the user, then push with replace (new experiment, old numbers cleared) or same (same experiment, numbers stay).",
|
|
634
720
|
inputSchema: {
|
|
635
721
|
dryRun: z.boolean().optional(),
|
|
636
722
|
replace: z.array(z.string()).optional().describe("keys that are new experiments: the old numbers under them are cleared"),
|
|
@@ -650,8 +736,8 @@ server.registerTool(
|
|
|
650
736
|
server.registerTool("splithub_pull", { description: "Fetch the cloud config and write dashboard-created experiments into splithub.config.ts." }, async () => reply(await runCli(["pull"])));
|
|
651
737
|
server.registerTool("splithub_doctor", { description: "Check the installation: config, provider, middleware, routes, code references, endpoint; in a React Native / Expo app also the package, its storage module and redirect experiments; in a native iOS / Android project the SDK in the build files. Run after wiring code; ok: false lists what to fix." }, async () => reply(await runCli(["doctor"])));
|
|
652
738
|
server.registerTool("splithub_whoami", { description: "Which cloud project this folder is connected to, and its public key." }, async () => reply(await runCli(["whoami"])));
|
|
653
|
-
server.registerTool("splithub_projects", { description: "Every folder on this machine connected to a
|
|
654
|
-
server.registerTool("splithub_login", { description: "Connect this folder to
|
|
739
|
+
server.registerTool("splithub_projects", { description: "Every folder on this machine connected to a sh2 Cloud project, the current one marked (current)." }, async () => reply(await runCli(["projects"])));
|
|
740
|
+
server.registerTool("splithub_login", { description: "Connect this folder to sh2 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 () => {
|
|
655
741
|
const r = await startLogin();
|
|
656
742
|
if ("error" in r) return { content: [{ type: "text", text: JSON.stringify(r) }], isError: r.error !== "already logged in" };
|
|
657
743
|
return { content: [{ type: "text", text: `Open this link to connect: ${r.verifyUrl}
|
|
@@ -660,7 +746,7 @@ Waiting for the approval in the background; call splithub_whoami to check.` }] }
|
|
|
660
746
|
});
|
|
661
747
|
server.registerTool(
|
|
662
748
|
"splithub_init",
|
|
663
|
-
{ description: "Set up
|
|
749
|
+
{ description: "Set up sh2 in this project: config file, framework files, agent skills; React Native / Expo apps also get @splithub/react-native and their entry (App.tsx, app/_layout.tsx) wrapped in <SplitHubProvider> with screen tracking (app.entry.status added | already | manual: wire nextStep by hand); native iOS / Android get install lines and a quick start (app.install, app.quickStart) and no config file; 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() } },
|
|
664
750
|
async ({ mode, key, githubAction }) => {
|
|
665
751
|
const args = ["init", "--mode", mode, "--yes", "--no-install", "--no-login"];
|
|
666
752
|
if (key) args.push("--key", key);
|
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// 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 KEY_CONFLICT: 'The key already belongs to another experiment in the cloud. Ask the user whether this is a new experiment (rename the key, or splithub_push with replace: the old numbers are cleared) or the same experiment (splithub_push with same). Never pick for them.',\n KEY_DELETED: 'A deleted experiment used this key. Rename the experiment key in splithub.config.ts (and in the code), then call splithub_push again.',\n NOT_CLOUD: 'This project stores events in its own database (self-hosted). Experiment slices, breakdowns, timelines, engagement, events by variant and raw events, push, funnels, paths, retention, realtime, segments, notes, links and alerts come with SplitHub Cloud: tell the user; splithub_analytics still reads raw counts.',\n PRO_REQUIRED: 'Alert rules fire on Pro. Tell the user; they upgrade in the dashboard (Billing), then the rule can be turned on.',\n NOT_FOUND: 'Call the same tool with action list for the ids.',\n INSUFFICIENT_SCOPE: 'This API key lacks the scope named in `scope` (e.g. notes:write). Ask the user for a key with it (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).\n// SplitHub Cloud sends verdicts with ready-to-print words; a self-hosted endpoint sends raw counts and\n// `analysis: { available: false }`.\nconst voiceShape = z\n .object({ scenario: z.string(), line: z.string(), advice: z.enum(['wait', 'ship', 'keep_control', 'move_on', 'fix_setup', 'hold']) })\n .passthrough()\n .describe('friendly line for humans; quote verdict.message for facts. advice move_on = suggest finishing and starting the next experiment');\nconst displayShape = z\n .object({ label: z.string(), lines: z.array(z.string()), next: z.string().optional() })\n .passthrough()\n .describe('ready-to-print label (WINNER, TOO EARLY, ...), lines and next step, for showing the result');\nconst analysisShape = z\n .object({ available: z.literal(false), message: z.string(), url: z.string() })\n .passthrough()\n .describe('self-hosted: raw numbers only. Tell the user verdicts come with SplitHub Cloud; never invent one');\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().optional(), headline: z.string().nullable().optional(), sample: z.enum(['small', 'ok', 'good']).nullable().optional(), stars: z.number().nullable().optional(), daysToVerdict: z.number().nullable().optional(), voice: voiceShape.nullable().optional(), display: displayShape.optional() }).passthrough()),\n properties: z\n .array(z.object({ property: z.string(), name: z.string(), status: z.string(), visitors: z.number(), previousVisitors: z.number(), change: z.number().nullable(), conversions: z.array(z.object({ goal: z.string(), conversions: z.number(), change: z.number().nullable() }).passthrough()) }).passthrough())\n .optional()\n .describe('SplitHub Cloud: analytics properties, last 7 days (propertiesRange) against the 7 before; change is relative, null = no visitors before'),\n propertiesRange: z.object({ from: z.string(), to: z.string() }).optional(),\n analysis: analysisShape.optional(),\n next: z.string().optional(),\n}).passthrough();\nconst scopeShape = z\n .object({ filtered: z.boolean(), range: z.object({ from: z.string(), to: z.string() }).nullable(), filters: z.record(z.union([z.string(), z.array(z.string())])), note: z.string().optional() })\n .passthrough()\n .describe('present on a slice (from / to / filters): the verdict is computed on that slice only; quote note');\nconst resultsOutput = z.object({\n experiment: z.string(),\n view: z.enum(['breakdown', 'timeline', 'engagement', 'events']).optional().describe('set when by, timeline, engagement or events was asked: the shape is that view, not a verdict'),\n kind: z.string().optional(),\n status: z.string().optional(),\n goal: z.string().nullable().optional(),\n scope: scopeShape.optional(),\n verdict: verdictShape.optional().describe('SplitHub Cloud only'),\n daysToVerdict: z.number().nullable().optional().describe('days until a verdict at the current traffic; schedule the next check then'),\n voice: voiceShape.nullable().optional(),\n display: displayShape.optional(),\n variants: z\n .array(z.union([z.string(), z.object({ variant: z.string(), visitors: z.number() }).passthrough()]))\n .optional()\n .describe('self-hosted: raw counts per variant (conversions, rate), control first; view engagement: sessions, pagesPerVisit, bounceRate, avgVisit (ms) per variant; view events: the variant keys, control first'),\n rows: z\n .array(z.object({ name: z.string(), goalKey: z.string().nullable(), isGoal: z.boolean(), measured: z.enum(['goal', 'metric', 'guardrail']).nullable() }).passthrough())\n .optional()\n .describe('view events: every goal and event of these visitors; perVariant { visitors, count, rate, revenue } and comparisons[] against the control (lift, pValue, significant); small = too few visitors'),\n analysis: analysisShape.optional(),\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\n/** Visitor columns experiment reports filter by, and the dimensions a breakdown splits by (the CLI checks the same lists). `page` is analytics' word: landing as a filter, url as a breakdown. */\nconst EXPERIMENT_FILTERS = ['country', 'region', 'city', 'device', 'os', 'browser', 'language', 'host', 'platform', 'app_version', 'source', 'channel', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'landing', 'page'] as const;\nconst EXPERIMENT_BY = ['country', 'region', 'city', 'device', 'os', 'browser', 'language', 'host', 'platform', 'app_version', 'page', 'url', 'referrer', 'source', 'channel', 'landing', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content'] as const;\nfunction experimentArgs(a: { from?: string; to?: string; filters?: Partial<Record<string, string>> }): string[] {\n const args: string[] = [];\n if (a.from) args.push('--from', a.from);\n if (a.to) args.push('--to', a.to);\n for (const [k, v] of Object.entries(a.filters ?? {})) if (v) args.push('--filter', `${k}=${v}`);\n return args;\n}\nconst DAY = /^\\d{4}-\\d{2}-\\d{2}$/;\n\nconst LOOP = 'The loop: splithub_plan → splithub_experiment_create → wire the code → splithub_doctor → splithub_push (cloud) → splithub_results (re-check after daysToVerdict days) → splithub_experiment_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). properties[] (SplitHub Cloud) is each analytics property's last 7 days against the 7 before (visitors, change, goal conversions): mention a big move; splithub_analytics has the details. 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 experiment, then call splithub_ship. display { label, lines, next } is ready to show; voice.line is the friendly line for humans; voice.advice move_on means suggest finishing the experiment and starting the next one. If analysis.available is false the project is self-hosted: report the raw numbers as they are, say verdicts come with SplitHub Cloud (analysis.url), and never call a winner from raw rates. ${LOOP}`,\n outputSchema: statusOutput,\n },\n async () => reply(await runCli(['status']), { structured: true })\n);\n\nserver.registerTool(\n 'splithub_results',\n {\n description: 'Results of one experiment. SplitHub Cloud gives the full verdict: 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 experiments). 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. Facts are in verdict.message; voice.line is the friendly line for humans (voice.advice move_on = suggest finishing the experiment and starting the next one); display { label, lines, next } is ready to show. If analysis.available is false the project is self-hosted: report the raw numbers as they are, say verdicts come with SplitHub Cloud (analysis.url), and never call a winner from raw rates. If finished, ask which variant to keep, then splithub_ship. SLICE (SplitHub Cloud): from / to (YYYY-MM-DD, project time zone) keep the visitors first exposed on those days, filters keep visitors by country, device, platform (ios, android, web…), app_version, source, channel, landing page, UTM…; the answer carries scope and the verdict is computed on that slice only: say so and quote scope.note, the decision stays with the unfiltered verdict. A slice carries no voice and no advice (numbers only): never suggest shipping or finishing from one. VIEWS (one at a time, same from / to / filters; the answer has view set): by splits visitors by a dimension, segments[] each with cells per variant (order[] = variants, control first) and comparisons[] (lift vs the control inside the segment, pValue, significant, better; small = too few visitors); timeline gives exposures[] and conversions[] per day and variant (a day = visitors first seen that day, conversions whenever they happened); engagement gives bounce rate, pages per visit and avgVisit (ms) per variant from the analytics property on the same visitors (property null = no analytics there); events gives rows[] for every goal (measured goal / metric / guardrail first) and event of these visitors, each with perVariant visitors and rate and comparisons[] against the control (property null = goals only, other events need analytics on the same site). Segments, engagement and events are for exploring: never call a winner from one segment or one event.',\n inputSchema: {\n experiment: z.string().describe('experiment id (key)'),\n from: z.string().regex(DAY).optional().describe('first-exposure day, from (inclusive)'),\n to: z.string().regex(DAY).optional().describe('first-exposure day, to (inclusive)'),\n filters: z.record(z.enum(EXPERIMENT_FILTERS), z.string()).optional().describe('visitor column → comma-separated values, e.g. { country: \"DE,FR\", channel: \"Paid Search\" }; \"(none)\" matches empty'),\n by: z.enum(EXPERIMENT_BY).optional().describe('view: lift per segment of this dimension'),\n timeline: z.boolean().optional().describe('view: visitors and conversions per day and variant'),\n engagement: z.boolean().optional().describe('view: bounce rate, pages per visit, visit length per variant'),\n events: z.boolean().optional().describe('view: every goal and event per variant, with lift against the control'),\n },\n outputSchema: resultsOutput,\n },\n async (a) => reply(await runCli(['results', a.experiment, ...experimentArgs(a), ...(a.by ? ['--by', a.by] : []), ...(a.timeline ? ['--timeline'] : []), ...(a.engagement ? ['--engagement'] : []), ...(a.events ? ['--events'] : [])]), { structured: true })\n);\n\nserver.registerTool(\n 'splithub_experiment_events',\n {\n description: 'The latest raw events of one experiment (SplitHub Cloud, newest first): exposures (type exposure, the variant a visitor saw) and goals (type goal) with time, visitor, url, country. Same from / to / filters as splithub_results; type keeps one kind; nextBefore pages to older ones (pass it as before). Raw events stay 7 days (30 on Pro); the key needs events:read. Use to check that exposures and goals arrive after wiring code.',\n inputSchema: {\n experiment: z.string().describe('experiment id (key)'),\n type: z.enum(['exposure', 'goal']).optional(),\n limit: z.number().int().min(1).max(200).optional(),\n before: z.number().int().positive().optional().describe('nextBefore of the previous page (unix ms)'),\n from: z.string().regex(DAY).optional(),\n to: z.string().regex(DAY).optional(),\n filters: z.record(z.enum(EXPERIMENT_FILTERS), z.string()).optional().describe('visitor column → comma-separated values'),\n },\n },\n async (a) => reply(await runCli(['events', '--experiment', a.experiment, ...experimentArgs(a), ...(a.type ? ['--type', a.type] : []), ...(a.limit ? ['--limit', String(a.limit)] : []), ...(a.before ? ['--before', String(a.before)] : [])]))\n);\n\nserver.registerTool(\n 'splithub_plan',\n {\n description: 'Before creating an experiment: visitors per variant (and in all) to detect a relative lift `mde` on a `baseline` conversion rate, sized by SplitHub Cloud for its sequential verdict (no account needed; fails with UNREACHABLE offline). With an experiment id, also the days left at its current traffic when its numbers are readable. 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\n/** Old tool names (before `splithub_<noun>_<verb>`), still registered for one release. */\nconst oldName = (name: string) => `Old name of ${name}, kept for one release: call ${name} instead.`;\n\nfor (const [name, old] of [['splithub_experiment_create', false], ['splithub_create_experiment', true]] as const)\n server.registerTool(\n name,\n {\n description: old ? oldName('splithub_experiment_create') : `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_experiment_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 compared, read with useValue as { factor: value }). First variant / first level is the control. In an app (React Native, Expo) redirect does nothing, and the config ships inside the build: the variants' code needs a release, then starting, pausing and weights apply live from the cloud; target new builds with an app_version gte condition in the flow. 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('the goal: any event name the app sends with track() (signup, Video Played) or a goal key from the config; an event not in goals becomes a goal, nothing to declare first'),\n values: z.record(z.string()).optional().describe('value experiments: variant → value'),\n match: z.string().optional().describe('redirect experiments: the path it runs on, e.g. /'),\n to: z.record(z.string()).optional().describe('redirect experiments: variant → destination path'),\n status: z.enum(['draft', 'running']).optional(),\n name: z.string().max(80).optional().describe('human name shown instead of the key; can be renamed later, the key stays'),\n description: z.string().optional(),\n traffic: z.number().gt(0).max(100).optional().describe('percent of visitors in the experiment (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 experiment starts'),\n end: z.string().optional().describe('ISO date the experiment ends'),\n secondary: z.array(z.string()).optional().describe('goals (event names or goal keys) 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 (event names or goal keys) 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: experiments 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.name) args.push('--name', a.name);\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\nfor (const [name, old] of [['splithub_experiment_status', false], ['splithub_set_status', true]] as const)\n server.registerTool(\n name,\n {\n description: old ? oldName('splithub_experiment_status') : '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\n/** Visit dimensions a funnel can be split by. */\nconst SESSION_BY = ['source', 'referrer', 'channel', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'country', 'region', 'city', 'device', 'os', 'browser', 'language', 'host', 'platform', 'app_version', 'entry', 'exit'] as const;\n/** Range, filters and a saved segment: every analytics report takes them. */\nconst RANGE = {\n days: z.number().int().min(1).max(400).optional(),\n from: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/).optional(),\n to: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/).optional(),\n filters: z.record(z.string()).optional().describe('dimension → comma-separated values'),\n segment: z.string().optional().describe('saved segment name or id'),\n};\nfunction rangeArgs(a: { days?: number; from?: string; to?: string; filters?: Record<string, string>; segment?: string }): string[] {\n const args: string[] = [];\n if (a.days) args.push('--days', String(a.days));\n if (a.from) args.push('--from', a.from);\n if (a.to) args.push('--to', a.to);\n if (a.segment) args.push('--segment', a.segment);\n for (const [k, v] of Object.entries(a.filters ?? {})) args.push('--filter', `${k}=${v}`);\n return args;\n}\n\nconst BY = ['source', 'referrer', 'channel', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'country', 'region', 'city', 'device', 'os', 'browser', 'language', 'host', 'platform', 'app_version', 'entry', 'exit', 'page', 'event', 'goal', 'variant', 'trait'] as const;\n\nserver.registerTool(\n 'splithub_analytics',\n {\n description: `Analytics properties (pageviews or app screens, and custom events, no variants). A property is kind site or app; in an app a screen is a page (url /ScreenName) and platform / app_version are dimensions for by and filters. Without property: every property with visitors, visits, pageviews and bounce for the last 30 days. With property: totals (visitors, newVisitors, sessions = visits, pageviews, events, bounces, duration in ms; bounce rate = bounces / sessions), goals (conversions = unique visitors who reached it in the range, completions = how many times, revenue), topPages and topSources (value \"(none)\" = direct). With by: rows grouped by a visit dimension, page, event or goal; goal adds that goal's conversions per row; variant (needs experiment) splits visits by the variant each visitor saw, trait (needs key) by an identify() trait. Range: days (last N days) or from / to (YYYY-MM-DD, project time zone). filters narrow the visits, e.g. { country: \"DE,FR\", source: \"(none)\" }. Self-hosted projects get raw counts only (analysis.available false): report them as they are and say full reports come with SplitHub Cloud. compare adds previous (the compared range, with its dates in previous.range) for change against it: 'previous' (the same-length range right before), 'year' (the same days a year earlier) or 'YYYY-MM-DD..YYYY-MM-DD'. segment applies a saved segment (splithub_segments) by name or id. These are counts, not experiments: no verdicts, never call a winner from them.`,\n inputSchema: {\n property: z.string().optional().describe('property id; omit to list every property'),\n by: z.enum(BY).optional(),\n goal: z.string().optional().describe('with by: also count this goal per row'),\n experiment: z.string().optional().describe('by variant: the experiment key'),\n key: z.string().optional().describe('by trait: the trait name, e.g. plan'),\n days: z.number().int().min(1).max(400).optional(),\n from: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/).optional(),\n to: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/).optional(),\n filters: z.record(z.string()).optional().describe('dimension → comma-separated values'),\n segment: z.string().optional().describe('saved segment name or id'),\n compare: z.union([z.enum(['previous', 'year']), z.string().regex(/^\\d{4}-\\d{2}-\\d{2}\\.\\.\\d{4}-\\d{2}-\\d{2}$/)]).optional().describe(\"also read another period: 'previous' (right before), 'year' (a year earlier) or 'YYYY-MM-DD..YYYY-MM-DD'\"),\n limit: z.number().int().min(1).max(500).optional(),\n },\n },\n async (a) => {\n const args = ['analytics', ...(a.property ? [a.property] : [])];\n if (a.by) args.push('--by', a.by);\n if (a.goal) args.push('--goal', a.goal);\n if (a.experiment) args.push('--experiment', a.experiment);\n if (a.key) args.push('--key', a.key);\n if (a.compare) args.push('--compare', a.compare);\n if (a.limit) args.push('--limit', String(a.limit));\n return reply(await runCli([...args, ...rangeArgs(a)]));\n }\n);\n\nserver.registerTool(\n 'splithub_analytics_funnel',\n {\n description: `Funnel of an analytics property (SplitHub Cloud): visitors who reached each step in order. Steps: page:/path (patterns like page:/blog/* work), event:<name>, goal:<key>; 2 to 8. Or funnel: a saved funnel's name or id (splithub_analytics_funnels), which brings its steps and within. within: visit (same visit, default), 7d or 30d (from the first step). Answers steps[] with visitors, conversion (share of the first step) and dropoff (share lost since the step before); by splits it by a visit dimension. rolledUp: days older than 90 count nothing. Counts, not an experiment: never call a winner from it.`,\n inputSchema: {\n property: z.string(),\n steps: z.array(z.string()).min(2).max(8).optional().describe('e.g. [\"page:/\", \"event:Signup\", \"goal:paid\"]; omit with funnel'),\n funnel: z.string().optional().describe('a saved funnel name or id'),\n within: z.enum(['visit', '7d', '30d']).optional(),\n by: z.enum(SESSION_BY).optional(),\n ...RANGE,\n },\n },\n async (a) => reply(await runCli(['analytics', 'funnel', a.property, ...(a.steps ? ['--steps', a.steps.join(',')] : []), ...(a.funnel ? ['--funnel', a.funnel] : []), ...(a.within ? ['--within', a.within] : []), ...(a.by ? ['--by', a.by] : []), ...rangeArgs(a)]))\n);\n\nserver.registerTool(\n 'splithub_analytics_funnels',\n {\n description: 'Saved funnels of an analytics property (SplitHub Cloud), shown on its Funnels tab for the whole team. Without save or delete: the list (id, name, steps, within). save + steps: save one under that name (a name already saved updates it; steps and within as in splithub_analytics_funnel). delete: remove one by id or name. Run one with splithub_analytics_funnel { funnel }.',\n inputSchema: {\n property: z.string(),\n save: z.string().max(60).optional().describe('name of the funnel to save or update'),\n steps: z.array(z.string()).min(2).max(8).optional().describe('e.g. [\"page:/\", \"event:Signup\", \"goal:paid\"]'),\n within: z.enum(['visit', '7d', '30d']).optional(),\n delete: z.string().optional().describe('id or name to delete'),\n },\n },\n async (a) => {\n if (a.delete) return reply(await runCli(['analytics', 'funnels', a.property, '--delete', a.delete]));\n if (a.save) return reply(await runCli(['analytics', 'funnels', a.property, '--save', a.save, ...(a.steps ? ['--steps', a.steps.join(',')] : []), ...(a.within ? ['--within', a.within] : [])]));\n return reply(await runCli(['analytics', 'funnels', a.property]));\n }\n);\n\nserver.registerTool(\n 'splithub_analytics_paths',\n {\n description: 'Where visits went right after a page (or, with direction prev, where they came from), within the visit (SplitHub Cloud). rows[] { value, visits }; (exit) = left the site, (entrance) = landed on the page.',\n inputSchema: { property: z.string(), page: z.string().describe('a path like /pricing or /blog/*'), direction: z.enum(['next', 'prev']).optional(), ...RANGE },\n },\n async (a) => reply(await runCli(['analytics', 'paths', a.property, '--page', a.page, ...(a.direction === 'prev' ? ['--prev'] : []), ...rangeArgs(a)]))\n);\n\nserver.registerTool(\n 'splithub_analytics_retention',\n {\n description: 'Retention cohorts of an analytics property (SplitHub Cloud), the key report for apps: users grouped by the day or week they started (start: visit, event:<name> or goal:<key>), and how many came back (return: visit or event:<name>) in period 0, 1, 2… cohorts[] { start, users, retained[] }; retained[0] is the cohort period itself, retained[i] / users is the share. Ranges longer than 90 days / 26 weeks are cut (clamped: true). Default: start visit, return visit, period week. filters take platform (ios, android, web…) and app_version too. Counts, not an experiment.',\n inputSchema: {\n property: z.string(),\n start: z.string().optional().describe('visit | event:<name> | goal:<key>'),\n return: z.string().optional().describe('visit | event:<name>'),\n period: z.enum(['day', 'week']).optional(),\n ...RANGE,\n },\n },\n async (a) => reply(await runCli(['analytics', 'retention', a.property, ...(a.start ? ['--start', a.start] : []), ...(a.return ? ['--return', a.return] : []), ...(a.period ? ['--period', a.period] : []), ...rangeArgs(a)]))\n);\n\nserver.registerTool(\n 'splithub_analytics_realtime',\n {\n description: 'Who is on an analytics property right now (SplitHub Cloud): activeVisitors5m, pageviews and events per minute over the last 30 minutes, top pages and sources. Use to confirm tracking works after a deploy.',\n inputSchema: { property: z.string() },\n },\n async ({ property }) => reply(await runCli(['analytics', 'realtime', property]))\n);\n\nserver.registerTool(\n 'splithub_segments',\n {\n description: 'Saved segments: named report filters every report can apply (segment on splithub_analytics, funnel, paths, retention). Without arguments: the list. save + filters: save one (filters like { country: \"DE,FR\", channel: \"Paid Search\" }; property limits it to one property). delete: remove one by id or name. SplitHub Cloud.',\n inputSchema: {\n save: z.string().max(60).optional().describe('name of the segment to save'),\n filters: z.record(z.string()).optional().describe('dimension → comma-separated values'),\n property: z.string().optional(),\n delete: z.string().optional().describe('id or name to delete'),\n },\n },\n async (a) => {\n if (a.delete) return reply(await runCli(['analytics', 'segments', '--delete', a.delete]));\n const scope = a.property ? ['--property', a.property] : [];\n if (a.save) return reply(await runCli(['analytics', 'segments', '--save', a.save, ...Object.entries(a.filters ?? {}).map(([k, v]) => `${k}=${v}`), ...scope]));\n return reply(await runCli(['analytics', 'segments', ...scope]));\n }\n);\n\nserver.registerTool(\n 'splithub_notes',\n {\n description:\n 'Notes: what happened on a day (a launch, an outage, a campaign), shown on experiment timelines and analytics charts (SplitHub Cloud). action list (default): newest first; experiment or property narrows it (project-wide notes come too), kind filters, days / from / to set the range. add: text (day defaults to today in the project time zone; kind note | issue | win; experiment or property ties it to one, none = the whole project). edit: id + text / kind / day. delete: id. Add one when you ship something that may move the numbers.',\n inputSchema: {\n action: z.enum(['list', 'add', 'edit', 'delete']).optional(),\n id: z.string().optional().describe('note id (edit, delete)'),\n text: z.string().max(2000).optional(),\n kind: z.enum(['note', 'issue', 'win']).optional(),\n day: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/).optional(),\n experiment: z.string().optional().describe('experiment key'),\n property: z.string().optional().describe('analytics property id'),\n days: RANGE.days,\n from: RANGE.from,\n to: RANGE.to,\n },\n },\n async (a) => {\n const action = a.action ?? (a.text && !a.id ? 'add' : 'list');\n const opt = [...(a.kind ? ['--kind', a.kind] : []), ...(a.day ? ['--day', a.day] : [])];\n const scope = a.experiment ? ['--experiment', a.experiment] : a.property ? ['--property', a.property] : [];\n if (action === 'add') return reply(await runCli(['notes', 'add', a.text ?? '', ...opt, ...scope]));\n if (action === 'edit') return reply(await runCli(['notes', 'edit', a.id ?? '', ...(a.text ? [a.text] : []), ...opt]));\n if (action === 'delete') return reply(await runCli(['notes', 'delete', a.id ?? '']));\n return reply(await runCli(['notes', ...(a.kind ? ['--kind', a.kind] : []), ...scope, ...rangeArgs(a)]));\n }\n);\n\nserver.registerTool(\n 'splithub_links',\n {\n description:\n 'Short links (SplitHub Cloud): one short URL that redirects to one or more destinations split by weight (split visitors between landing pages without code), clicks counted. action list (default): every link with totalClicks. stats: one link (id or slug): clicks per day (30 days), per destination, country, device, referrer, unique visitors. create: urls (one or more full http(s) URLs), slug (3-32 letters, digits, - _; random when omitted), name, weights (one per URL). edit: name / slug / description. pause, resume, delete: by id or slug. Targeting by country, device or a flow is done in the dashboard.',\n inputSchema: {\n action: z.enum(['list', 'stats', 'create', 'edit', 'pause', 'resume', 'delete']).optional(),\n link: z.string().optional().describe('link id or slug (stats, edit, pause, resume, delete)'),\n urls: z.array(z.string()).min(1).optional().describe('create: destinations'),\n weights: z.array(z.number().min(0)).optional().describe('create: one weight per URL (default equal)'),\n slug: z.string().optional(),\n name: z.string().max(80).optional(),\n description: z.string().max(500).optional(),\n },\n },\n async (a) => {\n const action = a.action ?? 'list';\n if (action === 'list') return reply(await runCli(['links']));\n const opt = [...(a.slug ? ['--slug', a.slug] : []), ...(a.name ? ['--name', a.name] : []), ...(a.description !== undefined ? ['--description', a.description] : [])];\n if (action === 'create') return reply(await runCli(['links', 'create', ...(a.urls ?? []), ...opt, ...(a.weights ? ['--weights', a.weights.join(',')] : [])]));\n if (action === 'stats') return reply(await runCli(['links', a.link ?? '']));\n return reply(await runCli(['links', action, a.link ?? '', ...(action === 'edit' ? opt : [])]));\n }\n);\n\nserver.registerTool(\n 'splithub_alerts',\n {\n description:\n \"Alert rules (SplitHub Cloud; they fire on Pro, a rule added on another plan is saved switched off). action list (default): rules with condition, params (params.progress { total, fired, month? } on usage and event_count is read-only), enabled; channels; history (recent alerts). add: condition + params. Experiment conditions (experiment = one key, omit for every running one): srm (broken split), winner (minVisitors?), loser (lift %, minVisitors?), exposures (visitors), conversions (conversions), duration (days), no_events (hours). Account: quota (percent of the monthly allowance), usage (every: alert each time this month's billed events cross another multiple, e.g. 1000). Analytics (property required): traffic_drop / traffic_spike (percent vs the same 24 hours a week before), goal_silent (goal, hours), event_count (event, any event when omitted; count; repeat = every count instead of once). Experiment rules may also pause, finish or dropLoser (winner / loser). enable, disable, delete, test (dry run: what would fire now, nothing sent): rule = id, the start of it, or the name. Where alerts go (email, Slack, Discord, webhook) is set in the dashboard.\",\n inputSchema: {\n action: z.enum(['list', 'add', 'enable', 'disable', 'delete', 'test']).optional(),\n rule: z.string().optional().describe('rule id, id prefix or name (enable, disable, delete, test)'),\n condition: z.enum(['srm', 'winner', 'loser', 'exposures', 'conversions', 'duration', 'no_events', 'quota', 'usage', 'traffic_drop', 'traffic_spike', 'goal_silent', 'event_count']).optional(),\n experiment: z.string().optional(),\n property: z.string().optional(),\n goal: z.string().optional(),\n event: z.string().optional(),\n every: z.number().int().min(100).optional(),\n count: z.number().int().min(1).optional(),\n repeat: z.boolean().optional(),\n percent: z.number().min(1).optional(),\n hours: z.number().min(1).optional(),\n days: z.number().int().min(1).optional(),\n visitors: z.number().int().min(1).optional(),\n conversions: z.number().int().min(1).optional(),\n lift: z.number().min(0).max(100).optional(),\n minVisitors: z.number().int().min(0).optional(),\n name: z.string().max(80).optional(),\n cooldownHours: z.number().min(1).optional(),\n enabled: z.boolean().optional().describe('add: false saves it switched off'),\n pause: z.boolean().optional(),\n finish: z.boolean().optional(),\n dropLoser: z.boolean().optional(),\n },\n },\n async (a) => {\n const action = a.action ?? (a.condition ? 'add' : 'list');\n if (action === 'list') return reply(await runCli(['alerts']));\n if (action !== 'add') return reply(await runCli(['alerts', action, a.rule ?? '']));\n const args = ['alerts', 'add', a.condition ?? ''];\n const text: Array<[string, string | undefined]> = [\n ['--experiment', a.experiment],\n ['--property', a.property],\n ['--goal', a.goal],\n ['--event', a.event],\n ['--name', a.name],\n ];\n for (const [flag, v] of text) if (v) args.push(flag, v);\n const nums: Array<[string, number | undefined]> = [\n ['--every', a.every],\n ['--count', a.count],\n ['--percent', a.percent],\n ['--hours', a.hours],\n ['--days', a.days],\n ['--visitors', a.visitors],\n ['--conversions', a.conversions],\n ['--lift', a.lift],\n ['--min-visitors', a.minVisitors],\n ['--cooldown', a.cooldownHours],\n ];\n for (const [flag, v] of nums) if (v !== undefined) args.push(flag, String(v));\n if (a.repeat) args.push('--repeat');\n if (a.enabled === false) args.push('--disabled');\n if (a.pause) args.push('--pause');\n if (a.finish) args.push('--finish');\n if (a.dropLoser) args.push('--drop-loser');\n return reply(await runCli(args));\n }\n);\n\nserver.registerTool(\n 'splithub_analytics_connect',\n {\n description:\n 'Set up analytics in this app: use a property (id), create one (name, or nothing when the project has none), then name it on the one <SplitHubProvider> / <SplitHubNextProvider> in the code (property=\"sh-…\"). Answers property, created, wired { status: added | already | other | none | many, file, line }, snippets { provider, script (sh.js tag with data-property), track, identify } and next. status none or many: add the provider snippet yourself (or the sh.js tag on a site without React). other: the provider names another property; ask before calling again with force. Pageviews are sent for you; events are track(name, props). In an app, script is empty and snippets.screen shows useScreen for screens the navigation tracker does not see. In cloud mode a new property is created in the cloud at once (live: applied), so no push: deploy.',\n inputSchema: {\n property: z.string().optional().describe('property id to use (added to the config when new)'),\n name: z.string().max(80).optional().describe('create a new property with this name'),\n force: z.boolean().optional().describe('replace another property already named on the provider'),\n },\n },\n async (a) => reply(await runCli(['analytics', 'connect', ...(a.property ? [a.property] : []), ...(a.name ? ['--name', a.name] : []), ...(a.force ? ['--force'] : [])]))\n);\n\nserver.registerTool(\n 'splithub_analytics_events',\n {\n description: `The latest raw pageviews and custom events of an analytics property (cloud: the raw tail, 7 days free / 30 Pro; self-hosted: the user's database). Use to check that tracking works after wiring track() or sh.js.`,\n inputSchema: { property: z.string(), limit: z.number().int().min(1).max(200).optional() },\n },\n async ({ property, limit }) => reply(await runCli(['analytics', 'events', property, ...(limit ? ['--limit', String(limit)] : [])]))\n);\n\nfor (const [name, old] of [['splithub_property_create', false], ['splithub_create_property', true]] as const)\n server.registerTool(\n name,\n {\n description: old ? oldName('splithub_property_create') : 'Add an analytics property to splithub.config.ts, checked by reloading the file. Its id is generated (sh-x1h78w) unless given; it comes back as property. Events go only to a property named explicitly: wire <SplitHubProvider config={config} property=\"<id>\"> (pageviews on load and every route change, and every track() call) or data-property=\"<id>\" on the sh.js script tag. Every goal of the project counts as a conversion unless goals narrows them. In cloud mode it is created in the cloud at once (live: applied), so no push is needed: tell the user to deploy. If live names a missing API key, log in and call again (or push). In an app (React Native, Expo) screens are page events: the screen tracker or useScreen(name) sends them.',\n inputSchema: {\n id: z.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).optional().describe('omit to get a generated id'),\n name: z.string().max(80).optional(),\n goals: z.array(z.string()).optional(),\n description: z.string().optional(),\n status: z.enum(['running', 'paused']).optional(),\n kind: z.enum(['site', 'app']).optional().describe('app: a mobile or desktop app (screens, versions, retention); default: app in an app project, else site'),\n },\n },\n async (a) => reply(await runCli(['analytics', 'create', ...(a.kind ? ['--kind', a.kind] : []), ...(a.id ? [a.id] : []), ...(a.name ? ['--name', a.name] : []), ...(a.goals?.length ? ['--goals', a.goals.join(',')] : []), ...(a.description ? ['--description', a.description] : []), ...(a.status ? ['--status', a.status] : [])]))\n );\n\nconst PROPERTY_STATUS_CMD = { running: 'resume', paused: 'pause', archived: 'archive', restored: 'restore', removed: 'remove' } as const;\nfor (const [name, old] of [['splithub_property_status', false], ['splithub_set_property_status', true]] as const)\n server.registerTool(\n name,\n {\n description: old\n ? oldName('splithub_property_status')\n : 'Pause or resume an analytics property (paused: its pageviews and events are dropped and not billed). Updates splithub.config.ts; in cloud mode it applies live within a minute. archived (SplitHub Cloud) stops collecting and hides it like the dashboard Archive, numbers kept; restored brings it back paused. removed takes it out of the config (a dashboard-made property is deleted in the cloud with its numbers).',\n inputSchema: { property: z.string(), status: z.enum(['running', 'paused', 'archived', 'restored', 'removed']) },\n },\n async ({ property, status }) => reply(await runCli(['analytics', PROPERTY_STATUS_CMD[status], property]))\n );\n\nserver.registerTool(\n 'splithub_domains',\n {\n description: `Allowed domains, per experiment and per analytics property (SplitHub Cloud). Without arguments: every allowed domain with where it applies, which experiments / properties accept any origin, and the origins seen sending events. With kind + id + hosts: replace that experiment's or property's list (subdomains included; an empty list accepts any origin again). Events from an origin outside the list are dropped (403 when nothing in the batch is allowed).`,\n inputSchema: {\n kind: z.enum(['experiment', 'property', 'test']).optional().describe('experiment or property (test is an old name for experiment)'),\n id: z.string().optional(),\n hosts: z.array(z.string()).optional().describe('e.g. [\"example.com\"]; [] clears the list'),\n },\n },\n async ({ kind, id, hosts }) => {\n if (!kind || !id || !hosts) return reply(await runCli(['domains']));\n return reply(await runCli(hosts.length ? ['domains', 'set', kind, id, ...hosts] : ['domains', 'clear', kind, id]));\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 experiment 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(\n 'splithub_push',\n {\n description: 'Upload splithub.config.ts to SplitHub Cloud (cloud mode). Also returns kept: experiments the cloud has from an earlier push that this file lacks, left as they are. prune removes those: only when the user asked for it. Returns experiments created in the dashboard that were written into the file. dryRun: only check the config and show what would change. A key that already belonged to another experiment fails with KEY_CONFLICT: ask the user, then push with replace (new experiment, old numbers cleared) or same (same experiment, numbers stay).',\n inputSchema: {\n dryRun: z.boolean().optional(),\n replace: z.array(z.string()).optional().describe('keys that are new experiments: the old numbers under them are cleared'),\n same: z.array(z.string()).optional().describe('keys that are the same experiment as before: the numbers stay'),\n prune: z.boolean().optional().describe('also remove experiments the cloud has that the file lacks (ask the user first)'),\n },\n },\n async ({ dryRun, replace, same, prune }) => {\n if (dryRun) return reply(await runCli(['push', '--dry-run', ...(prune ? ['--prune'] : [])]));\n const args = ['push'];\n if (replace?.length) args.push('--replace', replace.join(','));\n if (same?.length) args.push('--same', same.join(','));\n if (prune) args.push('--prune');\n return reply(await runCli(args));\n }\n);\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; in a React Native / Expo app also the package, its storage module and redirect experiments; in a native iOS / Android project the SDK in the build files. 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; React Native / Expo apps also get @splithub/react-native and their entry (App.tsx, app/_layout.tsx) wrapped in <SplitHubProvider> with screen tracking (app.entry.status added | already | manual: wire nextStep by hand); native iOS / Android get install lines and a quick start (app.install, app.quickStart) and no config file; 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 scope?: 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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yPAAyP,GAAG,YAAY;AAC3T,QAAM,IAAI,MAAM,WAAW;AAC3B,MAAI,WAAW,EAAG,QAAO,EAAE,SAAS,CAAC,EAAE,MAAM,QAAiB,MAAM,KAAK,UAAU,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,UAAU,oBAAoB;AACnI,SAAO,EAAE,SAAS,CAAC,EAAE,MAAM,QAAiB,MAAM,8BAA8B,EAAE,SAAS;AAAA,QAAW,EAAE,QAAQ,gBAAgB,KAAK,MAAM,EAAE,YAAY,EAAE,CAAC;AAAA,4EAAoF,CAAC,EAAE;AACrP,CAAC;AAED,OAAO;AAAA,EACL;AAAA,EACA,EAAE,aAAa,ojBAAojB,aAAa,EAAE,MAAM,EAAE,KAAK,CAAC,SAAS,MAAM,CAAC,EAAE,QAAQ,OAAO,GAAG,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,iCAA4B,GAAG,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE;AAAA,EAC9uB,OAAO,EAAE,MAAM,KAAK,aAAa,MAAM;AACrC,UAAM,OAAO,CAAC,QAAQ,UAAU,MAAM,SAAS,gBAAgB,YAAY;AAC3E,QAAI,IAAK,MAAK,KAAK,SAAS,GAAG;AAC/B,QAAI,aAAc,MAAK,KAAK,iBAAiB;AAC7C,WAAO,MAAM,MAAM,OAAO,MAAM,EAAE,WAAW,KAAQ,CAAC,CAAC;AAAA,EACzD;AACF;AAEA,IAAM,YAAY,IAAI,qBAAqB;AAC3C,MAAM,OAAO,QAAQ,SAAS;","names":["createRequire","require","createRequire"]}
|
|
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 sh2 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 KEY_CONFLICT: 'The key already belongs to another experiment in the cloud. Ask the user whether this is a new experiment (rename the key, or splithub_push with replace: the old numbers are cleared) or the same experiment (splithub_push with same). Never pick for them.',\n KEY_DELETED: 'A deleted experiment used this key. Rename the experiment key in splithub.config.ts (and in the code), then call splithub_push again.',\n NOT_CLOUD: 'This project stores events in its own database (self-hosted). Experiment slices, breakdowns, timelines, engagement, events by variant and raw events, push, funnels, paths, retention, realtime, segments, notes, links and alerts come with sh2 Cloud: tell the user; splithub_analytics still reads raw counts.',\n PRO_REQUIRED: 'Alert rules fire on Pro. Tell the user; they upgrade in the dashboard (Billing), then the rule can be turned on.',\n NOT_FOUND: 'Call the same tool with action list for the ids.',\n INSUFFICIENT_SCOPE: 'This API key lacks the scope named in `scope` (e.g. notes:write). Ask the user for a key with it (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).\n// sh2 Cloud sends verdicts with ready-to-print words; a self-hosted endpoint sends raw counts and\n// `analysis: { available: false }`.\nconst voiceShape = z\n .object({ scenario: z.string(), line: z.string(), advice: z.enum(['wait', 'ship', 'keep_control', 'move_on', 'fix_setup', 'hold']) })\n .passthrough()\n .describe('friendly line for humans; quote verdict.message for facts. advice move_on = suggest finishing and starting the next experiment');\nconst displayShape = z\n .object({ label: z.string(), lines: z.array(z.string()), next: z.string().optional() })\n .passthrough()\n .describe('ready-to-print label (WINNER, TOO EARLY, ...), lines and next step, for showing the result');\nconst analysisShape = z\n .object({ available: z.literal(false), message: z.string(), url: z.string() })\n .passthrough()\n .describe('self-hosted: raw numbers only. Tell the user verdicts come with sh2 Cloud; never invent one');\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().optional(), headline: z.string().nullable().optional(), sample: z.enum(['small', 'ok', 'good']).nullable().optional(), stars: z.number().nullable().optional(), daysToVerdict: z.number().nullable().optional(), voice: voiceShape.nullable().optional(), display: displayShape.optional() }).passthrough()),\n properties: z\n .array(z.object({ property: z.string(), name: z.string(), status: z.string(), visitors: z.number(), previousVisitors: z.number(), change: z.number().nullable(), conversions: z.array(z.object({ goal: z.string(), conversions: z.number(), change: z.number().nullable() }).passthrough()) }).passthrough())\n .optional()\n .describe('sh2 Cloud: analytics properties, last 7 days (propertiesRange) against the 7 before; change is relative, null = no visitors before'),\n propertiesRange: z.object({ from: z.string(), to: z.string() }).optional(),\n analysis: analysisShape.optional(),\n next: z.string().optional(),\n}).passthrough();\nconst scopeShape = z\n .object({ filtered: z.boolean(), range: z.object({ from: z.string(), to: z.string() }).nullable(), filters: z.record(z.union([z.string(), z.array(z.string())])), note: z.string().optional() })\n .passthrough()\n .describe('present on a slice (from / to / filters): the verdict is computed on that slice only; quote note');\nconst resultsOutput = z.object({\n experiment: z.string(),\n view: z.enum(['breakdown', 'timeline', 'engagement', 'events']).optional().describe('set when by, timeline, engagement or events was asked: the shape is that view, not a verdict'),\n kind: z.string().optional(),\n status: z.string().optional(),\n goal: z.string().nullable().optional(),\n scope: scopeShape.optional(),\n verdict: verdictShape.optional().describe('sh2 Cloud only'),\n daysToVerdict: z.number().nullable().optional().describe('days until a verdict at the current traffic; schedule the next check then'),\n voice: voiceShape.nullable().optional(),\n display: displayShape.optional(),\n variants: z\n .array(z.union([z.string(), z.object({ variant: z.string(), visitors: z.number() }).passthrough()]))\n .optional()\n .describe('self-hosted: raw counts per variant (conversions, rate), control first; view engagement: sessions, pagesPerVisit, bounceRate, avgVisit (ms) per variant; view events: the variant keys, control first'),\n rows: z\n .array(z.object({ name: z.string(), goalKey: z.string().nullable(), isGoal: z.boolean(), measured: z.enum(['goal', 'metric', 'guardrail']).nullable() }).passthrough())\n .optional()\n .describe('view events: every goal and event of these visitors; perVariant { visitors, count, rate, revenue } and comparisons[] against the control (lift, pValue, significant); small = too few visitors'),\n analysis: analysisShape.optional(),\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\n/** Visitor columns experiment reports filter by, and the dimensions a breakdown splits by (the CLI checks the same lists). `page` is analytics' word: landing as a filter, url as a breakdown. */\nconst EXPERIMENT_FILTERS = ['country', 'region', 'city', 'device', 'os', 'browser', 'language', 'host', 'platform', 'app_version', 'source', 'channel', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'landing', 'page'] as const;\nconst EXPERIMENT_BY = ['country', 'region', 'city', 'device', 'os', 'browser', 'language', 'host', 'platform', 'app_version', 'page', 'url', 'referrer', 'source', 'channel', 'landing', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content'] as const;\nfunction experimentArgs(a: { from?: string; to?: string; filters?: Partial<Record<string, string>> }): string[] {\n const args: string[] = [];\n if (a.from) args.push('--from', a.from);\n if (a.to) args.push('--to', a.to);\n for (const [k, v] of Object.entries(a.filters ?? {})) if (v) args.push('--filter', `${k}=${v}`);\n return args;\n}\nconst DAY = /^\\d{4}-\\d{2}-\\d{2}$/;\n\nconst LOOP = 'The loop: splithub_plan → splithub_experiment_create → wire the code → splithub_doctor → splithub_push (cloud) → splithub_results (re-check after daysToVerdict days) → splithub_experiment_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). properties[] (sh2 Cloud) is each analytics property's last 7 days against the 7 before (visitors, change, goal conversions): mention a big move; splithub_analytics has the details. 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 experiment, then call splithub_ship. display { label, lines, next } is ready to show; voice.line is the friendly line for humans; voice.advice move_on means suggest finishing the experiment and starting the next one. If analysis.available is false the project is self-hosted: report the raw numbers as they are, say verdicts come with sh2 Cloud (analysis.url), and never call a winner from raw rates. ${LOOP}`,\n outputSchema: statusOutput,\n },\n async () => reply(await runCli(['status']), { structured: true })\n);\n\nserver.registerTool(\n 'splithub_results',\n {\n description: 'Results of one experiment. sh2 Cloud gives the full verdict: 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 experiments). 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. Facts are in verdict.message; voice.line is the friendly line for humans (voice.advice move_on = suggest finishing the experiment and starting the next one); display { label, lines, next } is ready to show. If analysis.available is false the project is self-hosted: report the raw numbers as they are, say verdicts come with sh2 Cloud (analysis.url), and never call a winner from raw rates. If finished, ask which variant to keep, then splithub_ship. SLICE (sh2 Cloud): from / to (YYYY-MM-DD, project time zone) keep the visitors first exposed on those days, filters keep visitors by country, device, platform (ios, android, web…), app_version, source, channel, landing page, UTM…; the answer carries scope and the verdict is computed on that slice only: say so and quote scope.note, the decision stays with the unfiltered verdict. A slice carries no voice and no advice (numbers only): never suggest shipping or finishing from one. VIEWS (one at a time, same from / to / filters; the answer has view set): by splits visitors by a dimension, segments[] each with cells per variant (order[] = variants, control first) and comparisons[] (lift vs the control inside the segment, pValue, significant, better; small = too few visitors); timeline gives exposures[] and conversions[] per day and variant (a day = visitors first seen that day, conversions whenever they happened); engagement gives bounce rate, pages per visit and avgVisit (ms) per variant from the analytics property on the same visitors (property null = no analytics there); events gives rows[] for every goal (measured goal / metric / guardrail first) and event of these visitors, each with perVariant visitors and rate and comparisons[] against the control (property null = goals only, other events need analytics on the same site). Segments, engagement and events are for exploring: never call a winner from one segment or one event.',\n inputSchema: {\n experiment: z.string().describe('experiment id (key)'),\n from: z.string().regex(DAY).optional().describe('first-exposure day, from (inclusive)'),\n to: z.string().regex(DAY).optional().describe('first-exposure day, to (inclusive)'),\n filters: z.record(z.enum(EXPERIMENT_FILTERS), z.string()).optional().describe('visitor column → comma-separated values, e.g. { country: \"DE,FR\", channel: \"Paid Search\" }; \"(none)\" matches empty'),\n by: z.enum(EXPERIMENT_BY).optional().describe('view: lift per segment of this dimension'),\n timeline: z.boolean().optional().describe('view: visitors and conversions per day and variant'),\n engagement: z.boolean().optional().describe('view: bounce rate, pages per visit, visit length per variant'),\n events: z.boolean().optional().describe('view: every goal and event per variant, with lift against the control'),\n },\n outputSchema: resultsOutput,\n },\n async (a) => reply(await runCli(['results', a.experiment, ...experimentArgs(a), ...(a.by ? ['--by', a.by] : []), ...(a.timeline ? ['--timeline'] : []), ...(a.engagement ? ['--engagement'] : []), ...(a.events ? ['--events'] : [])]), { structured: true })\n);\n\nserver.registerTool(\n 'splithub_experiment_events',\n {\n description: 'The latest raw events of one experiment (sh2 Cloud, newest first): exposures (type exposure, the variant a visitor saw) and goals (type goal) with time, visitor, url, country. Same from / to / filters as splithub_results; type keeps one kind; nextBefore pages to older ones (pass it as before). Raw events stay 7 days (30 on Pro); the key needs events:read. Use to check that exposures and goals arrive after wiring code.',\n inputSchema: {\n experiment: z.string().describe('experiment id (key)'),\n type: z.enum(['exposure', 'goal']).optional(),\n limit: z.number().int().min(1).max(200).optional(),\n before: z.number().int().positive().optional().describe('nextBefore of the previous page (unix ms)'),\n from: z.string().regex(DAY).optional(),\n to: z.string().regex(DAY).optional(),\n filters: z.record(z.enum(EXPERIMENT_FILTERS), z.string()).optional().describe('visitor column → comma-separated values'),\n },\n },\n async (a) => reply(await runCli(['events', '--experiment', a.experiment, ...experimentArgs(a), ...(a.type ? ['--type', a.type] : []), ...(a.limit ? ['--limit', String(a.limit)] : []), ...(a.before ? ['--before', String(a.before)] : [])]))\n);\n\nserver.registerTool(\n 'splithub_plan',\n {\n description: 'Before creating an experiment: visitors per variant (and in all) to detect a relative lift `mde` on a `baseline` conversion rate, sized by sh2 Cloud for its sequential verdict (no account needed; fails with UNREACHABLE offline). With an experiment id, also the days left at its current traffic when its numbers are readable. 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\n/** Old tool names (before `splithub_<noun>_<verb>`), still registered for one release. */\nconst oldName = (name: string) => `Old name of ${name}, kept for one release: call ${name} instead.`;\n\nfor (const [name, old] of [['splithub_experiment_create', false], ['splithub_create_experiment', true]] as const)\n server.registerTool(\n name,\n {\n description: old ? oldName('splithub_experiment_create') : `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_experiment_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 compared, read with useValue as { factor: value }). First variant / first level is the control. In an app (React Native, Expo) redirect does nothing, and the config ships inside the build: the variants' code needs a release, then starting, pausing and weights apply live from the cloud; target new builds with an app_version gte condition in the flow. 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('the goal: any event name the app sends with track() (signup, Video Played) or a goal key from the config; an event not in goals becomes a goal, nothing to declare first'),\n values: z.record(z.string()).optional().describe('value experiments: variant → value'),\n match: z.string().optional().describe('redirect experiments: the path it runs on, e.g. /'),\n to: z.record(z.string()).optional().describe('redirect experiments: variant → destination path'),\n status: z.enum(['draft', 'running']).optional(),\n name: z.string().max(80).optional().describe('human name shown instead of the key; can be renamed later, the key stays'),\n description: z.string().optional(),\n traffic: z.number().gt(0).max(100).optional().describe('percent of visitors in the experiment (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 experiment starts'),\n end: z.string().optional().describe('ISO date the experiment ends'),\n secondary: z.array(z.string()).optional().describe('goals (event names or goal keys) 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 (event names or goal keys) 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: experiments 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.name) args.push('--name', a.name);\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\nfor (const [name, old] of [['splithub_experiment_status', false], ['splithub_set_status', true]] as const)\n server.registerTool(\n name,\n {\n description: old ? oldName('splithub_experiment_status') : '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\n/** Visit dimensions a funnel can be split by. */\nconst SESSION_BY = ['source', 'referrer', 'channel', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'country', 'region', 'city', 'device', 'os', 'browser', 'language', 'host', 'platform', 'app_version', 'entry', 'exit'] as const;\n/** Range, filters and a saved segment: every analytics report takes them. */\nconst RANGE = {\n days: z.number().int().min(1).max(400).optional(),\n from: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/).optional(),\n to: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/).optional(),\n filters: z.record(z.string()).optional().describe('dimension → comma-separated values'),\n segment: z.string().optional().describe('saved segment name or id'),\n};\nfunction rangeArgs(a: { days?: number; from?: string; to?: string; filters?: Record<string, string>; segment?: string }): string[] {\n const args: string[] = [];\n if (a.days) args.push('--days', String(a.days));\n if (a.from) args.push('--from', a.from);\n if (a.to) args.push('--to', a.to);\n if (a.segment) args.push('--segment', a.segment);\n for (const [k, v] of Object.entries(a.filters ?? {})) args.push('--filter', `${k}=${v}`);\n return args;\n}\n\nconst BY = ['source', 'referrer', 'channel', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'country', 'region', 'city', 'device', 'os', 'browser', 'language', 'host', 'platform', 'app_version', 'entry', 'exit', 'page', 'event', 'goal', 'variant', 'trait'] as const;\n\nserver.registerTool(\n 'splithub_analytics',\n {\n description: `Analytics properties (pageviews or app screens, and custom events, no variants). A property is kind site or app; in an app a screen is a page (url /ScreenName) and platform / app_version are dimensions for by and filters. Without property: every property with visitors, visits, pageviews and bounce for the last 30 days. With property: totals (visitors, newVisitors, sessions = visits, pageviews, events, bounces, duration in ms; bounce rate = bounces / sessions), goals (conversions = unique visitors who reached it in the range, completions = how many times, revenue), topPages and topSources (value \"(none)\" = direct). With by: rows grouped by a visit dimension, page, event or goal; goal adds that goal's conversions per row; variant (needs experiment) splits visits by the variant each visitor saw, trait (needs key) by an identify() trait. Range: days (last N days) or from / to (YYYY-MM-DD, project time zone). filters narrow the visits, e.g. { country: \"DE,FR\", source: \"(none)\" }. Self-hosted projects get raw counts only (analysis.available false): report them as they are and say full reports come with sh2 Cloud. compare adds previous (the compared range, with its dates in previous.range) for change against it: 'previous' (the same-length range right before), 'year' (the same days a year earlier) or 'YYYY-MM-DD..YYYY-MM-DD'. segment applies a saved segment (splithub_segments) by name or id. These are counts, not experiments: no verdicts, never call a winner from them.`,\n inputSchema: {\n property: z.string().optional().describe('property id; omit to list every property'),\n by: z.enum(BY).optional(),\n goal: z.string().optional().describe('with by: also count this goal per row'),\n experiment: z.string().optional().describe('by variant: the experiment key'),\n key: z.string().optional().describe('by trait: the trait name, e.g. plan'),\n days: z.number().int().min(1).max(400).optional(),\n from: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/).optional(),\n to: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/).optional(),\n filters: z.record(z.string()).optional().describe('dimension → comma-separated values'),\n segment: z.string().optional().describe('saved segment name or id'),\n compare: z.union([z.enum(['previous', 'year']), z.string().regex(/^\\d{4}-\\d{2}-\\d{2}\\.\\.\\d{4}-\\d{2}-\\d{2}$/)]).optional().describe(\"also read another period: 'previous' (right before), 'year' (a year earlier) or 'YYYY-MM-DD..YYYY-MM-DD'\"),\n limit: z.number().int().min(1).max(500).optional(),\n },\n },\n async (a) => {\n const args = ['analytics', ...(a.property ? [a.property] : [])];\n if (a.by) args.push('--by', a.by);\n if (a.goal) args.push('--goal', a.goal);\n if (a.experiment) args.push('--experiment', a.experiment);\n if (a.key) args.push('--key', a.key);\n if (a.compare) args.push('--compare', a.compare);\n if (a.limit) args.push('--limit', String(a.limit));\n return reply(await runCli([...args, ...rangeArgs(a)]));\n }\n);\n\nserver.registerTool(\n 'splithub_analytics_funnel',\n {\n description: `Funnel of an analytics property (sh2 Cloud): visitors who reached each step in order. Steps: page:/path (patterns like page:/blog/* work), event:<name>, goal:<key>; 2 to 8. Or funnel: a saved funnel's name or id (splithub_analytics_funnels), which brings its steps and within. within: visit (same visit, default), 7d or 30d (from the first step). Answers steps[] with visitors, conversion (share of the first step) and dropoff (share lost since the step before); by splits it by a visit dimension. rolledUp: days older than 90 count nothing. Counts, not an experiment: never call a winner from it.`,\n inputSchema: {\n property: z.string(),\n steps: z.array(z.string()).min(2).max(8).optional().describe('e.g. [\"page:/\", \"event:Signup\", \"goal:paid\"]; omit with funnel'),\n funnel: z.string().optional().describe('a saved funnel name or id'),\n within: z.enum(['visit', '7d', '30d']).optional(),\n by: z.enum(SESSION_BY).optional(),\n ...RANGE,\n },\n },\n async (a) => reply(await runCli(['analytics', 'funnel', a.property, ...(a.steps ? ['--steps', a.steps.join(',')] : []), ...(a.funnel ? ['--funnel', a.funnel] : []), ...(a.within ? ['--within', a.within] : []), ...(a.by ? ['--by', a.by] : []), ...rangeArgs(a)]))\n);\n\nserver.registerTool(\n 'splithub_analytics_funnels',\n {\n description: 'Saved funnels of an analytics property (sh2 Cloud), shown on its Funnels tab for the whole team. Without save or delete: the list (id, name, steps, within). save + steps: save one under that name (a name already saved updates it; steps and within as in splithub_analytics_funnel). delete: remove one by id or name. Run one with splithub_analytics_funnel { funnel }.',\n inputSchema: {\n property: z.string(),\n save: z.string().max(60).optional().describe('name of the funnel to save or update'),\n steps: z.array(z.string()).min(2).max(8).optional().describe('e.g. [\"page:/\", \"event:Signup\", \"goal:paid\"]'),\n within: z.enum(['visit', '7d', '30d']).optional(),\n delete: z.string().optional().describe('id or name to delete'),\n },\n },\n async (a) => {\n if (a.delete) return reply(await runCli(['analytics', 'funnels', a.property, '--delete', a.delete]));\n if (a.save) return reply(await runCli(['analytics', 'funnels', a.property, '--save', a.save, ...(a.steps ? ['--steps', a.steps.join(',')] : []), ...(a.within ? ['--within', a.within] : [])]));\n return reply(await runCli(['analytics', 'funnels', a.property]));\n }\n);\n\nserver.registerTool(\n 'splithub_analytics_paths',\n {\n description: 'Where visits went right after a page (or, with direction prev, where they came from), within the visit (sh2 Cloud). rows[] { value, visits }; (exit) = left the site, (entrance) = landed on the page.',\n inputSchema: { property: z.string(), page: z.string().describe('a path like /pricing or /blog/*'), direction: z.enum(['next', 'prev']).optional(), ...RANGE },\n },\n async (a) => reply(await runCli(['analytics', 'paths', a.property, '--page', a.page, ...(a.direction === 'prev' ? ['--prev'] : []), ...rangeArgs(a)]))\n);\n\nserver.registerTool(\n 'splithub_analytics_retention',\n {\n description: 'Retention cohorts of an analytics property (sh2 Cloud), the key report for apps: users grouped by the day or week they started (start: visit, event:<name> or goal:<key>), and how many came back (return: visit or event:<name>) in period 0, 1, 2… cohorts[] { start, users, retained[] }; retained[0] is the cohort period itself, retained[i] / users is the share. Ranges longer than 90 days / 26 weeks are cut (clamped: true). Default: start visit, return visit, period week. filters take platform (ios, android, web…) and app_version too. Counts, not an experiment.',\n inputSchema: {\n property: z.string(),\n start: z.string().optional().describe('visit | event:<name> | goal:<key>'),\n return: z.string().optional().describe('visit | event:<name>'),\n period: z.enum(['day', 'week']).optional(),\n ...RANGE,\n },\n },\n async (a) => reply(await runCli(['analytics', 'retention', a.property, ...(a.start ? ['--start', a.start] : []), ...(a.return ? ['--return', a.return] : []), ...(a.period ? ['--period', a.period] : []), ...rangeArgs(a)]))\n);\n\nserver.registerTool(\n 'splithub_analytics_realtime',\n {\n description: 'Who is on an analytics property right now (sh2 Cloud): activeVisitors5m, pageviews and events per minute over the last 30 minutes, top pages and sources. Use to confirm tracking works after a deploy.',\n inputSchema: { property: z.string() },\n },\n async ({ property }) => reply(await runCli(['analytics', 'realtime', property]))\n);\n\nserver.registerTool(\n 'splithub_segments',\n {\n description: 'Saved segments: named report filters every report can apply (segment on splithub_analytics, funnel, paths, retention). Without arguments: the list. save + filters: save one (filters like { country: \"DE,FR\", channel: \"Paid Search\" }; property limits it to one property). delete: remove one by id or name. sh2 Cloud.',\n inputSchema: {\n save: z.string().max(60).optional().describe('name of the segment to save'),\n filters: z.record(z.string()).optional().describe('dimension → comma-separated values'),\n property: z.string().optional(),\n delete: z.string().optional().describe('id or name to delete'),\n },\n },\n async (a) => {\n if (a.delete) return reply(await runCli(['analytics', 'segments', '--delete', a.delete]));\n const scope = a.property ? ['--property', a.property] : [];\n if (a.save) return reply(await runCli(['analytics', 'segments', '--save', a.save, ...Object.entries(a.filters ?? {}).map(([k, v]) => `${k}=${v}`), ...scope]));\n return reply(await runCli(['analytics', 'segments', ...scope]));\n }\n);\n\nserver.registerTool(\n 'splithub_notes',\n {\n description:\n 'Notes: what happened on a day (a launch, an outage, a campaign), shown on experiment timelines and analytics charts (sh2 Cloud). action list (default): newest first; experiment or property narrows it (project-wide notes come too), kind filters, days / from / to set the range. add: text (day defaults to today in the project time zone; kind note | issue | win; experiment or property ties it to one, none = the whole project). edit: id + text / kind / day. delete: id. Add one when you ship something that may move the numbers.',\n inputSchema: {\n action: z.enum(['list', 'add', 'edit', 'delete']).optional(),\n id: z.string().optional().describe('note id (edit, delete)'),\n text: z.string().max(2000).optional(),\n kind: z.enum(['note', 'issue', 'win']).optional(),\n day: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/).optional(),\n experiment: z.string().optional().describe('experiment key'),\n property: z.string().optional().describe('analytics property id'),\n days: RANGE.days,\n from: RANGE.from,\n to: RANGE.to,\n },\n },\n async (a) => {\n const action = a.action ?? (a.text && !a.id ? 'add' : 'list');\n const opt = [...(a.kind ? ['--kind', a.kind] : []), ...(a.day ? ['--day', a.day] : [])];\n const scope = a.experiment ? ['--experiment', a.experiment] : a.property ? ['--property', a.property] : [];\n if (action === 'add') return reply(await runCli(['notes', 'add', a.text ?? '', ...opt, ...scope]));\n if (action === 'edit') return reply(await runCli(['notes', 'edit', a.id ?? '', ...(a.text ? [a.text] : []), ...opt]));\n if (action === 'delete') return reply(await runCli(['notes', 'delete', a.id ?? '']));\n return reply(await runCli(['notes', ...(a.kind ? ['--kind', a.kind] : []), ...scope, ...rangeArgs(a)]));\n }\n);\n\nserver.registerTool(\n 'splithub_links',\n {\n description:\n 'Short links (sh2 Cloud): one short URL that redirects to one or more destinations split by weight (split visitors between landing pages without code), clicks counted. action list (default): every link with totalClicks. stats: one link (id or slug): clicks per day (30 days), per destination, country, device, referrer, unique visitors. create: urls (one or more full http(s) URLs), slug (3-32 letters, digits, - _; random when omitted), name, weights (one per URL). edit: name / slug / description. pause, resume, delete: by id or slug. Targeting by country, device or a flow is done in the dashboard.',\n inputSchema: {\n action: z.enum(['list', 'stats', 'create', 'edit', 'pause', 'resume', 'delete']).optional(),\n link: z.string().optional().describe('link id or slug (stats, edit, pause, resume, delete)'),\n urls: z.array(z.string()).min(1).optional().describe('create: destinations'),\n weights: z.array(z.number().min(0)).optional().describe('create: one weight per URL (default equal)'),\n slug: z.string().optional(),\n name: z.string().max(80).optional(),\n description: z.string().max(500).optional(),\n },\n },\n async (a) => {\n const action = a.action ?? 'list';\n if (action === 'list') return reply(await runCli(['links']));\n const opt = [...(a.slug ? ['--slug', a.slug] : []), ...(a.name ? ['--name', a.name] : []), ...(a.description !== undefined ? ['--description', a.description] : [])];\n if (action === 'create') return reply(await runCli(['links', 'create', ...(a.urls ?? []), ...opt, ...(a.weights ? ['--weights', a.weights.join(',')] : [])]));\n if (action === 'stats') return reply(await runCli(['links', a.link ?? '']));\n return reply(await runCli(['links', action, a.link ?? '', ...(action === 'edit' ? opt : [])]));\n }\n);\n\nserver.registerTool(\n 'splithub_alerts',\n {\n description:\n \"Alert rules (sh2 Cloud; they fire on Pro, a rule added on another plan is saved switched off). action list (default): rules with condition, params (params.progress { total, fired, month? } on usage and event_count is read-only), enabled; channels; history (recent alerts). add: condition + params. Experiment conditions (experiment = one key, omit for every running one): srm (broken split), winner (minVisitors?), loser (lift %, minVisitors?), exposures (visitors), conversions (conversions), duration (days), no_events (hours). Account: quota (percent of the monthly allowance), usage (every: alert each time this month's billed events cross another multiple, e.g. 1000). Analytics (property required): traffic_drop / traffic_spike (percent vs the same 24 hours a week before), goal_silent (goal, hours), event_count (event, any event when omitted; count; repeat = every count instead of once). Experiment rules may also pause, finish or dropLoser (winner / loser). enable, disable, delete, test (dry run: what would fire now, nothing sent): rule = id, the start of it, or the name. Where alerts go (email, Slack, Discord, webhook) is set in the dashboard.\",\n inputSchema: {\n action: z.enum(['list', 'add', 'enable', 'disable', 'delete', 'test']).optional(),\n rule: z.string().optional().describe('rule id, id prefix or name (enable, disable, delete, test)'),\n condition: z.enum(['srm', 'winner', 'loser', 'exposures', 'conversions', 'duration', 'no_events', 'quota', 'usage', 'traffic_drop', 'traffic_spike', 'goal_silent', 'event_count']).optional(),\n experiment: z.string().optional(),\n property: z.string().optional(),\n goal: z.string().optional(),\n event: z.string().optional(),\n every: z.number().int().min(100).optional(),\n count: z.number().int().min(1).optional(),\n repeat: z.boolean().optional(),\n percent: z.number().min(1).optional(),\n hours: z.number().min(1).optional(),\n days: z.number().int().min(1).optional(),\n visitors: z.number().int().min(1).optional(),\n conversions: z.number().int().min(1).optional(),\n lift: z.number().min(0).max(100).optional(),\n minVisitors: z.number().int().min(0).optional(),\n name: z.string().max(80).optional(),\n cooldownHours: z.number().min(1).optional(),\n enabled: z.boolean().optional().describe('add: false saves it switched off'),\n pause: z.boolean().optional(),\n finish: z.boolean().optional(),\n dropLoser: z.boolean().optional(),\n },\n },\n async (a) => {\n const action = a.action ?? (a.condition ? 'add' : 'list');\n if (action === 'list') return reply(await runCli(['alerts']));\n if (action !== 'add') return reply(await runCli(['alerts', action, a.rule ?? '']));\n const args = ['alerts', 'add', a.condition ?? ''];\n const text: Array<[string, string | undefined]> = [\n ['--experiment', a.experiment],\n ['--property', a.property],\n ['--goal', a.goal],\n ['--event', a.event],\n ['--name', a.name],\n ];\n for (const [flag, v] of text) if (v) args.push(flag, v);\n const nums: Array<[string, number | undefined]> = [\n ['--every', a.every],\n ['--count', a.count],\n ['--percent', a.percent],\n ['--hours', a.hours],\n ['--days', a.days],\n ['--visitors', a.visitors],\n ['--conversions', a.conversions],\n ['--lift', a.lift],\n ['--min-visitors', a.minVisitors],\n ['--cooldown', a.cooldownHours],\n ];\n for (const [flag, v] of nums) if (v !== undefined) args.push(flag, String(v));\n if (a.repeat) args.push('--repeat');\n if (a.enabled === false) args.push('--disabled');\n if (a.pause) args.push('--pause');\n if (a.finish) args.push('--finish');\n if (a.dropLoser) args.push('--drop-loser');\n return reply(await runCli(args));\n }\n);\n\nserver.registerTool(\n 'splithub_analytics_connect',\n {\n description:\n 'Set up analytics in this app: use a property (id), create one (name, or nothing when the project has none), then name it on the one <SplitHubProvider> / <SplitHubNextProvider> in the code (property=\"sh-…\"). Answers property, created, wired { status: added | already | other | none | many, file, line }, snippets { provider, script (sh.js tag with data-property), track, identify } and next. status none or many: add the provider snippet yourself (or the sh.js tag on a site without React). other: the provider names another property; ask before calling again with force. Pageviews are sent for you; events are track(name, props). In an app, script is empty and snippets.screen shows useScreen for screens the navigation tracker does not see. In cloud mode a new property is created in the cloud at once (live: applied), so no push: deploy.',\n inputSchema: {\n property: z.string().optional().describe('property id to use (added to the config when new)'),\n name: z.string().max(80).optional().describe('create a new property with this name'),\n force: z.boolean().optional().describe('replace another property already named on the provider'),\n },\n },\n async (a) => reply(await runCli(['analytics', 'connect', ...(a.property ? [a.property] : []), ...(a.name ? ['--name', a.name] : []), ...(a.force ? ['--force'] : [])]))\n);\n\nserver.registerTool(\n 'splithub_analytics_events',\n {\n description: `The latest raw pageviews and custom events of an analytics property (cloud: the raw tail, 7 days free / 30 Pro; self-hosted: the user's database). Use to check that tracking works after wiring track() or sh.js.`,\n inputSchema: { property: z.string(), limit: z.number().int().min(1).max(200).optional() },\n },\n async ({ property, limit }) => reply(await runCli(['analytics', 'events', property, ...(limit ? ['--limit', String(limit)] : [])]))\n);\n\nfor (const [name, old] of [['splithub_property_create', false], ['splithub_create_property', true]] as const)\n server.registerTool(\n name,\n {\n description: old ? oldName('splithub_property_create') : 'Add an analytics property to splithub.config.ts, checked by reloading the file. Its id is generated (sh-x1h78w) unless given; it comes back as property. Events go only to a property named explicitly: wire <SplitHubProvider config={config} property=\"<id>\"> (pageviews on load and every route change, and every track() call) or data-property=\"<id>\" on the sh.js script tag. Every goal of the project counts as a conversion unless goals narrows them. In cloud mode it is created in the cloud at once (live: applied), so no push is needed: tell the user to deploy. If live names a missing API key, log in and call again (or push). In an app (React Native, Expo) screens are page events: the screen tracker or useScreen(name) sends them.',\n inputSchema: {\n id: z.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).optional().describe('omit to get a generated id'),\n name: z.string().max(80).optional(),\n goals: z.array(z.string()).optional(),\n description: z.string().optional(),\n status: z.enum(['running', 'paused']).optional(),\n kind: z.enum(['site', 'app']).optional().describe('app: a mobile or desktop app (screens, versions, retention); default: app in an app project, else site'),\n },\n },\n async (a) => reply(await runCli(['analytics', 'create', ...(a.kind ? ['--kind', a.kind] : []), ...(a.id ? [a.id] : []), ...(a.name ? ['--name', a.name] : []), ...(a.goals?.length ? ['--goals', a.goals.join(',')] : []), ...(a.description ? ['--description', a.description] : []), ...(a.status ? ['--status', a.status] : [])]))\n );\n\nconst PROPERTY_STATUS_CMD = { running: 'resume', paused: 'pause', archived: 'archive', restored: 'restore', removed: 'remove' } as const;\nfor (const [name, old] of [['splithub_property_status', false], ['splithub_set_property_status', true]] as const)\n server.registerTool(\n name,\n {\n description: old\n ? oldName('splithub_property_status')\n : 'Pause or resume an analytics property (paused: its pageviews and events are dropped and not billed). Updates splithub.config.ts; in cloud mode it applies live within a minute. archived (sh2 Cloud) stops collecting and hides it like the dashboard Archive, numbers kept; restored brings it back paused. removed takes it out of the config (a dashboard-made property is deleted in the cloud with its numbers).',\n inputSchema: { property: z.string(), status: z.enum(['running', 'paused', 'archived', 'restored', 'removed']) },\n },\n async ({ property, status }) => reply(await runCli(['analytics', PROPERTY_STATUS_CMD[status], property]))\n );\n\nserver.registerTool(\n 'splithub_domains',\n {\n description: `Allowed domains, per experiment and per analytics property (sh2 Cloud). Without arguments: every allowed domain with where it applies, which experiments / properties accept any origin, and the origins seen sending events. With kind + id + hosts: replace that experiment's or property's list (subdomains included; an empty list accepts any origin again). Events from an origin outside the list are dropped (403 when nothing in the batch is allowed).`,\n inputSchema: {\n kind: z.enum(['experiment', 'property', 'test']).optional().describe('experiment or property (test is an old name for experiment)'),\n id: z.string().optional(),\n hosts: z.array(z.string()).optional().describe('e.g. [\"example.com\"]; [] clears the list'),\n },\n },\n async ({ kind, id, hosts }) => {\n if (!kind || !id || !hosts) return reply(await runCli(['domains']));\n return reply(await runCli(hosts.length ? ['domains', 'set', kind, id, ...hosts] : ['domains', 'clear', kind, id]));\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 experiment 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 sh2 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(\n 'splithub_push',\n {\n description: 'Upload splithub.config.ts to sh2 Cloud (cloud mode). Also returns kept: experiments the cloud has from an earlier push that this file lacks, left as they are. prune removes those: only when the user asked for it. Returns experiments created in the dashboard that were written into the file. dryRun: only check the config and show what would change. A key that already belonged to another experiment fails with KEY_CONFLICT: ask the user, then push with replace (new experiment, old numbers cleared) or same (same experiment, numbers stay).',\n inputSchema: {\n dryRun: z.boolean().optional(),\n replace: z.array(z.string()).optional().describe('keys that are new experiments: the old numbers under them are cleared'),\n same: z.array(z.string()).optional().describe('keys that are the same experiment as before: the numbers stay'),\n prune: z.boolean().optional().describe('also remove experiments the cloud has that the file lacks (ask the user first)'),\n },\n },\n async ({ dryRun, replace, same, prune }) => {\n if (dryRun) return reply(await runCli(['push', '--dry-run', ...(prune ? ['--prune'] : [])]));\n const args = ['push'];\n if (replace?.length) args.push('--replace', replace.join(','));\n if (same?.length) args.push('--same', same.join(','));\n if (prune) args.push('--prune');\n return reply(await runCli(args));\n }\n);\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; in a React Native / Expo app also the package, its storage module and redirect experiments; in a native iOS / Android project the SDK in the build files. 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 sh2 Cloud project, the current one marked (current).' }, async () => reply(await runCli(['projects'])));\n\nserver.registerTool('splithub_login', { description: 'Connect this folder to sh2 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 sh2 in this project: config file, framework files, agent skills; React Native / Expo apps also get @splithub/react-native and their entry (App.tsx, app/_layout.tsx) wrapped in <SplitHubProvider> with screen tracking (app.entry.status added | already | manual: wire nextStep by hand); native iOS / Android get install lines and a quick start (app.install, app.quickStart) and no config file; 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 scope?: 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\n/**\n * Flags the tools pass to the CLI. Tool values come from the model, so a value\n * like `--api=https://elsewhere` would otherwise be parsed as an option and send\n * the credential to another host. Anything starting with `-` must be one of these,\n * written alone (the tools never use `--flag=value`).\n */\nexport const TOOL_FLAGS = new Set([\n 'baseline', 'before', 'by', 'compare', 'conversions', 'cooldown', 'count', 'day', 'days', 'delete', 'description', 'disabled',\n 'drop-loser', 'dry-run', 'end', 'engagement', 'event', 'events', 'every', 'experiment', 'factor', 'filter', 'finish', 'force',\n 'from', 'funnel', 'github-action', 'goal', 'goals', 'good-sample', 'guardrail', 'hours', 'id', 'keep', 'key', 'kind', 'layer',\n 'lift', 'limit', 'match', 'max-visitors', 'mde', 'min-days', 'min-visitors', 'mode', 'name', 'no-install', 'no-login', 'page',\n 'pause', 'percent', 'period', 'prev', 'property', 'prune', 'repeat', 'replace', 'return', 'same', 'save', 'secondary', 'segment',\n 'slug', 'start', 'status', 'steps', 'timeline', 'to', 'traffic', 'type', 'value', 'variants', 'visitors', 'weights', 'within', 'yes',\n].map((f) => `--${f}`));\n\nexport function unsafeArg(args: string[]): string | null {\n return args.find((a) => a.startsWith('-') && !TOOL_FLAGS.has(a)) ?? null;\n}\n\nexport function runCli(args: string[], options: { timeoutMs?: number } = {}): Promise<CliResult> {\n const bad = unsafeArg(args);\n if (bad !== null) {\n const json: CliErrorBody = { error: `\"${bad.slice(0, 80)}\" is not a value the tool can pass on: values cannot start with \"-\".`, code: 'INVALID_ARGUMENT', hint: 'Use the id, host or text without a leading dash.' };\n return Promise.resolve({ code: 1, stdout: JSON.stringify(json), stderr: '', json });\n }\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;AAqBO,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,GA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AQ,OAAO,GAAG,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,iCAA4B,GAAG,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE;AAAA,EACzuB,OAAO,EAAE,MAAM,KAAK,aAAa,MAAM;AACrC,UAAM,OAAO,CAAC,QAAQ,UAAU,MAAM,SAAS,gBAAgB,YAAY;AAC3E,QAAI,IAAK,MAAK,KAAK,SAAS,GAAG;AAC/B,QAAI,aAAc,MAAK,KAAK,iBAAiB;AAC7C,WAAO,MAAM,MAAM,OAAO,MAAM,EAAE,WAAW,KAAQ,CAAC,CAAC;AAAA,EACzD;AACF;AAEA,IAAM,YAAY,IAAI,qBAAqB;AAC3C,MAAM,OAAO,QAAQ,SAAS;","names":["createRequire","require","createRequire"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splithub/mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "sh2 as MCP tools for Claude Code, Cursor and Codex: run A/B experiments on websites and apps, read verdicts, and read analytics, funnels, paths and retention.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"splithub",
|
|
7
7
|
"ab-testing",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"url": "git+https://github.com/splithub-io/splithub-sdk.git",
|
|
33
33
|
"directory": "packages/mcp"
|
|
34
34
|
},
|
|
35
|
-
"homepage": "https://
|
|
35
|
+
"homepage": "https://sh2.uk",
|
|
36
36
|
"bugs": {
|
|
37
37
|
"url": "https://github.com/splithub-io/splithub-sdk/issues"
|
|
38
38
|
},
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
54
54
|
"zod": "^3.23.8",
|
|
55
|
-
"splithub": "0.
|
|
55
|
+
"splithub": "0.6.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/node": "^22.13.0",
|