cd /news/ai-agents/scan-an-mcp-server-before-you-connec… · home › topics › ai-agents › article
[ARTICLE · art-177942] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Scan an MCP server before you connect it

A developer built the MCP Server Security Scanner, a stdlib-only Python tool that audits an MCP server's config and tool list before an agent connects to it. The scanner applies nine deterministic rules — covering unauthenticated transport, secret-shaped env values, arbitrary command execution, raw SQL, unrestricted fetch, broad write scope, instruction-like tool descriptions, missing schemas and confined read-only tools — and returns a severity-ranked report with a fix per finding and a BLOCK / REVIEW / PASS verdict. It is static and script-first, never executing, importing or evaluating scanned input and never touching the network, and a dry run on a fictional seven-tool server surfaced three Criticals: a secret-shaped env value, an arbitrary shell tool and a raw-SQL tool.

recommendation

Scan each MCP server's config and tool list with deterministic rules before connecting it, and treat BLOCK findings like wildcard shell_exec or raw SQL as arbitrary code execution until proven otherwise.

more in playbook: Securing agents and AI tools
by read2 min views6 publishedNov 29, 2026

Every MCP server you connect hands your agent a loaded toolbelt — shell, file writes, network fetches, raw SQL. Most teams audit that toolbelt after something goes wrong.

I built the MCP Server Security Scanner so the audit happens first.

shell_exec tool with wildcard scope is arbitrary code execution with a friendly name. You give it the MCP server config + tool list as JSON. A stdlib-only Python pipeline applies 9 deterministic rules (R1–R9): unauthenticated transport, secret-shaped env values, arbitrary command execution, raw SQL, unrestricted fetch, broad write scope, instruction-like tool descriptions, and missing schemas. A second script validates the report, and you get a severity-ranked report with a concrete fix per finding and a BLOCK / REVIEW / PASS verdict.

It is static and script-first: it never executes, imports, or evaluates anything from the scanned input, never touches the network, and redacts suspected secrets instead of printing them.

Dry run on a fictional 7-tool sample server:

The 3 Criticals: a secret-shaped value in the env, an arbitrary shell tool, and a raw-SQL tool.

The nine rules, in brief: R1 unauthenticated network transport, R2 secret-shaped env values, R3 arbitrary command execution, R4 raw SQL, R5 unrestricted network fetch, R6 broad write scope, R7 instruction-like tool descriptions, R8 missing schema or description, and R9 confined read-only tools. Each rule is deterministic — same input, same report, every run — and the validator re-checks severity ordering and count consistency so a report can't silently disagree with itself.

It analyses the declared config and tool list only — it cannot see risks inside tool implementations that aren't described in the config, and it doesn't observe runtime behaviour. Severity ranks are opinionated heuristics, not a CVE lookup. PASS means no rule fired, not "provably secure".

Scan before you connect. What does your MCP audit look like today — if it exists at all?

── more in #ai-agents 4 stories · sorted by recency
── more on @mcp server security scanner 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/scan-an-mcp-server-b…] indexed:0 read:2min 2026-11-29 · —