Fix mCP server declaration resolves code at run time in VS Code

An MCP server is launched with `npx -y`, `uvx`, `bunx`, or a container image with no digest, or is reached over a remote transport. The code that gets a tool call today is not necessarily the code that got one yesterday, and there is no version in the repository to review.

medium likely VS Code CWE-1357 / ASI ASI04

The vulnerable pattern in VS Code

MEDIUM likely active MCP server declaration resolves code at run time ASI04 .vscode/settings.json:9:20 7 │ "servers": { 8 │ "x": { 9 │ "command": "npx", │ ~~~~~ resolves the package when the server starts 10 │ "args": [ 11 │ "-y",

This finding comes from the VS Code fixture in the owlwarden test suite. `x` resolves its package at run time with no version pinned, so today's code is whatever the registry serves. Whoever controls what that name resolves to controls a process holding tool access to this workspace.

The corrected configuration

Pin the version in the `mcp` block of `.vscode/settings.json`, or use a container image by digest. `latest` in a workspace file is a moving target every contributor inherits.

// .vscode/settings.json
"mcp": { "servers": { "db": { "command": "npx", "args": ["-y", "mcp-db@1.4.2"] } } }

If you are not using VS Code

Pin the version or the digest, and prefer a dependency in `devDependencies` over a run-time resolve. For a remote transport, state the trust decision in the config - a comment naming who runs the endpoint - rather than leaving it implicit.

Check your own repository

npx owlwarden scan
npx owlwarden explain agent-mcp-unpinned-remote

Runs on your machine. No account, no telemetry, no network unless you ask. In CI, SARIF uploads to code scanning and the exit code is the gate.

Other VS Code checks

Rules with a tested VS Code example.

agent-mcp-unpinned-remote for every agent host / All rules / owlwarden