mirror of
https://github.com/ChromeDevTools/chrome-devtools-mcp.git
synced 2026-09-14 19:45:30 +08:00
feat: Add --allow-unrestricted-paths by default for CLI (#2618)
This commit is contained in:
@@ -24,12 +24,7 @@ uid=1_0 RootWebArea "Example Domain" url="https://example.com/"
|
||||
|
||||
## Permissions & File Access
|
||||
|
||||
By default, the server only has access to the **OS temp directory** (as defined by Node APIs, `os.tmpdir()`). File-saving parameters (`--filePath`, `--outputDirPath`) and `upload_file` outside the temp directory require unrestricted filesystem access:
|
||||
|
||||
```bash
|
||||
# Start daemon with full filesystem access
|
||||
chrome-devtools start --allowUnrestrictedPaths=true
|
||||
```
|
||||
By default, the CLI has full filesystem access (`--allowUnrestrictedPaths=true`), allowing file-saving parameters (`--filePath`, `--outputDirPath`) and `upload_file` to access files anywhere on the system. Pass `--allowUnrestrictedPaths=false` if you want to restrict file access to the OS temp directory.
|
||||
|
||||
## Command Usage
|
||||
|
||||
@@ -191,7 +186,6 @@ chrome-devtools execute_3p_developer_tool 1 "tool_name" --params '{"arg":"val"}'
|
||||
|
||||
```bash
|
||||
chrome-devtools start # Start or restart chrome-devtools-mcp
|
||||
chrome-devtools start --allowUnrestrictedPaths=true # Start with full filesystem access
|
||||
chrome-devtools start --headless=false # Start with visible browser window
|
||||
chrome-devtools status # Checks if chrome-devtools-mcp is running
|
||||
chrome-devtools stop # Stop chrome-devtools-mcp if any
|
||||
|
||||
@@ -383,6 +383,11 @@ export function getMcpOptionsForViaCli(): typeof mcpOptions {
|
||||
if (!('default' in mcpOptions.headless)) {
|
||||
throw new Error('headless cli option unexpectedly does not have a default');
|
||||
}
|
||||
if (!('default' in mcpOptions.allowUnrestrictedPaths)) {
|
||||
throw new Error(
|
||||
'allowUnrestrictedPaths cli option unexpectedly does not have a default',
|
||||
);
|
||||
}
|
||||
if (!('default' in mcpOptions.experimentalStructuredContent)) {
|
||||
throw new Error(
|
||||
'experimentalStructuredContent cli option unexpectedly does not have a default',
|
||||
@@ -394,6 +399,10 @@ export function getMcpOptionsForViaCli(): typeof mcpOptions {
|
||||
|
||||
return {
|
||||
...mcpOptions,
|
||||
allowUnrestrictedPaths: {
|
||||
...mcpOptions.allowUnrestrictedPaths,
|
||||
default: true,
|
||||
},
|
||||
headless: {
|
||||
...mcpOptions.headless,
|
||||
default: true,
|
||||
|
||||
@@ -45,6 +45,7 @@ describe('cli args parsing', () => {
|
||||
|
||||
it('parses with viaCli args', async () => {
|
||||
const args = parseArguments(['--viaCli']);
|
||||
assert.strictEqual(args.allowUnrestrictedPaths, true);
|
||||
assert.strictEqual(args.headless, true);
|
||||
assert.strictEqual(args.memoryDebugging, true);
|
||||
assert.strictEqual(args.categoryExtensions, true);
|
||||
|
||||
Reference in New Issue
Block a user