Pasting npx -y into an MCP config is not installing a plugin. It is spawning an unsandboxed local subprocess.Most tutorials treat .mcp.json like a browser extension store: copy a JSON snippet, drop in npx -y, restart your editor, and forget it. A check against the latest Model Context Protocol specification (2026-07-28), npm CLI documentation, VS Code's current docs, and NVD vulnerability records shows how wide the gap between that mental model and reality still is. 1. The protocol does not sandbox local servers.
Under the 2026-07-28 MCP stdio transport specification, the client launches the MCP server directly as a local subprocess communicating over stdin and stdout. Sandboxing is not built into the protocol layer. MCP's own Security Best Practices guide warns that inadequately restricted or untrusted local servers expose the host to arbitrary code execution with MCP client privileges, command obfuscation, data exfiltration, and irrecoverable data loss. 2. npx -y turns off npm's own friction—by design.
According to npm's CLI documentation, npx prompts before installing a package specifically to prevent security and user-experience problems from mistyped package names; -y (--yes) suppresses that prompt. On top of that, npm v11's npm-exec documentation notes that strict-allow-scripts defaults to false unless explicitly overridden (such as with --ignore-scripts), and package resolution relies on npm's cache and freshness checks when versions aren't pinned. Handing an agent config an unpinned npx -y command automates remote package resolution into local execution. 3. Tool annotations cannot protect you from an untrusted server.MCP introduced tool annotations such as readOnlyHint, which many users assume act like OS permission flags. The 2026-07-28 Tools specification explicitly requires clients to treat tool annotations as untrusted unless they come from trusted servers. As MCP's official blog stated in March 2026: "An untrusted server can lie. A server can claim readOnlyHint: true and delete your files anyway." Annotations are UX hints, not enforcement. 4. Real CVEs show the blast radius is config files and client plumbing—not just bad servers.
NVD records from mid-2025 through late 2026 trace the same pattern across the ecosystem: Official tooling (CVE-2025-49596, June 2025): MCP Inspector versions below 0.14.1 lacked authentication between client and proxy, allowing unauthenticated requests to launch MCP commands over stdio. Proxy layer (CVE-2025-6514, July 2025): mcp-remote versions 0.0.5 through 0.1.15 on npm had an OS command injection flaw (JFrog CNA CVSS 9.6 Critical) triggered by crafted authorization_endpoint URLs from untrusted servers. The 2026-07-28 MCP security guide now explicitly forbids clients from using shell commands (cmd.exe, sh, PowerShell) to open server-provided URLs. Config-as-code in editors (CVE-2025-54135, CVE-2025-54136, CVE-2025-64109 in 2025; CVE-2026-95660 in Sept 2026): In Cursor (versions below 1.3.9, 1.2.4 and earlier, and CLI Beta before 2025.09.17-25b418f), creating or editing .cursor/mcp.json via prompt injection or cloned repos led to RCE (with CVE-2025-54135 scored 9.8 Critical by NVD). More than a year later, Moonshot AI's Kimi Code (versions 0.31.0 and earlier) still hit OS command injection via untrusted .mcp.json auto-spawn before patching in 0.31.1. 5. Even late-2026 client defenses still leave opt-in gaps.VS Code's MCP documentation (updated November 18, 2026) makes the current boundary explicit: .vscode/mcp.json and .mcp.json inherit Workspace Trust. Once you trust a repository, those servers can start without a separate MCP trust prompt—even after configuration changes. Per-server stdio sandboxing (sandboxEnabled) is available on macOS and Linux, but must be configured in VS Code-format definitions, and VS Code's security docs note that outbound network access in Copilot's sandbox is allowed by default unless restricted. The takeaway for anyone editing an MCP config:
Treat .mcp.json the same way you treat a Makefile or a postinstall script. Never trust a repo before inspecting its MCP config, pin exact versions instead of floating npx -y calls, assume readOnlyHint means nothing on third-party servers, and turn on OS-level or container sandboxing wherever your client supports it. Primary reference — MCP Security Best Practices (2026-07-28):https://modelcontextprotocol.io/docs/2026-07-28/tutorials/security/security_best_practices