How would you test the security boundary of an AI agent connected to MCP tools?
Answer
Inventory tools, data and side effects, then grant the least privilege needed for each role and environment. Test direct and indirect prompt injection, unauthorized tool discovery or invocation, parameter tampering, data exfiltration, approval bypass, replay and runaway loops. Enforce authorization in downstream systems, isolate test credentials and workspaces, log every call, and require parameter-bound approval for consequential actions.
Strong answer includes
- tests both model behavior and downstream authorization
- covers indirect injection and excessive agency
- uses least privilege, isolation and auditable approvals
Practical example
A test plants an instruction inside a web page's hidden HTML comment telling the browsing agent to also call a delete-repository tool it has access to; a properly scoped agent either never has that destructive tool available in a read-only browsing session or refuses to act on instructions embedded in page content, and the test confirms which is actually true.