@splithub/mcp 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -92,6 +92,8 @@ var NEXT_BY_CODE = {
|
|
|
92
92
|
CONFIG_UNSAFE: "Edit splithub.config.ts by hand where the experiment is defined, then call splithub_doctor.",
|
|
93
93
|
CONFIG_WRITE: "The config file was restored as it was. Make the change by hand, then call splithub_doctor.",
|
|
94
94
|
CONFIG_PARSE: "Fix the error in splithub.config.ts, then call splithub_doctor.",
|
|
95
|
+
KEY_CONFLICT: "The key already belongs to another test in the cloud. Ask the user whether this is a new test (rename the key, or splithub_push with replace: the old numbers are cleared) or the same test (splithub_push with same). Never pick for them.",
|
|
96
|
+
KEY_DELETED: "A deleted test used this key. Rename the experiment key in splithub.config.ts (and in the code), then call splithub_push again.",
|
|
95
97
|
INSUFFICIENT_SCOPE: "This API key can only read. Ask the user for a key with the write scope (dashboard, Settings, API keys) or call splithub_login again."
|
|
96
98
|
};
|
|
97
99
|
function reply(r, options = {}) {
|
|
@@ -194,6 +196,7 @@ server.registerTool(
|
|
|
194
196
|
match: z.string().optional().describe("redirect experiments: path to test, e.g. /"),
|
|
195
197
|
to: z.record(z.string()).optional().describe("redirect experiments: variant \u2192 destination path"),
|
|
196
198
|
status: z.enum(["draft", "running"]).optional(),
|
|
199
|
+
name: z.string().max(80).optional().describe("human name shown instead of the key; can be renamed later, the key stays"),
|
|
197
200
|
description: z.string().optional(),
|
|
198
201
|
traffic: z.number().gt(0).max(100).optional().describe("percent of visitors in the test (default 100)"),
|
|
199
202
|
maxVisitors: z.number().int().positive().optional().describe("stop counting after this many visitors"),
|
|
@@ -217,6 +220,7 @@ server.registerTool(
|
|
|
217
220
|
if (a.match) args.push("--match", a.match);
|
|
218
221
|
if (a.to) for (const [k, v] of Object.entries(a.to)) args.push("--to", `${k}=${v}`);
|
|
219
222
|
if (a.status) args.push("--status", a.status);
|
|
223
|
+
if (a.name) args.push("--name", a.name);
|
|
220
224
|
if (a.description) args.push("--description", a.description);
|
|
221
225
|
if (a.traffic !== void 0) args.push("--traffic", String(a.traffic));
|
|
222
226
|
if (a.maxVisitors !== void 0) args.push("--max-visitors", String(a.maxVisitors));
|
|
@@ -272,7 +276,24 @@ server.registerTool(
|
|
|
272
276
|
{ 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") } },
|
|
273
277
|
async ({ experiment }) => reply(await runCli(experiment ? ["review", experiment] : ["review"]))
|
|
274
278
|
);
|
|
275
|
-
server.registerTool(
|
|
279
|
+
server.registerTool(
|
|
280
|
+
"splithub_push",
|
|
281
|
+
{
|
|
282
|
+
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. A key that already belonged to another test fails with KEY_CONFLICT: ask the user, then push with replace (new test, old numbers cleared) or same (same test, numbers stay).",
|
|
283
|
+
inputSchema: {
|
|
284
|
+
dryRun: z.boolean().optional(),
|
|
285
|
+
replace: z.array(z.string()).optional().describe("keys that are new tests: the old numbers under them are cleared"),
|
|
286
|
+
same: z.array(z.string()).optional().describe("keys that are the same test as before: the numbers stay")
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
async ({ dryRun, replace, same }) => {
|
|
290
|
+
if (dryRun) return reply(await runCli(["push", "--dry-run"]));
|
|
291
|
+
const args = ["push"];
|
|
292
|
+
if (replace?.length) args.push("--replace", replace.join(","));
|
|
293
|
+
if (same?.length) args.push("--same", same.join(","));
|
|
294
|
+
return reply(await runCli(args));
|
|
295
|
+
}
|
|
296
|
+
);
|
|
276
297
|
server.registerTool("splithub_pull", { description: "Fetch the cloud config and write dashboard-created experiments into splithub.config.ts." }, async () => reply(await runCli(["pull"])));
|
|
277
298
|
server.registerTool("splithub_doctor", { description: "Check the installation: config, provider, middleware, routes, code references, endpoint. Run after wiring code; ok: false lists what to fix." }, async () => reply(await runCli(["doctor"])));
|
|
278
299
|
server.registerTool("splithub_whoami", { description: "Which cloud project this folder is connected to, and its public key." }, async () => reply(await runCli(["whoami"])));
|
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).\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,G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,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 test in the cloud. Ask the user whether this is a new test (rename the key, or splithub_push with replace: the old numbers are cleared) or the same test (splithub_push with same). Never pick for them.',\n KEY_DELETED: 'A deleted test used this key. Rename the experiment key in splithub.config.ts (and in the code), then call splithub_push again.',\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 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 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.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\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(\n 'splithub_push',\n {\n 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. A key that already belonged to another test fails with KEY_CONFLICT: ask the user, then push with replace (new test, old numbers cleared) or same (same test, numbers stay).',\n inputSchema: {\n dryRun: z.boolean().optional(),\n replace: z.array(z.string()).optional().describe('keys that are new tests: the old numbers under them are cleared'),\n same: z.array(z.string()).optional().describe('keys that are the same test as before: the numbers stay'),\n },\n },\n async ({ dryRun, replace, same }) => {\n if (dryRun) return reply(await runCli(['push', '--dry-run']));\n const args = ['push'];\n if (replace?.length) args.push('--replace', replace.join(','));\n if (same?.length) args.push('--same', same.join(','));\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}\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,aAA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AC;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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splithub/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
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.
|
|
28
|
+
"splithub": "0.3.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^22.13.0",
|