TrolyPage

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

Contact Info

Follow Us

14 min read

Least-Privilege MCP Access: Scoping Claude and Cursor to Domain Servers Instead of Full-Workspace Keys

TrolyPage

Dec 02, 2026
10 views
Three-dimensional isometric glass routing prism directing cyan and mint light keys into isolated analytics crystal modules while deflecting unauthorized beams from locked cobalt and gold commerce vaults.

Teams enforce least-privilege MCP access in Claude and Cursor by scoping credentials to TrolyPage’s 11 domain servers instead of issuing full-workspace /mcp/troly (291-tool) admin keys. Server-side McpCredentialPermissions pairs Sanctum mcp:read and mcp:module:{module} abilities with OAuth 2.1 RFC 8707 mcp_resource bindings, isolating /mcp/analytics (16 tools) and /mcp/knowledge (14 tools) from mutating /mcp/commerce (40) and /mcp/agents (54) endpoints.

Editorial disclosure: Published by TrolyPage, whose 291-tool MCP Gateway, credential scoping, and approval mechanics are documented from our production codebase alongside Model Context Protocol, IETF RFC 8707, Anthropic, and OWASP specifications.

Why Full-Workspace Keys and Client-Side Hints Fail Least Privilege

When teams first connect Claude Desktop, Claude Code, or Cursor to a SaaS workspace, the common shortcut is minting one full-admin Bearer token for the unified endpoint and sharing it across analysts, marketers, and engineers. On TrolyPage’s Workspace MCP Gateway, https://trolypage.com/mcp/troly exposes the 291-tool baseline across 1 unified server and 11 domain servers—spanning support (19 tools), commerce (40), analytics (16), social (56), marketing (38), knowledge (14), workspace (30), agents (54), assets (13), automation (21), plus editorial blog capabilities. (TrolyPage’s pricing page still displays legacy copy referencing 86 tools across 7 business servers, while live deployments continue expanding actions on /mcp.)

Giving every session 291 tools creates two immediate failures. First, an LLM choosing among nearly three hundred schemas suffers tool-selection drift, risking accidental order cancellations or broadcast submissions during an analytics review. Second, as Anthropic’s Claude Code MCP documentation warns, any MCP server reading customer messages or web content opens an indirect prompt-injection vector capable of triggering unrelated write tools in the same session.

Client-side system prompts (“only call read tools”) or protocol hints are equally brittle. The Model Context Protocol Tools specification warns that clients must treat annotations like readOnlyHint and destructiveHint as untrusted unless backed by a trusted server, and still enforce human confirmation. Per OWASP API5:2023 (Broken Function Level Authorization), client-side hiding never stops unauthorized execution if the server accepts the call.

Option A vs Option B vs Option C: MCP Credential and Blast-Radius Tradeoffs

Before issuing keys or OAuth grants across a multi-role team, engineering and ops leads should weigh three concrete authorization patterns against exposed tool count, credential isolation, and real failure costs.

Decision Axis Option A: Shared Admin /mcp/troly Key Option B: Client Prompts & readOnlyHint Alone Option C: Server-Enforced McpCredentialPermissions (Split + Domain-Scoped)
Exposed Tool Surface 291 tools across all 11 domain servers in every client session 291 tools still advertised via tools/list; model self-polices via prompt rules 15–56 tools per role (e.g., 15 RO tools on /mcp/analytics; 33 on Support+Knowledge; 56 on Commerce+Analytics)
Write & Module Isolation None; single Sanctum PAT carries mcp:read + mcp:write across all modules Advisory client-side filtering only; server accepts any entitled tool call Server strips non-IsReadOnly tools for mcp:read tokens; rejects out-of-scope modules with HTTP 403 MCP_MODULE_NOT_GRANTED
Root Technical Mechanism Unified TrolyPageServer loads every workspace-entitled server catalog Relies on LLM instruction adherence and optional client confirmation dialogs TenantAwareServer::createContext() + McpCredentialPermissions (mcp:module:* or RFC 8707 mcp_resource) + McpPolicyGuard
Replay & Concurrency Guard None if paired with auto mode; duplicate retries mutate live rows Client-dependent retry prompts; no server-side argument hash verification McpPolicyGuard 300s SHA-256 bucket / idempotency_key + McpOperationReceipts 409 drift protection
Failure Cost When Chosen Wrong One prompt injection or hallucinated tool call in an analyst chat can cancel orders, edit live AI agents, or submit broadcasts Silent privilege escalation whenever a user switches clients, bypasses local prompts, or invokes tools/call directly Upfront credential split (2–3 scoped tokens or OAuth connections per role) and explicit human approval clicks in TrolyPage Approvals

Option C eliminates function-level authorization drift because tool visibility and write blocking happen inside the gateway’s PHP middleware and server boot pipeline rather than inside the LLM’s context window.

How Server-Side Isolation Works: Sanctum Abilities, RFC 8707, and Approval Gates

Every remote HTTP request hitting TrolyPage’s MCP Gateway traverses a strict multi-layer middleware stack before a single tool schema is returned or executed:

  • Origin allow-list (EnsureMcpOriginAllowed): Browser-based MCP clients sending an Origin header are checked against an explicit HTTPS origin allow-list to block DNS-rebinding attacks, while native CLI clients (Claude Code, Cursor, local scripts) without an Origin header pass cleanly.
  • Explicit MCP credential gate (EnsureMcpAccess): Both Sanctum Personal Access Tokens and Passport OAuth 2.1 tokens must carry the explicit mcp:use ability or scope. Wildcard mobile or legacy Sanctum tokens (['*']) are rejected immediately with HTTP 403.
  • Immutable tenant binding (BindMcpTenantScope): Tenant isolation (current_account_id) is resolved strictly from the token’s account:{id} ability or an active McpOAuthGrant record—never from request headers or JSON arguments—activating Laravel’s global workspace scope.
  • Role and plan entitlement enforcement (EnsureMcpWorkspaceAdmin + EnsureMcpEntitlement): HTTP MCP access requires a workspace admin or owner membership, and missing plan modules return a structured HTTP 402 (FEATURE_NOT_INCLUDED) payload rather than leaking partial schemas.
Three-column architecture diagram showing Founder/Analyst Claude Desktop, Content/Growth OAuth 2.1, and Ops/AI Cursor clients routed through TrolyPage's McpCredentialPermissions middleware pipeline to Tier 1 read-only Analytics, Tier 2 staged Knowledge/Social/Support, and Tier 3 isolated Commerce/Agents endpoints while deflecting cross-domain calls with HTTP 403.
Figure 1: Server-side least-privilege isolation across TrolyPage's 11 domain MCP servers, binding Sanctum mcp:read / mcp:module:* abilities and OAuth 2.1 RFC 8707 mcp_resource targets inside McpCredentialPermissions.

Two Complementary Least-Privilege Mechanisms: Sanctum Abilities vs. RFC 8707

Once the request clears tenant and plan checks, McpCredentialPermissions enforces least privilege differently depending on how the client authenticates:

  1. Sanctum API Keys (mcp:read, mcp:write, mcp:module:{module}): Tokens issued inside TrolyPage at /app/mcp accept a read_only flag, optional expiration (expires_in_days from 1 to 365), and an explicit modules allow-list. When read_only is enabled, the token receives mcp:read without mcp:write. At server boot, TenantAwareServer::createContext() inspects PHP reflection attributes and strips every tool lacking #[IsReadOnly]—so on /mcp/analytics (16 tools total), export-report (marked #[IsDestructive] because it queues an async export job) is automatically hidden, leaving 15 purely read-only query tools and zero mutations. Any write attempt against a read_only token is additionally blocked inside McpPolicyGuard. Adding mcp:module:analytics or mcp:module:knowledge causes EnsureMcpEntitlement to reject out-of-scope domain servers with HTTP 403 MCP_MODULE_NOT_GRANTED and filters unified /mcp/troly down to the granted modules.
  2. OAuth 2.1 + PKCE with RFC 8707 Resource Indicators: As required by the Model Context Protocol Authorization specification and standardized in IETF RFC 8707, OAuth clients bind a resource parameter during both authorization and token exchange. TrolyPage validates this URI via McpResource::validate() and stores it on the Passport token as mcp_resource. A token minted for https://trolypage.com/mcp/analytics cannot be replayed against /mcp/commerce or /mcp/agents because McpCredentialPermissions::allowsModule() checks $token->mcp_resource against the target endpoint URI.

Write-Approval Modes, Argument Caps, and Durable Operation Receipts

Even for tokens holding mcp:write on an authorized module, TrolyPage’s McpPolicy and McpPolicyGuard separate staging actions from high-impact live changes according to the workspace’s mcp_approval_mode configured at /app/mcp:

  • strict mode: Every non-read-only tool call is intercepted before execution, checked against a 64 KiB (65,536-byte) JSON argument safety cap, and queued as a pending McpActionRequest awaiting human sign-off in TrolyPage Approvals.
  • hybrid mode (fail-closed default): Read-only tools and explicitly vetted HYBRID_DIRECT_TOOLS execute directly—such as support tags, notes, and messages, propose-fact (creating a pending knowledge proposal), unscheduled create-social-post drafts, edits to inactive AI agents (is_active = false), create-order (which enters the Orders UI pending_review workflow), and draft/disabled integration configs. Everything else fails closed into McpActionRequest, including scheduled social posts, active agent edits, publish-social-post, submit-broadcast, create-shipment, publish-automation-workflow, enable-integration-configuration, and replay-integration-delivery.
  • auto mode: Authorized workspace admins execute writes immediately without an approval queue, though McpPolicyGuard still enforces tenant binding, blocks mcp:read-only tokens, verifies admin/owner roles, and checks paid capabilities (returning HTTP 402 if unentitled).

To prevent double-charging, duplicate orders, or retry storms when an AI client times out, TrolyPage layers two idempotency defenses. For queued approvals, McpPolicyGuard locks rows via lockForUpdate() using either a client-supplied idempotency_key (up to 255 characters) or a canonical SHA-256 hash inside a time bucket (approval_idempotency_window_seconds, default 300s, minimum 60s), rejecting argument drift with an error. For direct side-effect writes, McpOperationReceipts inserts an executing claim into mcp_operation_receipts keyed by (manychat_account_id, user_id, tool, request_key) alongside a recursively sorted canonical SHA-256 arguments_hash before running the mutation. Replaying the same key with altered arguments returns HTTP 409; replaying a finished receipt returns the cached response with replayed: true; and hitting an in-flight or crashed receipt (result === null) returns HTTP 409 executing_or_unknown with an operation_id, requiring a read check (such as get-order or get-product) before minting a new key. Additionally, McpSecretFieldGuard recursively masks sensitive keys and URL credentials as [redacted] so tokens never leak back into model transcripts.

Multi-Role Client Configs and 11-Domain-Server Privilege Matrix

The configurations below implement Option C across Claude Desktop (claude_desktop_config.json) and Cursor (.cursor/mcp.json). Never commit raw Bearer tokens into Git; keep keys in environment variables or OS credential managers, and mint separate Sanctum PATs at /app/mcp per role.

1. Copy-Pasteable Multi-Role Client Configurations

// File A: Claude Desktop (claude_desktop_config.json)
// Role 1 (Founder / Analyst): Read-only Analytics + Read-only Support
// Role 2 (Content / Marketing): Scoped Knowledge + Social drafts (Hybrid queue)
{
  "mcpServers": {
    "troly-founder-analytics-ro": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://trolypage.com/mcp/analytics",
        "--header",
        "Authorization: Bearer ${TROLY_ANALYTICS_RO_KEY}"
      ]
    },
    "troly-founder-support-ro": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://trolypage.com/mcp/support",
        "--header",
        "Authorization: Bearer ${TROLY_SUPPORT_RO_KEY}"
      ]
    },
    "troly-content-knowledge": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://trolypage.com/mcp/knowledge",
        "--header",
        "Authorization: Bearer ${TROLY_CONTENT_RW_KEY}"
      ]
    },
    "troly-content-social": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://trolypage.com/mcp/social",
        "--header",
        "Authorization: Bearer ${TROLY_CONTENT_RW_KEY}"
      ]
    }
  }
}

For teams operating Cursor, native Streamable HTTP entries connect directly without an npx bridge, splitting read-only observability from isolated high-impact domain keys:

// File B: Cursor (.cursor/mcp.json)
// Splits RO Analytics from guarded Commerce and Agents endpoints
{
  "mcpServers": {
    "troly-analytics-ro": {
      "url": "https://trolypage.com/mcp/analytics",
      "headers": {
        "Authorization": "Bearer ${env:TROLY_ANALYTICS_RO_KEY}"
      }
    },
    "troly-commerce-guarded": {
      "url": "https://trolypage.com/mcp/commerce",
      "headers": {
        "Authorization": "Bearer ${env:TROLY_COMMERCE_HYBRID_KEY}"
      }
    },
    "troly-agents-guarded": {
      "url": "https://trolypage.com/mcp/agents",
      "headers": {
        "Authorization": "Bearer ${env:TROLY_AGENTS_HYBRID_KEY}"
      }
    }
  }
}

In both setups, pair TROLY_ANALYTICS_RO_KEY with read_only: true and modules: ["analytics"], while scoping TROLY_CONTENT_RW_KEY to modules: ["knowledge", "social"]. Notice how this mirrors our Founder’s Monday Morning MCP Brief (read-only reporting) and ChatGPT Social Ops workflow (staged drafts under Hybrid approval).

2. 11-Domain-Server Privilege Assignment Matrix

Domain Server Endpoint Path Baseline Tools Recommended Sanctum / OAuth Scope hybrid Mode Guardrail & Primary Role
Analytics /mcp/analytics 16 (15 RO + export-report) mcp:read + mcp:module:analytics (or OAuth mcp_resource) 0 write mutations under mcp:read; Founder / Finance / Analyst
Knowledge /mcp/knowledge 14 mcp:read for Q&A; add mcp:write + mcp:module:knowledge for curation propose-fact stages pending proposal; Support Lead / Content Ops
Customer Support /mcp/support 19 mcp:read for triage; mcp:write + mcp:module:support for replies Tags, notes, and messages run directly; Support Ops / Team Lead
Assets /mcp/assets 13 mcp:write + mcp:module:assets Local uploads & image cleanup run directly without publishing; Creative Ops
Social /mcp/social 56 mcp:write + mcp:module:social Unscheduled drafts direct; scheduled posts & publish-social-post queued; Social Manager
Marketing /mcp/marketing 38 mcp:write + mcp:module:marketing Strategies & draft broadcasts direct; submit-broadcast fails closed; Growth Lead
Workspace /mcp/workspace 30 mcp:write + mcp:module:workspace Draft integration configs direct; enable-integration-configuration & replay-integration-delivery queued; Platform Admin
Commerce /mcp/commerce 40 mcp:write + mcp:module:commerce (isolated key) create-order lands in Orders pending_review; create-shipment & cancel-order queued; Commerce Ops
Agents /mcp/agents 54 mcp:write + mcp:module:agents (isolated key) Inactive agent edits direct; live active agents & activation queued; AI Engineer
Automation /mcp/automation 21 baseline mcp:write + mcp:module:automation Workflow drafts/checks direct; publish-automation-workflow queued; Automation Engineer
Editorial Blog /mcp/platform-blog/editorial/{role} Role-bound Passport OAuth mcp_resource bound to blog editorial role Dedicated editorial workflow isolated from tenant business data; Editorial Team
Dark-mode horizontal bar chart comparing exposed tool counts across Full-Workspace Unified (/mcp/troly 291 tools), Scoped Commerce and Analytics (56 tools), Support and Knowledge (33 tools), and Analytics Read-Only (15 of 16 tools exposed with 0 write mutations), paired with RFC 8707 audience binding and enterprise SSO/API boundary callouts.
Figure 2: Scoping Claude and Cursor to domain endpoints cuts exposed tools by 80.8% to 94.8% against the 291-tool baseline while reducing Analytics write mutations to zero under mcp:read.

Webhook Bridges, Identity Boundaries, and Honest Platform Limits

Architects evaluating TrolyPage for enterprise automation should factor in several explicit platform boundaries verified against our production codebase and feature documentation:

  • Public Developer REST API status: While an internal v1 REST API exists in the codebase, TrolyPage’s public developer REST API is still in progress and not yet publicly open. Production external automation relies on Outbound/Inbound Webhooks, Zapier Webhooks, and the 291-tool MCP Gateway.
  • No arbitrary SAML/OIDC enterprise SSO: TrolyPage provides cross-app SSO across the Troly ecosystem via auth tokens, not SAML 2.0 or custom OIDC federation for external corporate identity providers (Okta, Azure AD). Workspace operators achieve per-role isolation via workspace admin permissions, expiring Sanctum MCP keys (1–365 days), or OAuth 2.1 + PKCE grants.
  • Plan tiers and gating: The Free tier is a one-time, time-limited workspace trial (10 auto-posts/mo without links, not a permanent free plan). Paid tiers span Lite ($8/mo) through Scale ($104/mo), with $1/mo per extra human seat and $2/mo per extra Page (note that 1 Page using both publishing and messaging consumes 2 service connection units). Requests targeting an unentitled MCP module return HTTP 402.
  • Integration and channel limits: TrolyPage does not provide native two-way admin sync for Shopify, WooCommerce, BigCommerce, HubSpot, or Salesforce (use Webhooks, Zapier Webhooks, or MCP), lacks an OCR pipeline for scanned image-only PDFs (though vision models interpret attached images), and supports Slack outbound notifications only rather than a two-way customer inbox.
  • Support and docs locale: Automated AI agents run 24/7, while live vendor staff support operates during Vietnam business hours (UTC+7). Public user guides at docs.trolypage.com are currently authored in Vietnamese, whereas English MCP server manifests and schemas live on /mcp.

Verification Checklist Before Issuing Team MCP Credentials

Run these six checks against a test workspace before rolling out scoped Claude or Cursor configs:

  1. Verify mcp_approval_mode at /app/mcp: Confirm the workspace uses hybrid or strict (never leave shared team workspaces in auto).
  2. Confirm mcp:read schema stripping: Connect with an analytics-only read_only: true token; verify tools/list returns 15 read-only tools without export-report.
  3. Test cross-module HTTP 403 enforcement: Point the analytics token at https://trolypage.com/mcp/commerce and confirm HTTP 403 MCP_MODULE_NOT_GRANTED.
  4. Validate Hybrid fail-closed queuing: Issue an unscheduled create-social-post (runs as draft) versus a scheduled post or publish-social-post (returns action_id and enters Approvals).
  5. Exercise McpOperationReceipts conflict handling: Replay a direct write with identical arguments (expect replayed: true), then alter one field with the same key (expect HTTP 409).
  6. Enforce rate limits and key TTL: Set expires_in_days (e.g., 90 days) on Sanctum PATs, respect HTTP 429 Retry-After headers, and rotate keys when roles change.

Comments

Your comment will appear after review.

Sign in to comment

No comments to show.