On this page
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_idis unbound or non-positive, preventing cross-tenant leakage over Streamable HTTP endpoints that follow the MCP Transports specification Origin validation rules. - Credential scope enforcement:
McpCredentialPermissionsblocks every mutating call when a Sanctum Personal Access Token carriesmcp:readwithoutmcp:write, and restricts module access viamcp: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/analyticsfrom 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
PlanEntitlementServiceper capability—includingagent_routing,agent_ai_parameters,agent_skills,agent_autonomy,agent_knowledge, andshipping—returning HTTP402if 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.

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.

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:
- Pending approval deduplication (
McpPolicyGuard): When a write enters the approval queue, TrolyPage checks either your explicitidempotency_key(up to 255 characters) or a canonical SHA-256 hash insideapproval_idempotency_window_seconds(default300seconds, minimum60seconds) underlockForUpdate(). Re-sending identical arguments reuses the existingMcpActionRequestID instead of spamming reviewers; reusing the same key with mutated arguments throws an error. - Direct write durability (
McpOperationReceipts): For direct executions carrying an explicit key (required oncreate-orderand media uploads/imports), TrolyPage inserts anexecutingclaim intomcp_operation_receiptskeyed by(manychat_account_id, user_id, tool, request_key)plus a recursively sorted SHA-256arguments_hashbefore executing side effects. Completed receipts replay the cached payload withreplayed: true. Reusing a key with different arguments returns HTTP409. If a worker crashed mid-flight leavingresult === null, TrolyPage returns HTTP409withexecuting_or_unknownandoperation_id—requiring you to inspect state via read tools likeget-orderorget-productbefore 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 atdocs.trolypage.comis currently authored in Vietnamese while English MCP guidance lives on/mcpand 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 commentNo comments to show.