Security
~9 min readUpdated: November 2026

Agent Smith (SCAN-MCP): Internet-Scale Automated Security Analysis of MCP Tools

Agent Smith SCAN-MCP Automated Security Analysis Architecture in Smoke Monkey

Agent Smith (arXiv:2611.36552) introduces SCAN-MCP, an automated security analysis pipeline for Model Context Protocol (MCP) servers. By combining AST tool-handler slicing, semantic taint filtering, inter-tool dataflow edge inference, and sandboxed proof-of-concept (PoC) confirmation, SCAN-MCP achieves 82.67% precision and 17.33% false discovery rate while uncovering 19/20 multi-tool exploit chains missed by Semgrep and mcp-scanner.

Technical Review: Smoke Monkey Core Architecture Team
Tested on Node.js 18+ & BunTypeScript 5.x
Quick Answer & Executive Definition

Agent Smith (SCAN-MCP): Internet-Scale Automated Security Analysis of MCP Tools: Agent Smith (arXiv:2611.36552) introduces SCAN-MCP, an automated security analysis pipeline for Model Context Protocol (MCP) servers. By combining AST tool-handler slicing, semantic taint filtering, inter-tool dataflow edge inference, and sandboxed proof-of-concept (PoC) confirmation, SCAN-MCP achieves 82.67% precision and 17.33% false discovery rate while uncovering 19/20 multi-tool exploit chains missed by Semgrep and mcp-scanner. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.

Key Architectural Takeaways
Quick Implementation Examplescan-mcp-security-gate.ts
scan-mcp-security-gate.tstypescript
import { createAgent } from '@smoke-monkey/harness';
const mcpSecurityAuditor = createAgent({
agentId: 'scan-mcp-preinstall-gate',
provider: 'anthropic',
model: 'claude-sonnet-4-5',
workspacePath: process.cwd(),
permissions: {
read_file: 'allow',
write_file: 'allow',
run_command: 'ask',
},
mcpServers: {
semgrep: { command: 'npx', args: ['-y', '@modelcontextprotocol/server-filesystem', './mcp-audit'] },
},
});
async function auditMcpServerRepo(repoPath: string) {
const result = await mcpSecurityAuditor.run(
`Extract MCP tool schemas and executable handlers in ${repoPath}, slice single-tool sinks, infer inter-tool dataflow edges, and output a sandbox PoC verification report.`
);
console.log('MCP Audit Report:', result.summary);
}
auditMcpServerRepo('./third-party-mcp-server').catch(console.error);
Video Guides

Watch: Related Video Guides

MCP Security Fundamentals Course

Securing The Model Context Protocol Defense Strategies For Ai Tool Ecosystems

What Is Agent Smith (SCAN-MCP)? Closing the Inter-Tool Security Gap

Agent Smith's SCAN-MCP pipeline addresses a blind spot in conventional static analysis: MCP tools do not invoke one another via source-level function calls. Instead, an LLM runtime acts as the implicit control-flow bridge, reading untrusted output from Tool A and passing it as arguments into Tool B.

Because existing scanners inspect functions in isolation, they miss multi-step exploit chains (#TV) where a benign-looking reader tool feeds tainted data into a file writer, SQL runner, or shell executor. SCAN-MCP maps schemas to handlers, slices only tool-reachable code, labels sources/sinks, infers cross-tool edges, and validates vulnerabilities with executable PoCs inside a sandbox.

SCAN-MCP Benchmarks vs Semgrep, A.I.G, mcp-scanner & Pure-LLM

Evaluated across internet-scale MCP server implementations, Full SCAN-MCP outperforms rule-based SAST tools and unguided LLMs on both single-tool vulnerabilities (#SV) and inter-tool chain vulnerabilities (#TV).

Analyzer / ConfigurationInter-Tool (#TV)Single-Tool (#SV)False Discovery Rate (FDR)Precision (%)
Full SCAN-MCP19 / 20105 / 13017.33%82.67%
V3 (w/o Inter-Tool)0 / 0105 / 13019.23%80.77%
Pure-LLM (V4)6 / 858 / 11849.21%50.79%
A.I.G0 / 070 / 19163.35%36.65%
V2 (w/o Filters)27 / 96141 / 42367.63%32.37%
V1 (w/o Slicing)0 / 046 / 21578.60%21.40%
Semgrep0 / 027 / 14180.85%19.15%
mcp-scanner0 / 00 / 2100.00%0.00%

Stage-level validation shows 100.00% precision / 100.00% recall for tool extraction and slicing, 99.60% recall on handler mapping, 96.00% precision on source-and-sink labeling, and 98.39% precision on inter-tool edge inference (filtering out 78.87% of 9,871 proposed noisy edges before PoC synthesis).

Why Slicing + Filtering Are Mandatory

Removing program slicing drops precision from 82.67% to 21.40% (and loses all inter-tool detection), while removing semantic filters spikes FDR to 67.63%.

Implementing a Pre-Attach MCP Security Verification Pipeline

Before onboarding a third-party MCP server into production, extract its JSON-RPC tool manifest, isolate handler entrypoints, and verify untrusted inputs cannot reach child_process, filesystem writes, or outbound HTTP sinks without sanitization.

bash
# Inspect exported MCP tool schemas via stdio JSON-RPC initialize + tools/list
printf '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"audit","version":"1.0"}}}\n{"jsonrpc":"2.0","id":2,"method":"tools/list"}\n' \
  | npx -y @target-org/mcp-server 2>/dev/null | jq '.result.tools[] | {name, inputSchema}'

# Audit handler sinks for unvalidated shell/fs/network execution
rg -n "execSync|spawn|child_process|writeFile|eval\(|SELECT .*\$\{" ./third-party-mcp-server/src

Enforcing Tool-Boundary Trust in Smoke Monkey Harness

Smoke Monkey Harness treats every third-party MCP tool output as untrusted data rather than privileged instructions, applying explicit human-in-the-loop permission tiers (allow, ask, deny) per tool call. Pairing SCAN-MCP pre-installation audits with Smoke Monkey's runtime permission gating prevents poisoned external MCP responses from pivoting into local shell or filesystem tools.

Google Search Questions & Answers

Frequently Asked Questions

Q:Why do Semgrep and mcp-scanner miss inter-tool MCP vulnerabilities?

Traditional SAST rules trace direct code calls, whereas MCP tools compose at runtime through the LLM's context window. Without inter-tool dataflow edge inference, Semgrep and mcp-scanner detected 0 inter-tool chains in the Agent Smith evaluation.

Q:How does SCAN-MCP reduce false positives to 17.33% FDR?

SCAN-MCP chains four filters: deterministic AST tool slicing (cutting irrelevant repo code), semantic source-sink filtering, edge pruning (rejecting 78.87% of spurious edges), and live sandboxed PoC execution (rejecting 68.09% of unexploitable candidates).

Q:Does SCAN-MCP work when MCP servers use stdio instead of HTTP?

Yes. SCAN-MCP maps tool schemas directly to source-code handler implementations regardless of whether the server exposes JSON-RPC over stdio, WebSocket, or Streamable HTTP.

Q:What is the biggest security risk in public MCP registries?

Unattested tool outputs and missing inter-tool privilege boundaries: even non-malicious servers can be exploited when untrusted data read by one tool is forwarded into a sink tool on the host.

Related Alternatives & Comparisons

Related Architecture Guides

View all guides

Build with Smoke Monkey Harness

Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.

npm install smoke-monkey-harness