# Lakera Guard — how to use (mcp.ai)

Connect your Lakera Guard account and use 10 tools for AI safety and compliance straight from your AI agent. Connect with your own API key. Lakera Guard screens AI application interactions for security and safety risks and provides Enterprise APIs for managing guardrail policies and projects.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_lakera_guard?ms=1787293560000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `lakera_guard_create_policy`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/lakera_guard`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/lakera_guard/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/lakera_guard/create/policy` — Create an Enterprise Lakera policy with built-in detectors and/or custom guardrails. Lakera may omit the new policy ID; if omitted, later retrieval, replacement, and deletion require external policy l
  - body: { name: string, detectors?: object[], default_threshold: string, custom_guardrail_ids?: string[] }
- `POST https://api.mcp.ai/api/lakera_guard/create/project` — Create an Enterprise Lakera project, optionally assigning a policy, metadata, and detect-or-flag action. Omit policy_id to use the default policy. Lakera does not return the generated project ID, so l
  - body: { name: string, action?: string, policy_id?: string, project_metadata?: object }
- `POST https://api.mcp.ai/api/lakera_guard/delete/policy` — Permanently delete an Enterprise Lakera policy by ID. The provider rejects deletion while any project is assigned to the policy.
  - body: { policy_id: string }
- `POST https://api.mcp.ai/api/lakera_guard/delete/project` — Permanently and irreversibly delete an Enterprise Lakera project by ID. Historical requests lose their association with the project's metadata and assigned policy.
  - body: { project_id: string }
- `POST https://api.mcp.ai/api/lakera_guard/evaluate/detectors` — Evaluate content and return one confidence result per configured detector without producing an aggregate flagging decision or Guard screening log. Use for analysis and tuning, not runtime allow/block 
  - body: { dev_info?: boolean, messages: object[], metadata?: object, project_id?: string }
- `POST https://api.mcp.ai/api/lakera_guard/get/policy` — Retrieve an Enterprise Lakera policy by ID, including its detector configuration, custom guardrails, version, and assigned projects.
  - body: { policy_id: string }
- `POST https://api.mcp.ai/api/lakera_guard/get/project` — Retrieve an Enterprise Lakera project by ID, including its assigned policy, metadata, and detect-or-flag action.
  - body: { project_id: string }
- `POST https://api.mcp.ai/api/lakera_guard/screen/content` — Screen the latest LLM or agent interaction with Lakera Guard and return the policy decision. Use this for runtime allow/block decisions; earlier messages provide context, but only the latest interacti
  - body: { payload?: boolean, dev_info?: boolean, messages: object[], metadata?: object, breakdown?: boolean, project_id?: string }
- `POST https://api.mcp.ai/api/lakera_guard/update/policy` — Replace an Enterprise Lakera policy's complete configuration and create a new policy version. Omitted detectors or custom guardrails are removed, so retrieve the policy first when preserving existing 
  - body: { name: string, detectors?: object[], policy_id: string, default_threshold: string, custom_guardrail_ids?: string[] }
- `POST https://api.mcp.ai/api/lakera_guard/update/project` — Update an Enterprise Lakera project by ID. Name is required by the official request schema; retrieve the project first when preserving its current name or other optional settings.
  - body: { name: string, action?: string, policy_id?: string, project_id: string, project_metadata?: object }

## Example prompts
- "What can I do in Lakera Guard?"
- "Show me a summary of my Lakera Guard account"

## More
- Page: https://mcp.ai/lakera_guard
- Agent spec (llms.txt): https://mcp.ai/lakera_guard/llms.txt
- Postman collection: https://mcp.ai/lakera_guard/postman.json
