ReferenceCLI commands
BetaYou are reading docs for the beta channel (
2.4.1-beta.1) — updated automatically on every beta release.Switch to stable →CLI commands
ak mcp add
Add or update an MCP server
ak mcp add writes a single MCP server entry into a selected Claude-style MCP config file, giving scripts, CI jobs, and reviewers a deterministic way to edit MCP configuration.
When to use it: Reach for it after reviewing your existing MCP inventory with ak mcp list. Supply the server's --command, repeat --arg to preserve argument order, and pass --env KEY=VALUE for environment assignments — env values are written but never displayed. By default it writes the project's .mcp.json; use --source to target a different MCP config path.
Usage
ak mcp add <name> [flags]Examples
ak mcp add memory --command npx --arg -y --arg @modelcontextprotocol/server-memory
ak mcp add db --command node --arg server.js --env MCP_ENV_ONE=value --source .mcp.json --jsonFlags
| Flag | Description |
|---|---|
--arg stringArray | Server argument; repeat to preserve order |
--command string | Server command to execute |
--env stringArray | Server env assignment KEY=VALUE; values are written but never displayed |
-h, --help | help for add |
--json | Emit machine-readable JSON (implies --no-interactive) |
--no-interactive | Disable interactive prompts (CI-safe) |
-q, --quiet | Suppress non-error output on stderr |
--source string | MCP config path to edit; defaults to project .mcp.json |
-V, --verbose | Extra diagnostic output on stderr (loses to --quiet) |
-y, --yes | Assume yes for all prompts |
Inherited flags
| Flag | Description |
|---|---|
--claude-home string | Claude home override; defaults to AGENTKIT_CLAUDE_HOME or ~/.claude |
--cwd string | Project directory override; defaults to current working directory |
Output modes
| Mode | Behavior |
|---|---|
pretty | default on TTY (colors, ASCII markers) |
plain | auto when stdout piped or --no-interactive |
json | --json (single-object envelope, NDJSON-safe) |
Exit codes
| Code | Meaning |
|---|---|
0 | success |
1 | runtime error |
2 | invalid flags |
3 | user-cancel (SIGINT, prompt-cancel) |
Related commands
ak mcp— Inspect local MCP server configuration