Connect Ai Agent Safely
Use this playbook before letting an AI agent call Zerq-managed APIs or MCP tools.
Use this when
- You are enabling Cursor/Claude/ChatGPT or internal agents.
- You need to prevent tool overreach and accidental writes.
Prerequisites
- Dedicated agent client and profile exist.
- Required MCP surface (
gatewayormanagement) is chosen. - You can run at least one allow and one deny test before rollout.
Step 1: isolate agent identity
- Create dedicated
X-Client-IDper agent environment (dev/stage/prod). - Use a profile scoped to minimum required collections/tools.
- Use short-lived tokens and planned rotation cadence.
Step 2: enforce least privilege
- Publish only needed routes/tools.
- Keep profile read-only first; add writes only with explicit approval.
- Apply stricter rate limits than human traffic.
- Keep destructive methods (
DELETE, widePOST) blocked by default.
Step 3: verify policy behavior
# Allowed operation
curl -i "https://gateway.example.com/mcp/tools/list" \
-H "Authorization: Bearer $AGENT_TOKEN" \
-H "X-Client-ID: ai-assistant-prod" \
-H "X-Profile-ID: prod-ai-readonly"
# Expected denied operation
curl -i -X POST "https://gateway.example.com/mcp/tools/delete-config" \
-H "Authorization: Bearer $AGENT_TOKEN" \
-H "X-Client-ID: ai-assistant-prod" \
-H "X-Profile-ID: prod-ai-readonly"
Expected deny semantics
401invalid token.403tool or route outside granted scope.405method blocked.429safety throttle triggered.
Go-live checklist
- Confirm logs show the agent profile and expected request volume.
- Confirm one explicit denied write operation (
403or405) is captured. - Confirm token rotation path works without manual intervention.
Rollback
- Disable or narrow the agent profile.
- Revoke/rotate the current token.
- Re-enable with read-only scope first.