- storebound mcp: stdio MCP server (spec 2025-11-25, tools only), one tool per command, write tools dry_run by default, readOnly/destructive/idempotent/openWorld annotations; submit, release, rollout, cancel and delete are not exposed. Own JSON-RPC subset, no SDK, zero runtime deps. - storebound install --agent claude|codex|cursor|copilot|windsurf|gemini|opencode: copies the skills and adds the storebound MCP entry (.mcp.json, .codex/config.toml, .cursor/mcp.json, .vscode/mcp.json, Windsurf mcp_config.json, .gemini/settings.json, opencode.json). Idempotent, keeps other entries, --dry.
153 lines
13 KiB
TypeScript
153 lines
13 KiB
TypeScript
// The tools `storebound mcp` offers, as data. Pure, so tests can check the list and the argv each call builds.
|
|
// Rules: one tool per CLI command; every tool that writes anything has `dry_run` defaulting to true; nothing that
|
|
// submits for review, releases to the public, resumes / completes a rollout, cancels a submission or deletes is
|
|
// exposed. Those stay terminal commands the owner runs (they also ask for confirmation there).
|
|
|
|
export interface JsonSchema { type: string; description?: string; enum?: (string | number)[]; default?: unknown; items?: JsonSchema; minimum?: number; maximum?: number; pattern?: string }
|
|
|
|
export interface ToolDef {
|
|
name: string;
|
|
title: string;
|
|
description: string;
|
|
/** CLI words before the options, e.g. ['play', 'listing']. */
|
|
command: string[];
|
|
/** Writes to a store or to local files. Gets `dry_run` (default true). */
|
|
write: boolean;
|
|
/** Replaces existing data (screenshots, a whole form) instead of only adding. */
|
|
destructive?: boolean;
|
|
idempotent?: boolean;
|
|
/** Talks to a store API or the internet. */
|
|
network: boolean;
|
|
props?: Record<string, JsonSchema>;
|
|
required?: string[];
|
|
/** Input -> extra CLI options (dry_run is handled for every write tool). */
|
|
args?: (i: Record<string, unknown>) => string[];
|
|
}
|
|
|
|
const only: JsonSchema = { type: 'string', description: 'Comma-separated ids / language codes to limit the run to (optional)' };
|
|
const opt = (flag: string, v: unknown): string[] => (v === undefined || v === null || v === '' ? [] : [`--${flag}`, String(v)]);
|
|
const flag = (name: string, v: unknown): string[] => (v === true ? [`--${name}`] : []);
|
|
|
|
export const TOOLS: ToolDef[] = [
|
|
{ name: 'check', title: 'Offline config check', command: ['check'], write: false, network: false,
|
|
description: 'Validate storebound.config.ts, both listing files, screenshot copy, Data safety answers, product texts and referenced files. Offline.' },
|
|
{ name: 'check_aso', title: 'Keyword audit', command: ['check'], write: false, network: false,
|
|
description: 'Offline ASO audit of the listing files: App Store keyword field rules (100 chars, no spaces, no name/subtitle repeats, >= 90% used) and Play keyword stuffing.',
|
|
props: { storefront: { type: 'string', description: 'App Store storefront for the cross-locale hint', default: 'US' } },
|
|
args: i => ['--aso', ...opt('storefront', i.storefront)] },
|
|
{ name: 'validate', title: 'Store readiness report', command: ['validate'], write: false, network: true,
|
|
description: 'Read-only readiness report for App Store Connect and/or Google Play with ordered blockers (build, encryption, metadata, screenshots, review details, age rating, prices, IAPs, privacy URL, app-ads.txt, tracks, products).',
|
|
props: { store: { type: 'string', enum: ['both', 'apple', 'play'], default: 'both' } },
|
|
args: i => (i.store === 'apple' ? ['--apple'] : i.store === 'play' ? ['--play'] : []) },
|
|
{ name: 'apple_status', title: 'App Store status', command: ['apple', 'status'], write: false, network: true,
|
|
description: 'Read-only App Store Connect overview: versions and their states, recent builds, in-app purchases, review submissions.' },
|
|
{ name: 'apple_next_build', title: 'Next iOS build number', command: ['apple', 'next-build'], write: false, network: true,
|
|
description: 'Next safe CFBundleVersion: one above every build uploaded for the app.' },
|
|
{ name: 'play_status', title: 'Google Play status', command: ['play', 'status'], write: false, network: true,
|
|
description: 'Read-only Play overview: tracks and releases (with rollout fraction), listing languages, one-time products.' },
|
|
{ name: 'play_next_version_code', title: 'Next Play versionCode', command: ['play', 'next-version-code'], write: false, network: true,
|
|
description: 'Next Play versionCode: one above every uploaded bundle and track release.' },
|
|
{ name: 'privacy_manifest', title: 'iOS privacy manifest scan', command: ['privacy-manifest'], write: false, network: false,
|
|
description: 'Local scan of an iOS project: PrivacyInfo.xcprivacy present, required-reason APIs declared, SDKs without manifests.',
|
|
props: { ios: { type: 'string', description: 'Path of the iOS project folder, e.g. ios/App' }, sdk_dirs: { type: 'string', description: 'Extra plugin / SDK folders, comma-separated' } },
|
|
required: ['ios'], args: i => [...opt('ios', i.ios), ...opt('sdk-dirs', i.sdk_dirs)] },
|
|
|
|
{ name: 'whats_new', title: 'Draft release notes', command: ['whats-new'], write: true, network: false, idempotent: true,
|
|
description: 'Draft player-facing release notes from the git log since a tag; with dry_run false writes the draft into the listing files (local text only, nothing is sent to a store).',
|
|
props: { since: { type: 'string', description: 'Git tag or ref (default: latest tag)' }, lang: { type: 'string' }, all_languages: { type: 'boolean', default: false } },
|
|
args: i => [...opt('since', i.since), ...opt('lang', i.lang), ...flag('all', i.all_languages)] },
|
|
{ name: 'play_listing', title: 'Push Play listing text', command: ['play', 'listing'], write: true, network: true, idempotent: true,
|
|
description: 'Google Play app details + title / short / full description per language from the listing file. Not public until the next review / publish.',
|
|
props: { only }, args: i => opt('only', i.only) },
|
|
{ name: 'play_images', title: 'Upload Play graphics', command: ['play', 'images'], write: true, destructive: true, network: true, idempotent: true,
|
|
description: 'Replace icon, feature graphic and screenshots per Play language from the renders folder. Slow (minutes): prefer the terminal with a log for many languages.',
|
|
props: { only }, args: i => opt('only', i.only) },
|
|
{ name: 'play_products', title: 'Sync Play one-time products', command: ['play', 'products'], write: true, network: true, idempotent: true,
|
|
description: 'Create / update one-time products with regional prices and activate their purchase option.',
|
|
props: { only }, args: i => opt('only', i.only) },
|
|
{ name: 'play_data_safety', title: 'Push Play Data safety', command: ['play', 'data-safety'], write: true, destructive: true, network: true, idempotent: true,
|
|
description: 'Replace the whole Play Data safety form with the answers from the config (CSV import). dry_run prints the CSV.' },
|
|
{ name: 'play_release_testing', title: 'Release to a Play testing track', command: ['play', 'release'], write: true, network: true,
|
|
description: 'Upload an AAB (or reuse a versionCode) to a TESTING track (internal, alpha, beta) with release notes. Production is not available here.',
|
|
props: { aab: { type: 'string', description: 'Path to the .aab' }, version_code: { type: 'integer', minimum: 1 },
|
|
track: { type: 'string', enum: ['internal', 'alpha', 'beta'], default: 'internal' }, status: { type: 'string', enum: ['completed', 'draft'], default: 'completed' } },
|
|
args: i => [...(i.aab ? [String(i.aab)] : []), ...opt('version-code', i.version_code), `--${String(i.track ?? 'internal')}`, String(i.status ?? 'completed')] },
|
|
{ name: 'apple_bundle', title: 'Register bundle id', command: ['apple', 'bundle'], write: true, network: true, idempotent: true,
|
|
description: 'Register the bundle id if missing and look up the App Store Connect app record.' },
|
|
{ name: 'apple_iap', title: 'Sync App Store IAPs', command: ['apple', 'iap'], write: true, network: true, idempotent: true,
|
|
description: 'Create missing in-app purchases, localizations, price schedules and availability. Never submits.',
|
|
props: { only }, args: i => opt('only', i.only) },
|
|
{ name: 'apple_iap_review', title: 'IAP review screenshots', command: ['apple', 'iap-review'], write: true, destructive: true, network: true, idempotent: true,
|
|
description: 'Upload (replace when changed) the App Review screenshot of every in-app purchase. Never submits.' },
|
|
{ name: 'apple_listing', title: 'Push App Store version + text', command: ['apple', 'listing'], write: true, network: true, idempotent: true,
|
|
description: 'Create / update the editable version (manual release), attach a build by explicit number, and push name / subtitle / description / keywords / promo / what\'s new per locale.',
|
|
props: { version: { type: 'string', pattern: '^\\d+(\\.\\d+){0,2}$' }, build: { type: 'string', description: 'Exact build number to attach (use the number you just uploaded, never "latest")' }, only },
|
|
required: ['version'], args: i => [...opt('version', i.version), ...opt('build', i.build), ...opt('only', i.only)] },
|
|
{ name: 'apple_screenshots', title: 'Upload App Store screenshots', command: ['apple', 'screenshots'], write: true, destructive: true, network: true, idempotent: true,
|
|
description: 'Sync 6.9" and 6.5" screenshots per locale (MD5-idempotent; changed sets are replaced). Slow: prefer the terminal with a log.',
|
|
props: { only }, args: i => opt('only', i.only) },
|
|
{ name: 'apple_appinfo', title: 'App Store app info', command: ['apple', 'appinfo'], write: true, network: true, idempotent: true,
|
|
description: 'Categories, age rating declaration, content rights, Free price and availability (when missing).' },
|
|
{ name: 'apple_review_details', title: 'App Review information', command: ['apple', 'review-details'], write: true, network: true, idempotent: true,
|
|
description: 'App Review contact (from .storebound/credentials.json) and review notes from the config.' },
|
|
{ name: 'apple_encryption', title: 'Export compliance answer', command: ['apple', 'encryption'], write: true, network: true, idempotent: true,
|
|
description: 'Answer export compliance for builds from apple.usesNonExemptEncryption in the config (never guesses).',
|
|
props: { build: { type: 'string', description: 'Build number (default: every build without an answer)' } }, args: i => opt('build', i.build) },
|
|
{ name: 'apple_phased_release', title: 'Phased release on / pause', command: ['apple', 'release'], write: true, network: true, idempotent: true,
|
|
description: 'Turn on the 7-day phased release for the upcoming version, or pause an active one (pausing is not a rollback). Resume / complete / release are owner-only terminal commands.',
|
|
props: { action: { type: 'string', enum: ['on', 'pause'] }, version: { type: 'string' } }, required: ['action'],
|
|
args: i => ['--phased', String(i.action), ...opt('version', i.version)] },
|
|
{ name: 'icons', title: 'Generate icons', command: ['icons'], write: true, network: false, idempotent: true,
|
|
description: 'Write every store / launcher / web icon from the artwork in the config (local files, needs ffmpeg).' },
|
|
];
|
|
|
|
/** CLI flags / commands that must never be reachable through MCP. Tests assert none of the tools can produce them. */
|
|
export const FORBIDDEN_ARGS = ['--yes', '--manual-release', '--cancel-submission', '--production', 'rollout', 'resume', 'complete'];
|
|
|
|
export function inputSchema(t: ToolDef): Record<string, unknown> {
|
|
const props: Record<string, JsonSchema> = { ...(t.props ?? {}) };
|
|
if (t.write) props.dry_run = { type: 'boolean', default: true, description: 'Default true: only show what would change. Set false only after the owner agreed.' };
|
|
return { type: 'object', properties: props, ...(t.required?.length ? { required: t.required } : {}), additionalProperties: false };
|
|
}
|
|
|
|
export const OUTPUT_SCHEMA = {
|
|
type: 'object',
|
|
properties: { exitCode: { type: 'integer' }, dryRun: { type: 'boolean' }, command: { type: 'string' }, output: { type: 'string' } },
|
|
required: ['exitCode', 'command', 'output'],
|
|
} as const;
|
|
|
|
export function listTools(): Record<string, unknown>[] {
|
|
return TOOLS.map(t => ({
|
|
name: t.name, title: t.title, description: t.description,
|
|
inputSchema: inputSchema(t), outputSchema: OUTPUT_SCHEMA,
|
|
annotations: { title: t.title, readOnlyHint: !t.write, destructiveHint: t.write ? !!t.destructive : false, idempotentHint: !!t.idempotent || !t.write, openWorldHint: t.network },
|
|
}));
|
|
}
|
|
|
|
/** Checks an input against the tool schema; returns problems (empty = fine). */
|
|
export function validateInput(t: ToolDef, input: unknown): string[] {
|
|
const e: string[] = [];
|
|
if (input === undefined || input === null) input = {};
|
|
if (typeof input !== 'object' || Array.isArray(input)) return ['arguments must be an object'];
|
|
const s = inputSchema(t) as { properties: Record<string, JsonSchema>; required?: string[] };
|
|
const i = input as Record<string, unknown>;
|
|
for (const r of s.required ?? []) if (i[r] === undefined) e.push(`${r}: required`);
|
|
for (const [k, v] of Object.entries(i)) {
|
|
const p = s.properties[k];
|
|
if (!p) { e.push(`${k}: unknown argument`); continue; }
|
|
const ok = p.type === 'integer' ? Number.isInteger(v) : p.type === 'boolean' ? typeof v === 'boolean' : p.type === 'string' ? typeof v === 'string' : true;
|
|
if (!ok) { e.push(`${k}: must be ${p.type}`); continue; }
|
|
if (p.enum && !p.enum.includes(v as string)) e.push(`${k}: one of ${p.enum.join(', ')}`);
|
|
if (p.pattern && typeof v === 'string' && !new RegExp(p.pattern).test(v)) e.push(`${k}: does not match ${p.pattern}`);
|
|
if (p.minimum !== undefined && typeof v === 'number' && v < p.minimum) e.push(`${k}: >= ${p.minimum}`);
|
|
if (typeof v === 'string' && /^-/.test(v)) e.push(`${k}: must not start with "-"`);
|
|
}
|
|
return e;
|
|
}
|
|
|
|
/** argv after `storebound` for a validated call. Write tools get --dry unless dry_run is explicitly false. */
|
|
export function toArgv(t: ToolDef, input: Record<string, unknown> = {}): { argv: string[]; dryRun: boolean } {
|
|
const dryRun = t.write ? input.dry_run !== false : false;
|
|
const argv = [...t.command, ...(t.args?.(input) ?? []), ...(dryRun ? ['--dry'] : [])];
|
|
return { argv, dryRun };
|
|
}
|