@splithub/mcp 0.4.1 → 0.4.3
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 +15 -9
- package/dist/index.js +22 -3
- package/dist/index.js.map +1 -1
- package/package.json +21 -3
package/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# @splithub/mcp
|
|
2
2
|
|
|
3
|
-
MCP server for SplitHub. Lets Claude Code, Cursor, Codex or any MCP client
|
|
4
|
-
|
|
5
|
-
with the same config file and
|
|
3
|
+
MCP server for SplitHub. Lets Claude Code, Cursor, Codex or any MCP client run experiments
|
|
4
|
+
(create, start, pause, finish, read verdicts, ship the winner) and read web analytics (traffic,
|
|
5
|
+
sources, funnels, paths, retention, realtime) through tools, with the same config file and
|
|
6
|
+
credentials as the `splithub` CLI.
|
|
6
7
|
|
|
7
8
|
```bash
|
|
8
9
|
npx splithub skills --mcp # writes .mcp.json (Claude Code) and .cursor/mcp.json (Cursor)
|
|
@@ -14,12 +15,17 @@ claude mcp add splithub -- npx -y @splithub/mcp
|
|
|
14
15
|
{ "mcpServers": { "splithub": { "command": "npx", "args": ["-y", "@splithub/mcp"] } } }
|
|
15
16
|
```
|
|
16
17
|
|
|
17
|
-
Tools:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
`
|
|
22
|
-
|
|
18
|
+
Tools:
|
|
19
|
+
|
|
20
|
+
| Area | Tools |
|
|
21
|
+
|---|---|
|
|
22
|
+
| Experiments | `splithub_status`, `splithub_results`, `splithub_experiment_events`, `splithub_plan`, `splithub_experiment_create`, `splithub_experiment_status`, `splithub_refs`, `splithub_ship`, `splithub_remove`, `splithub_review` |
|
|
23
|
+
| Analytics | `splithub_analytics`, `splithub_analytics_connect`, `splithub_analytics_events`, `splithub_analytics_funnel`, `splithub_analytics_funnels` (saved funnels), `splithub_analytics_paths`, `splithub_analytics_retention`, `splithub_analytics_realtime`, `splithub_segments`, `splithub_property_create`, `splithub_property_status` |
|
|
24
|
+
| Around them | `splithub_notes`, `splithub_links`, `splithub_alerts`, `splithub_domains` |
|
|
25
|
+
| Project | `splithub_init`, `splithub_push`, `splithub_pull`, `splithub_doctor`, `splithub_login`, `splithub_whoami`, `splithub_projects` |
|
|
26
|
+
|
|
27
|
+
The old names `splithub_create_experiment`, `splithub_set_status`, `splithub_create_property` and
|
|
28
|
+
`splithub_set_property_status` still work for one release.
|
|
23
29
|
|
|
24
30
|
With SplitHub Cloud, results carry the verdict (`verdict.message`), a friendly line (`voice.line`)
|
|
25
31
|
and ready-to-show text (`display`). Self-hosted projects get raw numbers only
|
package/dist/index.js
CHANGED
|
@@ -343,16 +343,35 @@ server.registerTool(
|
|
|
343
343
|
server.registerTool(
|
|
344
344
|
"splithub_analytics_funnel",
|
|
345
345
|
{
|
|
346
|
-
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. 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.`,
|
|
346
|
+
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.`,
|
|
347
347
|
inputSchema: {
|
|
348
348
|
property: z.string(),
|
|
349
|
-
steps: z.array(z.string()).min(2).max(8).describe('e.g. ["page:/", "event:Signup", "goal:paid"]'),
|
|
349
|
+
steps: z.array(z.string()).min(2).max(8).optional().describe('e.g. ["page:/", "event:Signup", "goal:paid"]; omit with funnel'),
|
|
350
|
+
funnel: z.string().optional().describe("a saved funnel name or id"),
|
|
350
351
|
within: z.enum(["visit", "7d", "30d"]).optional(),
|
|
351
352
|
by: z.enum(SESSION_BY).optional(),
|
|
352
353
|
...RANGE
|
|
353
354
|
}
|
|
354
355
|
},
|
|
355
|
-
async (a) => reply(await runCli(["analytics", "funnel", a.property, "--steps", a.steps.join(","), ...a.within ? ["--within", a.within] : [], ...a.by ? ["--by", a.by] : [], ...rangeArgs(a)]))
|
|
356
|
+
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)]))
|
|
357
|
+
);
|
|
358
|
+
server.registerTool(
|
|
359
|
+
"splithub_analytics_funnels",
|
|
360
|
+
{
|
|
361
|
+
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 }.",
|
|
362
|
+
inputSchema: {
|
|
363
|
+
property: z.string(),
|
|
364
|
+
save: z.string().max(60).optional().describe("name of the funnel to save or update"),
|
|
365
|
+
steps: z.array(z.string()).min(2).max(8).optional().describe('e.g. ["page:/", "event:Signup", "goal:paid"]'),
|
|
366
|
+
within: z.enum(["visit", "7d", "30d"]).optional(),
|
|
367
|
+
delete: z.string().optional().describe("id or name to delete")
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
async (a) => {
|
|
371
|
+
if (a.delete) return reply(await runCli(["analytics", "funnels", a.property, "--delete", a.delete]));
|
|
372
|
+
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] : []]));
|
|
373
|
+
return reply(await runCli(["analytics", "funnels", a.property]));
|
|
374
|
+
}
|
|
356
375
|
);
|
|
357
376
|
server.registerTool(
|
|
358
377
|
"splithub_analytics_paths",
|
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', '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', '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, 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. 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', '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', 'entry', 'exit', 'page', 'event', 'goal', 'variant', 'trait'] as const;\n\nserver.registerTool(\n 'splithub_analytics',\n {\n description: `Analytics properties (pageviews and custom events, no variants). 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. 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).describe('e.g. [\"page:/\", \"event:Signup\", \"goal:paid\"]'),\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, '--steps', a.steps.join(','), ...(a.within ? ['--within', a.within] : []), ...(a.by ? ['--by', a.by] : []), ...rangeArgs(a)]))\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): visitors 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[] { cohort, size, returned[] }; returned[i] / size is the share. Default: start visit, return visit, period week.',\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 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).',\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 },\n },\n async (a) => reply(await runCli(['analytics', 'create', ...(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. Run after wiring code; ok: false lists what to fix.' }, async () => reply(await runCli(['doctor'])));\nserver.registerTool('splithub_whoami', { description: 'Which cloud project this folder is connected to, and its public key.' }, async () => reply(await runCli(['whoami'])));\nserver.registerTool('splithub_projects', { description: 'Every folder on this machine connected to a SplitHub Cloud project, the current one marked (current).' }, async () => reply(await runCli(['projects'])));\n\nserver.registerTool('splithub_login', { description: 'Connect this folder to SplitHub Cloud. Returns a sign-in link and a code: show them to the user, who approves in the browser (and can create a project there). The CLI then stores a project API key for this folder. Call splithub_whoami afterwards.' }, async () => {\n const r = await startLogin();\n if ('error' in r) return { content: [{ type: 'text' as const, text: JSON.stringify(r) }], isError: r.error !== 'already logged in' };\n return { content: [{ type: 'text' as const, text: `Open this link to connect: ${r.verifyUrl}\\nCode: ${r.userCode} (expires in ${Math.round(r.expiresIn / 60)} min)\\nWaiting for the approval in the background; call splithub_whoami to check.` }] };\n});\n\nserver.registerTool(\n 'splithub_init',\n { description: 'Set up SplitHub in this project: config file, framework files, agent skills; in cloud mode see splithub_login to connect. Use once per project. githubAction: also write a GitHub workflow (checks on PRs, results comment on a schedule).', inputSchema: { mode: z.enum(['cloud', 'self']).default('cloud'), key: z.string().optional().describe('public key pk_… when known'), githubAction: z.boolean().optional() } },\n async ({ mode, key, githubAction }) => {\n const args = ['init', '--mode', mode, '--yes', '--no-install', '--no-login'];\n if (key) args.push('--key', key);\n if (githubAction) args.push('--github-action');\n return reply(await runCli(args, { timeoutMs: 120_000 }));\n }\n);\n\nconst transport = new StdioServerTransport();\nawait server.connect(transport);\n","// Runs the splithub CLI as a child process with --json and parses the reply.\n// The MCP server is a thin layer: credentials, config parsing and the cloud\n// protocol stay in one place (the CLI).\nimport { spawn } from 'node:child_process';\nimport { createRequire } from 'node:module';\n\nconst require = createRequire(import.meta.url);\n\nexport function cliPath(): string {\n if (process.env.SPLITHUB_CLI) return process.env.SPLITHUB_CLI;\n return require.resolve('splithub/dist/index.js');\n}\n\nexport function projectDir(): string {\n return process.env.SPLITHUB_PROJECT_DIR || process.cwd();\n}\n\n/** What the CLI prints with --json when a command fails. */\nexport interface CliErrorBody {\n error: string;\n code: string;\n hint?: string;\n 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\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,s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A8B,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,8OAA8O,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,EACxa,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 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', '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', '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, 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. 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', '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', 'entry', 'exit', 'page', 'event', 'goal', 'variant', 'trait'] as const;\n\nserver.registerTool(\n 'splithub_analytics',\n {\n description: `Analytics properties (pageviews and custom events, no variants). 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): visitors 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[] { cohort, size, returned[] }; returned[i] / size is the share. Default: start visit, return visit, period week.',\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 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).',\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 },\n },\n async (a) => reply(await runCli(['analytics', 'create', ...(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. Run after wiring code; ok: false lists what to fix.' }, async () => reply(await runCli(['doctor'])));\nserver.registerTool('splithub_whoami', { description: 'Which cloud project this folder is connected to, and its public key.' }, async () => reply(await runCli(['whoami'])));\nserver.registerTool('splithub_projects', { description: 'Every folder on this machine connected to a SplitHub Cloud project, the current one marked (current).' }, async () => reply(await runCli(['projects'])));\n\nserver.registerTool('splithub_login', { description: 'Connect this folder to SplitHub Cloud. Returns a sign-in link and a code: show them to the user, who approves in the browser (and can create a project there). The CLI then stores a project API key for this folder. Call splithub_whoami afterwards.' }, async () => {\n const r = await startLogin();\n if ('error' in r) return { content: [{ type: 'text' as const, text: JSON.stringify(r) }], isError: r.error !== 'already logged in' };\n return { content: [{ type: 'text' as const, text: `Open this link to connect: ${r.verifyUrl}\\nCode: ${r.userCode} (expires in ${Math.round(r.expiresIn / 60)} min)\\nWaiting for the approval in the background; call splithub_whoami to check.` }] };\n});\n\nserver.registerTool(\n 'splithub_init',\n { description: 'Set up SplitHub in this project: config file, framework files, agent skills; in cloud mode see splithub_login to connect. Use once per project. githubAction: also write a GitHub workflow (checks on PRs, results comment on a schedule).', inputSchema: { mode: z.enum(['cloud', 'self']).default('cloud'), key: z.string().optional().describe('public key pk_… when known'), githubAction: z.boolean().optional() } },\n async ({ mode, key, githubAction }) => {\n const args = ['init', '--mode', mode, '--yes', '--no-install', '--no-login'];\n if (key) args.push('--key', key);\n if (githubAction) args.push('--github-action');\n return reply(await runCli(args, { timeoutMs: 120_000 }));\n }\n);\n\nconst transport = new StdioServerTransport();\nawait server.connect(transport);\n","// Runs the splithub CLI as a child process with --json and parses the reply.\n// The MCP server is a thin layer: credentials, config parsing and the cloud\n// protocol stay in one place (the CLI).\nimport { spawn } from 'node:child_process';\nimport { createRequire } from 'node:module';\n\nconst require = createRequire(import.meta.url);\n\nexport function cliPath(): string {\n if (process.env.SPLITHUB_CLI) return process.env.SPLITHUB_CLI;\n return require.resolve('splithub/dist/index.js');\n}\n\nexport function projectDir(): string {\n return process.env.SPLITHUB_PROJECT_DIR || process.cwd();\n}\n\n/** What the CLI prints with --json when a command fails. */\nexport interface CliErrorBody {\n error: string;\n code: string;\n hint?: string;\n 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\n }\n }\n });\n child.on('close', (code) => {\n if (!done) resolve({ error: `login exited with code ${code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AAE,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,8OAA8O,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,EACxa,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,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splithub/mcp",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "SplitHub as MCP tools for Claude Code, Cursor and Codex:
|
|
3
|
+
"version": "0.4.3",
|
|
4
|
+
"description": "SplitHub as MCP tools for Claude Code, Cursor and Codex: run A/B experiments, read verdicts, and read web analytics, funnels, paths and retention.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"splithub",
|
|
7
|
+
"ab-testing",
|
|
8
|
+
"a-b-testing",
|
|
9
|
+
"experiments",
|
|
10
|
+
"split-testing",
|
|
11
|
+
"analytics",
|
|
12
|
+
"web-analytics",
|
|
13
|
+
"product-analytics",
|
|
14
|
+
"funnels",
|
|
15
|
+
"mcp",
|
|
16
|
+
"ai-agents",
|
|
17
|
+
"model-context-protocol",
|
|
18
|
+
"mcp-server",
|
|
19
|
+
"claude-code",
|
|
20
|
+
"cursor",
|
|
21
|
+
"codex"
|
|
22
|
+
],
|
|
5
23
|
"license": "MIT",
|
|
6
24
|
"repository": {
|
|
7
25
|
"type": "git",
|
|
@@ -25,7 +43,7 @@
|
|
|
25
43
|
"dependencies": {
|
|
26
44
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
27
45
|
"zod": "^3.23.8",
|
|
28
|
-
"splithub": "0.4.
|
|
46
|
+
"splithub": "0.4.3"
|
|
29
47
|
},
|
|
30
48
|
"devDependencies": {
|
|
31
49
|
"@types/node": "^22.13.0",
|