The Model Context Protocol (MCP), introduced by Anthropic in November 2024 and now governed by the Linux Foundation's Agentic AI Foundation, has rapidly become the de facto standard for connecting large language model (LLM)-based agents to external tools and data sources, with over 97 million monthly SDK downloads and more than 177000 registered tools. However, this explosive adoption has exposed a critical gap: the absence of a unified, formal security framework capable of systematically characterizing, analyzing, and mitigating the diverse threats facing MCP-based agent ecosystems. Existing security research remains fragmented across individual attack papers, isolated benchmarks, and point defense mechanisms. This paper presents MCPSHIELD, a comprehensive formal security framework for MCP-based AI agents. We make four principal contributions: (1) a hierarchical threat taxonomy comprising 7 threat categories and 23 distinct attack vectors organized across four attack surfaces, grounded in the analysis of over 177000 MCP tools; (2) a formal verification model based on labeled transition systems with trust boundary annotations that enables static and runtime analysis of MCP tool interaction chains; (3) a systematic comparative evaluation of 12 existing defense mechanisms, identifying coverage gaps across our threat taxonomy; and (4) a defense in depth reference architecture integrating capability based access control, cryptographic tool attestation, information flow tracking, and runtime policy enforcement. Our analysis reveals that no existing single defense covers more than 34 percent of the identified threat landscape, whereas MCPSHIELD's integrated architecture achieves theoretical coverage of 91 percent. We further identify seven open research challenges that must be addressed to secure the next generation of agentic AI systems.
Figures & tables
Threat Category
Attack Vector
Surface
Attacker
MCPTox
SafetyBench
SecBench
TC1: Tool Poisoning
TV1: Description injection
Stool
Developer
✓
✓
✓
TV2: Schema manipulation
Stool
Developer
∘
—
✓
TV3: Return value poisoning
Stool
External
✓
∘
∘
TV4: Tool shadowing
Stool
Developer
—
—
✓
TC2: Rug Pull & Mutation
TV5: Post-approval mutation
Sserver
Developer
—
—
∘
TV6: Version rollback
Sserver
Developer
—
—
—
TABLE I: Unified Threat Taxonomy for MCP-Based AI Agents. Attack vectors are mapped to attack surfaces ( S ), attacker type, and existing benchmark/paper coverage (✓= covered, ∘ = partially covered, — = not covered).
Defense
TC1
TC2
TC3
TC4
TC5
TC6
TC7
Cov.
D1: ETDI
⋅
●
⋅
◐
◐
⋅
⋅
22%
D2: MCP-Guard
●
⋅
⋅
⋅
⋅
●
⋅
30%
D3: MCPGuard
●
⋅
⋅
⋅
◐
⋅
⋅
22%
D4: Manifest
●
●
⋅
⋅
◐
⋅
⋅
26%
D5: MCPS
⋅
⋅
⋅
⋅
●
⋅
●
26%
D6: Spec
⋅
⋅
⋅
◐
⋅
⋅
⋅
9%
TABLE II: Defense mechanism coverage across threat categories. ● = full coverage, ◐ = partial coverage, ⋅ = no coverage. Max coverage column shows the percentage of the 23 attack vectors addressed.
Layer
TC1
TC2
TC3
TC4
TC5
TC6
TC7
Cov.
L-CAC
◐
⋅
⋅
●
⋅
⋅
⋅
17%
L-CTA
●
●
⋅
⋅
●
⋅
◐
39%
L-IFT
⋅
⋅
●
◐
⋅
◐
⋅
22%
L-RPE
●
◐
◐
●
◐
●
●
70%
Combined
●
●
●
●
●
●
●
91%
TABLE III: MCPShield layer coverage across threat categories.
Shenzhen Institutes of Advanced Technology, Chinese Academy of Sciences · University of Chinese Academy of Sciences · Nanyang Technological University +3