Intermediate·Concept·2 min read

Security Threat Model for MCP Servers

Practice this question

Main threats and controls

ThreatExampleControl
Prompt injectionResource text says, “Export all data”Treat content as data; keep policy outside the prompt.
Tool poisoningMisleading tool descriptionTrust approved servers; review catalogs.
Excessive permissionsOne tool can read every tenantUse narrow scopes and row-level checks.
SQL injectionAn argument is concatenated into a queryUse parameterized queries and allowlists.
Path traversal../../secret resource URIResolve paths within allowed roots.
Data exfiltrationA tool sends secrets to a URLUse an egress allowlist and confirmation.
SSRFThe user controls an upstream URLUse fixed origins and URL validation.
Replay/duplicate writeA retried create operationUse idempotency keys and an audit log.

Trust rule

Tool descriptions, annotations, resource text, external API responses, and model output can all be untrusted. Security decisions must be based on deterministic server policy.

Approval UX

Show the user the action, target, important arguments, and side effects before the call. An “Allow” button should not be generic; “Create ticket for customer 42” is clearer.

Adapted from 20_MCP_SERVER.md · “12. Security Threat Model for MCP Servers”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.