TrolyPage

An autonomous Marketing & Sales operating system for businesses that want AI-powered omni-channel growth.

Contact Info

Follow Us

15 min read

MCP Write-Approval Modes Compared (Strict vs Hybrid vs Auto): Choosing Guardrails by Team Risk

TrolyPage

Dec 02, 2026
14 views
Three-dimensional isometric glassmorphism illustration of three frosted cobalt, mint, and amber security gates filtering glowing beams toward a crystalline lock core.

Teams operating AI agents over TrolyPage's MCP Gateway should run fail-closed hybrid mode for 5 to 50 operators, reserving strict mode for zero-trust commerce or publishing workspaces and limiting auto mode to isolated sandboxes. Server-side gates inside McpPolicyGuard inspect every write against tenant context, token scopes, plan entitlements, and a 64 KiB ceiling—preventing client-side auto-run toggles from pushing unreviewed broadcasts or shipments to production.

Editorial disclosure: Published by TrolyPage, the platform whose MCP Gateway governance architecture is analyzed alongside open Model Context Protocol standards, OpenAI Responses API, Anthropic Claude Code, and Visual Studio Code client controls. All server-side policy mechanics and thresholds are verified directly against TrolyPage's production codebase and live public pages checked on December 2, 2026.

Why Client-Only Approval Prompts Fail Under Shared Workspace Risk

The Model Context Protocol (MCP) Tools specification treats annotations like readOnlyHint and destructiveHint as advisory hints rather than enforced security boundaries, advising hosts to keep a human in the loop to inspect arguments and deny calls. Yet client-side confirmations fail as soon as a team scales past one operator.

Each AI client governs approvals locally per session. OpenAI's remote MCP guide uses require_approval ("always" or "never") to emit mcp_approval_request items, while Anthropic's Claude Code MCP docs prompt per project server and warn about prompt injection from fetched content. A single contractor clicking "always allow" defeats client-only guardrails.

That exposure compounds across large tool catalogs. The OWASP Top 10 for LLM Applications highlights Excessive Agency and Prompt Injection as core risks. On TrolyPage's MCP Gateway—built on a baseline of 291 tools across 1 unified server (/mcp/troly, 14 resources) and 11 domain servers (support 19, commerce 40, analytics 16, social 56, marketing 38, knowledge 14, workspace 30, agents 54, assets 13, automation 21, plus editorial blog; live /mcp keeps expanding and shows 330 tools after the latest automation update, while TrolyPage pricing still displays legacy copy of 86 tools and 7 servers)—a prompt-injected message can jump from reading tickets to firing broadcasts unless the server enforces write governance.

Inside McpPolicyGuard: Pre-Checks, 3-Mode Branching, and Queue Mechanics

Rather than trusting client UI prompts, TrolyPage evaluates every non-read-only MCP tool call inside a mandatory server-side pipeline comprising McpCredentialPermissions, McpPolicyGuard, McpPolicy, and ExecuteMcpActionJob. Read-only tools annotated with PHP attribute #[IsReadOnly] (such as all 16 tools on /mcp/analytics) short-circuit approval queues in all three modes once authentication and module scope pass.

For every mutating tool, guardPolicy($request) executes four fail-closed pre-checks before inspecting the workspace's approval mode configured at /app/mcp (mcp_approval_mode):

  • Tenant context binding: Rejects any execution where current_account_id is unbound or non-positive, preventing cross-tenant leakage over Streamable HTTP endpoints that follow the MCP Transports specification Origin validation rules.
  • Credential scope enforcement: McpCredentialPermissions blocks every mutating call when a Sanctum Personal Access Token carries mcp:read without mcp:write, and restricts module access via mcp:module:<module> abilities or OAuth 2.1 Passport tokens bound to specific resource URIs under IETF RFC 8707 (for example, preventing a token issued for /mcp/analytics from calling /mcp/commerce).
  • Workspace admin or owner verification: Confirms the authenticated actor holds an active workspace admin/owner role (or platform admin), rejecting lower-privilege tokens before any state change.
  • Plan entitlement gate: Evaluates PlanEntitlementService per capability—including agent_routing, agent_ai_parameters, agent_skills, agent_autonomy, agent_knowledge, and shipping—returning HTTP 402 if the workspace subscription excludes that feature.

Only after those four checks pass does McpPolicy::requiresApproval() branch according to the workspace mode: strict queues every non-read-only tool into McpActionRequest; hybrid runs 41 allowlisted low-risk HYBRID_DIRECT_TOOLS plus conditional draft/inactive operations immediately while failing closed into the approval queue for everything else; and auto executes writes immediately for authorized admins while still enforcing tenant binding, mcp:read blocks, and HTTP 402 entitlement checks.

When gated, McpPolicyGuard enforces a 64 KiB (65,536-byte) JSON payload cap, hashes a SHA-256 idempotency_key (explicit key up to 255 chars or canonical ksort args within a 300s default bucket, min 60s), and writes a pending McpActionRequest plus Approval row using lockForUpdate(). Altered args on a reused key fail immediately. Once approved in /app/approvals, ExecuteMcpActionJob (ShouldBeUnique, tries = 1, timeout = 300s) claims pending to executing, re-checks role and plan entitlements, and runs the tool once with mcp_approved_execution bound.

Three-column architectural pipeline showing McpPolicyGuard pre-checks (tenant context, mcp:read write block, admin role, and PlanEntitlementService HTTP 402 gate) feeding into McpPolicy's Strict, Hybrid, and Auto branching modes and durable McpActionRequest and ExecuteMcpActionJob execution.
Figure 1: Server-side execution flow inside McpPolicyGuard, McpPolicy, McpActionRequest, and ExecuteMcpActionJob across TrolyPage's 291-tool baseline MCP Gateway.

Option A vs Option B vs Option C: Approval Mode Tradeoffs by Team Size

Choosing an approval posture is an architectural tradeoff between operator throughput, context-window hygiene, and unreviewed production blast radius. In a deterministic 100-action mixed operations workload—modeled as 45 read-only lookups, 35 low-risk triage/draft calls in HYBRID_DIRECT_TOOLS, and 20 high-liability fulfillment, publishing, or live-agent mutations—running hybrid requires 20 approval clicks versus 55 under strict (a 63.6% reduction in operator friction) while keeping unreviewed high-liability mutations at zero.

Evaluation Dimension Option A: Unified Auto (auto on /mcp/troly) Option B: All-Strict (strict across all writes) Option C: Scoped Hybrid + Strict Escalation
Exposed Tool & Write Surface All 291 baseline tools (330 on live /mcp) exposed with immediate admin write execution. All 291 baseline tools exposed, but 100% of non-read-only calls queue into McpActionRequest. Domain endpoints (e.g., /mcp/support 19 tools, /mcp/agents 54) paired with mcp:read audit keys and fail-closed hybrid writes.
Approval Friction (per 100 Ops) 0 server-side approval clicks; relies purely on local IDE or LLM host prompts. 55 approval clicks (queues tags, notes, support replies, and draft copy alongside shipments). 20 approval clicks (63.6% fewer than Strict); only high-liability mutations enter /app/approvals.
Unreviewed Production Blast Radius Maximum: prompt injection or model hallucination can immediately send broadcasts, cancel orders, or overwrite live agents. Zero unreviewed writes, but payload sizes above 65,536 bytes fail pre-queue checks (blocking large inline uploads). Zero unreviewed publish, shipment, broadcast, or live-agent edits; 41 safe actions + draft/inactive setup proceed smoothly.
Root Technical & Economic Mechanism McpPolicy::requiresApproval() returns false across all tools; operators skip queue polling via get-mcp-action. Every non-IsReadOnly tool enters DB queue; high ticket volume turns human reviewers into rubber-stamps. HYBRID_DIRECT_TOOLS whitelist + conditional state checks separate safe workspace prep from external/financial commits.
Exact Failure Cost When Chosen Wrong For teams of 5–50 operators, one misrouted submit-broadcast or cancel-order creates customer churn, carrier fees, and irreversible messaging volume. High-volume support teams abandon MCP and revert to manual browser tabs when every add-subscriber-tag or add-customer-note waits in /app/approvals. Minimal risk if strictly paired with strict escalation on dedicated high-liability commerce/publishing workspaces; requires clear SOP for create-order review in Orders UI.
Recommended Team Profile 1–2 engineers in an isolated staging or sandbox workspace with synthetic data only. Regulated finance, healthcare, or zero-trust storefronts where every state mutation needs dual control. Default production baseline for SaaS, ecommerce ops, and multi-client agencies of 2 to 50 operators.

Option C also aligns with TrolyPage's public USD plans—Lite ($8/mo), Starter ($16/mo), Pro ($32/mo), and Scale ($104/mo), plus $1/mo extra seats and $2/mo extra Pages (1 Page pub+msg = 2 connections). Scoping analysts to mcp:read tokens avoids paying reviewers to rubber-stamp routine tags.

Dark-mode quantitative bar chart comparing operator approval clicks against unreviewed writes per 100 agent actions across auto, hybrid, and strict modes, paired with architecture comparison rows and callout cards for the 64 KiB payload ceiling, 300-second deduplication bucket, and 360 requests per minute workspace rate limit.
Figure 2: Deterministic 100-action ops model (45 reads, 35 HYBRID_DIRECT_TOOLS, 20 high-liability writes) showing why Hybrid cuts approval clicks by 63.6% versus Strict while keeping unreviewed publish and fulfillment blast radius at zero.

Behavioral Decision Matrix: HYBRID_DIRECT_TOOLS vs. TOOL_RISK Gates

Unlike naive allow-all or block-all toggles, TrolyPage's hybrid mode combines a static 41-tool allowlist (HYBRID_DIRECT_TOOLS), three state-aware conditional branches in McpPolicy::requiresApproval(), and explicit TOOL_RISK classifications (high or medium, defaulting to medium) displayed inside the approval queue.

Operational Domain & Tool Group strict Mode hybrid Mode (Fail-Closed) auto Mode TOOL_RISK & Governing Mechanism
Read-Only Analytics & Inspection
(#[IsReadOnly] tools, all 16 on /mcp/analytics, get-mcp-action, list-mcp-actions)
Runs directly Runs directly Runs directly N/A — IsReadOnly attribute short-circuits approval checks after token/module scope validation.
Support Triage & Inbox Ops
(13 tools: send-message, add-subscriber-tag, add-customer-note, set-lead-stage, close-conversation)
Queued Runs directly Runs directly Listed in HYBRID_DIRECT_TOOLS so support copilots can triage and tag conversations without queue lag.
Knowledge & Asset Prep
(propose-fact, 8 asset tools: upload-asset, import-asset, clean-asset-image)
Queued Runs directly Runs directly propose-fact submits into human knowledge review; local asset prep does not publish externally.
Order Creation vs. Cancellation & Shipping
(create-order vs. cancel-order, create-shipment, create-ondemand-shipment, create-booking)
All queued create-order direct; cancel, shipment & booking queued All direct high risk tier. create-order enters Orders pending_review UI natively; shipping/booking commit external carriers.
Social Drafting vs. Scheduled/Live Publishing
(create-social-post, update-social-post vs. publish-social-post)
All queued Unscheduled drafts direct; scheduled_at or edits to scheduled posts + publish-social-post queued All direct high risk for publish-social-post; medium for retry-failed-post. Prevents silent edits to already-scheduled posts.
AI Agent & Knowledge Mutations
(21 tools: update-agent-core, update-agent-safety, save-agent-prompt-version, restore-agent-prompt-version, knowledge writes)
All queued Direct if AIAgent.is_active === false; queued if agent is live (is_active === true) All direct medium default risk + PlanEntitlementService HTTP 402 checks. Lets agencies build drafts freely while protecting live bots.
Marketing, Automation & Integration Hub
(create-broadcast, save-automation-workflow, save-integration-* vs. submit-broadcast, publish-automation-workflow, enable-integration-configuration, replay-integration-delivery)
All queued Drafts & draft/disabled integration edits direct; active integration edits, publish, submit & replay queued All direct high risk tier on live submit/publish/enable/replay. Enforces McpSecretFieldGuard to block/redact raw secret fields.

This state-aware behavior explains why teams running Claude support operations or VS Code agency release pipelines should pair hybrid mode with domain-scoped endpoints rather than disabling approvals altogether.

Operational Assets: Split Read/Write .mcp.json and HMAC Approval Alert Bridge

Following the Visual Studio Code MCP configuration reference, production teams should standardize on portable .mcp.json (with mcpServers, "type": "http", and ${ENV_VAR} header substitution—avoiding hardcoded keys in git and noting that legacy .vscode/mcp.json support is scheduled for Local harness removal in February 2027). Split your credentials so analysts and CI audits use an mcp:read token while release operators hold a module-scoped mcp:write token governed by hybrid or strict mode:

{
  "mcpServers": {
    "troly-audit-ro": {
      "type": "http",
      "url": "https://trolypage.com/mcp/analytics",
      "headers": {
        "Authorization": "Bearer ${TROLYPAGE_MCP_READ_TOKEN}"
      }
    },
    "troly-support-ops": {
      "type": "http",
      "url": "https://trolypage.com/mcp/support",
      "headers": {
        "Authorization": "Bearer ${TROLYPAGE_MCP_SUPPORT_TOKEN}"
      }
    },
    "troly-workspace-ops": {
      "type": "http",
      "url": "https://trolypage.com/mcp/workspace",
      "headers": {
        "Authorization": "Bearer ${TROLYPAGE_MCP_WORKSPACE_TOKEN}"
      }
    }
  }
}

When a write call enters McpActionRequest under hybrid or strict mode, McpPolicyGuard records ActivityEventManager::log('mcp_tool_approval_requested', ...) internally and returns structured trolypage/action metadata (action_id, status, approval_url, and status_tool: "get-mcp-action") inline on the MCP tool response—it does not emit an outbound action_id approval webhook by default. Never resubmit the write tool on timeout or pending status. Instead, have your MCP orchestrator forward a compact review alert from that inline trolypage/action payload (remembering Slack supports outbound notifications only) and poll get-mcp-action or list-mcp-actions, while pairing the workflow with an IntegrationHub webhook receiver for downstream business or automation events. For IntegrationHub outbound webhooks, TrolyPage's DeliveryProcessor signs the canonical JSON wire body using IETF RFC 2104 HMAC-SHA256 with headers X-Webhook-Event-Id, X-Webhook-Timestamp, and X-Webhook-Signature: sha256= computed over ${timestamp}.${raw_body}:

import hashlib, hmac, json, os, time
from fastapi import FastAPI, Header, HTTPException, Request
import redis

app = FastAPI()
r = redis.Redis.from_url(os.environ["REDIS_URL"], decode_responses=True)
WEBHOOK_SECRET = os.environ["TROLYPAGE_WEBHOOK_SECRET"].encode("utf-8")
REPLAY_WINDOW_SECONDS = 300

@app.post("/hooks/integration-hub")
async def integration_hub_webhook(
    request: Request,
    x_webhook_event_id: str = Header(...),
    x_webhook_timestamp: str = Header(...),
    x_webhook_signature: str = Header(...),
):
    try:
        ts = int(x_webhook_timestamp)
    except ValueError as exc:
        raise HTTPException(status_code=400, detail="Invalid X-Webhook-Timestamp") from exc
    if abs(int(time.time()) - ts) > REPLAY_WINDOW_SECONDS:
        raise HTTPException(status_code=401, detail="Stale X-Webhook-Timestamp")

    raw_body = await request.body()
    signed_payload = f"{x_webhook_timestamp}.".encode("utf-8") + raw_body
    expected = hmac.new(WEBHOOK_SECRET, signed_payload, hashlib.sha256).hexdigest()
    if not x_webhook_signature.startswith("sha256="):
        raise HTTPException(status_code=401, detail="Malformed X-Webhook-Signature")
    provided = x_webhook_signature.removeprefix("sha256=")
    if not hmac.compare_digest(expected, provided):
        raise HTTPException(status_code=401, detail="Invalid HMAC signature")

    dedup_key = f"troly:webhook:event:{x_webhook_event_id}"
    if not r.set(dedup_key, "1", nx=True, ex=86400):
        return {"ok": True, "deduplicated": True, "event_id": x_webhook_event_id}

    event = json.loads(raw_body)
    # Process verified IntegrationHub outbound event (e.g., forward to Slack/PagerDuty)
    return {"ok": True, "event_id": x_webhook_event_id, "event_type": event.get("type")}

@app.post("/internal/mcp-approval-alert")
async def forward_mcp_approval_alert(payload: dict):
    # Called by your MCP client/orchestrator when a gated write returns inline trolypage/action metadata
    action_id = payload.get("action_id")
    if not action_id:
        raise HTTPException(status_code=400, detail="Missing action_id")

    dedup_key = f"mcp:approval:notified:{action_id}:{payload.get('status', 'pending')}"
    if not r.set(dedup_key, "1", nx=True, ex=86400):
        return {"ok": True, "deduplicated": True, "action_id": action_id}

    # Forward compact review alert (approval_url = /app/approvals, no secrets) to Slack/PagerDuty;
    # MCP client polls get-mcp-action(action_id) until ExecuteMcpActionJob completes.
    return {"ok": True, "queued_alert": True, "action_id": action_id}

Idempotency Receipts, Payload Ceilings, and Honest Platform Boundaries

Even with the right approval mode, production reliability depends on how retries behave during network timeouts or HTTP 429 throttling (TrolyPage's gateway enforces 360/workspace/min in production with Retry-After backoff headers). Two distinct durability layers protect against duplicate side effects:

  1. Pending approval deduplication (McpPolicyGuard): When a write enters the approval queue, TrolyPage checks either your explicit idempotency_key (up to 255 characters) or a canonical SHA-256 hash inside approval_idempotency_window_seconds (default 300 seconds, minimum 60 seconds) under lockForUpdate(). Re-sending identical arguments reuses the existing McpActionRequest ID instead of spamming reviewers; reusing the same key with mutated arguments throws an error.
  2. Direct write durability (McpOperationReceipts): For direct executions carrying an explicit key (required on create-order and media uploads/imports), TrolyPage inserts an executing claim into mcp_operation_receipts keyed by (manychat_account_id, user_id, tool, request_key) plus a recursively sorted SHA-256 arguments_hash before executing side effects. Completed receipts replay the cached payload with replayed: true. Reusing a key with different arguments returns HTTP 409. If a worker crashed mid-flight leaving result === null, TrolyPage returns HTTP 409 with executing_or_unknown and operation_id—requiring you to inspect state via read tools like get-order or get-product before minting a new key.

Additionally, McpSecretFieldGuard scrubs keys matching credential, secret, password, token, or cookie patterns (plus credential query parameters) into [redacted] so raw API secrets never leak into logs or agent prompts. At the same time, engineering leaders should evaluate TrolyPage's documented boundaries before standardizing across an enterprise stack:

  • Public Developer REST API status: TrolyPage's public developer REST API is still in progress and not yet publicly open (an internal v1 API exists in the codebase); external automation currently runs through Outbound/Inbound Webhooks, Zapier Webhooks, and the 291-tool baseline MCP Gateway (listed across TrolyPage features and /mcp).
  • Identity & documentation language: There is no enterprise SAML/OIDC SSO for arbitrary third-party identity providers (SSO spans the Troly ecosystem via auth tokens), live vendor support operates during Vietnam business hours (UTC+7), and the public portal at docs.trolypage.com is currently authored in Vietnamese while English MCP guidance lives on /mcp and in English engineering guides.
  • Pricing & connector scope: The Free plan is a one-time time-limited workspace trial (10 auto-posts/month without links), not a permanent free tier; there is no native two-way Shopify, WooCommerce, BigCommerce, HubSpot, or Salesforce admin sync (use Webhooks, Zapier, or MCP), Slack supports outbound notifications only without a two-way inbox, and PDF knowledge ingestion reads embedded text layers without OCR for scanned image-only PDFs.

For teams of 2 to 50 operators, the operational path is unambiguous: start every production workspace on fail-closed hybrid mode, issue split mcp:read and domain-scoped mcp:module:* tokens, verify idempotency_key behavior across retries, and escalate dedicated high-liability commerce or publishing workspaces to strict.

Comments

Your comment will appear after review.

Sign in to comment

No comments to show.