Auditing MCP Configurations and AI Agent Rules for Security Risks A developer released agentconfig_audit_mcp_and_rules_scanner.py, a self-contained Python standard-library script that audits Model Context Protocol server configurations and AI agent rule files for security risks. The tool flags overly broad filesystem access (such as root, home directories, or Windows drive roots) as CRITICAL findings, detects unpinned npx/uvx package executions that could run unreviewed upstream code, and scans environment variables for embedded credentials like GitHub, AWS, and Slack tokens. It targets configs used by tools including Claude Desktop, Cursor, and Windsurf, and requires Python 3.8 or later with no third-party dependencies. Modern developer workflows increasingly rely on AI agent configurations and Model Context Protocol MCP servers. Tools like Claude Desktop, Cursor, and Windsurf execute local commands, connect to remote services, and read workspace instructions from files like .cursorrules or claude desktop config.json . However, these configuration files can introduce serious security vulnerabilities into your environment: npx or uvx packages without fixed versions , allowing upstream package updates to execute unreviewed code on your machine. / , home directories ~ , or entire user profiles. agentconfig audit mcp and rules scanner.py is an audit script designed to inspect MCP configuration files and agent instruction rulebooks to flag these specific security issues. The tool is self-contained and relies entirely on Python's standard library argparse , json , pathlib , re , unicodedata , dataclasses , and shlex . You do not need to run pip install for any third-party dependencies. Download the script file and save it to your workspace as agentconfig audit mcp and rules scanner.py . Ensure you have Python 3.8 or later installed. You can display the built-in command options by invoking Python directly: python agentconfig audit mcp and rules scanner.py --help To audit an entire workspace for both MCP configurations and rule files such as .cursorrules , agents.md , and markdown prompts , pass the directory path to the script: python agentconfig audit mcp and rules scanner.py . You can also target specific standard system locations where tools like Claude Desktop or Cursor store their MCP definitions: Auditing a specific configuration file python agentconfig audit mcp and rules scanner.py ~/.cursor/mcp.json The audit tool inspects two main surfaces: structured JSON MCP server configurations and plaintext rule/instruction documents. When parsing mcpServers configurations, the scanner evaluates command arguments against dangerous system roots and verifies if package runners include immutable version specifications: Check Overly Permissive Filesystem Paths if isinstance args, list : for arg in args: if not isinstance arg, str : continue expanded = os.path.expanduser arg for pat in BROAD PATH PATTERNS: if re.match pat, arg.strip or re.match pat, expanded.strip : findings.append Finding rule id="MCP-BROAD-FILESYSTEM-ROOT", title=f"Overly Broad Filesystem Access in '{server name}'", severity="CRITICAL", file path=str file path , line number=None, description= f"Server '{server name}' is assigned an expansive filesystem path '{arg}'. " "Agents interacting with this server obtain arbitrary read/write access to user " "home directories or root." , evidence=f"arg: {arg}", remediation="Scope the server access specifically to a dedicated subproject folder.", The script monitors paths matching expressions like ^/$ , ^/home/?$ , ^/Users/?$ , ^~$ , or root drives on Windows ^ A-Za-z :\\?$ . If an MCP server is configured to mount those locations, it raises a CRITICAL finding. Similarly, the scanner evaluates whether npx or uvx executions pin their targets. If an argument lacks @