Skip to Content
DocumentationCommonStep-up AuthStep 3: AI agent (MCP)

Step 3: AI agent (MCP)

⚡ 3 min read

transcodes-guard intercepts risky shell and MCP tool calls before they run. When RBAC requires step-up, the hook blocks, opens Transcodes Auth, and the agent waits for human MFA — then retries the same command.


Hook flow

  1. Agent runs a gated Bash command or protected MCP tool.
  2. PreToolUse hook calls POST /guard/evaluate — AI classifies { resource, action }, then the backend checks the member’s RBAC matrix.
  3. If level 2: backend creates a step-up session → browser opens verify URL → hook returns deny with sid + URL for the agent.
  4. Human completes MFA on Transcodes Auth.
  5. Agent calls poll_stepup_session_wait (or polls manually).
  6. Agent retries the same command — verified record consumed → execution proceeds.
deny (step-up pending) → human MFA → poll verified → retry → allow

The hook is advisory for UX; MCP tool handlers re-check RBAC on execution (execProtectedTool). Stdio bypass cannot skip server enforcement.


MCP tools for step-up

ToolPurpose
create_stepup_sessionOpen session + browser URL (same backend path as the hook)
poll_stepup_sessionSingle status check (pending / verified / rejected)
poll_stepup_session_waitBlock until terminal status (preferred after a deny)
inspect_stepup_stateShow pending / verified local state

Typical agent recovery after a deny:

poll_stepup_session_wait with the sid from the hook message, then retry the command.

Gate audit and webhooks

A pending step-up (hook deny, browser opened, MFA not finished) writes no guard_gate_decision audit row. Active Webhook channels may still receive a session webhook with the verify URL.

After MFA, Transcodes Auth writes mcp:stepup (or {resource}:{action}) at high severity. When the agent retries and verification is consumed, the hook writes guard_gate_decision with decision: allow (low). See Audit Logs.


Host setup

Install per IDE — same step-up semantics everywhere:


Next: Step 4: Outcome and audit

Last updated on