Skip to content

Network Request Interception and URL Replacement #848

Description

@marco-prontera

Is your feature request related to a problem? Please describe.

Currently there is no automated way through the Chrome DevTools MCP server to intercept and modify network requests. Developers can manually override or redirect resources using the Chrome DevTools UI (e.g., Local Overrides or Response Overrides), but these actions must be done interactively and cannot be scripted or integrated into automated measurement workflows. This becomes a blocker when trying to test development versions of scripts against real production pages.
This become a blocker also to automate experiments in CI or lab environments by using built scripts before doing a production release.
In this issue I'm referring to script but it could be useful also for others resources as is done in the Chrome DevTools UI.

Example real-world impact: if a production page loads a script at https://bar.foo.com/scriptWeAlreadyHaveInWebsite.js, there is no way via MCP today to replace that with a development version and collect metrics without doing it manually in the browser.

Describe the solution you'd like

Add support in the Chrome DevTools MCP server for programmatic network request interception and modification, including:

  • Redirect requests to a different URL
  • Override responses with custom content (remote or local file)

Specifically, the ability to:

  • Match a network request (by URL or pattern)
  • Redirect it to a different URL (e.g., dev/newVersion.js)
  • Optionally serve a custom or local file as the response

This would expose the same functionality found in the DevTools UI (“Override content” / “Local Overrides”) through MCP, enabling automation and tooling scenarios.

Describe alternatives you've considered

The only alternative currently available is to manually use Chrome DevTools UI (https://developer.chrome.com/docs/devtools/overrides) or by developing a custom Chrome Extension.

Additional context

No response

Activity

  1. corradopetrelli commented on Mar 10, 2026

    @corradopetrelli

    This would help a lot in my case as well. It would unblock an automation workflow I'm building around MCP for testing.
    Right now I need to run experiments against real production pages while temporarily replacing a production script with a development version. Since this can only be done manually via DevTools (Local Overrides), it's hard to integrate it into automated tests.
    Being able to intercept and redirect the request programmatically through MCP would make this much easier! 😄

  2. std4453 commented on Mar 24, 2026

    @std4453

    This sounds great, our app currently rely on redirecting some JS files on production page to local dev server to reuse production environment credentials, account, etc. An automated request redirection could really help us with our workflow.

  3. corradopetrelli commented on Aug 27, 2026

    @corradopetrelli

    Has this functionality already been considered? I am asking because I would personally find it very useful and it would be particularly valuable for my needs 🥲

  4. anacromaniac commented on Aug 28, 2026

    @anacromaniac

    I'm using the feature proposed in the PR, and I'm finding it really useful as I can also have the agent measure and compare the performance metrics by replacing versions of some libraries and see which ones cause slowdowns or if the site where I'm working gets benefits. It could be included this year, that would be great!

  5. armandoxheka commented on Aug 31, 2026

    @armandoxheka

    Thanks for proposing this feature. Network request overrides would be very useful in Chrome DevTools MCP, especially for testing local builds directly on existing pages without modifying the deployed application.

    It would make debugging, comparing implementations and testing alternative resources much easier to automate. It would be great to have this capability directly in the official MCP server.

  6. natorion commented on Oct 14, 2026

    @natorion
    Contributor

    Thanks, everyone, for the use cases. We'll consider adding network request overrides (redirecting or replacing responses), similar to Local Overrides in DevTools.

  7. EndeavorYen commented on Oct 26, 2026

    @EndeavorYen

    Adding a use case and some lessons from implementing this, since you mentioned you're still collecting feedback.

    Use case: forcing error and empty states. Besides redirecting a script to a dev build, we use interception to let an agent check how a page handles a failing or empty API: for example, fulfill */api/* with a 503 and {"ok":false}, or a list endpoint with [], then inspect the UI. That is "fulfill with a status and an inline body", with no local file. It would help if the design covered this next to redirect and local-file overrides.

    Lessons from building this on the CDP Fetch domain in our own CDP tool:

    1. Agents write URL patterns that never match. Fetch patterns are compared with the whole URL, so /api/items* does not match https://example.com/api/items?x=1, and the override just shows 0 hits while the page keeps the real data. We now warn when a pattern cannot match a real URL.
    2. Report hit counts per override. Without them, the agent cannot tell "the override ran and the page ignored it" from "the override never matched".
    3. Disable the cache while an override is active, or script overrides can silently not apply. In a quick test on Chromium 156, scripts and images that the tab had already loaded were served from the renderer's memory cache on the next navigation. Fetch.requestPaused never fired for them, and the page ran the original app.js. fetch() requests and a new tab (disk cache only) were intercepted normally. Network.setCacheDisabled({cacheDisabled: true}) made every request go through interception. Since replacing a script is the main use case here, this seems worth handling in the tool rather than leaving it to the agent.
    4. Make cleanup easy. Overrides on a user's own browser outlive the task if nobody removes them, so list and clear matter as much as add.

    The add/list/remove shape in #2371 fits these points well. I'm happy to help with review or tests, or to send a PR scoped however you prefer once the design is settled.

  8. added a commit that references this issue on Nov 11, 2026
    eb4b53d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions