`evaluate_script` `sourcePath` http(s) URLs are mangled into `file://` paths
Maintainers usually reply within 1 day
Nobody has claimed this yet.
- #3571 by @DrSkyle — closed without merging
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, typescript
- Domain
- backend-api-design
Research direction
Start with resolveScriptSource in src/tools/script.ts and compare its URL handling with the allowUrl pass-through in src/ToolHandler.ts and the loadResource behavior described in the issue. Check the Zod schema in src/tools/script.ts and the sourcePath description in docs/tool-reference.md. Done when http(s) and file URLs reach the loader unchanged, plain paths are converted, and the docs and schema agree.
Written by the indexing model from the issue text.
Description
Description of the bug
evaluate_script advertises remote sourcePath URLs: file verification is called with allowUrl: true, and McpContext.loadResource can fetch http: / https:. resolveScriptSource then always runs non-file: values through pathToFileURL, so a CDN or gist URL never reaches the network loader.
Actual behavior
pathToFileURL("https://example.com/script.js") produces a bogus path such as file:///…/https:/example.com/script.js. loadResource then treats it as a local file and fails with Unable to read script source from ….
The comment and schema at src/tools/script.ts already state that sourcePath may be an http(s) URL the server fetches. docs/tool-reference.md still describes filesystem-only paths and is stale relative to that code.
This was confirmed by reading the current main code path and by evaluating the pathToFileURL transform; it was not re-run end-to-end against a live page.
Reproduction
- Start the MCP server against a page.
- Call
evaluate_scriptwith onlysourcePath: "https://example.com/script.js"(any reachable JS URL). - Observe the error: the URL is rewritten to a
file://path and the fetch never happens.
Root cause: src/tools/script.ts (resolveScriptSource, around lines 237–239) preserves only file: and forces everything else through pathToFileURL, undoing the earlier allowUrl pass-through in src/ToolHandler.ts.
Expectation
If sourcePath is an http:, https:, or file: URL, pass it through unchanged so loadResource can fetch it. Only plain filesystem paths should go through pathToFileURL. The Zod schema and docs/tool-reference.md should match this remote-URL support.
Chrome DevTools MCP version
Latest npm release 1.12.0, and current default branch main at 1d692d31ae37.
Operating system
macOS
Extra checklist
- I want to provide a PR to fix this bug
- Dominant language
- TypeScript
- Stars
- 59.8k
- Forks
- 4.8k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 162
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ChromeDevTools/chrome-devtools-mcp
-
feature
Difficulty 1/5 Under an hour Newbie friendliness 78/100
ChromeDevTools/chrome-devtools-mcp#3689 ·
Maintainers usually reply within 1 day
-
collecting-feedback feature
Difficulty 2/5 Half a day Newbie friendliness 76/100
ChromeDevTools/chrome-devtools-mcp#3225 · 3 comments ·
Maintainers usually reply within 1 day
-
confirmed p3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ChromeDevTools/chrome-devtools-mcp#2947 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 1/100
ChromeDevTools/chrome-devtools-mcp#3648 ·
Maintainers usually reply within 1 day
-
install_extension / uninstall_extension abandon the operation at 30 s and leave the timer unclearedPossibly taken @amirkhakshour claimed this 7 days ago. Openconfirmed p3
Difficulty 3/5 Half a day Newbie friendliness 25/100
ChromeDevTools/chrome-devtools-mcp#3607 · 2 comments ·
Maintainers usually reply within 1 day
All issues in ChromeDevTools/chrome-devtools-mcp
Similar issues
-
bug from-app needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
nightly-labs/openbot#21303 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ADORSYS-GIS/CoopData#282 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
OHDSI/Data2Evidence#3816 ·
Maintainers usually reply within 3 days
-
`ovsx verify` fails for a version older than the 100 newest of an extensionPossibly taken @trivikr claimed this today. Opencli
Difficulty 2/5 1-3 hours Newbie friendliness 81/100
eclipse-openvsx/openvsx#2482 · 2 comments ·
Maintainers usually reply within 1 day
-
bug builder-vite hmr sev:S3
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
storybookjs/storybook#37965 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day