@splithub/mcp 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,8 +14,14 @@ claude mcp add splithub -- npx -y @splithub/mcp
14
14
  { "mcpServers": { "splithub": { "command": "npx", "args": ["-y", "@splithub/mcp"] } } }
15
15
  ```
16
16
 
17
- Tools: `splithub_status`, `splithub_results`, `splithub_create_experiment`, `splithub_set_status`,
18
- `splithub_push`, `splithub_pull`, `splithub_doctor`, `splithub_login`, `splithub_whoami`, `splithub_init`.
17
+ Tools: `splithub_status`, `splithub_results`, `splithub_plan`, `splithub_create_experiment`, `splithub_set_status`,
18
+ `splithub_refs`, `splithub_ship`, `splithub_remove`, `splithub_review`, `splithub_push`, `splithub_pull`,
19
+ `splithub_doctor`, `splithub_login`, `splithub_whoami`, `splithub_projects`, `splithub_init`.
20
+
21
+ With SplitHub Cloud, results carry the verdict (`verdict.message`), a friendly line (`voice.line`)
22
+ and ready-to-show text (`display`). Self-hosted projects get raw numbers only
23
+ (`analysis.available: false`): the agent reports them and says verdicts come with SplitHub Cloud.
24
+ `splithub_plan` asks SplitHub Cloud for the sample size; no account needed.
19
25
 
20
26
  Env: `SPLITHUB_PROJECT_DIR` (defaults to the client's cwd), `SPLITHUB_API` (staging / self-hosted cloud),
21
27
  `SPLITHUB_API_KEY` (CI), `SPLITHUB_CLI` (path to a specific CLI build).
package/dist/index.js CHANGED
@@ -105,10 +105,14 @@ function reply(r, options = {}) {
105
105
  const structured = options.structured && r.json && typeof r.json === "object" && !Array.isArray(r.json) ? r.json : void 0;
106
106
  return { content: [{ type: "text", text }], ...structured ? { structuredContent: structured } : {} };
107
107
  }
108
+ var voiceShape = z.object({ scenario: z.string(), line: z.string(), advice: z.enum(["wait", "ship", "keep_control", "move_on", "fix_setup", "hold"]) }).passthrough().describe("friendly line for humans; quote verdict.message for facts. advice move_on = suggest finishing and starting the next test");
109
+ var displayShape = z.object({ label: z.string(), lines: z.array(z.string()), next: z.string().optional() }).passthrough().describe("ready-to-print label (WINNER, TOO EARLY, ...), lines and next step, for showing the result");
110
+ var analysisShape = z.object({ available: z.literal(false), message: z.string(), url: z.string() }).passthrough().describe("self-hosted: raw numbers only. Tell the user verdicts come with SplitHub Cloud; never invent one");
108
111
  var verdictShape = z.object({ status: z.string(), message: z.string(), winner: z.string().nullable().optional(), notes: z.array(z.string()).optional() }).passthrough();
109
112
  var statusOutput = z.object({
110
113
  project: z.string(),
111
- experiments: z.array(z.object({ experiment: z.string(), kind: z.string(), status: z.string(), visitors: z.number(), days: z.number(), verdict: z.string().nullable(), headline: z.string().nullable(), daysToVerdict: z.number().nullable().optional() }).passthrough()),
114
+ 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()),
115
+ analysis: analysisShape.optional(),
112
116
  next: z.string().optional()
113
117
  }).passthrough();
114
118
  var resultsOutput = z.object({
@@ -116,8 +120,12 @@ var resultsOutput = z.object({
116
120
  kind: z.string(),
117
121
  status: z.string(),
118
122
  goal: z.string().nullable(),
119
- verdict: verdictShape,
123
+ verdict: verdictShape.optional().describe("SplitHub Cloud only"),
120
124
  daysToVerdict: z.number().nullable().optional().describe("days until a verdict at the current traffic; schedule the next check then"),
125
+ voice: voiceShape.nullable().optional(),
126
+ display: displayShape.optional(),
127
+ variants: z.array(z.object({ variant: z.string(), visitors: z.number(), conversions: z.number(), rate: z.number() }).passthrough()).optional().describe("self-hosted: raw counts per variant, control first"),
128
+ analysis: analysisShape.optional(),
121
129
  next: z.string().optional()
122
130
  }).passthrough();
123
131
  var refsOutput = z.object({
@@ -144,7 +152,7 @@ var LOOP = "The loop: splithub_plan \u2192 splithub_create_experiment \u2192 wir
144
152
  server.registerTool(
145
153
  "splithub_status",
146
154
  {
147
- description: `Every experiment of this project with status, visitors, days, the verdict headline and daysToVerdict (days until a verdict at the current traffic: schedule the next check then, do not poll). verdict guardrail_breached = do not ship that variant. The __holdout row is the project holdout (long-term impact). Start here. A finished experiment is over but its variants are still in the code: report its verdict, ask the user which variant to keep and whether to remove the test, then call splithub_ship. ${LOOP}`,
155
+ description: `Every experiment of this project with status, visitors, days, the verdict headline, sample (verdict.sample.quality: small | ok | good), stars (verdict.sample.stars, data quality 0..5) and daysToVerdict (days until a verdict at the current traffic: schedule the next check then, do not poll). verdict guardrail_breached = do not ship that variant. The __holdout row is the project holdout (long-term impact). Start here. A finished experiment is over but its variants are still in the code: report its verdict, ask the user which variant to keep and whether to remove the test, then call splithub_ship. display { label, lines, next } is ready to show; voice.line is the friendly line for humans; voice.advice move_on means suggest finishing the test 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}`,
148
156
  outputSchema: statusOutput
149
157
  },
150
158
  async () => reply(await runCli(["status"]), { structured: true })
@@ -152,7 +160,7 @@ server.registerTool(
152
160
  server.registerTool(
153
161
  "splithub_results",
154
162
  {
155
- description: "Full verdict for one experiment: sample per variant, lift, P(beat), SRM, winner; mvt adds factors[]. verdict.status guardrail_breached means do not ship: a variant made a guardrail metric worse (verdict.guardrailBreached[]); say what broke. verdict.metrics[] has secondary metrics and guardrails. The experiment __holdout is the project holdout (long-term impact of all tests). Verdicts are sequential (always-valid, safe to check daily, none before the experiment minDays, default 1 day): quote verdict.message verbatim, use comparisons[].sequential.pValue / sequential.ci (the plain pValue is fixed-horizon, display only: p = 0.01 there can be not significant) and relay verdict.notes[]. daysToVerdict says when to check again. If finished, ask which variant to keep, then splithub_ship.",
163
+ 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 tests). Verdicts are sequential (always-valid, safe to check any time) and depend on sample size, not days. verdict.sample.quality is small (below the minimums), ok, or good (every variant has its share of verdict.sample.goodSample, default 5000 visitors): say it next to the verdict; it never changes the decision. verdict.sample.stars (0..5) is a data-quality score from verdict.sample.checks[] (minimum, split, goodSample, power, week; each { met, label }): report the stars and the unmet labels, never as a reason to override the verdict. Quote verdict.message verbatim, use comparisons[].sequential.pValue / sequential.ci (the plain pValue is fixed-horizon, display only: p = 0.01 there can be not significant) and relay verdict.notes[]. daysToVerdict says when to check again. Facts are in verdict.message; voice.line is the friendly line for humans (voice.advice move_on = suggest finishing the test 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.",
156
164
  inputSchema: { experiment: z.string().describe("experiment id (key)") },
157
165
  outputSchema: resultsOutput
158
166
  },
@@ -161,7 +169,7 @@ server.registerTool(
161
169
  server.registerTool(
162
170
  "splithub_plan",
163
171
  {
164
- description: "Before creating a test: visitors per variant (and in all) to detect a relative lift `mde` on a `baseline` conversion rate, sized for the sequential verdict. With an experiment id, also the days left at its current traffic. If it takes months, suggest a bigger change or a busier page.",
172
+ description: "Before creating a test: 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.",
165
173
  inputSchema: {
166
174
  baseline: z.number().gt(0).lt(1).describe("conversion rate today, e.g. 0.05"),
167
175
  mde: z.number().gt(0).describe("smallest relative lift worth finding, e.g. 0.1 for +10%"),
@@ -174,7 +182,7 @@ server.registerTool(
174
182
  server.registerTool(
175
183
  "splithub_create_experiment",
176
184
  {
177
- description: `Add an experiment to splithub.config.ts (checked by reloading the file). It is written as running: it goes live when the code is deployed (and pushed in cloud mode). Tell the user that, and that splithub_set_status paused holds it. Pass status draft only when the user asks to hold it. kind: value (text/number/URL read with useValue), component (<Experiment>/<Variant> markup), redirect (match path + per-variant destination), mvt (factors instead of variants, every combination tested, read with useValue as { factor: value }). First variant / first level is the control. minDays: fewest days before a verdict (default 1, 0 = none). Then wire the returned snippet, call splithub_doctor and splithub_refs. ${LOOP}`,
185
+ description: `Add an experiment to splithub.config.ts (checked by reloading the file). It is written as running: it goes live when the code is deployed (and pushed in cloud mode). Tell the user that, and that splithub_set_status paused holds it. Pass status draft only when the user asks to hold it. kind: value (text/number/URL read with useValue), component (<Experiment>/<Variant> markup), redirect (match path + per-variant destination), mvt (factors instead of variants, every combination tested, read with useValue as { factor: value }). First variant / first level is the control. goodSample: total visitors at which the sample counts as good (default 5000). minDays: opt-in fewest days before a verdict (default 0 = none). Then wire the returned snippet, call splithub_doctor and splithub_refs. ${LOOP}`,
178
186
  inputSchema: {
179
187
  id: z.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).describe("experiment key, lowercase"),
180
188
  kind: z.enum(["value", "component", "redirect", "mvt"]),
@@ -189,7 +197,8 @@ server.registerTool(
189
197
  description: z.string().optional(),
190
198
  traffic: z.number().gt(0).max(100).optional().describe("percent of visitors in the test (default 100)"),
191
199
  maxVisitors: z.number().int().positive().optional().describe("stop counting after this many visitors"),
192
- minDays: z.number().int().min(0).max(30).optional().describe("fewest days before a verdict (default 1, 0 = none); raise it to cover weekly cycles"),
200
+ 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"),
201
+ goodSample: z.number().int().min(100).max(1e7).optional().describe("total visitors at which verdict.sample.quality turns good (default 5000); informational, never changes the verdict"),
193
202
  start: z.string().optional().describe("ISO date the test starts"),
194
203
  end: z.string().optional().describe("ISO date the test ends"),
195
204
  secondary: z.array(z.string()).optional().describe("goals to watch next to the primary goal"),
@@ -212,6 +221,7 @@ server.registerTool(
212
221
  if (a.traffic !== void 0) args.push("--traffic", String(a.traffic));
213
222
  if (a.maxVisitors !== void 0) args.push("--max-visitors", String(a.maxVisitors));
214
223
  if (a.minDays !== void 0) args.push("--min-days", String(a.minDays));
224
+ if (a.goodSample !== void 0) args.push("--good-sample", String(a.goodSample));
215
225
  if (a.start) args.push("--start", a.start);
216
226
  if (a.end) args.push("--end", a.end);
217
227
  if (a.secondary?.length) args.push("--secondary", a.secondary.join(","));
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 INSUFFICIENT_SCOPE: 'This API key can only read. Ask the user for a key with the write scope (dashboard, Settings, API keys) or call splithub_login again.',\n};\n\nfunction reply(r: CliResult, options: { structured?: boolean } = {}): ToolReply {\n const err = errorBody(r.json);\n if (r.code !== 0 || err) {\n const body = err ?? { error: (r.stderr || r.stdout || 'the splithub CLI failed').trim(), code: 'INTERNAL' };\n const next = NEXT_BY_CODE[body.code];\n return { content: [{ type: 'text', text: JSON.stringify({ ...body, ...(next ? { next } : {}) }) }], isError: true };\n }\n const text = r.json ? JSON.stringify(r.json, null, 2) : r.stdout.trim();\n const structured = options.structured && r.json && typeof r.json === 'object' && !Array.isArray(r.json) ? (r.json as Record<string, unknown>) : undefined;\n return { content: [{ type: 'text', text }], ...(structured ? { structuredContent: structured } : {}) };\n}\n\n// Output schemas mirror the CLI --json shapes (key fields; the rest passes through).\nconst verdictShape = z.object({ status: z.string(), message: z.string(), winner: z.string().nullable().optional(), notes: z.array(z.string()).optional() }).passthrough();\nconst statusOutput = z.object({\n project: z.string(),\n experiments: z.array(z.object({ experiment: z.string(), kind: z.string(), status: z.string(), visitors: z.number(), days: z.number(), verdict: z.string().nullable(), headline: z.string().nullable(), daysToVerdict: z.number().nullable().optional() }).passthrough()),\n next: z.string().optional(),\n}).passthrough();\nconst resultsOutput = z.object({\n experiment: z.string(),\n kind: z.string(),\n status: z.string(),\n goal: z.string().nullable(),\n verdict: verdictShape,\n daysToVerdict: z.number().nullable().optional().describe('days until a verdict at the current traffic; schedule the next check then'),\n next: z.string().optional(),\n}).passthrough();\nconst refsOutput = z.object({\n experiment: z.string(),\n goal: z.string().nullable(),\n goalShared: z.boolean(),\n inConfig: z.boolean(),\n count: z.number(),\n refs: z.array(z.object({ file: z.string(), line: z.number(), column: z.number(), text: z.string(), match: z.enum(['experiment', 'goal']) }).passthrough()),\n}).passthrough();\nconst shipOutput = z.object({\n experiment: z.string(),\n kept: z.string(),\n kind: z.string(),\n dryRun: z.boolean(),\n live: z.string(),\n configFile: z.string(),\n files: z.array(z.string()),\n diff: z.string().describe('unified diff of the config and the source files'),\n leftovers: z.array(z.object({ file: z.string(), line: z.number(), text: z.string(), reason: z.string() }).passthrough()),\n next: z.array(z.string()),\n}).passthrough();\n\nconst LOOP = 'The loop: splithub_plan → splithub_create_experiment → wire the code → splithub_doctor → splithub_push (cloud) → splithub_results (re-check after daysToVerdict days) → splithub_set_status finished → splithub_ship.';\n\nserver.registerTool(\n 'splithub_status',\n {\n description: `Every experiment of this project with status, visitors, days, the verdict headline and daysToVerdict (days until a verdict at the current traffic: schedule the next check then, do not poll). verdict guardrail_breached = do not ship that variant. The __holdout row is the project holdout (long-term impact). Start here. A finished experiment is over but its variants are still in the code: report its verdict, ask the user which variant to keep and whether to remove the test, then call splithub_ship. ${LOOP}`,\n outputSchema: statusOutput,\n },\n async () => reply(await runCli(['status']), { structured: true })\n);\n\nserver.registerTool(\n 'splithub_results',\n {\n description: 'Full verdict for one experiment: sample per variant, lift, P(beat), SRM, winner; mvt adds factors[]. verdict.status guardrail_breached means do not ship: a variant made a guardrail metric worse (verdict.guardrailBreached[]); say what broke. verdict.metrics[] has secondary metrics and guardrails. The experiment __holdout is the project holdout (long-term impact of all tests). Verdicts are sequential (always-valid, safe to check daily, none before the experiment minDays, default 1 day): quote verdict.message verbatim, use comparisons[].sequential.pValue / sequential.ci (the plain pValue is fixed-horizon, display only: p = 0.01 there can be not significant) and relay verdict.notes[]. daysToVerdict says when to check again. If finished, ask which variant to keep, then splithub_ship.',\n inputSchema: { experiment: z.string().describe('experiment id (key)') },\n outputSchema: resultsOutput,\n },\n async ({ experiment }) => reply(await runCli(['results', experiment]), { structured: true })\n);\n\nserver.registerTool(\n 'splithub_plan',\n {\n description: 'Before creating a test: visitors per variant (and in all) to detect a relative lift `mde` on a `baseline` conversion rate, sized for the sequential verdict. With an experiment id, also the days left at its current traffic. If it takes months, suggest a bigger change or a busier page.',\n inputSchema: {\n baseline: z.number().gt(0).lt(1).describe('conversion rate today, e.g. 0.05'),\n mde: z.number().gt(0).describe('smallest relative lift worth finding, e.g. 0.1 for +10%'),\n variants: z.number().int().min(2).optional().describe('number of variants including the control (default 2)'),\n experiment: z.string().optional().describe('experiment id: adds days at its traffic'),\n },\n },\n async ({ baseline, mde, variants, experiment }) => reply(await runCli(['plan', ...(experiment ? [experiment] : []), '--baseline', String(baseline), '--mde', String(mde), ...(variants ? ['--variants', String(variants)] : [])]))\n);\n\nserver.registerTool(\n 'splithub_create_experiment',\n {\n description: `Add an experiment to splithub.config.ts (checked by reloading the file). It is written as running: it goes live when the code is deployed (and pushed in cloud mode). Tell the user that, and that splithub_set_status paused holds it. Pass status draft only when the user asks to hold it. kind: value (text/number/URL read with useValue), component (<Experiment>/<Variant> markup), redirect (match path + per-variant destination), mvt (factors instead of variants, every combination tested, read with useValue as { factor: value }). First variant / first level is the control. minDays: fewest days before a verdict (default 1, 0 = none). Then wire the returned snippet, call splithub_doctor and splithub_refs. ${LOOP}`,\n inputSchema: {\n id: z.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).describe('experiment key, lowercase'),\n kind: z.enum(['value', 'component', 'redirect', 'mvt']),\n variants: z.array(z.string()).min(2).optional().describe('variant keys, first = control (not for mvt)'),\n factors: z.record(z.record(z.string())).optional().describe('mvt only: factor → level → value, e.g. { headline: { old: \"Old\", new: \"New\" }, button: { blue: \"#2563eb\", green: \"#16a34a\" } }; first level = control; at most 4 factors × 4 levels'),\n weights: z.array(z.number().min(0)).optional().describe('relative weights, same order as variants (not for mvt)'),\n goal: z.string().optional().describe('goal key from the config'),\n values: z.record(z.string()).optional().describe('value experiments: variant → value'),\n match: z.string().optional().describe('redirect experiments: path to test, e.g. /'),\n to: z.record(z.string()).optional().describe('redirect experiments: variant → destination path'),\n status: z.enum(['draft', 'running']).optional(),\n description: z.string().optional(),\n traffic: z.number().gt(0).max(100).optional().describe('percent of visitors in the test (default 100)'),\n maxVisitors: z.number().int().positive().optional().describe('stop counting after this many visitors'),\n minDays: z.number().int().min(0).max(30).optional().describe('fewest days before a verdict (default 1, 0 = none); raise it to cover weekly cycles'),\n start: z.string().optional().describe('ISO date the test starts'),\n end: z.string().optional().describe('ISO date the test ends'),\n secondary: z.array(z.string()).optional().describe('goals to watch next to the primary goal'),\n guardrails: z.array(z.union([z.string(), z.object({ goal: z.string(), worse: z.enum(['lower', 'higher']) })])).optional().describe('goals that must not get worse; { goal, worse: \"higher\" } when a rise is bad (refunds, errors). A breach makes the verdict guardrail_breached: do not ship'),\n layer: z.object({ key: z.string(), start: z.number().int().min(0).max(99), end: z.number().int().min(1).max(100) }).optional().describe('mutual exclusion: tests in one layer never share a visitor; bucket ranges [start, end) must not overlap'),\n },\n },\n async (a) => {\n const args = ['create', '--kind', a.kind, '--id', a.id, '--yes'];\n if (a.kind === 'mvt') {\n for (const [factor, levels] of Object.entries(a.factors ?? {})) args.push('--factor', `${factor}=${Object.entries(levels).map(([l, v]) => `${l}:${v}`).join(',')}`);\n } else args.push('--variants', (a.variants ?? ['control', 'b']).join(','));\n if (a.weights) args.push('--weights', a.weights.join(','));\n if (a.goal) args.push('--goal', a.goal);\n if (a.values) for (const [k, v] of Object.entries(a.values)) args.push('--value', `${k}=${v}`);\n if (a.match) args.push('--match', a.match);\n if (a.to) for (const [k, v] of Object.entries(a.to)) args.push('--to', `${k}=${v}`);\n if (a.status) args.push('--status', a.status);\n if (a.description) args.push('--description', a.description);\n if (a.traffic !== undefined) args.push('--traffic', String(a.traffic));\n if (a.maxVisitors !== undefined) args.push('--max-visitors', String(a.maxVisitors));\n if (a.minDays !== undefined) args.push('--min-days', String(a.minDays));\n if (a.start) args.push('--start', a.start);\n if (a.end) args.push('--end', a.end);\n if (a.secondary?.length) args.push('--secondary', a.secondary.join(','));\n if (a.guardrails?.length) args.push('--guardrail', a.guardrails.map((g) => (typeof g === 'string' ? g : `${g.goal}:${g.worse}`)).join(','));\n if (a.layer) args.push('--layer', `${a.layer.key}:${a.layer.start}-${a.layer.end}`);\n return reply(await runCli(args));\n }\n);\n\nserver.registerTool(\n 'splithub_set_status',\n {\n description: 'Start, pause or finish an experiment. The config file is updated (and checked); in cloud mode it applies live within a minute. After finishing, the variants are still in the code: ask the user which variant to keep, then call splithub_ship.',\n inputSchema: { experiment: z.string(), status: z.enum(['running', 'paused', 'finished']) },\n },\n async ({ experiment, status }) => {\n const cmd = status === 'running' ? 'start' : status === 'paused' ? 'pause' : 'finish';\n return reply(await runCli([cmd, experiment]));\n }\n);\n\nserver.registerTool(\n 'splithub_refs',\n {\n description: 'Files and lines that use an experiment id or its goal. Use after wiring code (is it referenced?) and after splithub_ship (count should be 0 for the experiment).',\n inputSchema: { experiment: z.string() },\n outputSchema: refsOutput,\n },\n async ({ experiment }) => reply(await runCli(['refs', experiment]), { structured: true })\n);\n\nserver.registerTool(\n 'splithub_ship',\n {\n description: 'Keep one variant and take the test out: archives it in the cloud (numbers stay readable), removes it from splithub.config.ts and rewrites the code (<Experiment> → the kept <Variant>, useValue → the kept literal, useVariant branches folded, unused imports dropped). Ask the user which variant to keep first (recommend verdict.winner; never a variant listed in verdict.guardrailBreached). Call with dryRun: true, show the diff, then without. Fix leftovers[] by hand, then follow next[] (push, doctor, tests).',\n inputSchema: { experiment: z.string(), keep: z.string().describe('variant key to keep'), dryRun: z.boolean().optional().describe('only return the diff') },\n outputSchema: shipOutput,\n },\n async ({ experiment, keep, dryRun }) => reply(await runCli(['ship', experiment, '--keep', keep, ...(dryRun ? ['--dry-run'] : [])]), { structured: true })\n);\n\nserver.registerTool(\n 'splithub_remove',\n {\n description: 'Remove an experiment from splithub.config.ts (and archive it in the cloud when connected) without touching the code. Prefer splithub_ship, which also cleans the code. Returns refs still in the code.',\n inputSchema: { experiment: z.string() },\n },\n async ({ experiment }) => reply(await runCli(['remove', experiment]))\n);\n\nserver.registerTool(\n 'splithub_review',\n { description: 'AI reviews of an experiment stored in SplitHub Cloud (Pro): written at the start, when the verdict changes while it runs, when it finishes, or on demand in the dashboard. Newest first. Quote them as an opinion; the verdict stays the source of truth.', inputSchema: { experiment: z.string().optional().describe('experiment id; omit for every experiment of the project') } },\n async ({ experiment }) => reply(await runCli(experiment ? ['review', experiment] : ['review']))\n);\n\nserver.registerTool('splithub_push', { description: 'Upload splithub.config.ts to SplitHub Cloud (cloud mode). Returns experiments created in the dashboard that were written into the file. dryRun: only check the config and show what would change.', inputSchema: { dryRun: z.boolean().optional() } }, async ({ dryRun }) => reply(await runCli(dryRun ? ['push', '--dry-run'] : ['push'])));\nserver.registerTool('splithub_pull', { description: 'Fetch the cloud config and write dashboard-created experiments into splithub.config.ts.' }, async () => reply(await runCli(['pull'])));\nserver.registerTool('splithub_doctor', { description: 'Check the installation: config, provider, middleware, routes, code references, endpoint. Run after wiring code; ok: false lists what to fix.' }, async () => reply(await runCli(['doctor'])));\nserver.registerTool('splithub_whoami', { description: 'Which cloud project this folder is connected to, and its public key.' }, async () => reply(await runCli(['whoami'])));\nserver.registerTool('splithub_projects', { description: 'Every folder on this machine connected to a SplitHub Cloud project, the current one marked (current).' }, async () => reply(await runCli(['projects'])));\n\nserver.registerTool('splithub_login', { description: 'Connect this folder to SplitHub Cloud. Returns a sign-in link and a code: show them to the user, who approves in the browser (and can create a project there). The CLI then stores a project API key for this folder. Call splithub_whoami afterwards.' }, async () => {\n const r = await startLogin();\n if ('error' in r) return { content: [{ type: 'text' as const, text: JSON.stringify(r) }], isError: r.error !== 'already logged in' };\n return { content: [{ type: 'text' as const, text: `Open this link to connect: ${r.verifyUrl}\\nCode: ${r.userCode} (expires in ${Math.round(r.expiresIn / 60)} min)\\nWaiting for the approval in the background; call splithub_whoami to check.` }] };\n});\n\nserver.registerTool(\n 'splithub_init',\n { description: 'Set up SplitHub in this project: config file, framework files, agent skills; in cloud mode see splithub_login to connect. Use once per project. githubAction: also write a GitHub workflow (checks on PRs, results comment on a schedule).', inputSchema: { mode: z.enum(['cloud', 'self']).default('cloud'), key: z.string().optional().describe('public key pk_… when known'), githubAction: z.boolean().optional() } },\n async ({ mode, key, githubAction }) => {\n const args = ['init', '--mode', mode, '--yes', '--no-install', '--no-login'];\n if (key) args.push('--key', key);\n if (githubAction) args.push('--github-action');\n return reply(await runCli(args, { timeoutMs: 120_000 }));\n }\n);\n\nconst transport = new StdioServerTransport();\nawait server.connect(transport);\n","// Runs the splithub CLI as a child process with --json and parses the reply.\n// The MCP server is a thin layer: credentials, config parsing and the cloud\n// protocol stay in one place (the CLI).\nimport { spawn } from 'node:child_process';\nimport { createRequire } from 'node:module';\n\nconst require = createRequire(import.meta.url);\n\nexport function cliPath(): string {\n if (process.env.SPLITHUB_CLI) return process.env.SPLITHUB_CLI;\n return require.resolve('splithub/dist/index.js');\n}\n\nexport function projectDir(): string {\n return process.env.SPLITHUB_PROJECT_DIR || process.cwd();\n}\n\n/** What the CLI prints with --json when a command fails. */\nexport interface CliErrorBody {\n error: string;\n code: string;\n hint?: string;\n}\n\nexport interface CliResult {\n code: number;\n stdout: string;\n stderr: string;\n json: unknown;\n}\n\n/**\n * The CLI prints one line of JSON per --json command; init and login print a step\n * line first (the sign-in link), so the result is the last JSON line.\n */\nexport function parseJson(text: string): unknown {\n const lines = text\n .split('\\n')\n .map((l) => l.trim())\n .filter((l) => l.startsWith('{') || l.startsWith('['));\n for (let i = lines.length - 1; i >= 0; i--) {\n try {\n return JSON.parse(lines[i]!);\n } catch {\n // not JSON after all; try the line before\n }\n }\n return null;\n}\n\nexport function errorBody(json: unknown): CliErrorBody | null {\n const j = json as Partial<CliErrorBody> | null;\n return j && typeof j.error === 'string' && typeof j.code === 'string' ? (j as CliErrorBody) : null;\n}\n\nexport function runCli(args: string[], options: { timeoutMs?: number } = {}): Promise<CliResult> {\n const extra: string[] = [];\n if (process.env.SPLITHUB_API) extra.push('--api', process.env.SPLITHUB_API);\n return new Promise((resolve) => {\n const child = spawn(process.execPath, [cliPath(), ...args, ...extra, '--json'], { cwd: projectDir(), env: { ...process.env, NO_COLOR: '1' }, stdio: ['ignore', 'pipe', 'pipe'] });\n let stdout = '';\n let stderr = '';\n child.stdout.on('data', (d) => (stdout += d));\n child.stderr.on('data', (d) => (stderr += d));\n const timer = setTimeout(() => child.kill(), options.timeoutMs ?? 60_000);\n child.on('close', (code) => {\n clearTimeout(timer);\n resolve({ code: code ?? 1, stdout, stderr, json: parseJson(stdout) });\n });\n });\n}\n\n/**\n * `login` prints the sign-in link first and then waits (up to 10 min) for the\n * approval. Return the link at once and let the process finish on its own.\n */\nexport function startLogin(): Promise<{ verifyUrl: string; userCode: string; expiresIn: number } | { error: string; code?: string }> {\n const extra: string[] = [];\n if (process.env.SPLITHUB_API) extra.push('--api', process.env.SPLITHUB_API);\n return new Promise((resolve) => {\n const child = spawn(process.execPath, [cliPath(), 'login', '--yes', ...extra, '--json'], { cwd: projectDir(), env: { ...process.env, NO_COLOR: '1' }, stdio: ['ignore', 'pipe', 'pipe'], detached: false });\n let buf = '';\n let done = false;\n child.stdout.on('data', (d) => {\n buf += d;\n if (done) return;\n for (const line of buf.split('\\n')) {\n if (!line.trim().startsWith('{')) continue;\n try {\n const j = JSON.parse(line) as { step?: string; verifyUrl?: string; userCode?: string; expiresIn?: number; alreadyLoggedIn?: boolean; error?: string; code?: string };\n if (j.step === 'approve' && j.verifyUrl) {\n done = true;\n resolve({ verifyUrl: j.verifyUrl, userCode: j.userCode ?? '', expiresIn: j.expiresIn ?? 600 });\n } else if (j.alreadyLoggedIn) {\n done = true;\n resolve({ error: 'already logged in' });\n } else if (typeof j.error === 'string') {\n done = true;\n resolve({ error: j.error, ...(j.code ? { code: j.code } : {}) });\n }\n } catch {\n // partial line\n }\n }\n });\n child.on('close', (code) => {\n if (!done) resolve({ error: `login exited with code ${code}: ${buf.slice(0, 300)}` });\n });\n child.unref();\n });\n}\n"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AS,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 INSUFFICIENT_SCOPE: 'This API key can only read. Ask the user for a key with the write scope (dashboard, Settings, API keys) or call splithub_login again.',\n};\n\nfunction reply(r: CliResult, options: { structured?: boolean } = {}): ToolReply {\n const err = errorBody(r.json);\n if (r.code !== 0 || err) {\n const body = err ?? { error: (r.stderr || r.stdout || 'the splithub CLI failed').trim(), code: 'INTERNAL' };\n const next = NEXT_BY_CODE[body.code];\n return { content: [{ type: 'text', text: JSON.stringify({ ...body, ...(next ? { next } : {}) }) }], isError: true };\n }\n const text = r.json ? JSON.stringify(r.json, null, 2) : r.stdout.trim();\n const structured = options.structured && r.json && typeof r.json === 'object' && !Array.isArray(r.json) ? (r.json as Record<string, unknown>) : undefined;\n return { content: [{ type: 'text', text }], ...(structured ? { structuredContent: structured } : {}) };\n}\n\n// Output schemas mirror the CLI --json shapes (key fields; the rest passes through).\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 test');\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 analysis: analysisShape.optional(),\n next: z.string().optional(),\n}).passthrough();\nconst resultsOutput = z.object({\n experiment: z.string(),\n kind: z.string(),\n status: z.string(),\n goal: z.string().nullable(),\n verdict: verdictShape.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.array(z.object({ variant: z.string(), visitors: z.number(), conversions: z.number(), rate: z.number() }).passthrough()).optional().describe('self-hosted: raw counts per variant, control first'),\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\nconst LOOP = 'The loop: splithub_plan → splithub_create_experiment → wire the code → splithub_doctor → splithub_push (cloud) → splithub_results (re-check after daysToVerdict days) → splithub_set_status finished → splithub_ship.';\n\nserver.registerTool(\n 'splithub_status',\n {\n description: `Every experiment of this project with status, visitors, days, the verdict headline, sample (verdict.sample.quality: small | ok | good), stars (verdict.sample.stars, data quality 0..5) and daysToVerdict (days until a verdict at the current traffic: schedule the next check then, do not poll). verdict guardrail_breached = do not ship that variant. The __holdout row is the project holdout (long-term impact). Start here. A finished experiment is over but its variants are still in the code: report its verdict, ask the user which variant to keep and whether to remove the test, then call splithub_ship. display { label, lines, next } is ready to show; voice.line is the friendly line for humans; voice.advice move_on means suggest finishing the test 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 tests). Verdicts are sequential (always-valid, safe to check any time) and depend on sample size, not days. verdict.sample.quality is small (below the minimums), ok, or good (every variant has its share of verdict.sample.goodSample, default 5000 visitors): say it next to the verdict; it never changes the decision. verdict.sample.stars (0..5) is a data-quality score from verdict.sample.checks[] (minimum, split, goodSample, power, week; each { met, label }): report the stars and the unmet labels, never as a reason to override the verdict. Quote verdict.message verbatim, use comparisons[].sequential.pValue / sequential.ci (the plain pValue is fixed-horizon, display only: p = 0.01 there can be not significant) and relay verdict.notes[]. daysToVerdict says when to check again. Facts are in verdict.message; voice.line is the friendly line for humans (voice.advice move_on = suggest finishing the test 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.',\n inputSchema: { experiment: z.string().describe('experiment id (key)') },\n outputSchema: resultsOutput,\n },\n async ({ experiment }) => reply(await runCli(['results', experiment]), { structured: true })\n);\n\nserver.registerTool(\n 'splithub_plan',\n {\n description: 'Before creating a test: visitors per variant (and in all) to detect a relative lift `mde` on a `baseline` conversion rate, sized 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\nserver.registerTool(\n 'splithub_create_experiment',\n {\n description: `Add an experiment to splithub.config.ts (checked by reloading the file). It is written as running: it goes live when the code is deployed (and pushed in cloud mode). Tell the user that, and that splithub_set_status paused holds it. Pass status draft only when the user asks to hold it. kind: value (text/number/URL read with useValue), component (<Experiment>/<Variant> markup), redirect (match path + per-variant destination), mvt (factors instead of variants, every combination tested, read with useValue as { factor: value }). First variant / first level is the control. goodSample: total visitors at which the sample counts as good (default 5000). minDays: opt-in fewest days before a verdict (default 0 = none). Then wire the returned snippet, call splithub_doctor and splithub_refs. ${LOOP}`,\n inputSchema: {\n id: z.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).describe('experiment key, lowercase'),\n kind: z.enum(['value', 'component', 'redirect', 'mvt']),\n variants: z.array(z.string()).min(2).optional().describe('variant keys, first = control (not for mvt)'),\n factors: z.record(z.record(z.string())).optional().describe('mvt only: factor → level → value, e.g. { headline: { old: \"Old\", new: \"New\" }, button: { blue: \"#2563eb\", green: \"#16a34a\" } }; first level = control; at most 4 factors × 4 levels'),\n weights: z.array(z.number().min(0)).optional().describe('relative weights, same order as variants (not for mvt)'),\n goal: z.string().optional().describe('goal key from the config'),\n values: z.record(z.string()).optional().describe('value experiments: variant → value'),\n match: z.string().optional().describe('redirect experiments: path to test, e.g. /'),\n to: z.record(z.string()).optional().describe('redirect experiments: variant → destination path'),\n status: z.enum(['draft', 'running']).optional(),\n description: z.string().optional(),\n traffic: z.number().gt(0).max(100).optional().describe('percent of visitors in the test (default 100)'),\n maxVisitors: z.number().int().positive().optional().describe('stop counting after this many visitors'),\n minDays: z.number().int().min(0).max(30).optional().describe('opt-in fewest days before a verdict (default 0 = none); verdicts otherwise depend on sample size'),\n goodSample: z.number().int().min(100).max(10_000_000).optional().describe('total visitors at which verdict.sample.quality turns good (default 5000); informational, never changes the verdict'),\n start: z.string().optional().describe('ISO date the test starts'),\n end: z.string().optional().describe('ISO date the test ends'),\n secondary: z.array(z.string()).optional().describe('goals to watch next to the primary goal'),\n guardrails: z.array(z.union([z.string(), z.object({ goal: z.string(), worse: z.enum(['lower', 'higher']) })])).optional().describe('goals that must not get worse; { goal, worse: \"higher\" } when a rise is bad (refunds, errors). A breach makes the verdict guardrail_breached: do not ship'),\n layer: z.object({ key: z.string(), start: z.number().int().min(0).max(99), end: z.number().int().min(1).max(100) }).optional().describe('mutual exclusion: tests in one layer never share a visitor; bucket ranges [start, end) must not overlap'),\n },\n },\n async (a) => {\n const args = ['create', '--kind', a.kind, '--id', a.id, '--yes'];\n if (a.kind === 'mvt') {\n for (const [factor, levels] of Object.entries(a.factors ?? {})) args.push('--factor', `${factor}=${Object.entries(levels).map(([l, v]) => `${l}:${v}`).join(',')}`);\n } else args.push('--variants', (a.variants ?? ['control', 'b']).join(','));\n if (a.weights) args.push('--weights', a.weights.join(','));\n if (a.goal) args.push('--goal', a.goal);\n if (a.values) for (const [k, v] of Object.entries(a.values)) args.push('--value', `${k}=${v}`);\n if (a.match) args.push('--match', a.match);\n if (a.to) for (const [k, v] of Object.entries(a.to)) args.push('--to', `${k}=${v}`);\n if (a.status) args.push('--status', a.status);\n if (a.description) args.push('--description', a.description);\n if (a.traffic !== undefined) args.push('--traffic', String(a.traffic));\n if (a.maxVisitors !== undefined) args.push('--max-visitors', String(a.maxVisitors));\n if (a.minDays !== undefined) args.push('--min-days', String(a.minDays));\n if (a.goodSample !== undefined) args.push('--good-sample', String(a.goodSample));\n if (a.start) args.push('--start', a.start);\n if (a.end) args.push('--end', a.end);\n if (a.secondary?.length) args.push('--secondary', a.secondary.join(','));\n if (a.guardrails?.length) args.push('--guardrail', a.guardrails.map((g) => (typeof g === 'string' ? g : `${g.goal}:${g.worse}`)).join(','));\n if (a.layer) args.push('--layer', `${a.layer.key}:${a.layer.start}-${a.layer.end}`);\n return reply(await runCli(args));\n }\n);\n\nserver.registerTool(\n 'splithub_set_status',\n {\n description: 'Start, pause or finish an experiment. The config file is updated (and checked); in cloud mode it applies live within a minute. After finishing, the variants are still in the code: ask the user which variant to keep, then call splithub_ship.',\n inputSchema: { experiment: z.string(), status: z.enum(['running', 'paused', 'finished']) },\n },\n async ({ experiment, status }) => {\n const cmd = status === 'running' ? 'start' : status === 'paused' ? 'pause' : 'finish';\n return reply(await runCli([cmd, experiment]));\n }\n);\n\nserver.registerTool(\n 'splithub_refs',\n {\n description: 'Files and lines that use an experiment id or its goal. Use after wiring code (is it referenced?) and after splithub_ship (count should be 0 for the experiment).',\n inputSchema: { experiment: z.string() },\n outputSchema: refsOutput,\n },\n async ({ experiment }) => reply(await runCli(['refs', experiment]), { structured: true })\n);\n\nserver.registerTool(\n 'splithub_ship',\n {\n description: 'Keep one variant and take the test out: archives it in the cloud (numbers stay readable), removes it from splithub.config.ts and rewrites the code (<Experiment> → the kept <Variant>, useValue → the kept literal, useVariant branches folded, unused imports dropped). Ask the user which variant to keep first (recommend verdict.winner; never a variant listed in verdict.guardrailBreached). Call with dryRun: true, show the diff, then without. Fix leftovers[] by hand, then follow next[] (push, doctor, tests).',\n inputSchema: { experiment: z.string(), keep: z.string().describe('variant key to keep'), dryRun: z.boolean().optional().describe('only return the diff') },\n outputSchema: shipOutput,\n },\n async ({ experiment, keep, dryRun }) => reply(await runCli(['ship', experiment, '--keep', keep, ...(dryRun ? ['--dry-run'] : [])]), { structured: true })\n);\n\nserver.registerTool(\n 'splithub_remove',\n {\n description: 'Remove an experiment from splithub.config.ts (and archive it in the cloud when connected) without touching the code. Prefer splithub_ship, which also cleans the code. Returns refs still in the code.',\n inputSchema: { experiment: z.string() },\n },\n async ({ experiment }) => reply(await runCli(['remove', experiment]))\n);\n\nserver.registerTool(\n 'splithub_review',\n { description: 'AI reviews of an experiment stored in SplitHub Cloud (Pro): written at the start, when the verdict changes while it runs, when it finishes, or on demand in the dashboard. Newest first. Quote them as an opinion; the verdict stays the source of truth.', inputSchema: { experiment: z.string().optional().describe('experiment id; omit for every experiment of the project') } },\n async ({ experiment }) => reply(await runCli(experiment ? ['review', experiment] : ['review']))\n);\n\nserver.registerTool('splithub_push', { description: 'Upload splithub.config.ts to SplitHub Cloud (cloud mode). Returns experiments created in the dashboard that were written into the file. dryRun: only check the config and show what would change.', inputSchema: { dryRun: z.boolean().optional() } }, async ({ dryRun }) => reply(await runCli(dryRun ? ['push', '--dry-run'] : ['push'])));\nserver.registerTool('splithub_pull', { description: 'Fetch the cloud config and write dashboard-created experiments into splithub.config.ts.' }, async () => reply(await runCli(['pull'])));\nserver.registerTool('splithub_doctor', { description: 'Check the installation: config, provider, middleware, routes, code references, endpoint. Run after wiring code; ok: false lists what to fix.' }, async () => reply(await runCli(['doctor'])));\nserver.registerTool('splithub_whoami', { description: 'Which cloud project this folder is connected to, and its public key.' }, async () => reply(await runCli(['whoami'])));\nserver.registerTool('splithub_projects', { description: 'Every folder on this machine connected to a SplitHub Cloud project, the current one marked (current).' }, async () => reply(await runCli(['projects'])));\n\nserver.registerTool('splithub_login', { description: 'Connect this folder to SplitHub Cloud. Returns a sign-in link and a code: show them to the user, who approves in the browser (and can create a project there). The CLI then stores a project API key for this folder. Call splithub_whoami afterwards.' }, async () => {\n const r = await startLogin();\n if ('error' in r) return { content: [{ type: 'text' as const, text: JSON.stringify(r) }], isError: r.error !== 'already logged in' };\n return { content: [{ type: 'text' as const, text: `Open this link to connect: ${r.verifyUrl}\\nCode: ${r.userCode} (expires in ${Math.round(r.expiresIn / 60)} min)\\nWaiting for the approval in the background; call splithub_whoami to check.` }] };\n});\n\nserver.registerTool(\n 'splithub_init',\n { description: 'Set up SplitHub in this project: config file, framework files, agent skills; in cloud mode see splithub_login to connect. Use once per project. githubAction: also write a GitHub workflow (checks on PRs, results comment on a schedule).', inputSchema: { mode: z.enum(['cloud', 'self']).default('cloud'), key: z.string().optional().describe('public key pk_… when known'), githubAction: z.boolean().optional() } },\n async ({ mode, key, githubAction }) => {\n const args = ['init', '--mode', mode, '--yes', '--no-install', '--no-login'];\n if (key) args.push('--key', key);\n if (githubAction) args.push('--github-action');\n return reply(await runCli(args, { timeoutMs: 120_000 }));\n }\n);\n\nconst transport = new StdioServerTransport();\nawait server.connect(transport);\n","// Runs the splithub CLI as a child process with --json and parses the reply.\n// The MCP server is a thin layer: credentials, config parsing and the cloud\n// protocol stay in one place (the CLI).\nimport { spawn } from 'node:child_process';\nimport { createRequire } from 'node:module';\n\nconst require = createRequire(import.meta.url);\n\nexport function cliPath(): string {\n if (process.env.SPLITHUB_CLI) return process.env.SPLITHUB_CLI;\n return require.resolve('splithub/dist/index.js');\n}\n\nexport function projectDir(): string {\n return process.env.SPLITHUB_PROJECT_DIR || process.cwd();\n}\n\n/** What the CLI prints with --json when a command fails. */\nexport interface CliErrorBody {\n error: string;\n code: string;\n hint?: string;\n}\n\nexport interface CliResult {\n code: number;\n stdout: string;\n stderr: string;\n json: unknown;\n}\n\n/**\n * The CLI prints one line of JSON per --json command; init and login print a step\n * line first (the sign-in link), so the result is the last JSON line.\n */\nexport function parseJson(text: string): unknown {\n const lines = text\n .split('\\n')\n .map((l) => l.trim())\n .filter((l) => l.startsWith('{') || l.startsWith('['));\n for (let i = lines.length - 1; i >= 0; i--) {\n try {\n return JSON.parse(lines[i]!);\n } catch {\n // not JSON after all; try the line before\n }\n }\n return null;\n}\n\nexport function errorBody(json: unknown): CliErrorBody | null {\n const j = json as Partial<CliErrorBody> | null;\n return j && typeof j.error === 'string' && typeof j.code === 'string' ? (j as CliErrorBody) : null;\n}\n\nexport function runCli(args: string[], options: { timeoutMs?: number } = {}): Promise<CliResult> {\n const extra: string[] = [];\n if (process.env.SPLITHUB_API) extra.push('--api', process.env.SPLITHUB_API);\n return new Promise((resolve) => {\n const child = spawn(process.execPath, [cliPath(), ...args, ...extra, '--json'], { cwd: projectDir(), env: { ...process.env, NO_COLOR: '1' }, stdio: ['ignore', 'pipe', 'pipe'] });\n let stdout = '';\n let stderr = '';\n child.stdout.on('data', (d) => (stdout += d));\n child.stderr.on('data', (d) => (stderr += d));\n const timer = setTimeout(() => child.kill(), options.timeoutMs ?? 60_000);\n child.on('close', (code) => {\n clearTimeout(timer);\n resolve({ code: code ?? 1, stdout, stderr, json: parseJson(stdout) });\n });\n });\n}\n\n/**\n * `login` prints the sign-in link first and then waits (up to 10 min) for the\n * approval. Return the link at once and let the process finish on its own.\n */\nexport function startLogin(): Promise<{ verifyUrl: string; userCode: string; expiresIn: number } | { error: string; code?: string }> {\n const extra: string[] = [];\n if (process.env.SPLITHUB_API) extra.push('--api', process.env.SPLITHUB_API);\n return new Promise((resolve) => {\n const child = spawn(process.execPath, [cliPath(), 'login', '--yes', ...extra, '--json'], { cwd: projectDir(), env: { ...process.env, NO_COLOR: '1' }, stdio: ['ignore', 'pipe', 'pipe'], detached: false });\n let buf = '';\n let done = false;\n child.stdout.on('data', (d) => {\n buf += d;\n if (done) return;\n for (const line of buf.split('\\n')) {\n if (!line.trim().startsWith('{')) continue;\n try {\n const j = JSON.parse(line) as { step?: string; verifyUrl?: string; userCode?: string; expiresIn?: number; alreadyLoggedIn?: boolean; error?: string; code?: string };\n if (j.step === 'approve' && j.verifyUrl) {\n done = true;\n resolve({ verifyUrl: j.verifyUrl, userCode: j.userCode ?? '', expiresIn: j.expiresIn ?? 600 });\n } else if (j.alreadyLoggedIn) {\n done = true;\n resolve({ error: 'already logged in' });\n } else if (typeof j.error === 'string') {\n done = true;\n resolve({ error: j.error, ...(j.code ? { code: j.code } : {}) });\n }\n } catch {\n // partial line\n }\n }\n });\n child.on('close', (code) => {\n if (!done) resolve({ error: `login exited with code ${code}: ${buf.slice(0, 300)}` });\n });\n child.unref();\n });\n}\n"],"mappings":";;;AASA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,iBAAAA,sBAAqB;AAC9B,SAAS,SAAS;;;ACTlB,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAE9B,IAAMC,WAAU,cAAc,YAAY,GAAG;AAEtC,SAAS,UAAkB;AAChC,MAAI,QAAQ,IAAI,aAAc,QAAO,QAAQ,IAAI;AACjD,SAAOA,SAAQ,QAAQ,wBAAwB;AACjD;AAEO,SAAS,aAAqB;AACnC,SAAO,QAAQ,IAAI,wBAAwB,QAAQ,IAAI;AACzD;AAoBO,SAAS,UAAU,MAAuB;AAC/C,QAAM,QAAQ,KACX,MAAM,IAAI,EACV,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,OAAO,CAAC,MAAM,EAAE,WAAW,GAAG,KAAK,EAAE,WAAW,GAAG,CAAC;AACvD,WAAS,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK;AAC1C,QAAI;AACF,aAAO,KAAK,MAAM,MAAM,CAAC,CAAE;AAAA,IAC7B,QAAQ;AAAA,IAER;AAAA,EACF;AACA,SAAO;AACT;AAEO,SAAS,UAAU,MAAoC;AAC5D,QAAM,IAAI;AACV,SAAO,KAAK,OAAO,EAAE,UAAU,YAAY,OAAO,EAAE,SAAS,WAAY,IAAqB;AAChG;AAEO,SAAS,OAAO,MAAgB,UAAkC,CAAC,GAAuB;AAC/F,QAAM,QAAkB,CAAC;AACzB,MAAI,QAAQ,IAAI,aAAc,OAAM,KAAK,SAAS,QAAQ,IAAI,YAAY;AAC1E,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,UAAM,QAAQ,MAAM,QAAQ,UAAU,CAAC,QAAQ,GAAG,GAAG,MAAM,GAA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AAC,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,6 +1,6 @@
1
1
  {
2
2
  "name": "@splithub/mcp",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "SplitHub as MCP tools for Claude Code, Cursor and Codex: create tests, start and finish them, read verdicts.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@modelcontextprotocol/sdk": "^1.12.0",
27
27
  "zod": "^3.23.8",
28
- "splithub": "0.2.0"
28
+ "splithub": "0.2.2"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "^22.13.0",