@mcpc-tech/unplugin-dev-inspector-mcp 0.0.42-beta.2 → 0.0.42-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -125,12 +125,16 @@ If you prefer to configure it manually:
125
125
  + enabled: true,
126
126
  showInspectorBar: true, // Default: true. Set to false to hide the UI.
127
127
  + autoOpenBrowser: false, // Default: false. Automatically open browser when server starts.
128
+ + // Disable Chrome DevTools integration (useful in CI/headless/cloud environments)
129
+ + // disableChrome: true,
128
130
  }),
129
131
  react(), // or vue(), svelte(), solid(), preact()
130
132
  ],
131
133
  };
132
134
  ```
133
135
 
136
+ > 📴 **Disable Chrome DevTools integration:** set `disableChrome: true` in plugin options or export `DEV_INSPECTOR_DISABLE_CHROME=1`.
137
+
134
138
  > ⚠️ **Plugin order matters:** Place `DevInspector.vite()` **before** `react()`, `vue()`, `svelte()`, `solid()`, or `preact()`. Otherwise source locations may show `unknown:0:0`.
135
139
 
136
140
  #### For Non-HTML Projects (Miniapps, Library Bundles)
package/dist/cli.cjs CHANGED
@@ -113,6 +113,7 @@ async function startStandaloneServer(options = {}) {
113
113
 
114
114
  //#endregion
115
115
  //#region src/utils/config-detector.ts
116
+ require_config_updater.init_helpers();
116
117
  const CONFIG_PATTERNS = {
117
118
  vite: [
118
119
  "vite.config.ts",
@@ -592,10 +593,15 @@ Example:
592
593
  });
593
594
  const serverContext = {
594
595
  host: actualHost,
595
- port: actualPort
596
+ port: actualPort,
597
+ disableChrome: require_config_updater.isEnvTruthy(process.env.DEV_INSPECTOR_DISABLE_CHROME)
596
598
  };
597
599
  const displayHost = actualHost === "0.0.0.0" ? "localhost" : actualHost;
598
- const baseUrl = `${process.env.DEV_INSPECTOR_PUBLIC_BASE_URL ? process.env.DEV_INSPECTOR_PUBLIC_BASE_URL.replace(/\/+$/, "") : `http://${displayHost}:${actualPort}`}/__mcp__/sse`;
600
+ const baseUrl = `${require_config_updater.getPublicBaseUrl({
601
+ publicBaseUrl: process.env.DEV_INSPECTOR_PUBLIC_BASE_URL,
602
+ host: displayHost,
603
+ port: actualPort
604
+ })}/__mcp__/sse`;
599
605
  console.log(`[dev-inspector] 📡 MCP (Standalone): ${baseUrl}\n`);
600
606
  require_config_updater.setupMcpMiddleware(server, serverContext);
601
607
  require_config_updater.setupAcpMiddleware(server, serverContext, {});
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { i as setupMcpMiddleware, n as setupAcpMiddleware, r as setupInspectorMiddleware, t as updateMcpConfigs } from "./config-updater.js";
2
+ import { a as getPublicBaseUrl, c as isEnvTruthy, i as setupMcpMiddleware, n as setupAcpMiddleware, o as init_helpers, r as setupInspectorMiddleware, t as updateMcpConfigs } from "./config-updater.js";
3
3
  import http from "node:http";
4
4
  import { copyFileSync, existsSync, readFileSync, writeFileSync } from "fs";
5
5
  import { resolve } from "path";
@@ -109,6 +109,7 @@ async function startStandaloneServer(options = {}) {
109
109
 
110
110
  //#endregion
111
111
  //#region src/utils/config-detector.ts
112
+ init_helpers();
112
113
  const CONFIG_PATTERNS = {
113
114
  vite: [
114
115
  "vite.config.ts",
@@ -588,10 +589,15 @@ Example:
588
589
  });
589
590
  const serverContext = {
590
591
  host: actualHost,
591
- port: actualPort
592
+ port: actualPort,
593
+ disableChrome: isEnvTruthy(process.env.DEV_INSPECTOR_DISABLE_CHROME)
592
594
  };
593
595
  const displayHost = actualHost === "0.0.0.0" ? "localhost" : actualHost;
594
- const baseUrl = `${process.env.DEV_INSPECTOR_PUBLIC_BASE_URL ? process.env.DEV_INSPECTOR_PUBLIC_BASE_URL.replace(/\/+$/, "") : `http://${displayHost}:${actualPort}`}/__mcp__/sse`;
596
+ const baseUrl = `${getPublicBaseUrl({
597
+ publicBaseUrl: process.env.DEV_INSPECTOR_PUBLIC_BASE_URL,
598
+ host: displayHost,
599
+ port: actualPort
600
+ })}/__mcp__/sse`;
595
601
  console.log(`[dev-inspector] 📡 MCP (Standalone): ${baseUrl}\n`);
596
602
  setupMcpMiddleware(server, serverContext);
597
603
  setupAcpMiddleware(server, serverContext, {});
@@ -86536,8 +86536,33 @@ const TOOL_SCHEMAS = {
86536
86536
  }
86537
86537
  };
86538
86538
 
86539
+ //#endregion
86540
+ //#region src/utils/helpers.ts
86541
+ /**
86542
+ * Simple utility functions following KISS principle
86543
+ */
86544
+ function stripTrailingSlash(url$1) {
86545
+ return url$1.replace(/\/+$/, "");
86546
+ }
86547
+ function isEnvTruthy(value) {
86548
+ if (!value) return false;
86549
+ const normalized = value.trim().toLowerCase();
86550
+ return normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on";
86551
+ }
86552
+ function isChromeDisabled(disableOption) {
86553
+ return Boolean(disableOption) || isEnvTruthy(process.env.DEV_INSPECTOR_DISABLE_CHROME);
86554
+ }
86555
+ function getPublicBaseUrl(options) {
86556
+ const fromEnv = process.env.DEV_INSPECTOR_PUBLIC_BASE_URL;
86557
+ if (fromEnv) return stripTrailingSlash(fromEnv);
86558
+ if (options?.publicBaseUrl) return stripTrailingSlash(options.publicBaseUrl);
86559
+ return `http://${options?.host || "localhost"}:${options?.port || 5173}`;
86560
+ }
86561
+ var init_helpers = require_chunk.__esmMin((() => {}));
86562
+
86539
86563
  //#endregion
86540
86564
  //#region src/mcp.ts
86565
+ init_helpers();
86541
86566
  /**
86542
86567
  * Get Chrome DevTools binary path from npm package, then use node to run it, faster/stabler than npx
86543
86568
  */
@@ -86580,6 +86605,7 @@ function callMcpMethod(mcpServer, method, params) {
86580
86605
  * Create and configure the MCP server for source inspection
86581
86606
  */
86582
86607
  async function createInspectorMcpServer(serverContext) {
86608
+ const chromeDisabled = isChromeDisabled(serverContext?.disableChrome);
86583
86609
  const mcpServer = await mcpc([{
86584
86610
  name: "dev-inspector",
86585
86611
  version: "1.0.0",
@@ -86588,7 +86614,7 @@ async function createInspectorMcpServer(serverContext) {
86588
86614
  tools: { listChanged: true },
86589
86615
  sampling: {},
86590
86616
  prompts: { listChanged: true }
86591
- } }], [{
86617
+ } }], chromeDisabled ? [] : [{
86592
86618
  name: "chrome_devtools",
86593
86619
  description: `Access Chrome DevTools for browser diagnostics.
86594
86620
 
@@ -86639,24 +86665,33 @@ You MUST ask the user for confirmation before navigating to any URL.`,
86639
86665
  { ...TOOL_SCHEMAS.execute_page_script }
86640
86666
  ]);
86641
86667
  mcpServer.setRequestHandler(_modelcontextprotocol_sdk_types_js.ListPromptsRequestSchema, async (_request) => {
86642
- const defaultUrl = process.env.DEV_INSPECTOR_PUBLIC_BASE_URL ? process.env.DEV_INSPECTOR_PUBLIC_BASE_URL.replace(/\/+$/, "") : `http://${serverContext?.host || "localhost"}:${serverContext?.port || 5173}`;
86668
+ const defaultUrl = process.env.DEV_INSPECTOR_PUBLIC_BASE_URL ? stripTrailingSlash(process.env.DEV_INSPECTOR_PUBLIC_BASE_URL) : `http://${serverContext?.host || "localhost"}:${serverContext?.port || 5173}`;
86643
86669
  return { prompts: [
86644
86670
  { ...PROMPT_SCHEMAS.capture_element },
86645
86671
  { ...PROMPT_SCHEMAS.view_inspections },
86646
- {
86647
- ...PROMPT_SCHEMAS.launch_chrome_devtools,
86648
- description: `Launch Chrome DevTools and navigate to the dev server for debugging and inspection. Default URL: ${defaultUrl}. You can use this default URL or provide a custom one.`,
86649
- arguments: [{
86650
- name: "url",
86651
- description: `The URL to navigate to. Press Enter to use default: ${defaultUrl}`,
86652
- required: false
86653
- }]
86654
- },
86655
- { ...PROMPT_SCHEMAS.get_network_requests },
86656
- { ...PROMPT_SCHEMAS.get_console_messages }
86672
+ ...!chromeDisabled ? [
86673
+ {
86674
+ ...PROMPT_SCHEMAS.launch_chrome_devtools,
86675
+ description: `Launch Chrome DevTools and navigate to the dev server for debugging and inspection. Default URL: ${defaultUrl}. You can use this default URL or provide a custom one.`,
86676
+ arguments: [{
86677
+ name: "url",
86678
+ description: `The URL to navigate to. Press Enter to use default: ${defaultUrl}`,
86679
+ required: false
86680
+ }]
86681
+ },
86682
+ { ...PROMPT_SCHEMAS.get_network_requests },
86683
+ { ...PROMPT_SCHEMAS.get_console_messages }
86684
+ ] : []
86657
86685
  ] };
86658
86686
  });
86659
86687
  async function refreshChromeState() {
86688
+ if (chromeDisabled) return { messages: [{
86689
+ role: "user",
86690
+ content: {
86691
+ type: "text",
86692
+ text: "Chrome integration is disabled (set DEV_INSPECTOR_DISABLE_CHROME=0 to enable)."
86693
+ }
86694
+ }] };
86660
86695
  const networkResult = await callMcpMethod(mcpServer, "tools/call", {
86661
86696
  name: "chrome_devtools",
86662
86697
  arguments: {
@@ -86687,23 +86722,25 @@ You MUST ask the user for confirmation before navigating to any URL.`,
86687
86722
  return { prompts: [
86688
86723
  { ...PROMPT_SCHEMAS.capture_element },
86689
86724
  { ...PROMPT_SCHEMAS.view_inspections },
86690
- { ...PROMPT_SCHEMAS.launch_chrome_devtools },
86691
- {
86692
- ...PROMPT_SCHEMAS.get_network_requests,
86693
- arguments: [{
86694
- name: "reqid",
86695
- description: `Optional. The request ID to get details for. If omitted, only refreshes and lists requests.\n\nAvailable requests:\n${requestOptions || "No requests available"}`,
86696
- required: false
86697
- }]
86698
- },
86699
- {
86700
- ...PROMPT_SCHEMAS.get_console_messages,
86701
- arguments: [{
86702
- name: "msgid",
86703
- description: `Optional. The message ID to get details for. If omitted, only refreshes and lists messages.\n\nAvailable messages:\n${messageOptions || "No messages available"}`,
86704
- required: false
86705
- }]
86706
- }
86725
+ ...!chromeDisabled ? [
86726
+ { ...PROMPT_SCHEMAS.launch_chrome_devtools },
86727
+ {
86728
+ ...PROMPT_SCHEMAS.get_network_requests,
86729
+ arguments: [{
86730
+ name: "reqid",
86731
+ description: `Optional. The request ID to get details for. If omitted, only refreshes and lists requests.\n\nAvailable requests:\n${requestOptions || "No requests available"}`,
86732
+ required: false
86733
+ }]
86734
+ },
86735
+ {
86736
+ ...PROMPT_SCHEMAS.get_console_messages,
86737
+ arguments: [{
86738
+ name: "msgid",
86739
+ description: `Optional. The message ID to get details for. If omitted, only refreshes and lists messages.\n\nAvailable messages:\n${messageOptions || "No messages available"}`,
86740
+ required: false
86741
+ }]
86742
+ }
86743
+ ] : []
86707
86744
  ] };
86708
86745
  });
86709
86746
  await mcpServer.sendPromptListChanged();
@@ -86714,6 +86751,13 @@ You MUST ask the user for confirmation before navigating to any URL.`,
86714
86751
  }
86715
86752
  mcpServer.setRequestHandler(_modelcontextprotocol_sdk_types_js.GetPromptRequestSchema, async (request) => {
86716
86753
  const promptName = request.params.name;
86754
+ if (chromeDisabled && (promptName === "launch_chrome_devtools" || promptName === "get_network_requests" || promptName === "get_console_messages")) return { messages: [{
86755
+ role: "user",
86756
+ content: {
86757
+ type: "text",
86758
+ text: "Chrome integration is disabled. Enable it by unsetting DEV_INSPECTOR_DISABLE_CHROME or setting it to 0/false."
86759
+ }
86760
+ }] };
86717
86761
  switch (promptName) {
86718
86762
  case "capture_element": return { messages: (await callMcpMethod(mcpServer, "tools/call", {
86719
86763
  name: "capture_element_context",
@@ -86730,7 +86774,7 @@ You MUST ask the user for confirmation before navigating to any URL.`,
86730
86774
  content: item
86731
86775
  })) || [] };
86732
86776
  case "launch_chrome_devtools": {
86733
- const defaultUrl = process.env.DEV_INSPECTOR_PUBLIC_BASE_URL ? process.env.DEV_INSPECTOR_PUBLIC_BASE_URL.replace(/\/+$/, "") : `http://${serverContext?.host || "localhost"}:${serverContext?.port || 5173}`;
86777
+ const defaultUrl = process.env.DEV_INSPECTOR_PUBLIC_BASE_URL ? stripTrailingSlash(process.env.DEV_INSPECTOR_PUBLIC_BASE_URL) : `http://${serverContext?.host || "localhost"}:${serverContext?.port || 5173}`;
86734
86778
  const url$1 = request.params.arguments?.url || defaultUrl;
86735
86779
  try {
86736
86780
  new URL(url$1);
@@ -87088,18 +87132,6 @@ async function handleStreamableHttpDelete(req, res, connectionManager) {
87088
87132
  */
87089
87133
  async function handleSseConnection(req, res, serverContext, connectionManager) {
87090
87134
  try {
87091
- if (!res.headersSent) {
87092
- res.statusCode = 200;
87093
- res.setHeader("Content-Type", "text/event-stream; charset=utf-8");
87094
- res.setHeader("Cache-Control", "no-cache, no-transform");
87095
- res.setHeader("Connection", "keep-alive");
87096
- res.setHeader("X-Accel-Buffering", "no");
87097
- res.setHeader("Content-Encoding", "identity");
87098
- }
87099
- res.socket?.setKeepAlive?.(true);
87100
- res.socket?.setTimeout?.(0);
87101
- res.flushHeaders?.();
87102
- res.write(`: mcp-sse-connected\n\n`);
87103
87135
  const mcpServer = await createInspectorMcpServer(serverContext);
87104
87136
  const host = serverContext?.host || "localhost";
87105
87137
  const port = serverContext?.port || 5173;
@@ -87118,6 +87150,9 @@ async function handleSseConnection(req, res, serverContext, connectionManager) {
87118
87150
  connectionManager.handleWatcherConnection(sessionId, clientId, puppetId, transport);
87119
87151
  }
87120
87152
  await mcpServer.connect(transport);
87153
+ try {
87154
+ res.write(`: mcp-sse-connected\n\n`);
87155
+ } catch {}
87121
87156
  } catch (error) {
87122
87157
  console.error("Error establishing SSE connection:", error);
87123
87158
  if (!res.headersSent) res.writeHead(500).end("Error establishing SSE stream");
@@ -88904,6 +88939,30 @@ async function updateMcpConfigs(root$1, sseUrl, options, logger) {
88904
88939
  }
88905
88940
 
88906
88941
  //#endregion
88942
+ Object.defineProperty(exports, 'getPublicBaseUrl', {
88943
+ enumerable: true,
88944
+ get: function () {
88945
+ return getPublicBaseUrl;
88946
+ }
88947
+ });
88948
+ Object.defineProperty(exports, 'init_helpers', {
88949
+ enumerable: true,
88950
+ get: function () {
88951
+ return init_helpers;
88952
+ }
88953
+ });
88954
+ Object.defineProperty(exports, 'isChromeDisabled', {
88955
+ enumerable: true,
88956
+ get: function () {
88957
+ return isChromeDisabled;
88958
+ }
88959
+ });
88960
+ Object.defineProperty(exports, 'isEnvTruthy', {
88961
+ enumerable: true,
88962
+ get: function () {
88963
+ return isEnvTruthy;
88964
+ }
88965
+ });
88907
88966
  Object.defineProperty(exports, 'setupAcpMiddleware', {
88908
88967
  enumerable: true,
88909
88968
  get: function () {
@@ -88922,6 +88981,12 @@ Object.defineProperty(exports, 'setupMcpMiddleware', {
88922
88981
  return setupMcpMiddleware;
88923
88982
  }
88924
88983
  });
88984
+ Object.defineProperty(exports, 'stripTrailingSlash', {
88985
+ enumerable: true,
88986
+ get: function () {
88987
+ return stripTrailingSlash;
88988
+ }
88989
+ });
88925
88990
  Object.defineProperty(exports, 'updateMcpConfigs', {
88926
88991
  enumerable: true,
88927
88992
  get: function () {
@@ -86571,8 +86571,33 @@ const TOOL_SCHEMAS = {
86571
86571
  }
86572
86572
  };
86573
86573
 
86574
+ //#endregion
86575
+ //#region src/utils/helpers.ts
86576
+ /**
86577
+ * Simple utility functions following KISS principle
86578
+ */
86579
+ function stripTrailingSlash(url) {
86580
+ return url.replace(/\/+$/, "");
86581
+ }
86582
+ function isEnvTruthy(value) {
86583
+ if (!value) return false;
86584
+ const normalized = value.trim().toLowerCase();
86585
+ return normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on";
86586
+ }
86587
+ function isChromeDisabled(disableOption) {
86588
+ return Boolean(disableOption) || isEnvTruthy(process.env.DEV_INSPECTOR_DISABLE_CHROME);
86589
+ }
86590
+ function getPublicBaseUrl(options) {
86591
+ const fromEnv = process.env.DEV_INSPECTOR_PUBLIC_BASE_URL;
86592
+ if (fromEnv) return stripTrailingSlash(fromEnv);
86593
+ if (options?.publicBaseUrl) return stripTrailingSlash(options.publicBaseUrl);
86594
+ return `http://${options?.host || "localhost"}:${options?.port || 5173}`;
86595
+ }
86596
+ var init_helpers = __esmMin((() => {}));
86597
+
86574
86598
  //#endregion
86575
86599
  //#region src/mcp.ts
86600
+ init_helpers();
86576
86601
  /**
86577
86602
  * Get Chrome DevTools binary path from npm package, then use node to run it, faster/stabler than npx
86578
86603
  */
@@ -86615,6 +86640,7 @@ function callMcpMethod(mcpServer, method, params) {
86615
86640
  * Create and configure the MCP server for source inspection
86616
86641
  */
86617
86642
  async function createInspectorMcpServer(serverContext) {
86643
+ const chromeDisabled = isChromeDisabled(serverContext?.disableChrome);
86618
86644
  const mcpServer = await mcpc([{
86619
86645
  name: "dev-inspector",
86620
86646
  version: "1.0.0",
@@ -86623,7 +86649,7 @@ async function createInspectorMcpServer(serverContext) {
86623
86649
  tools: { listChanged: true },
86624
86650
  sampling: {},
86625
86651
  prompts: { listChanged: true }
86626
- } }], [{
86652
+ } }], chromeDisabled ? [] : [{
86627
86653
  name: "chrome_devtools",
86628
86654
  description: `Access Chrome DevTools for browser diagnostics.
86629
86655
 
@@ -86674,24 +86700,33 @@ You MUST ask the user for confirmation before navigating to any URL.`,
86674
86700
  { ...TOOL_SCHEMAS.execute_page_script }
86675
86701
  ]);
86676
86702
  mcpServer.setRequestHandler(ListPromptsRequestSchema, async (_request) => {
86677
- const defaultUrl = process.env.DEV_INSPECTOR_PUBLIC_BASE_URL ? process.env.DEV_INSPECTOR_PUBLIC_BASE_URL.replace(/\/+$/, "") : `http://${serverContext?.host || "localhost"}:${serverContext?.port || 5173}`;
86703
+ const defaultUrl = process.env.DEV_INSPECTOR_PUBLIC_BASE_URL ? stripTrailingSlash(process.env.DEV_INSPECTOR_PUBLIC_BASE_URL) : `http://${serverContext?.host || "localhost"}:${serverContext?.port || 5173}`;
86678
86704
  return { prompts: [
86679
86705
  { ...PROMPT_SCHEMAS.capture_element },
86680
86706
  { ...PROMPT_SCHEMAS.view_inspections },
86681
- {
86682
- ...PROMPT_SCHEMAS.launch_chrome_devtools,
86683
- description: `Launch Chrome DevTools and navigate to the dev server for debugging and inspection. Default URL: ${defaultUrl}. You can use this default URL or provide a custom one.`,
86684
- arguments: [{
86685
- name: "url",
86686
- description: `The URL to navigate to. Press Enter to use default: ${defaultUrl}`,
86687
- required: false
86688
- }]
86689
- },
86690
- { ...PROMPT_SCHEMAS.get_network_requests },
86691
- { ...PROMPT_SCHEMAS.get_console_messages }
86707
+ ...!chromeDisabled ? [
86708
+ {
86709
+ ...PROMPT_SCHEMAS.launch_chrome_devtools,
86710
+ description: `Launch Chrome DevTools and navigate to the dev server for debugging and inspection. Default URL: ${defaultUrl}. You can use this default URL or provide a custom one.`,
86711
+ arguments: [{
86712
+ name: "url",
86713
+ description: `The URL to navigate to. Press Enter to use default: ${defaultUrl}`,
86714
+ required: false
86715
+ }]
86716
+ },
86717
+ { ...PROMPT_SCHEMAS.get_network_requests },
86718
+ { ...PROMPT_SCHEMAS.get_console_messages }
86719
+ ] : []
86692
86720
  ] };
86693
86721
  });
86694
86722
  async function refreshChromeState() {
86723
+ if (chromeDisabled) return { messages: [{
86724
+ role: "user",
86725
+ content: {
86726
+ type: "text",
86727
+ text: "Chrome integration is disabled (set DEV_INSPECTOR_DISABLE_CHROME=0 to enable)."
86728
+ }
86729
+ }] };
86695
86730
  const networkResult = await callMcpMethod(mcpServer, "tools/call", {
86696
86731
  name: "chrome_devtools",
86697
86732
  arguments: {
@@ -86722,23 +86757,25 @@ You MUST ask the user for confirmation before navigating to any URL.`,
86722
86757
  return { prompts: [
86723
86758
  { ...PROMPT_SCHEMAS.capture_element },
86724
86759
  { ...PROMPT_SCHEMAS.view_inspections },
86725
- { ...PROMPT_SCHEMAS.launch_chrome_devtools },
86726
- {
86727
- ...PROMPT_SCHEMAS.get_network_requests,
86728
- arguments: [{
86729
- name: "reqid",
86730
- description: `Optional. The request ID to get details for. If omitted, only refreshes and lists requests.\n\nAvailable requests:\n${requestOptions || "No requests available"}`,
86731
- required: false
86732
- }]
86733
- },
86734
- {
86735
- ...PROMPT_SCHEMAS.get_console_messages,
86736
- arguments: [{
86737
- name: "msgid",
86738
- description: `Optional. The message ID to get details for. If omitted, only refreshes and lists messages.\n\nAvailable messages:\n${messageOptions || "No messages available"}`,
86739
- required: false
86740
- }]
86741
- }
86760
+ ...!chromeDisabled ? [
86761
+ { ...PROMPT_SCHEMAS.launch_chrome_devtools },
86762
+ {
86763
+ ...PROMPT_SCHEMAS.get_network_requests,
86764
+ arguments: [{
86765
+ name: "reqid",
86766
+ description: `Optional. The request ID to get details for. If omitted, only refreshes and lists requests.\n\nAvailable requests:\n${requestOptions || "No requests available"}`,
86767
+ required: false
86768
+ }]
86769
+ },
86770
+ {
86771
+ ...PROMPT_SCHEMAS.get_console_messages,
86772
+ arguments: [{
86773
+ name: "msgid",
86774
+ description: `Optional. The message ID to get details for. If omitted, only refreshes and lists messages.\n\nAvailable messages:\n${messageOptions || "No messages available"}`,
86775
+ required: false
86776
+ }]
86777
+ }
86778
+ ] : []
86742
86779
  ] };
86743
86780
  });
86744
86781
  await mcpServer.sendPromptListChanged();
@@ -86749,6 +86786,13 @@ You MUST ask the user for confirmation before navigating to any URL.`,
86749
86786
  }
86750
86787
  mcpServer.setRequestHandler(GetPromptRequestSchema, async (request) => {
86751
86788
  const promptName = request.params.name;
86789
+ if (chromeDisabled && (promptName === "launch_chrome_devtools" || promptName === "get_network_requests" || promptName === "get_console_messages")) return { messages: [{
86790
+ role: "user",
86791
+ content: {
86792
+ type: "text",
86793
+ text: "Chrome integration is disabled. Enable it by unsetting DEV_INSPECTOR_DISABLE_CHROME or setting it to 0/false."
86794
+ }
86795
+ }] };
86752
86796
  switch (promptName) {
86753
86797
  case "capture_element": return { messages: (await callMcpMethod(mcpServer, "tools/call", {
86754
86798
  name: "capture_element_context",
@@ -86765,7 +86809,7 @@ You MUST ask the user for confirmation before navigating to any URL.`,
86765
86809
  content: item
86766
86810
  })) || [] };
86767
86811
  case "launch_chrome_devtools": {
86768
- const defaultUrl = process.env.DEV_INSPECTOR_PUBLIC_BASE_URL ? process.env.DEV_INSPECTOR_PUBLIC_BASE_URL.replace(/\/+$/, "") : `http://${serverContext?.host || "localhost"}:${serverContext?.port || 5173}`;
86812
+ const defaultUrl = process.env.DEV_INSPECTOR_PUBLIC_BASE_URL ? stripTrailingSlash(process.env.DEV_INSPECTOR_PUBLIC_BASE_URL) : `http://${serverContext?.host || "localhost"}:${serverContext?.port || 5173}`;
86769
86813
  const url = request.params.arguments?.url || defaultUrl;
86770
86814
  try {
86771
86815
  new URL(url);
@@ -87123,18 +87167,6 @@ async function handleStreamableHttpDelete(req, res, connectionManager) {
87123
87167
  */
87124
87168
  async function handleSseConnection(req, res, serverContext, connectionManager) {
87125
87169
  try {
87126
- if (!res.headersSent) {
87127
- res.statusCode = 200;
87128
- res.setHeader("Content-Type", "text/event-stream; charset=utf-8");
87129
- res.setHeader("Cache-Control", "no-cache, no-transform");
87130
- res.setHeader("Connection", "keep-alive");
87131
- res.setHeader("X-Accel-Buffering", "no");
87132
- res.setHeader("Content-Encoding", "identity");
87133
- }
87134
- res.socket?.setKeepAlive?.(true);
87135
- res.socket?.setTimeout?.(0);
87136
- res.flushHeaders?.();
87137
- res.write(`: mcp-sse-connected\n\n`);
87138
87170
  const mcpServer = await createInspectorMcpServer(serverContext);
87139
87171
  const host = serverContext?.host || "localhost";
87140
87172
  const port = serverContext?.port || 5173;
@@ -87153,6 +87185,9 @@ async function handleSseConnection(req, res, serverContext, connectionManager) {
87153
87185
  connectionManager.handleWatcherConnection(sessionId, clientId, puppetId, transport);
87154
87186
  }
87155
87187
  await mcpServer.connect(transport);
87188
+ try {
87189
+ res.write(`: mcp-sse-connected\n\n`);
87190
+ } catch {}
87156
87191
  } catch (error) {
87157
87192
  console.error("Error establishing SSE connection:", error);
87158
87193
  if (!res.headersSent) res.writeHead(500).end("Error establishing SSE stream");
@@ -88939,4 +88974,4 @@ async function updateMcpConfigs(root$1, sseUrl, options, logger) {
88939
88974
  }
88940
88975
 
88941
88976
  //#endregion
88942
- export { __esmMin as a, setupMcpMiddleware as i, setupAcpMiddleware as n, __export as o, setupInspectorMiddleware as r, __toCommonJS as s, updateMcpConfigs as t };
88977
+ export { getPublicBaseUrl as a, isEnvTruthy as c, __export as d, __toCommonJS as f, setupMcpMiddleware as i, stripTrailingSlash as l, setupAcpMiddleware as n, init_helpers as o, setupInspectorMiddleware as r, isChromeDisabled as s, updateMcpConfigs as t, __esmMin as u };
package/dist/index.cjs CHANGED
@@ -72,6 +72,10 @@ async function getOrCreateClient(sseUrl) {
72
72
  */
73
73
  async function launchBrowserWithDevTools(options) {
74
74
  const { url, serverContext } = options;
75
+ if (require_config_updater.isChromeDisabled(serverContext.disableChrome)) {
76
+ console.log(`[dev-inspector] 📴 Skipping browser launch: Chrome integration disabled (DEV_INSPECTOR_DISABLE_CHROME=1 or disableChrome: true)`);
77
+ return false;
78
+ }
75
79
  const sseUrl = `http://${serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host || "localhost"}:${serverContext.port || 5173}/__mcp__/sse?clientId=browser-launcher-${process.pid}`;
76
80
  try {
77
81
  await (await getOrCreateClient(sseUrl)).callTool({
@@ -90,6 +94,7 @@ async function launchBrowserWithDevTools(options) {
90
94
  }
91
95
  var sharedClient, sharedSseUrl, connectPromise, cleanupRegistered;
92
96
  var init_browser_launcher = require_chunk.__esmMin((() => {
97
+ require_config_updater.init_helpers();
93
98
  sharedClient = null;
94
99
  sharedSseUrl = null;
95
100
  connectPromise = null;
@@ -99,6 +104,7 @@ var init_browser_launcher = require_chunk.__esmMin((() => {
99
104
  //#endregion
100
105
  //#region src/utils/create-plugin.ts
101
106
  init_browser_launcher();
107
+ require_config_updater.init_helpers();
102
108
  const createDevInspectorPlugin = (name, transformFactory) => {
103
109
  return (0, unplugin.createUnplugin)((options = {}) => {
104
110
  const enabled = options.enabled ?? process.env.NODE_ENV !== "production";
@@ -108,11 +114,7 @@ const createDevInspectorPlugin = (name, transformFactory) => {
108
114
  let resolvedHost = options.host || "localhost";
109
115
  let resolvedPort = options.port || 5173;
110
116
  const transformImpl = transformFactory(options);
111
- const stripTrailingSlash = (url) => url.replace(/\/+$/, "");
112
- const getPublicBaseUrl = (fallbackHttpHostPort) => {
113
- const fromOptions = options.publicBaseUrl || process.env.DEV_INSPECTOR_PUBLIC_BASE_URL;
114
- return fromOptions ? stripTrailingSlash(fromOptions) : fallbackHttpHostPort;
115
- };
117
+ const chromeDisabled = require_config_updater.isChromeDisabled(options.disableChrome);
116
118
  const transform = (code, id) => {
117
119
  if (!enabled) return null;
118
120
  if (viteCommand && viteCommand !== "serve") return null;
@@ -139,7 +141,7 @@ export function registerInspectorTool(_tool) {
139
141
  const port = resolvedPort;
140
142
  const showInspectorBar = options.showInspectorBar ?? true;
141
143
  const publicBaseUrl = options.publicBaseUrl || process.env.DEV_INSPECTOR_PUBLIC_BASE_URL;
142
- const injectedBaseUrl = publicBaseUrl ? stripTrailingSlash(publicBaseUrl) : void 0;
144
+ const injectedBaseUrl = publicBaseUrl ? require_config_updater.stripTrailingSlash(publicBaseUrl) : void 0;
143
145
  return `
144
146
  // Development-only code - removed in production builds
145
147
 
@@ -258,9 +260,15 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
258
260
  const viteHost = server.config.server.host;
259
261
  const serverContext = {
260
262
  host: options.host ?? (typeof viteHost === "string" ? viteHost : viteHost === true ? "0.0.0.0" : "localhost"),
261
- port: options.port ?? server.config.server.port ?? 5173
263
+ port: options.port ?? server.config.server.port ?? 5173,
264
+ disableChrome: chromeDisabled
262
265
  };
263
- const publicBase = getPublicBaseUrl(`http://${serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host}:${serverContext.port}`);
266
+ const displayHost = serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host;
267
+ const publicBase = require_config_updater.getPublicBaseUrl({
268
+ publicBaseUrl: options.publicBaseUrl,
269
+ host: displayHost,
270
+ port: serverContext.port
271
+ });
264
272
  const baseUrl = `${publicBase}/__mcp__/sse`;
265
273
  console.log(`[dev-inspector] 📡 MCP: ${baseUrl}\n`);
266
274
  await require_config_updater.setupMcpMiddleware(server.middlewares, serverContext);
@@ -276,7 +284,7 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
276
284
  updateConfigAdditionalServers: options.updateConfigAdditionalServers,
277
285
  customEditors: options.customEditors
278
286
  });
279
- if (options.autoOpenBrowser ?? false) {
287
+ if ((options.autoOpenBrowser ?? false) && !chromeDisabled) {
280
288
  const targetUrl = options.browserUrl ?? publicBase;
281
289
  setTimeout(async () => {
282
290
  if (await launchBrowserWithDevTools({
@@ -285,7 +293,8 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
285
293
  })) console.log(`[dev-inspector] 🌐 Browser opened: ${targetUrl}`);
286
294
  else console.log(`[dev-inspector] 💡 Use "launch_chrome_devtools" prompt to open browser manually.\n`);
287
295
  }, 1e3);
288
- } else {
296
+ } else if (chromeDisabled) console.log(`[dev-inspector] 📴 Chrome integration disabled (DEV_INSPECTOR_DISABLE_CHROME=1 or disableChrome: true)`);
297
+ else {
289
298
  console.log(`[dev-inspector] ⚠️ autoOpenBrowser: false - Console/Network context unavailable`);
290
299
  console.log(`[dev-inspector] 💡 Use "launch_chrome_devtools" prompt or "chrome_devtools" tool to open browser manually.\n`);
291
300
  }
@@ -316,9 +325,15 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
316
325
  }
317
326
  const serverContext = {
318
327
  host,
319
- port
328
+ port,
329
+ disableChrome: chromeDisabled
320
330
  };
321
- const publicBase = getPublicBaseUrl(`http://${host === "0.0.0.0" ? "localhost" : host}:${port}`);
331
+ const displayHost = host === "0.0.0.0" ? "localhost" : host;
332
+ const publicBase = require_config_updater.getPublicBaseUrl({
333
+ publicBaseUrl: options.publicBaseUrl,
334
+ host: displayHost,
335
+ port
336
+ });
322
337
  const baseUrl = `${publicBase}/__mcp__/sse`;
323
338
  console.log(`[dev-inspector] 📡 MCP (Standalone): ${baseUrl}\n`);
324
339
  require_config_updater.setupMcpMiddleware(server, serverContext);
@@ -334,7 +349,7 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
334
349
  updateConfigAdditionalServers: options.updateConfigAdditionalServers,
335
350
  customEditors: options.customEditors
336
351
  });
337
- if (options.autoOpenBrowser ?? false) {
352
+ if ((options.autoOpenBrowser ?? false) && !chromeDisabled) {
338
353
  const targetUrl = options.browserUrl ?? publicBase;
339
354
  console.log(`[dev-inspector] 🔄 Auto-opening browser in 1s...`);
340
355
  setTimeout(async () => {
@@ -348,7 +363,8 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
348
363
  console.error(`[dev-inspector] ❌ Browser launch error:`, err);
349
364
  }
350
365
  }, 1e3);
351
- } else {
366
+ } else if (chromeDisabled) console.log(`[dev-inspector] 📴 Chrome integration disabled (DEV_INSPECTOR_DISABLE_CHROME=1 or disableChrome: true)`);
367
+ else {
352
368
  console.log(`[dev-inspector] ⚠️ autoOpenBrowser: false - Console/Network context unavailable`);
353
369
  console.log(`[dev-inspector] 💡 Use "launch_chrome_devtools" prompt to enable.\n`);
354
370
  }
@@ -629,6 +645,7 @@ const unpluginExternal = createDevInspectorPlugin("unplugin-dev-inspector-extern
629
645
 
630
646
  //#endregion
631
647
  //#region src/turbopack.ts
648
+ require_config_updater.init_helpers();
632
649
  let browserLaunchScheduled = false;
633
650
  /**
634
651
  * Returns the Turbopack rules config for dev-inspector.
@@ -651,8 +668,10 @@ function turbopackDevInspector(options = {}) {
651
668
  } catch {
652
669
  loaderPath = "./loader.js";
653
670
  }
654
- if (!(options.enabled ?? process.env.NODE_ENV !== "production")) return {};
655
- if (options.autoOpenBrowser && !browserLaunchScheduled && typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
671
+ const enabled = options.enabled ?? process.env.NODE_ENV !== "production";
672
+ const chromeDisabled = require_config_updater.isChromeDisabled(options.disableChrome);
673
+ if (!enabled) return {};
674
+ if (options.autoOpenBrowser && !chromeDisabled && !browserLaunchScheduled && typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
656
675
  browserLaunchScheduled = true;
657
676
  const { launchBrowserWithDevTools: launchBrowserWithDevTools$1 } = (init_browser_launcher(), require_chunk.__toCommonJS(browser_launcher_exports));
658
677
  const host = options.host || "localhost";
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import * as unplugin0 from "unplugin";
1
+ import * as unplugin1 from "unplugin";
2
2
 
3
3
  //#region src/utils/config-updater.d.ts
4
4
  type EditorId = "cursor" | "vscode" | "windsurf" | "claude-code" | "antigravity";
@@ -162,6 +162,12 @@ interface DevInspectorOptions extends McpConfigOptions, AcpOptions {
162
162
  * @default false
163
163
  */
164
164
  autoOpenBrowser?: boolean;
165
+ /**
166
+ * Disable Chrome DevTools integration entirely (chrome_devtools tool + related prompts).
167
+ * Can also be controlled via DEV_INSPECTOR_DISABLE_CHROME=1
168
+ * @default false
169
+ */
170
+ disableChrome?: boolean;
165
171
  /**
166
172
  * Custom browser launch URL
167
173
  * If not specified, uses the dev server URL (e.g., http://localhost:5173)
@@ -177,10 +183,10 @@ interface DevInspectorOptions extends McpConfigOptions, AcpOptions {
177
183
  }
178
184
  //#endregion
179
185
  //#region src/core.d.ts
180
- declare const unplugin: unplugin0.UnpluginInstance<DevInspectorOptions | undefined, boolean>;
186
+ declare const unplugin: unplugin1.UnpluginInstance<DevInspectorOptions | undefined, boolean>;
181
187
  //#endregion
182
188
  //#region src/core-external.d.ts
183
- declare const unpluginExternal: unplugin0.UnpluginInstance<DevInspectorOptions | undefined, boolean>;
189
+ declare const unpluginExternal: unplugin1.UnpluginInstance<DevInspectorOptions | undefined, boolean>;
184
190
  //#endregion
185
191
  //#region src/turbopack.d.ts
186
192
  interface TurbopackDevInspectorOptions extends DevInspectorOptions {
@@ -205,7 +211,7 @@ interface TurbopackDevInspectorOptions extends DevInspectorOptions {
205
211
  declare function turbopackDevInspector(options?: TurbopackDevInspectorOptions): any;
206
212
  //#endregion
207
213
  //#region src/index.d.ts
208
- declare const external: unplugin0.UnpluginInstance<DevInspectorOptions | undefined, boolean>;
214
+ declare const external: unplugin1.UnpluginInstance<DevInspectorOptions | undefined, boolean>;
209
215
  declare module "virtual:dev-inspector-mcp" {}
210
216
  //#endregion
211
217
  export { type CustomEditorConfig, type DevInspectorOptions, type EditorId, type McpConfigOptions, type TurbopackDevInspectorOptions, unplugin as default, unplugin, external, turbopackDevInspector, unpluginExternal };
package/dist/index.d.ts CHANGED
@@ -162,6 +162,12 @@ interface DevInspectorOptions extends McpConfigOptions, AcpOptions {
162
162
  * @default false
163
163
  */
164
164
  autoOpenBrowser?: boolean;
165
+ /**
166
+ * Disable Chrome DevTools integration entirely (chrome_devtools tool + related prompts).
167
+ * Can also be controlled via DEV_INSPECTOR_DISABLE_CHROME=1
168
+ * @default false
169
+ */
170
+ disableChrome?: boolean;
165
171
  /**
166
172
  * Custom browser launch URL
167
173
  * If not specified, uses the dev server URL (e.g., http://localhost:5173)
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as __esmMin, i as setupMcpMiddleware, n as setupAcpMiddleware, o as __export, r as setupInspectorMiddleware, s as __toCommonJS, t as updateMcpConfigs } from "./config-updater.js";
1
+ import { a as getPublicBaseUrl, d as __export, f as __toCommonJS, i as setupMcpMiddleware, l as stripTrailingSlash, n as setupAcpMiddleware, o as init_helpers, r as setupInspectorMiddleware, s as isChromeDisabled, t as updateMcpConfigs, u as __esmMin } from "./config-updater.js";
2
2
  import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
@@ -68,6 +68,10 @@ async function getOrCreateClient(sseUrl) {
68
68
  */
69
69
  async function launchBrowserWithDevTools(options) {
70
70
  const { url, serverContext } = options;
71
+ if (isChromeDisabled(serverContext.disableChrome)) {
72
+ console.log(`[dev-inspector] 📴 Skipping browser launch: Chrome integration disabled (DEV_INSPECTOR_DISABLE_CHROME=1 or disableChrome: true)`);
73
+ return false;
74
+ }
71
75
  const sseUrl = `http://${serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host || "localhost"}:${serverContext.port || 5173}/__mcp__/sse?clientId=browser-launcher-${process.pid}`;
72
76
  try {
73
77
  await (await getOrCreateClient(sseUrl)).callTool({
@@ -86,6 +90,7 @@ async function launchBrowserWithDevTools(options) {
86
90
  }
87
91
  var sharedClient, sharedSseUrl, connectPromise, cleanupRegistered;
88
92
  var init_browser_launcher = __esmMin((() => {
93
+ init_helpers();
89
94
  sharedClient = null;
90
95
  sharedSseUrl = null;
91
96
  connectPromise = null;
@@ -95,6 +100,7 @@ var init_browser_launcher = __esmMin((() => {
95
100
  //#endregion
96
101
  //#region src/utils/create-plugin.ts
97
102
  init_browser_launcher();
103
+ init_helpers();
98
104
  const createDevInspectorPlugin = (name, transformFactory) => {
99
105
  return createUnplugin((options = {}) => {
100
106
  const enabled = options.enabled ?? process.env.NODE_ENV !== "production";
@@ -104,11 +110,7 @@ const createDevInspectorPlugin = (name, transformFactory) => {
104
110
  let resolvedHost = options.host || "localhost";
105
111
  let resolvedPort = options.port || 5173;
106
112
  const transformImpl = transformFactory(options);
107
- const stripTrailingSlash = (url) => url.replace(/\/+$/, "");
108
- const getPublicBaseUrl = (fallbackHttpHostPort) => {
109
- const fromOptions = options.publicBaseUrl || process.env.DEV_INSPECTOR_PUBLIC_BASE_URL;
110
- return fromOptions ? stripTrailingSlash(fromOptions) : fallbackHttpHostPort;
111
- };
113
+ const chromeDisabled = isChromeDisabled(options.disableChrome);
112
114
  const transform = (code, id) => {
113
115
  if (!enabled) return null;
114
116
  if (viteCommand && viteCommand !== "serve") return null;
@@ -254,9 +256,15 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
254
256
  const viteHost = server.config.server.host;
255
257
  const serverContext = {
256
258
  host: options.host ?? (typeof viteHost === "string" ? viteHost : viteHost === true ? "0.0.0.0" : "localhost"),
257
- port: options.port ?? server.config.server.port ?? 5173
259
+ port: options.port ?? server.config.server.port ?? 5173,
260
+ disableChrome: chromeDisabled
258
261
  };
259
- const publicBase = getPublicBaseUrl(`http://${serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host}:${serverContext.port}`);
262
+ const displayHost = serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host;
263
+ const publicBase = getPublicBaseUrl({
264
+ publicBaseUrl: options.publicBaseUrl,
265
+ host: displayHost,
266
+ port: serverContext.port
267
+ });
260
268
  const baseUrl = `${publicBase}/__mcp__/sse`;
261
269
  console.log(`[dev-inspector] 📡 MCP: ${baseUrl}\n`);
262
270
  await setupMcpMiddleware(server.middlewares, serverContext);
@@ -272,7 +280,7 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
272
280
  updateConfigAdditionalServers: options.updateConfigAdditionalServers,
273
281
  customEditors: options.customEditors
274
282
  });
275
- if (options.autoOpenBrowser ?? false) {
283
+ if ((options.autoOpenBrowser ?? false) && !chromeDisabled) {
276
284
  const targetUrl = options.browserUrl ?? publicBase;
277
285
  setTimeout(async () => {
278
286
  if (await launchBrowserWithDevTools({
@@ -281,7 +289,8 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
281
289
  })) console.log(`[dev-inspector] 🌐 Browser opened: ${targetUrl}`);
282
290
  else console.log(`[dev-inspector] 💡 Use "launch_chrome_devtools" prompt to open browser manually.\n`);
283
291
  }, 1e3);
284
- } else {
292
+ } else if (chromeDisabled) console.log(`[dev-inspector] 📴 Chrome integration disabled (DEV_INSPECTOR_DISABLE_CHROME=1 or disableChrome: true)`);
293
+ else {
285
294
  console.log(`[dev-inspector] ⚠️ autoOpenBrowser: false - Console/Network context unavailable`);
286
295
  console.log(`[dev-inspector] 💡 Use "launch_chrome_devtools" prompt or "chrome_devtools" tool to open browser manually.\n`);
287
296
  }
@@ -312,9 +321,15 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
312
321
  }
313
322
  const serverContext = {
314
323
  host,
315
- port
324
+ port,
325
+ disableChrome: chromeDisabled
316
326
  };
317
- const publicBase = getPublicBaseUrl(`http://${host === "0.0.0.0" ? "localhost" : host}:${port}`);
327
+ const displayHost = host === "0.0.0.0" ? "localhost" : host;
328
+ const publicBase = getPublicBaseUrl({
329
+ publicBaseUrl: options.publicBaseUrl,
330
+ host: displayHost,
331
+ port
332
+ });
318
333
  const baseUrl = `${publicBase}/__mcp__/sse`;
319
334
  console.log(`[dev-inspector] 📡 MCP (Standalone): ${baseUrl}\n`);
320
335
  setupMcpMiddleware(server, serverContext);
@@ -330,7 +345,7 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
330
345
  updateConfigAdditionalServers: options.updateConfigAdditionalServers,
331
346
  customEditors: options.customEditors
332
347
  });
333
- if (options.autoOpenBrowser ?? false) {
348
+ if ((options.autoOpenBrowser ?? false) && !chromeDisabled) {
334
349
  const targetUrl = options.browserUrl ?? publicBase;
335
350
  console.log(`[dev-inspector] 🔄 Auto-opening browser in 1s...`);
336
351
  setTimeout(async () => {
@@ -344,7 +359,8 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
344
359
  console.error(`[dev-inspector] ❌ Browser launch error:`, err);
345
360
  }
346
361
  }, 1e3);
347
- } else {
362
+ } else if (chromeDisabled) console.log(`[dev-inspector] 📴 Chrome integration disabled (DEV_INSPECTOR_DISABLE_CHROME=1 or disableChrome: true)`);
363
+ else {
348
364
  console.log(`[dev-inspector] ⚠️ autoOpenBrowser: false - Console/Network context unavailable`);
349
365
  console.log(`[dev-inspector] 💡 Use "launch_chrome_devtools" prompt to enable.\n`);
350
366
  }
@@ -625,6 +641,7 @@ const unpluginExternal = createDevInspectorPlugin("unplugin-dev-inspector-extern
625
641
 
626
642
  //#endregion
627
643
  //#region src/turbopack.ts
644
+ init_helpers();
628
645
  let browserLaunchScheduled = false;
629
646
  /**
630
647
  * Returns the Turbopack rules config for dev-inspector.
@@ -647,8 +664,10 @@ function turbopackDevInspector(options = {}) {
647
664
  } catch {
648
665
  loaderPath = "./loader.js";
649
666
  }
650
- if (!(options.enabled ?? process.env.NODE_ENV !== "production")) return {};
651
- if (options.autoOpenBrowser && !browserLaunchScheduled && typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
667
+ const enabled = options.enabled ?? process.env.NODE_ENV !== "production";
668
+ const chromeDisabled = isChromeDisabled(options.disableChrome);
669
+ if (!enabled) return {};
670
+ if (options.autoOpenBrowser && !chromeDisabled && !browserLaunchScheduled && typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
652
671
  browserLaunchScheduled = true;
653
672
  const { launchBrowserWithDevTools: launchBrowserWithDevTools$1 } = (init_browser_launcher(), __toCommonJS(browser_launcher_exports));
654
673
  const host = options.host || "localhost";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpc-tech/unplugin-dev-inspector-mcp",
3
- "version": "0.0.42-beta.2",
3
+ "version": "0.0.42-beta.4",
4
4
  "description": "Universal dev inspector plugin for React/Vue - inspect component sources and API calls in any bundler",
5
5
  "type": "module",
6
6
  "license": "MIT",