Evaluating the security of a Model Context Protocol (MCP) server or client requires analyzing the boundary where non-deterministic AI outputs meet deterministic tools and systems. Traditional API security models (like strictly defined REST schemas) often fail because MCP tools are invoked based on natural language model context, making them vulnerable to prompt injection, confused deputy attacks, and supply chain threats.
Below is a structured evaluation matrix to assess an MCP integration across the five critical security pillars.
The MCP Security Evaluation Matrix
[ Client / Host Application ]
│ (Natural Language & Tool Schema)
▼
┌──────────────────────────┐
│ MCP Security Boundary │
└─────────────┬────────────┘
│
┌────────────────┼────────────────┬────────────────┐
▼ ▼ ▼ ▼
1. Transport & 2. Tool Definition 3. Context & 4. Secrets &
Auth Scope & Shadowing Data Isolation Local OS
1. Transport, Authentication, and Scope
- Authentication Method:Verify whether the MCP server communicates locally (STDIO) or remotely (HTTP/SSE).Remote servers should implement standard OAuth 2.0 or mutual TLS.
- Confused Deputy Prevention:Ensure the MCP server executes actions scoped specifically to the end-user’s identity rather than inheriting the full service account permissions of the host host environment.
- Audience Binding:Confirm tokens passed over MCP cannot be reused or forwarded across unauthorized target domains.
2. Tool Exposure and Definition Integrity
- Tool Shadowing & Collisions:Check if a server exposes tool names identical to core or system tools (e.g., exposing a custom
execute_commandorread_filetool to override or shadow a native client capability). - Tool Poisoning in Descriptions: Inspect the
descriptionfields of MCP tool definitions. Attackers can embed indirect prompt injections directly into the JSON metadata of a tool to manipulate model behavior before the tool is even called. - Parameter Validation: Validate whether parameter schemas enforce strict data types, length limits, and format regexes rather than relying on open-ended string inputs.
3. Indirect Prompt Injection & Context Isolation
- Data vs. Instruction Separation: Assess how output returned from an MCP tool (e.g., a retrieved web page or database record) is parsed by the client host. If raw data contains system-prompt-style instructions, determine if the host application accidentally treats it as executable system context.
- Data Exfiltration Vectors: Verify if tools with external network capabilities (e.g.,
fetch_url) can be combined with local file-reading tools to leak sensitive local data.
4. Secret Management and Execution Sandboxing
- Configuration Storage:Check how API keys and tokens are supplied to the MCP server. Storing keys in plain-text
mcp_config.jsonfiles on local disk creates severe exposure risks. Prefer passing credentials via environment variables or secret vaults. - Command & Code Execution:Any MCP tool invoking shell scripts, system binaries, or arbitrary SQL must strictly sanitize parameters to prevent command injection.
- Sandboxing: Local STDIO-based MCP servers should execute within a containerized or sandboxed process (e.g., Docker, AppArmor, or macOS sandbox) with restricted filesystem and network access.
5. Supply Chain & Package Integrity
- Package Source Verification: Verify the origin of the server repository or npm/uv package. Look for signed releases and pinned package dependencies to prevent “rug pulls” where a trusted server version is modified post-release.
- Post-Install Scripts: Audit
package.jsonor build hooks for malicious post-install scripts that run during initial setup.
Evaluation Checklist
To run an evaluation on a target MCP server, verify each baseline control below:
| Security Domain | Control Check | Status |
| Sandbox | Server runs in an isolated, unprivileged process space. | [ ] |
| Credentials | API keys are injected at runtime, not written to configuration files. | [ ] |
| Permissions | High-impact actions require explicit Human-in-the-Loop (HITL) approval. | [ ] |
| Tool Names | Tool identifiers use unique namespaces to avoid naming collisions. | [ ] |
| Input Sanitization | Function arguments are strictly sanitized before reaching system calls. | [ ] |
| Logging | Sensitive parameters and authorization tokens are redacted from MCP traces. | [ ] |
