Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion docs/enterprise/guardrails.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 |

<Frame>
<img src="/media/guardrails/ui-mcp-guardrail-rule.png" alt="MCP guardrail rule editor showing the MCP target, before and after execution phases, a linked profile, and MCP client and tool conditions" />
</Frame>

### 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).

<Note>
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.
</Note>

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:
Expand Down
Binary file added docs/media/guardrails/ui-mcp-guardrail-rule.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading