Securing Model Context Protocol Servers: Security Assessment and a Lightweight Wrapper-Based Hardening Approach
Preprint
- 1 July 2026
- preprint
- Published by MDPI AG in Preprints.org
Abstract
The Model Context Protocol (MCP) enables LLM agents to interact with external tools, resources, file systems, and platform features. Although this improves interoperability in agent-based systems, improperly configured MCP servers may expose serious security risks, including unauthenticated tool invocation, excessive file access, arbitrary command execution, prompt injection, token replay, response leakage, and denial-of-service behavior. The current work presents a controlled security assessment of an insecure MCP server and evaluates a lightweight FastAPI-based security wrapper that hardens the server without modifying its original implementation. The wrapper mechanism enforces JWT authentication, role-based tool allow listing, input validation, prompt injection filtering, threat scoring, response inspection, rate limiting, and audit logging. The evaluation used 82 controlled scenarios across nine test suites mapped to STRIDE threat categories, including 69 attack cases, 10 rate-limit/DoS cases, 3 false-positive checks, and 3 legitimate-use validation cases. Compared with the insecure baseline, the wrapper reduced vulnerability exposure by 96%, blocked all tested attacks in several categories, and achieved 100% scenario-level mitigation for rate-limit exhaustion. The wrapper mechanism introduced low overhead, with an average latency increase of approximately 3 ms, corresponding to 1.1%, and a memory overhead of 4.3 MB, corresponding to 8.4%. These results show that external wrapper-based hardening can provide practical deployment-level protection for MCP servers, while remaining a complementary defense layer rather than a complete security solution.Keywords
All Related Versions
This publication has 2 references indexed in Scilit:
- MCP-Secure: A Runtime Access Control Layer for Privilege-Aware LLM Agent ToolingIEEE Open Journal of the Computer Society, 2026
- Role-based access control modelsComputer, 1996