Repository navigation
Description
Description of the bug
When an MCP client connects without the roots capability, chrome-devtools-mcp is meant to print a one-time stderr warning that file-writing tools are restricted to the OS temp directory. With default flags the warning never prints, although writes outside the temp directory are still refused. The guard in src/index.ts only warns when filesystemRoot is empty, but filesystemRoot defaults to [os.tmpdir()], so in the default configuration the list is never empty. The warning only appears when the root list is explicitly emptied (for example {"filesystemRoot": []} in a --config file), and in that case the server behaves exactly as it does with default flags. As a result, operators of clients that send no roots get no startup hint. They only see Access denied on the first write outside the temp directory. Observed on 1.10.1 and on main at b2f522c. Write enforcement itself is correct, and this report does not ask to change it.
Actual behavior
1.10.1, step 3 (default flags): the write was refused, and stderr contained only the standard disclaimer. No warning was printed:
"text":"Error: Access denied: path /tmp/x/out/outside.png (canonical: /private/tmp/x/out/outside.png) is not within any of the configured workspace roots."
--- stderr:
chrome-devtools-mcp exposes content of the browser instance to the MCP clients allowing them to inspect,
debug, and modify any data in the browser or DevTools.
Avoid sharing sensitive or personal information that you do not want to share with MCP clients.
--- outside.png exists: no
1.10.1, step 4 (control, {"filesystemRoot": []}): the write was refused in the same way, and the warning printed:
"text":"Error: Access denied: path /tmp/x/out/outside.png (canonical: /private/tmp/x/out/outside.png) is not within any of the configured workspace roots."
--- stderr:
chrome-devtools-mcp exposes content of the browser instance to the MCP clients allowing them to inspect,
debug, and modify any data in the browser or DevTools.
Avoid sharing sensitive or personal information that you do not want to share with MCP clients.
[chrome-devtools-mcp] The connecting client did not negotiate the MCP roots capability. File-writing tools will be restricted to the OS temp directory. To restore the previous unrestricted behavior, start the server with --allow-unrestricted-paths.
--- outside.png exists: no
main gave the same results. With default flags step 5 printed "text":"Error: Access denied: path \"/tmp/x/out/outside.png\" (canonical: \"/private/tmp/x/out/outside.png\") is not within any of the configured workspace roots." and no warning. With the empty-roots config the same refusal came with the warning line above. Step 6 (--workspace /tmp/x/out) printed Saved screenshot to /private/tmp/x/out/outside.png. on both builds, with no warning. In every run of the second client, a screenshot written into os.tmpdir() succeeded, so both configurations enforce the same temp-only restriction. Only the default one fails to warn. A --allowUnrestrictedPaths control on both builds wrote /tmp/x/out/outside.png successfully and printed no warning, as expected.
Reproduction
Executed on macOS, where node -p "require('os').tmpdir()" returns a directory under /var/folders/..., so /tmp/x/out is outside the OS temp directory. On Linux, where os.tmpdir() is usually /tmp, pick an output directory outside it. Usage statistics, CrUX and update checks were disabled. Scratch paths in the output below are shortened to /tmp/x.
npm i --prefix /tmp/x chrome-devtools-mcp@1.10.1,mkdir -p /tmp/x/out, andecho '{"filesystemRoot": []}' > /tmp/x/empty-roots.json.- Save this client as
/tmp/x/no-roots.sh. It declares no capabilities (in particular, noroots), sendsnotifications/initialized, then asks for a screenshot outside the temp directory and keeps stdin open long enough for the call to finish:
#!/bin/bash
# usage: no-roots.sh <server command...>
{
printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"no-roots-client","version":"0"}}}'
printf '%s\n' '{"jsonrpc":"2.0","method":"notifications/initialized"}'
sleep 2
printf '%s\n' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"take_screenshot","arguments":{"pageId":1,"filePath":"/tmp/x/out/outside.png"}}}'
sleep 15
} | CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS=1 "$@" --headless --isolated --no-usage-statistics --no-performance-crux 2>/tmp/x/stderr.txt | grep -o '"text":"\([^"\\]\|\\.\)*"'
echo "--- stderr:"; cat /tmp/x/stderr.txt
echo "--- outside.png exists: $([ -f /tmp/x/out/outside.png ] && echo yes || echo no)"- Default flags:
bash /tmp/x/no-roots.sh /tmp/x/node_modules/.bin/chrome-devtools-mcp. - Control (root list explicitly emptied):
bash /tmp/x/no-roots.sh /tmp/x/node_modules/.bin/chrome-devtools-mcp --config /tmp/x/empty-roots.json. - Repeat steps 3 and 4 with a local build of
main, usingnode build/src/bin/chrome-devtools-mcp.jsas the server command. - Explicit-workspace control on both builds: append
--workspace /tmp/x/outto the step 3 command.
I ran steps 3-5 a second time with a separate stdio MCP client that also passed --logFile and wrote a second screenshot into os.tmpdir(), and added a --allowUnrestrictedPaths run on both builds. The results matched.
Expectation
The warning was added in #2296 (commit 6e56c02, src/index.ts). That PR made file-writing tools fall back to the OS temp directory when a client does not negotiate roots, and it added a stderr warning in the oninitialized handler for that case. In #2296 the warning fired whenever the client lacked roots and --allowUnrestrictedPaths was not set. The --allowUnrestrictedPaths help text describes the same contract in both 1.10.1 and main (src/config/mcp-options.ts, generated into docs/configuration.md:225-228 at 1.10.1 and :232-235 on main): "By default, file-writing tools are restricted to the OS temp directory when no roots are configured." With default flags and a client that sends no roots, the server applies exactly that restriction (step 3 refuses the write), so the startup warning describing it should print on stderr once after initialization. This is the same output step 4 produces today.
The narrower condition is unlikely to be an intentional suppression of the default case. The filesystemRoot ?? [] length check and the [os.tmpdir()] default arrived together in #2605 (commit d00e6f8), whose message says "temp directory access stays the same". The temp-directory default was adopted in that PR's review on src/config/mcp-options.ts. In the same commit, the parser tells the default apart from an explicit value by identity, though only on the chrome-devtools CLI (viaCli) path (args.filesystemRoot === DEFAULT_FILESYSTEM_ROOT in the 1.10.1 yargs middleware, src/config/ConfigParser.ts:190 on main), so the default is distinguishable from configured roots. Since #2605 the warning is reachable only after explicitly emptying the root list, a setup that behaves exactly like the default. With an explicit --workspace <dir>, writes to that directory are allowed (step 6), so the existing warning text, "restricted to the OS temp directory", would be false there. Staying silent in that case is consistent with the contract.
Chrome DevTools MCP version
1.10.1 (npm) and main b2f522c (local build)
Chrome version
154.0.8037.93 (stable, headless, isolated)
Node version
v24.21.0
Operating system
macOS
Evidence
- Expected source: feat: support --allow-unrestricted-paths configuration #2296
src/index.ts:89-96(warning added underelse if (!serverArgs.allowUnrestrictedPaths)for clients without roots), plus the--allowUnrestrictedPathsdescription insrc/config/mcp-options.ts:254-263at 1.10.1 (:181-190onmain) anddocs/configuration.md. - Failure source: runtime output of steps 3-5 above on 1.10.1 (npm) and
main(local build). The guard is atsrc/index.ts:103-113at 1.10.1 (:119-129onmain):!this.#serverArgs.allowUnrestrictedPaths && (this.#serverArgs.filesystemRoot ?? []).length === 0. The default is atsrc/config/mcp-options.ts:12and:264-268at 1.10.1 (:11and:191-195onmain):export const DEFAULT_FILESYSTEM_ROOT = [os.tmpdir()];used asfilesystemRoot's yargs default. - Evidence provenance: observed
- Local verification: reproduced
- Reproduction completeness: complete
History: git log -S shows the filesystemRoot ?? [] length check and the [os.tmpdir()] default both arriving in #2605 ("support configurable filesystem roots"), which is contained in the 1.10.1 tag. The #2605 review comments on src/config/mcp-options.ts show the temp directory being adopted as the yargs default for filesystemRoot during review. Before that change, the #2296 warning printed for every client without roots unless --allowUnrestrictedPaths was set. No existing test asserts when this warning prints. tests/index.test.ts ("allows file access if roots capability is missing") and tests/roots.test.ts cover only path enforcement.
Additional context
The warning text itself is stale on both builds. It tells users to "restore the previous unrestricted behavior" with --allow-unrestricted-paths, but that option is marked deprecated: 'Use --workspace=/ instead.' in src/config/mcp-options.ts (1.10.1 and main). On main, #2858 (commit 45c1c6c) also rejects unrestricted paths combined with an explicit workspace. If the warning is restored as it stands, users without roots will be pointed at the deprecated flag. Whether the notice should name a non-deprecated option is left to the maintainers. It does not change the failing signal above. Separately, in the control runs the warning reached stderr only and did not appear in the --logFile file. This report does not treat that as a defect.
Fix check
Failing: with default flags (no --config, --workspace, --filesystemRoot or --allowUnrestrictedPaths) and a client whose initialize declares no roots capability (step 3), stderr has no notice that file-writing tools are restricted to the OS temp directory, while a write to /tmp/x/out/outside.png is refused. Passing: the same run prints that notice once on stderr after initialization, and the write outside the temp directory is still refused while a write inside os.tmpdir() still succeeds. Controls: with --workspace /tmp/x/out (step 6), the outside write still succeeds and the server does not claim that writes are restricted to the OS temp directory. With --allowUnrestrictedPaths, no warning prints and the outside write still succeeds. A client that declares roots should still get no such warning. That last control rests on the code (the roots branch in oninitialized runs before the warning branch) and was not executed, because the test clients declared no capabilities.
Activity
yulunz commentedon Oct 5, 2026
@Lightning00Blade could you take a look at this one too?
mvanhorn commentedon Oct 6, 2026
The oninitialized handler warns only when unrestricted paths are off and filesystemRoot is missing or empty. The option defaults to DEFAULT_FILESYSTEM_ROOT, the array [os.tmpdir()], so under default flags the list length is 1 and the branch is skipped.
The condition also matches when filesystemRoot is the same array as DEFAULT_FILESYSTEM_ROOT, so a no-roots client under default flags gets the existing temp-directory warning. Explicitly empty roots still warn.
Paraphern commentedon Oct 8, 2026
Version-pinned receipts in case they help date this - we audit MCP servers by pinning old versions and diffing behavior. Same client, no roots negotiation:
Which points at the thing worth pinning down from the maintainers' side: whether "by default" in that changelog line means enabled or merely wired - given that this issue observes writes outside temp still refused under default flags, while #2909 reports
--allowUnrestrictedPaths=falsefailing to restrict. An operator reading the changelog, the Chrome blog and--helptoday gets three different stories about the same security property, and the one runtime signal that used to state it went silent in a minor update.Raw startup transcripts for 1.8.0 vs 1.10.1 available if useful - repro is a 4-command pin-and-diff, method notes and the wider audit (top npm MCP servers) in our report: https://github.com/Paraphern/rugsnare/blob/main/audits/npm-top-mcp-drift-2026-10.md
fix: print the no-roots temp-directory warning under default flags
fix: print the no-roots temp-directory warning under default flags (C…