{"slug": "scan-an-mcp-server-before-you-connect-it", "title": "Scan an MCP server before you connect it", "summary": "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.", "body_md": "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.\n\nI built the MCP Server Security Scanner so the audit happens first.\n\n`shell_exec` tool with wildcard scope is arbitrary code execution with a friendly name.\nYou 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.\n\nIt 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.\n\nDry run on a fictional 7-tool sample server:\n\nThe 3 Criticals: a secret-shaped value in the env, an arbitrary shell tool, and a raw-SQL tool.\n\nThe 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.\n\nIt 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\".\n\nScan before you connect. What does your MCP audit look like today — if it exists at all?", "url": "https://wpnews.pro/news/scan-an-mcp-server-before-you-connect-it", "canonical_source": "https://dev.to/vikram1318/scan-an-mcp-server-before-you-connect-it-5a2k", "published_at": "2026-11-29 01:40:23+00:00", "updated_at": "2026-11-29 01:43:44.833844+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "ai-safety", "ai-tools", "developer-tools"], "entities": ["MCP Server Security Scanner", "Model Context Protocol"], "also_reported_by": [], "takeaway": "Static scanning of an MCP server's declared config and tool list with nine deterministic rules flags Criticals like secret-shaped env values, arbitrary shell tools and raw SQL before an agent connects, though it cannot see risks inside undescribed tool implementations or runtime behaviour.", "recommendation": {"advice": "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.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/scan-an-mcp-server-before-you-connect-it", "markdown": "https://wpnews.pro/news/scan-an-mcp-server-before-you-connect-it.md", "text": "https://wpnews.pro/news/scan-an-mcp-server-before-you-connect-it.txt", "jsonld": "https://wpnews.pro/news/scan-an-mcp-server-before-you-connect-it.jsonld"}}