diff --git a/docs/enterprise/guardrails.mdx b/docs/enterprise/guardrails.mdx index 8c7fa6994ff..64c8f4f32eb 100644 --- a/docs/enterprise/guardrails.mdx +++ b/docs/enterprise/guardrails.mdx @@ -114,7 +114,7 @@ Both targets also expose `headers`, `virtual_key`, `customer`, `team`, and `user ### Architecture -The following diagram illustrates how Rules and Profiles work together for the LLM target. MCP rules use the same rule/profile evaluation around tool execution: input guardrails run before the tool and output guardrails run after the result. +The following diagram illustrates how Rules and Profiles work together for the LLM target. For tool execution, see [MCP Guardrails](#mcp-guardrails). ```mermaid flowchart TB @@ -174,6 +174,38 @@ flowchart TB --- +## MCP Guardrails + +MCP guardrails protect the actual tool-execution boundary, not merely the tool call proposed by an LLM. + +After the rule's CEL expression matches, Bifrost applies the selected phase: + +| Apply on | Flow | +|----------|------| +| **Before tool call** (`input`) | Inspect arguments → allow or redact and execute; **block → stop before execution** | +| **After tool result** (`output`) | Execute tool → inspect a successful text-bearing result → allow or redact and return; **block → do not return the result** | +| **Both** (`both`) | Run the input flow; if allowed, execute the tool and run the output flow. A block at either boundary stops processing | + + + MCP guardrail rule editor showing the MCP target, before and after execution phases, a linked profile, and MCP client and tool conditions + + +### Choose Which Tool Calls to Guard + +- **MCP Client** is populated from configured clients that are enabled. +- **MCP Tool** is populated from their currently discovered tools. +- **Tool Argument** shows a searchable dropdown of top-level string, number, and boolean input-schema fields when one MCP tool is selected with the `=` operator. You can also enter an argument name manually. + +MCP rules can additionally use the shared identity fields listed under [Guardrail Targets](#guardrail-targets). + + +All supported guardrail providers can be linked to MCP rules without separate MCP-specific provider setup. Provider capabilities still apply: only providers listed in [Guardrail Redaction](/enterprise/guardrails/redaction) support Bifrost-managed redaction, while other providers may detect, block, or return provider-managed transformations. + + +MCP rules use the same linked profiles, sampling, and timeout settings as LLM rules. See [Creating Rules](#creating-rules) for configuration and [CEL Expression Examples](#cel-expression-examples) for targeting examples. + +--- + ## Streaming Output Guardrails Streaming delivery depends on what the matched output guardrails can do: diff --git a/docs/media/guardrails/ui-mcp-guardrail-rule.png b/docs/media/guardrails/ui-mcp-guardrail-rule.png new file mode 100644 index 00000000000..fe2a83ccd30 Binary files /dev/null and b/docs/media/guardrails/ui-mcp-guardrail-rule.png differ