Skip to content

MCP Server ​

variant mcp starts an MCP server that exposes database variant lifecycle operations to MCP clients. It is part of the variant command: no second executable is installed.

Setup ​

The Variant Worktrees extension registers the variant server for the open workspace in Cursor and VS Code. Installation covers installing the CLI and the extension. The mcp.json snippet stays the setup for other clients.

Run the server with a workspace configuration:

bash
variant mcp --config /workspace/variants.yaml

MCP client configuration:

json
{
  "mcpServers": {
    "variant": {
      "command": "variant",
      "args": ["mcp", "--config", "/workspace/variants.yaml"]
    }
  }
}

Available tools ​

Every tool is the command of the same name in Commands, run in-process. Each tool below says only what differs from that command, and lists the parameters it takes. slug is optional for the operations that support git worktree detection, and an explicit slug always takes precedence. Every result is returned as JSON text.

variant_init ​

variant init in the working directory of the server. It returns what each step did, and bun, the check that the Bun on PATH is the one Mise pins with a hint when it is not. It acts in-process, not through the editor. Each of file, gitignore and mise is on unless false.

ParameterTypeRequiredDescription
prefixstringnoWorktree directory prefix, default _v-
filebooleannoWrite variants.yaml
gitignorebooleannoAdd the worktree pattern to .gitignore
misebooleannoAdd the variant CLI to the Mise configuration
forcebooleannoReplace the variants.yaml of this directory when it exists

variant_config ​

variant config: the resolved configuration.

ParameterTypeRequiredDescription
verbosebooleannoFull output of quiet steps

variant_create ​

variant create. miseInstall is bg, sync or no; omitted it is bg, and bg writes {worktree}/.cache/variant/mise-install.log. A failure includes the command to run again.

ParameterTypeRequiredDescription
slugstringnoVariant slug; defaults to the current git worktree
fromstringnoCommit, tag, or branch a new variant branch starts at. Omitted, it starts at variant.baseBranch
pullFfbooleannoFast-forward the start branch before a new variant branch is created
miseInstallstringnobg, sync or no
verbosebooleannoFull output of quiet steps

variant_list ​

variant list: the state and the database variants with their mode, uptime and watch log file. With verbose every item carries all meta information, the same as variant_status. With db.multi set, items carry schemas.

ParameterTypeRequiredDescription
verbosebooleannoAll meta information of every variant

variant_status ​

variant status: the facts of variant_list plus a runtime object with the runtime state: mode, directory, database settings with the password hidden, and per watch the port, pid, URL, liveness and uptime. An unknown slug is an error. With db.multi set it carries schemas.

ParameterTypeRequiredDescription
slugstringnoVariant slug; defaults to the current git worktree
verbosebooleannoFull output of quiet steps

variant_provision ​

variant provision: install, env file, up, step and seed commands. miseInstall is passed through to the create; omitted it is sync.

ParameterTypeRequiredDescription
slugstringnoVariant slug; defaults to the current git worktree
fromstringnoCommit, tag, or branch a new variant branch starts at
pullFfbooleannoFast-forward the start branch before a new variant branch is created
miseInstallstringnobg, sync or no
verbosebooleannoFull output of quiet steps

variant_up ​

variant up, after provision and seed. It returns the mode, worktree, database target, and the port, URL and container name of each watch. up does not take miseInstall.

ParameterTypeRequiredDescription
slugstringnoVariant slug; defaults to the current git worktree
fromstringnoCommit, tag, or branch a new variant branch starts at
pullFfbooleannoFast-forward the start branch before a new variant branch is created
verbosebooleannoFull output of quiet steps

variant_down ​

variant down: stops the processes and containers of a variant and keeps its data.

ParameterTypeRequiredDescription
slugstringnoVariant slug; defaults to the current git worktree
verbosebooleannoFull output of quiet steps

variant_deprovision ​

variant deprovision: stops the watches and drops the schemas. A deprovision step replaces the drop. It refuses main and leaves the worktree.

ParameterTypeRequiredDescription
slugstringnoVariant slug; defaults to the current git worktree
verbosebooleannoFull output of quiet steps

variant_watch ​

variant watch, always detached: a tool call cannot stay attached to a console, so detach is fixed and is not a parameter. It returns the pids, ports and URLs. Each output line is prefixed [name] and appended to .cache/variant/watch.log in the worktree (see log of variant_status). A detached watch writes no ready-probe line. output.mode tty gives a watch a terminal, so color is in that log, and an omitted mode stays no-tty here, because this server does not see editor extensions. miseInstall is passed through to the create; omitted it is sync.

ParameterTypeRequiredDescription
slugstringnoVariant slug; defaults to the current git worktree
fromstringnoCommit, tag, or branch a new variant branch starts at
pullFfbooleannoFast-forward the start branch before a new variant branch is created
miseInstallstringnobg, sync or no
reprovisionbooleannoDrop the schemas before provisioning again
verbosebooleannoFull output of quiet steps

variant_implode ​

variant implode. branchRm is yes or no; omitted it is yes, and no keeps the local branch. It refuses main and work that is not merged into variant.baseBranch, including a branch started with from; the error names force, which overrides the gate. There is no variant_destroy; variant_implode replaces it.

ParameterTypeRequiredDescription
slugstringnoVariant slug; defaults to the current git worktree
forcebooleannoImplode work that is not merged and a worktree with local changes
branchRmyes or nonoRemove the local branch after the worktree. Default yes
verbosebooleannoFull output of quiet steps

Released under the MIT License.