Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

MCPShield: A Security Cognition Layer for Adaptive Trust Calibration in Model Context Protocol Agents

About

The Model Context Protocol (MCP) standardizes tool use for LLM-based agents and enable third-party servers. This openness introduces a security misalignment: agents implicitly trust tools exposed by potentially untrusted MCP servers. However, despite its excellent utility, existing agents typically offer limited validation for third-party MCP servers. As a result, agents remain vulnerable to MCP-based attacks that exploit the misalignment between agents and servers throughout the tool invocation lifecycle. In this paper, we propose MCPShield as a plug-in security cognition layer that mitigates this misalignment and ensures agent security when invoking MCP-based tools. Drawing inspiration from human experience-driven tool validation, MCPShield assists agent forms security cognition with metadata-guided probing before invocation. Our method constrains execution within controlled boundaries while cognizing runtime events, and subsequently updates security cognition by reasoning over historical traces after invocation, building on human post-use reflection on tool behavior. Experiments demonstrate that MCPShield exhibits strong generalization in defending against six novel MCP-based attack scenarios across six widely used agentic LLMs, while avoiding false positives on benign servers and incurring low deployment overhead. Overall, our work provides a practical and robust security safeguard for MCP-based tool invocation in open agent ecosystems.

Zhenhong Zhou, Yuanhe Zhang, Hongwei Cai, Moayad Aloqaily, Ouns Bouachir, Linsey Pang, Prakhar Mehrotra, Kun Wang, Qingsong Wen• 2026

Related benchmarks

TaskDatasetResultRank
Malicious server detectionBenign MCP Servers
Average Score29.41
6
Security RobustnessMCPSecbench
ASR (w/o Config)0.00e+0
6
Security RobustnessMCPSafetybench
ASR (w/o)5
6
Security RobustnessDemonAgent
ASR (w/o)0.00e+0
6
Security RobustnessAdaptive Attack
ASR (Baseline)40
6
Security RobustnessMCP-Artifact
ASR (w/o)40
6
Security RobustnessRug Pull Attack
ASR (w/o)0.00e+0
6
Showing 7 of 7 rows

Other info

Follow for update