MCP-Scanner: Detecting Security Risks in Model Context Protocol Systems
Integrating Artificial Intelligence (AI) models, especially Large Language Models (LLMs), with external tools is crucial for performing real-world tasks. However, the lack of a standard way to connect these tools has led to fragmented systems and new security risks. The Model Context Protocol (MCP) was introduced to solve this by providing a unified way for AI to interact with services. Despite its benefits, MCP’s open design creates new areas for attacks, making security a major concern. To address this, we introduce MCP-Scanner, the first comprehensive tool designed to automatically find a wide range of vulnerabilities in MCP servers. Unlike other tools that focus only on specific features like tools, MCP-Scanner checks all MCP features, including tools, prompts, and resources. It uses a multi-layered approach that combines keyword detection, semantic analysis, and evaluation by an LLM to find complex threats like variable and tool poisoning, prompt injection, rug pull attacks, and server impersonation, and addresses potential threats at each identified ‘Trust Boundary’. Our experiments on custom-built vulnerable servers and real online MCP servers show that MCP-Scanner is very effective and accurate. This work provides a vital tool for developers and researchers to build safer and more trustworthy AI agentic systems.