tools/call requests at two stages:
You can apply guardrails at the workspace level (default for all MCP servers in a workspace) or at the server level (targeting specific MCP servers and even individual tools).
How It Works
MCP guardrails use the same policy engine as LLM guardrails, with thetarget field set to mcp_tools. This keeps MCP and LLM guardrails separate β existing LLM guardrails are unaffected.
Each guardrail consists of checks (the validation rules) and actions (what happens when a check fails). You then map the guardrail to one or more MCP servers, choosing whether it runs on tool inputs, outputs, or both.
When both workspace-level and server-level guardrails are configured, server-level guardrails are applied in addition to workspace defaults.
Supported Checks
The following guardrail checks are available for MCP tool calls (target: "mcp_tools"):
LLM-specific checks (PII detection, content moderation, language checks, and third-party provider checks like Patronus, Azure, Bedrock, etc.) are not available for MCP tool calls. Use the checks listed above for MCP guardrails.
Key Concepts
Target
Every guardrail has atarget field:
When creating a guardrail for MCP, set
target to "mcp_tools".
Run On
Each MCP server mapping includes arun_on field that controls when the guardrail executes:
You can set
run_on to ["input"], ["output"], or ["input", "output"] for both.
Capability Scoping
By default, a guardrail mapping applies to all tools on an MCP server. To narrow the scope to specific tools, passmcp_integration_capability_ids β an array of tool capability UUIDs. The guardrail will only run on calls to those specific tools.
Workflow
Step 1: Create an MCP Guardrail
Create a guardrail withtarget: "mcp_tools". Unlike LLM guardrails, checks and actions are optional at creation time β you can configure them later.
cURL
Step 2: Map the Guardrail to MCP Servers
Attach the guardrail to one or more MCP servers. You can use either the bulk sync endpoint (replace all mappings at once) or the single upsert endpoint.Bulk Sync (Recommended)
This is a declarative, idempotent operation β it replaces the full set of MCP server mappings for the guardrail.cURL
Single Server Upsert
Map or update a guardrail for a single MCP server:cURL
Step 3: Verify the Configuration
List all MCP server mappings for a guardrail:cURL
Workspace-Level Defaults
You can set MCP guardrails as workspace defaults so they apply to all MCP servers in a workspace. Configuremcp_input_guardrails and mcp_output_guardrails in your workspace settings.
Blocked Request Response
When a guardrail blocks an MCP tool call, the gateway returns an MCP-compliant JSON-RPC error:API Reference
Create Guardrail
Create a new guardrail. Settarget to "mcp_tools" for MCP guardrails.
List Guardrails
Retrieve guardrails with optional filtering by target.Get Guardrail
Retrieve a single guardrail by ID or slug. Formcp_tools target guardrails, the response includes mcp_server_mappings.
mcp_server_mappings is only included in the response when target is "mcp_tools".Update Guardrail
Update a guardrailβs name, checks, or actions.Delete Guardrail
Archive a guardrail. This also removes all MCP server mappings.Bulk Sync MCP Server Mappings
Declaratively sync all MCP server mappings for a guardrail. This replaces the entire set β servers not included in the request body are removed.
Validation rules:
- The guardrail must have
target: "mcp_tools" - All MCP server IDs must be valid UUIDs
run_onmust be a non-empty array containing"input"and/or"output"- All
mcp_integration_capability_idsmust exist in the database
Upsert Single MCP Server Mapping
Create or update a guardrail mapping for a single MCP server.List MCP Server Mappings
List all MCP server mappings for a guardrail.Error Responses
Next Steps
Guardrail Checks
Full list of available guardrail checks and parameters.
Rate Limits
Throttle MCP tool call requests and token consumption.
Observability
Monitor MCP tool call logs and usage analytics.
Access Control
Control which workspaces and users can access MCP servers.
Portkey is now PRISMA AIRS AI Gateway. See it in action.
Contact Us

