MantisDocs

MCP tools

The 19 tools Claude Code, Codex, Cursor, Windsurf, Cline, and Antigravity use to work with your backend safely.

npx shipmantis mcp serves 19 Mantis tools over stdio. npx shipmantis@latest init registers the mantis MCP server and workflow rules for all six coding agents automatically:

.mcp.json
{
  "mcpServers": {
    "mantis": {
      "command": "npx",
      "args": ["-y", "shipmantis", "mcp"]
    }
  }
}

The server reads MANTIS_URL, MANTIS_SECRET_KEY, and MANTIS_BRANCH from .env.local, then .env, in the folder the agent runs in. You can supply a secret, agent (mk_agent_), or branch_only (mk_branch_) key in MANTIS_SECRET_KEY. On main, destructive schema steps, widened access rules, mass updates/deletes, and rewinds wait for a person to approve them.

Schema (5 tools)

ToolArgumentsWhat it does
read_schemabranchThe branch's current schema and version.
plan_migrationschemaPath, branchPlans the schema file against the branch without changing anything. Each step is marked safe or destructive, with its SQL.
apply_migrationschemaPath, branchApplies the schema file. On main a destructive step holds the whole change and the answer carries the change's id instead of a version.
undo_migrationbranchUndoes the latest migration, bringing dropped tables and columns back with their data. Held on main if it can lose data.
check_changeidWhether a held schema, rewind, or mass-write change is pending, approved, rejected, or stale.

schemaPath is relative to the project and defaults to mantis/schema.ts.

Branches & snapshots (8 tools)

ToolArgumentsWhat it does
list_branchesEvery branch and the one it came from.
create_branchname, fromA full copy of from (default main), schema and data.
promote_branchnameApplies the branch's schema to its parent. Data is not copied. Held on main if destructive.
delete_branchnameDeletes a non-main branch and its Postgres database.
reset_branchname, snapshotIdResets a branch back to its parent's current state, or restores a named snapshotId.
create_snapshotlabel, branchTakes a named point-in-time snapshot of a branch's schema and data (1–80 character label).
list_snapshotsbranchLists saved snapshots on a branch.
restore_snapshotsnapshotId, branchRestores a branch to a previously saved snapshot id.

Rewind & activity (3 tools)

ToolArgumentsWhat it does
preview_rewindto, table, id, branchWhat rewinding to to would undo, without changing anything.
rewindto, table, id, branchUndoes every write since to. Held on main.
list_activitylimitLists recent agent and dashboard actions (1–100, default 50) with rewindTo timestamps.

to is a time with an offset, like 2026-10-14T09:30:00Z, or 30m, 2h, 1d ago. id needs table.

Automation & data (3 tools)

ToolArgumentsWhat it does
list_webhook_deliveriesbranchLists recent declarative webhook delivery attempts and their HTTP statuses.
trigger_cronname, branchRuns a named declarative cron job from mantis/schema.ts immediately.
run_queryquery, branchRuns one query (including vector similarTo). Unfiltered or bulk updates/deletes on main are held by write guardrails.

query is the same shape the client sends:

{ "op": "select", "table": "todos", "where": { "done": false }, "orderBy": [{ "column": "createdAt", "direction": "desc" }], "limit": 20 }
{ "op": "select", "table": "documents", "similarTo": { "column": "embedding", "vector": [0.01, -0.02], "metric": "cosine" }, "limit": 5 }
{ "op": "insert", "table": "todos", "rows": [{ "title": "a" }] }
{ "op": "update", "table": "todos", "set": { "done": true }, "where": { "id": "…" } }
{ "op": "delete", "table": "todos", "where": { "done": true } }

How the agent is told to work

init writes .claude/skills/mantis/SKILL.md, .cursor/rules/mantis.mdc, .windsurfrules, and a section of AGENTS.md telling the agent to read the schema first, plan before applying, try risky changes on a branch, take snapshots before risky scripts, treat a held change on main as waiting rather than failed, and never print or commit any project key. Running init again updates Mantis's sections and leaves your own instructions outside <!-- mantis:start --> / <!-- mantis:end --> untouched.

Bring the agent up to date

npx -y shipmantis mcp keeps running whatever version npx cached the first time, and SKILL.md says what Mantis did on the day init wrote it. When the agent calls a tool that is gone, misses one that exists or explains Mantis the old way, paste this into it:

Prompt
Update this project's Mantis setup to the latest version, then work from the current docs.

1. Fetch https://docs.shipmantis.com/llms-full.txt and read all of it. It is the source of
   truth: where it disagrees with .claude/skills/mantis/SKILL.md, AGENTS.md or what you
   remember about Mantis, the docs win.
2. Run `npm view shipmantis version` and tell me the latest version.
3. Point the mantis MCP server at the latest release so npx stops reusing a cached one:
   - .mcp.json, .cursor/mcp.json, .windsurf/mcp_config.json, .cline/mcp_settings.json,
     .gemini/mcp.json (whichever exist): mcpServers.mantis.args becomes ["-y", "shipmantis@latest", "mcp"]
   - .codex/config.toml (if it exists): [mcp_servers.mantis] args becomes
     ["-y", "shipmantis@latest", "mcp"]
   Change nothing else in those files.
4. Rewrite .claude/skills/mantis/SKILL.md and .cursor/rules/mantis.mdc (if present) so they match
   the docs you just read. Cover: read the schema first, plan before applying, try risky changes on
   a branch and promote them, take snapshots before risky scripts, treat held schema/write/rewind
   changes on main as waiting rather than failed, rewind and undo_migration for bad writes, all 19
   MCP tools, and never print or commit MANTIS_SECRET_KEY.
5. In AGENTS.md and .windsurfrules (if present), replace only the part between
   <!-- mantis:start --> and <!-- mantis:end --> with the same rules. Leave everything outside the
   markers alone.
6. Look through mantis/schema.ts and the code that calls Mantis for anything the docs now
   describe differently (a renamed function, option or tool). List what you find and ask
   before changing it.
7. Do not touch .env.local, do not run `init`, and do not print any key.
8. Tell me what changed, then tell me to restart you so the new MCP server and skill load.

After the restart, ask "which Mantis tools do you have?" The answer should list all 19 tools above.

Things to ask

AskWhat the agent does
"Add tags to todos."Reads the schema, adds a table or column, plans, applies. Safe steps apply at once.
"Drop the legacy columns."Plans it, sees the steps are destructive, tries them on a branch first; on main the change waits for you.
"Snapshot this branch before seeding."Calls create_snapshot, runs the seed script, and can call restore_snapshot if anything looks wrong.
"Why is this user's order missing?"Reads rows with run_query, checks list_activity, and previews a rewind to see what changed.
"Undo what that script did an hour ago."Previews a rewind, shows you what it would undo, and applies it once you agree; on main it waits for you.
"Check why our order webhook failed."Calls list_webhook_deliveries to inspect HTTP status codes and errors.

When something waits

A tool that hits a held schema change, mass-write guardrail, or rewind on main answers with the change's id instead of failing. The agent tells you, and checks it later with check_change: pending until a person decides in the dashboard, then approved, rejected, or stale. See Held changes and Write guardrails.

On this page