使用说明
MCPTox: Model Context Protocol Security Testbed
This repository contains the source code and experimental framework for the paper "The Capability Paradox: Why Advanced Agents Are More Vulnerable to Protocol-Level Attacks" (CVPR 2025).
Overview
MCPTox is a comprehensive testbed designed to evaluate the security of the Model Context Protocol (MCP). It simulates various attack surfaces including:
- RQ1: Semantic Poisoning (Mobile Agent scenarios)
- RQ2: Contextual Infection (Code Agent scenarios)
- RQ3: Privacy Middleware Bypass (Privacy leakage analysis)
- RQ4: Agent-to-Agent Injection (Cascading trust failures)
Project Structure
opencode/
├── config/
│ └── experiment_config.yaml # Configuration for models and scenarios
├── src/
│ ├── simulation.py # Main entry point
│ ├── rq1_mobile_agent.py # RQ1 implementation
│ ├── rq2_code_agent.py # RQ2 implementation
│ ├── rq3_privacy_middleware.py # RQ3 implementation
│ ├── rq4_a2a_injection.py # RQ4 implementation
│ ├── tools.py # Mock MCP tools
│ └── visualization.py # Plotting utilities
├── requirements.txt # Python dependencies
└── README.md # This file
Installation
- Ensure you have Python 3.9+ installed.
- Install dependencies:
pip install -r requirements.txt
Usage
To run the full suite of experiments:
python -m src.simulation
Optional Flags
- Run specific experiments:
python -m src.simulation --rq1 # Run only RQ1 python -m src.simulation --rq2 # Run only RQ2 python -m src.simulation --rq3 # Run only RQ3 python -m src.simulation --rq4 # Run only RQ4 - Skip visualization generation:
python -m src.simulation --no-viz
Configuration
Modify config/experiment_config.yaml to adjust:
- Model parameters (temperature, max_tokens)
- Number of trials per experiment
- Attack payloads and scenarios
License
MIT License. See LICENSE file for details.