GebSecure Docs v0.1.0

Guides · MCP

MCP tool security

Tool pinning and quarantine, poisoning detection, allow and deny lists, data inspection and policies for MCP tools.

MCP tool descriptions and schemas are text the model reads, and tool results are content the model trusts. The gateway treats both as untrusted.

Discovery, pinning and quarantine#

The gateway discovers a server's tools when it is registered, on first use and at most every five minutes afterwards (immediately with POST /v1/mcp/servers/{id}/refresh). Each tool definition — name, description, input schema, annotations — is hashed and pinned. Every definition is also scanned as untrusted content (source: mcp_response) for prompt injection.

Tool status Meaning Listed and callable
pending discovered on a server with tool review required, not yet reviewed no — "is pending review"
active pinned and clean yes
poisoned the description or schema scored ≥ 45 for prompt injection no
changed the definition no longer matches the pinned hash while requirePinning is on (a "rug pull") no — "is quarantined (definition changed; pending review)"
blocked blocked by an administrator, or no longer offered upstream no

An administrator reviews a quarantined tool with POST {api}/v1/mcp/servers/{id}/tools/{tool}/review and {"decision": "approve"} (re-pins the current definition and activates it) or {"decision": "block"}. Both require mcp:manage and are audited (mcp.tool.approve, mcp.tool.block); detections are audited as mcp.tool.poisoned and mcp.tool.changed.

Tool review: connecting a server grants nothing#

Servers have a toolReview setting. With required (the default for new servers), every newly discovered tool is pending: agents neither see nor call it. Each pending tool carries a proposed decision, taken from the server's own hints first (destructiveHint → deny, readOnlyHint → allow) and otherwise from the tool's name and description (reads → allow; sending, publishing, payments and bulk export → require approval; deleting, permission and credential changes → deny).

Review in the console (the server page shows N tools pending review), or with the API:

http
POST {api}/v1/mcp/servers/{id}/tools/review
{ "decisions": { "read_record": "allow", "export_all": "require_approval", "delete_record": "deny" } }

Allowed and approval-gated tools become active (pinned); denied ones blocked. The response carries the server's policy over every reviewed tool, bound to the server (when resource.server == "{slug}"): a permit, a require_approval gate (a gate, so a broader permit elsewhere cannot skip it) and a forbid for denied tools. The console saves it as mcp-{slug} and deploys it through the normal policy gates; reviewing again later (a new tool appears) adds a version. Quarantined tools (changed, poisoned) are still reviewed one by one, as above. Requires mcp:manage; audited as mcp.tools.review.

With auto, new tools are active at once and governed by policy alone, as before tool review existed. Servers registered before tool review keep auto; switch them to required with PATCH /v1/mcp/servers/{id}.

Restricting tools#

allowedTools and deniedTools on the server registration are glob lists (* within a segment, ** across); a tool outside them is never listed or callable, regardless of policy. Use them for coarse exposure control and policies for decisions that depend on who calls, with which arguments, when.

Policies#

Tool calls are actions mcp:{slug}/{tool}. Policies see the tool arguments as context and the server, tool, annotations and annotation-derived risk category as resource attributes (resource.server, resource.tool, resource.annotations, resource.risk.category). action.category is derived from the verb that starts the tool name (delete_note → delete, search_issues → read, create_issue → write):

gsl
policy "mcp-read-only-tools" {
  description "Agents may use the read-only tools of the github server"
  effect permit
  principal agent
  action in ["mcp:github/search_issues", "mcp:github/get_*"]
  resource any
}

policy "mcp-no-destructive-tools-in-production" {
  description "Tools annotated destructiveHint are never allowed in production"
  effect forbid
  principal agent
  action "mcp:**"
  resource any
  environment in ["production"]
  when resource.risk.category == "delete"
}

policy "mcp-issue-creation-needs-review" {
  effect permit
  principal agent where "triage" in principal.tags
  action "mcp:github/create_issue"
  resource any
  when has(context.title) && len(context.title) <= 200
  limit count <= 20 per 1h by agent
  require approval when has(context.labels) && "security" in context.labels {
    approvers role "security_admin"
    expires 2h
  }
}

The mcp-tool-allowlist template generates an allowlist policy for one server.

Data inspection on every call#

Stage What happens
Arguments validated against the pinned JSON input schema (validation_failed otherwise)
Arguments outbound DLP: BLOCK returns a tool error with reason: "dlp_blocked"; REQUIRE_APPROVAL forces an approval (dlp-outbound); MASK/REDACT change the arguments sent upstream
Upstream call through the credential broker: allowed host only, SSRF checks, credential injected, response size and time bounded
Result credentials injected by the broker and secret-shaped strings are removed
Result inbound DLP (BLOCK withholds the result)
Result prompt-injection inspection: SANITIZE replaces the content, BLOCK withholds it, and a score at or above taintApprovalAt taints the agent so its write, delete and admin actions need approval for taintTtlSeconds (30 minutes by default)

Resources (resources/read) and prompts (prompts/get) are inspected the same way.

Rate limits#

Each agent may call each server at most rateLimitPerMinute times per minute (fixed one-minute window, default 120). Exceeding it returns JSON-RPC error -32002.