Claude Code

Make Claude Code ask a person before it runs a shell command or calls a tool: the MCP server, the skills, and a PreToolUse hook.

Claude Code already asks before it acts, on the machine it runs on. This sends the question to an inbox instead, where you can answer from your phone, a teammate can answer for you, rules can answer the routine ones, and every answer is kept on the record. There are two layers, and most people want both.

MCP server
Gives Claude a request_approval tool. The skill tells it when to ask: before sending, paying, publishing or deleting anything.
PreToolUse hook
Runs before every matching tool call, such as every shell command, and lets it through only on a yes. Claude cannot skip it.

1. Create a key

Sign in, open Agents and create a key named after this machine or project, such as claude-code-laptop. Copy it: it is shown once.

2. Add the server and the skills

Add the server for all your projects:

claude mcp add --transport http variantgate https://api.variantgate.com/mcp \
  --header "Authorization: Bearer gl_YOUR_KEY" --scope user

Add the skills, which teach Claude when to ask and how:

curl -fsSL https://variantgate.com/skills/asking-for-approval/SKILL.md --create-dirs -o ~/.claude/skills/asking-for-approval/SKILL.md
curl -fsSL https://variantgate.com/skills/adding-approvals-to-code/SKILL.md --create-dirs -o ~/.claude/skills/adding-approvals-to-code/SKILL.md

Restart Claude Code and run /mcp: the server appears as variantgate with four tools. The MCP server page describes each.

3. Put shell commands through approval

Add this to ~/.claude/settings.json for every project, or to a project’s .claude/settings.json for one:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          { "type": "command", "command": "variantgate hook claude-code", "timeout": 180 }
        ]
      }
    ]
  }
}

The hook needs VARIANTGATE_API_URL and VARIANTGATE_KEY in the environment Claude Code starts from. Change the matcher to choose which tools go through approval, such as Bash|Write. Each tool call becomes a request with an action name rules can match:

shell.run
Bash: Run the command: …
file.write
Write: Write the file …
file.edit
Edit and MultiEdit: Edit the file …; NotebookEdit: Edit the notebook …
web.fetch
WebFetch: Fetch …
mcp.<server>.<tool>
A tool from an MCP server: Use <tool> from the <server> MCP server
tool.<name>
Any other tool: Use the <name> tool
  • The hook waits up to two minutes for a person, then withdraws the request and denies the call. Set VARIANTGATE_HOOK_WAIT to change it, in seconds, and keep the hook’s timeout longer than that wait.
  • If the service cannot be reached, Claude Code falls back to its own permission prompt, so you are never locked out of your own machine.
  • A hook that times out or cannot run, such as when variantgate is not installed, does not stop the call: Claude Code goes on with its own permission settings. On Claude Code 2.1.295 or later, add "onFailure": "block" to the hook to deny the call instead.
  • A denial reaches Claude with the reason and an instruction not to try another way.

A rule matches the action, not the command, so a rule for shell.run covers every command. Leave shell commands to a person and write rules for quieter actions such as file.edit.

4. Try it

Ask Claude Code to list the files in a folder. A request appears in the inbox; approve it and the command runs. Ask again and deny it: Claude stops and tells you it was denied.

The article on approval hooks goes further: answering from your phone, which tools to gate, and how this differs from Claude Code’s own permission modes.