@mcpc-tech/unplugin-dev-inspector-mcp 0.0.2-beta.29 → 0.0.2-beta.30

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/dist/index.cjs CHANGED
@@ -86462,16 +86462,16 @@ const PROMPT_SCHEMAS = {
86462
86462
  required: true
86463
86463
  }]
86464
86464
  },
86465
- refresh_chrome_state: {
86466
- name: "refresh_chrome_state",
86467
- title: "Refresh Chrome State",
86468
- description: "Refresh the state of the Chrome DevTools for the specified URL.",
86469
- arguments: []
86470
- },
86471
86465
  get_network_requests: {
86472
86466
  name: "get_network_requests",
86473
86467
  title: "Get Network Requests",
86474
- description: "Get all network requests for the specified URL.",
86468
+ description: "List network requests or get details of a specific one. Always refreshes the list first.",
86469
+ arguments: []
86470
+ },
86471
+ get_console_messages: {
86472
+ name: "get_console_messages",
86473
+ title: "Get Console Messages",
86474
+ description: "List console messages or get details of a specific one. Always refreshes the list first.",
86475
86475
  arguments: []
86476
86476
  }
86477
86477
  };
@@ -86627,7 +86627,7 @@ async function createInspectorMcpServer(serverContext) {
86627
86627
 
86628
86628
  Provides tools for inspecting network requests, console logs, and performance metrics.
86629
86629
 
86630
- IMPORTANT: Must first call chrome_navigate_page to launch Chrome before using these capabilities.
86630
+ If Chrome is already open, this tool can connect to it directly. Otherwise, call chrome_navigate_page first to launch Chrome.
86631
86631
  Default dev server URL: http://${serverContext?.host || "localhost"}:${serverContext?.port || 5173}
86632
86632
 
86633
86633
  You MUST ask the user for confirmation before navigating to any URL.`,
@@ -86685,9 +86685,66 @@ You MUST ask the user for confirmation before navigating to any URL.`,
86685
86685
  required: false
86686
86686
  }]
86687
86687
  },
86688
- { ...PROMPT_SCHEMAS.refresh_chrome_state }
86688
+ { ...PROMPT_SCHEMAS.get_network_requests },
86689
+ { ...PROMPT_SCHEMAS.get_console_messages }
86689
86690
  ] };
86690
86691
  });
86692
+ async function refreshChromeState() {
86693
+ const networkResult = await callMcpMethod(mcpServer, "tools/call", {
86694
+ name: "chrome_devtools",
86695
+ arguments: {
86696
+ useTool: "chrome_list_network_requests",
86697
+ hasDefinitions: ["chrome_list_network_requests"],
86698
+ chrome_list_network_requests: {}
86699
+ }
86700
+ });
86701
+ const consoleResult = await callMcpMethod(mcpServer, "tools/call", {
86702
+ name: "chrome_devtools",
86703
+ arguments: {
86704
+ useTool: "chrome_list_console_messages",
86705
+ hasDefinitions: ["chrome_list_console_messages"],
86706
+ chrome_list_console_messages: {}
86707
+ }
86708
+ });
86709
+ const reqIdMatches = (networkResult?.content?.map((item) => item.text).join("\n") || "").matchAll(/reqid=(\d+)\s+(GET|POST|PUT|DELETE|PATCH)\s+([^\s]+)\s+\[([^\]]+)\]/g);
86710
+ const requestOptions = Array.from(reqIdMatches).map((match) => {
86711
+ const [, reqId, method, url$1, status] = match;
86712
+ return ` ${reqId}: ${method} ${url$1.length > 60 ? url$1.substring(0, 57) + "..." : url$1} [${status}]`;
86713
+ }).reverse().join("\n");
86714
+ const msgIdMatches = (consoleResult?.content?.map((item) => item.text).join("\n") || "").matchAll(/msgid=(\d+)\s+\[([^\]]+)\]\s+(.+)/g);
86715
+ const messageOptions = Array.from(msgIdMatches).map((match) => {
86716
+ const [, msgId, level, text$2] = match;
86717
+ return ` ${msgId}: [${level}] ${text$2.length > 60 ? text$2.substring(0, 57) + "..." : text$2}`;
86718
+ }).reverse().join("\n");
86719
+ mcpServer.setRequestHandler(__modelcontextprotocol_sdk_types_js.ListPromptsRequestSchema, async (request$1) => {
86720
+ return { prompts: [
86721
+ { ...PROMPT_SCHEMAS.capture_element },
86722
+ { ...PROMPT_SCHEMAS.view_inspections },
86723
+ { ...PROMPT_SCHEMAS.launch_chrome_devtools },
86724
+ {
86725
+ ...PROMPT_SCHEMAS.get_network_requests,
86726
+ arguments: [{
86727
+ name: "reqid",
86728
+ description: `Optional. The request ID to get details for. If omitted, only refreshes and lists requests.\n\nAvailable requests:\n${requestOptions || "No requests available"}`,
86729
+ required: false
86730
+ }]
86731
+ },
86732
+ {
86733
+ ...PROMPT_SCHEMAS.get_console_messages,
86734
+ arguments: [{
86735
+ name: "msgid",
86736
+ description: `Optional. The message ID to get details for. If omitted, only refreshes and lists messages.\n\nAvailable messages:\n${messageOptions || "No messages available"}`,
86737
+ required: false
86738
+ }]
86739
+ }
86740
+ ] };
86741
+ });
86742
+ await mcpServer.sendPromptListChanged();
86743
+ return { messages: [...networkResult?.content || [], ...consoleResult?.content || []].map((item) => ({
86744
+ role: "user",
86745
+ content: item
86746
+ })) };
86747
+ }
86691
86748
  mcpServer.setRequestHandler(__modelcontextprotocol_sdk_types_js.GetPromptRequestSchema, async (request$1) => {
86692
86749
  const promptName = request$1.params.name;
86693
86750
  switch (promptName) {
@@ -86720,14 +86777,16 @@ You MUST ask the user for confirmation before navigating to any URL.`,
86720
86777
  }] };
86721
86778
  }
86722
86779
  try {
86723
- return { messages: [...((await callMcpMethod(mcpServer, "tools/call", {
86780
+ const result = await callMcpMethod(mcpServer, "tools/call", {
86724
86781
  name: "chrome_devtools",
86725
86782
  arguments: {
86726
86783
  useTool: "chrome_navigate_page",
86727
86784
  hasDefinitions: ["chrome_navigate_page"],
86728
86785
  chrome_navigate_page: { url: url$1 }
86729
86786
  }
86730
- }))?.content || []).map((item) => ({
86787
+ });
86788
+ await refreshChromeState();
86789
+ return { messages: [...(result?.content || []).map((item) => ({
86731
86790
  role: "user",
86732
86791
  content: item
86733
86792
  }))] };
@@ -86741,52 +86800,11 @@ You MUST ask the user for confirmation before navigating to any URL.`,
86741
86800
  }] };
86742
86801
  }
86743
86802
  }
86744
- case "refresh_chrome_state": try {
86745
- const result = await callMcpMethod(mcpServer, "tools/call", {
86746
- name: "chrome_devtools",
86747
- arguments: {
86748
- useTool: "chrome_list_network_requests",
86749
- hasDefinitions: ["chrome_list_network_requests"],
86750
- chrome_list_network_requests: {}
86751
- }
86752
- });
86753
- const reqIdMatches = (result?.content?.map((item) => item.text).join("\n") || "").matchAll(/reqid=(\d+)\s+(GET|POST|PUT|DELETE|PATCH)\s+([^\s]+)\s+\[([^\]]+)\]/g);
86754
- const requestOptions = Array.from(reqIdMatches).map((match) => {
86755
- const [, reqId, method, url$1, status] = match;
86756
- return ` ${reqId}: ${method} ${url$1.length > 60 ? url$1.substring(0, 57) + "..." : url$1} [${status}]`;
86757
- }).reverse().join("\n");
86758
- mcpServer.setRequestHandler(__modelcontextprotocol_sdk_types_js.ListPromptsRequestSchema, async (request$2) => {
86759
- return { prompts: [
86760
- { ...PROMPT_SCHEMAS.capture_element },
86761
- { ...PROMPT_SCHEMAS.view_inspections },
86762
- { ...PROMPT_SCHEMAS.launch_chrome_devtools },
86763
- { ...PROMPT_SCHEMAS.refresh_chrome_state },
86764
- {
86765
- ...PROMPT_SCHEMAS.get_network_requests,
86766
- arguments: [{
86767
- name: "reqid",
86768
- description: `The request ID to get details for. Available requests:\n\n${requestOptions || "No requests available"}`,
86769
- required: true
86770
- }]
86771
- }
86772
- ] };
86773
- });
86774
- await mcpServer.sendPromptListChanged();
86775
- return { messages: [...(result?.content || []).map((item) => ({
86776
- role: "user",
86777
- content: item
86778
- }))] };
86779
- } catch (error$1) {
86780
- return { messages: [{
86781
- role: "user",
86782
- content: {
86783
- type: "text",
86784
- text: `Error launching Chrome DevTools: ${error$1 instanceof Error ? error$1.message : String(error$1)}`
86785
- }
86786
- }] };
86787
- }
86788
- case "get_network_requests":
86789
- const reqid = parseInt(request$1.params.arguments?.reqid);
86803
+ case "get_network_requests": {
86804
+ const refreshResult = await refreshChromeState();
86805
+ const reqidStr = request$1.params.arguments?.reqid;
86806
+ if (!reqidStr) return refreshResult;
86807
+ const reqid = parseInt(reqidStr);
86790
86808
  try {
86791
86809
  return { messages: [...((await callMcpMethod(mcpServer, "tools/call", {
86792
86810
  name: "chrome_devtools",
@@ -86804,10 +86822,38 @@ You MUST ask the user for confirmation before navigating to any URL.`,
86804
86822
  role: "user",
86805
86823
  content: {
86806
86824
  type: "text",
86807
- text: `Error launching Chrome DevTools: ${error$1 instanceof Error ? error$1.message : String(error$1)}`
86825
+ text: `Error getting network request: ${error$1 instanceof Error ? error$1.message : String(error$1)}`
86808
86826
  }
86809
86827
  }] };
86810
86828
  }
86829
+ }
86830
+ case "get_console_messages": {
86831
+ const refreshResultConsole = await refreshChromeState();
86832
+ const msgidStr = request$1.params.arguments?.msgid;
86833
+ if (!msgidStr) return refreshResultConsole;
86834
+ const msgid = parseInt(msgidStr);
86835
+ try {
86836
+ return { messages: [...((await callMcpMethod(mcpServer, "tools/call", {
86837
+ name: "chrome_devtools",
86838
+ arguments: {
86839
+ useTool: "chrome_get_console_message",
86840
+ hasDefinitions: ["chrome_get_console_message"],
86841
+ chrome_get_console_message: { msgid }
86842
+ }
86843
+ }))?.content || []).map((item) => ({
86844
+ role: "user",
86845
+ content: item
86846
+ }))] };
86847
+ } catch (error$1) {
86848
+ return { messages: [{
86849
+ role: "user",
86850
+ content: {
86851
+ type: "text",
86852
+ text: `Error getting console message: ${error$1 instanceof Error ? error$1.message : String(error$1)}`
86853
+ }
86854
+ }] };
86855
+ }
86856
+ }
86811
86857
  default: throw new Error(`Unknown promptId: ${promptName}`);
86812
86858
  }
86813
86859
  });
@@ -88214,10 +88260,10 @@ if (import.meta.env.DEV) {
88214
88260
  },
88215
88261
  async configureServer(server) {
88216
88262
  if (enableMcp) {
88217
- const host = server.config.server.host;
88263
+ const viteHost = server.config.server.host;
88218
88264
  const serverContext = {
88219
- host: typeof host === "string" ? host : host === true ? "0.0.0.0" : "localhost",
88220
- port: server.config.server.port || 5173
88265
+ host: options.host ?? (typeof viteHost === "string" ? viteHost : viteHost === true ? "0.0.0.0" : "localhost"),
88266
+ port: options.port ?? server.config.server.port ?? 5173
88221
88267
  };
88222
88268
  const sseUrl = `http://${serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host}:${serverContext.port}/__mcp__/sse?puppetId=chrome`;
88223
88269
  console.log(`[dev-inspector] 📡 MCP: ${sseUrl}\n`);
package/dist/index.d.cts CHANGED
@@ -71,7 +71,7 @@ interface Agent extends AcpOptions {
71
71
  interface DevInspectorOptions extends McpConfigOptions, AcpOptions {
72
72
  /**
73
73
  * Enable/disable the plugin
74
- * @default true in development, false in production
74
+ * @default true (automatically disabled in production)
75
75
  */
76
76
  enabled?: boolean;
77
77
  /**
@@ -79,14 +79,30 @@ interface DevInspectorOptions extends McpConfigOptions, AcpOptions {
79
79
  * @default true
80
80
  */
81
81
  enableMcp?: boolean;
82
+ /**
83
+ * Custom host for MCP server URL
84
+ * Useful when behind a proxy or in Docker containers
85
+ * If not specified, uses the Vite server host config
86
+ * @example "localhost" or "my-dev-server.local"
87
+ */
88
+ host?: string;
89
+ /**
90
+ * Custom port for MCP server URL
91
+ * Useful when behind a proxy or port forwarding (e.g., Docker, SSH tunnels)
92
+ * If not specified, uses the Vite server port config
93
+ * @example 3000
94
+ */
95
+ port?: number;
82
96
  /**
83
97
  * Custom agents configuration
84
98
  * If provided, these will be merged with or replace the default agents
99
+ * @see AVAILABLE_AGENTS https://github.com/mcpc-tech/dev-inspector-mcp/blob/main/packages/unplugin-dev-inspector/client/constants/agents.ts
85
100
  */
86
101
  agents?: Agent[];
87
102
  /**
88
103
  * Default agent name to use
89
104
  * @default "Claude Code"
105
+ * @see https://github.com/mcpc-tech/dev-inspector-mcp/blob/main/packages/unplugin-dev-inspector/client/constants/agents.ts
90
106
  */
91
107
  defaultAgent?: string;
92
108
  /**
package/dist/index.d.ts CHANGED
@@ -71,7 +71,7 @@ interface Agent extends AcpOptions {
71
71
  interface DevInspectorOptions extends McpConfigOptions, AcpOptions {
72
72
  /**
73
73
  * Enable/disable the plugin
74
- * @default true in development, false in production
74
+ * @default true (automatically disabled in production)
75
75
  */
76
76
  enabled?: boolean;
77
77
  /**
@@ -79,14 +79,30 @@ interface DevInspectorOptions extends McpConfigOptions, AcpOptions {
79
79
  * @default true
80
80
  */
81
81
  enableMcp?: boolean;
82
+ /**
83
+ * Custom host for MCP server URL
84
+ * Useful when behind a proxy or in Docker containers
85
+ * If not specified, uses the Vite server host config
86
+ * @example "localhost" or "my-dev-server.local"
87
+ */
88
+ host?: string;
89
+ /**
90
+ * Custom port for MCP server URL
91
+ * Useful when behind a proxy or port forwarding (e.g., Docker, SSH tunnels)
92
+ * If not specified, uses the Vite server port config
93
+ * @example 3000
94
+ */
95
+ port?: number;
82
96
  /**
83
97
  * Custom agents configuration
84
98
  * If provided, these will be merged with or replace the default agents
99
+ * @see AVAILABLE_AGENTS https://github.com/mcpc-tech/dev-inspector-mcp/blob/main/packages/unplugin-dev-inspector/client/constants/agents.ts
85
100
  */
86
101
  agents?: Agent[];
87
102
  /**
88
103
  * Default agent name to use
89
104
  * @default "Claude Code"
105
+ * @see https://github.com/mcpc-tech/dev-inspector-mcp/blob/main/packages/unplugin-dev-inspector/client/constants/agents.ts
90
106
  */
91
107
  defaultAgent?: string;
92
108
  /**
package/dist/index.js CHANGED
@@ -86454,16 +86454,16 @@ const PROMPT_SCHEMAS = {
86454
86454
  required: true
86455
86455
  }]
86456
86456
  },
86457
- refresh_chrome_state: {
86458
- name: "refresh_chrome_state",
86459
- title: "Refresh Chrome State",
86460
- description: "Refresh the state of the Chrome DevTools for the specified URL.",
86461
- arguments: []
86462
- },
86463
86457
  get_network_requests: {
86464
86458
  name: "get_network_requests",
86465
86459
  title: "Get Network Requests",
86466
- description: "Get all network requests for the specified URL.",
86460
+ description: "List network requests or get details of a specific one. Always refreshes the list first.",
86461
+ arguments: []
86462
+ },
86463
+ get_console_messages: {
86464
+ name: "get_console_messages",
86465
+ title: "Get Console Messages",
86466
+ description: "List console messages or get details of a specific one. Always refreshes the list first.",
86467
86467
  arguments: []
86468
86468
  }
86469
86469
  };
@@ -86619,7 +86619,7 @@ async function createInspectorMcpServer(serverContext) {
86619
86619
 
86620
86620
  Provides tools for inspecting network requests, console logs, and performance metrics.
86621
86621
 
86622
- IMPORTANT: Must first call chrome_navigate_page to launch Chrome before using these capabilities.
86622
+ If Chrome is already open, this tool can connect to it directly. Otherwise, call chrome_navigate_page first to launch Chrome.
86623
86623
  Default dev server URL: http://${serverContext?.host || "localhost"}:${serverContext?.port || 5173}
86624
86624
 
86625
86625
  You MUST ask the user for confirmation before navigating to any URL.`,
@@ -86677,9 +86677,66 @@ You MUST ask the user for confirmation before navigating to any URL.`,
86677
86677
  required: false
86678
86678
  }]
86679
86679
  },
86680
- { ...PROMPT_SCHEMAS.refresh_chrome_state }
86680
+ { ...PROMPT_SCHEMAS.get_network_requests },
86681
+ { ...PROMPT_SCHEMAS.get_console_messages }
86681
86682
  ] };
86682
86683
  });
86684
+ async function refreshChromeState() {
86685
+ const networkResult = await callMcpMethod(mcpServer, "tools/call", {
86686
+ name: "chrome_devtools",
86687
+ arguments: {
86688
+ useTool: "chrome_list_network_requests",
86689
+ hasDefinitions: ["chrome_list_network_requests"],
86690
+ chrome_list_network_requests: {}
86691
+ }
86692
+ });
86693
+ const consoleResult = await callMcpMethod(mcpServer, "tools/call", {
86694
+ name: "chrome_devtools",
86695
+ arguments: {
86696
+ useTool: "chrome_list_console_messages",
86697
+ hasDefinitions: ["chrome_list_console_messages"],
86698
+ chrome_list_console_messages: {}
86699
+ }
86700
+ });
86701
+ const reqIdMatches = (networkResult?.content?.map((item) => item.text).join("\n") || "").matchAll(/reqid=(\d+)\s+(GET|POST|PUT|DELETE|PATCH)\s+([^\s]+)\s+\[([^\]]+)\]/g);
86702
+ const requestOptions = Array.from(reqIdMatches).map((match) => {
86703
+ const [, reqId, method, url, status] = match;
86704
+ return ` ${reqId}: ${method} ${url.length > 60 ? url.substring(0, 57) + "..." : url} [${status}]`;
86705
+ }).reverse().join("\n");
86706
+ const msgIdMatches = (consoleResult?.content?.map((item) => item.text).join("\n") || "").matchAll(/msgid=(\d+)\s+\[([^\]]+)\]\s+(.+)/g);
86707
+ const messageOptions = Array.from(msgIdMatches).map((match) => {
86708
+ const [, msgId, level, text$2] = match;
86709
+ return ` ${msgId}: [${level}] ${text$2.length > 60 ? text$2.substring(0, 57) + "..." : text$2}`;
86710
+ }).reverse().join("\n");
86711
+ mcpServer.setRequestHandler(ListPromptsRequestSchema, async (request$1) => {
86712
+ return { prompts: [
86713
+ { ...PROMPT_SCHEMAS.capture_element },
86714
+ { ...PROMPT_SCHEMAS.view_inspections },
86715
+ { ...PROMPT_SCHEMAS.launch_chrome_devtools },
86716
+ {
86717
+ ...PROMPT_SCHEMAS.get_network_requests,
86718
+ arguments: [{
86719
+ name: "reqid",
86720
+ description: `Optional. The request ID to get details for. If omitted, only refreshes and lists requests.\n\nAvailable requests:\n${requestOptions || "No requests available"}`,
86721
+ required: false
86722
+ }]
86723
+ },
86724
+ {
86725
+ ...PROMPT_SCHEMAS.get_console_messages,
86726
+ arguments: [{
86727
+ name: "msgid",
86728
+ description: `Optional. The message ID to get details for. If omitted, only refreshes and lists messages.\n\nAvailable messages:\n${messageOptions || "No messages available"}`,
86729
+ required: false
86730
+ }]
86731
+ }
86732
+ ] };
86733
+ });
86734
+ await mcpServer.sendPromptListChanged();
86735
+ return { messages: [...networkResult?.content || [], ...consoleResult?.content || []].map((item) => ({
86736
+ role: "user",
86737
+ content: item
86738
+ })) };
86739
+ }
86683
86740
  mcpServer.setRequestHandler(GetPromptRequestSchema, async (request$1) => {
86684
86741
  const promptName = request$1.params.name;
86685
86742
  switch (promptName) {
@@ -86712,14 +86769,16 @@ You MUST ask the user for confirmation before navigating to any URL.`,
86712
86769
  }] };
86713
86770
  }
86714
86771
  try {
86715
- return { messages: [...((await callMcpMethod(mcpServer, "tools/call", {
86772
+ const result = await callMcpMethod(mcpServer, "tools/call", {
86716
86773
  name: "chrome_devtools",
86717
86774
  arguments: {
86718
86775
  useTool: "chrome_navigate_page",
86719
86776
  hasDefinitions: ["chrome_navigate_page"],
86720
86777
  chrome_navigate_page: { url }
86721
86778
  }
86722
- }))?.content || []).map((item) => ({
86779
+ });
86780
+ await refreshChromeState();
86781
+ return { messages: [...(result?.content || []).map((item) => ({
86723
86782
  role: "user",
86724
86783
  content: item
86725
86784
  }))] };
@@ -86733,52 +86792,11 @@ You MUST ask the user for confirmation before navigating to any URL.`,
86733
86792
  }] };
86734
86793
  }
86735
86794
  }
86736
- case "refresh_chrome_state": try {
86737
- const result = await callMcpMethod(mcpServer, "tools/call", {
86738
- name: "chrome_devtools",
86739
- arguments: {
86740
- useTool: "chrome_list_network_requests",
86741
- hasDefinitions: ["chrome_list_network_requests"],
86742
- chrome_list_network_requests: {}
86743
- }
86744
- });
86745
- const reqIdMatches = (result?.content?.map((item) => item.text).join("\n") || "").matchAll(/reqid=(\d+)\s+(GET|POST|PUT|DELETE|PATCH)\s+([^\s]+)\s+\[([^\]]+)\]/g);
86746
- const requestOptions = Array.from(reqIdMatches).map((match) => {
86747
- const [, reqId, method, url, status] = match;
86748
- return ` ${reqId}: ${method} ${url.length > 60 ? url.substring(0, 57) + "..." : url} [${status}]`;
86749
- }).reverse().join("\n");
86750
- mcpServer.setRequestHandler(ListPromptsRequestSchema, async (request$2) => {
86751
- return { prompts: [
86752
- { ...PROMPT_SCHEMAS.capture_element },
86753
- { ...PROMPT_SCHEMAS.view_inspections },
86754
- { ...PROMPT_SCHEMAS.launch_chrome_devtools },
86755
- { ...PROMPT_SCHEMAS.refresh_chrome_state },
86756
- {
86757
- ...PROMPT_SCHEMAS.get_network_requests,
86758
- arguments: [{
86759
- name: "reqid",
86760
- description: `The request ID to get details for. Available requests:\n\n${requestOptions || "No requests available"}`,
86761
- required: true
86762
- }]
86763
- }
86764
- ] };
86765
- });
86766
- await mcpServer.sendPromptListChanged();
86767
- return { messages: [...(result?.content || []).map((item) => ({
86768
- role: "user",
86769
- content: item
86770
- }))] };
86771
- } catch (error$1) {
86772
- return { messages: [{
86773
- role: "user",
86774
- content: {
86775
- type: "text",
86776
- text: `Error launching Chrome DevTools: ${error$1 instanceof Error ? error$1.message : String(error$1)}`
86777
- }
86778
- }] };
86779
- }
86780
- case "get_network_requests":
86781
- const reqid = parseInt(request$1.params.arguments?.reqid);
86795
+ case "get_network_requests": {
86796
+ const refreshResult = await refreshChromeState();
86797
+ const reqidStr = request$1.params.arguments?.reqid;
86798
+ if (!reqidStr) return refreshResult;
86799
+ const reqid = parseInt(reqidStr);
86782
86800
  try {
86783
86801
  return { messages: [...((await callMcpMethod(mcpServer, "tools/call", {
86784
86802
  name: "chrome_devtools",
@@ -86796,10 +86814,38 @@ You MUST ask the user for confirmation before navigating to any URL.`,
86796
86814
  role: "user",
86797
86815
  content: {
86798
86816
  type: "text",
86799
- text: `Error launching Chrome DevTools: ${error$1 instanceof Error ? error$1.message : String(error$1)}`
86817
+ text: `Error getting network request: ${error$1 instanceof Error ? error$1.message : String(error$1)}`
86800
86818
  }
86801
86819
  }] };
86802
86820
  }
86821
+ }
86822
+ case "get_console_messages": {
86823
+ const refreshResultConsole = await refreshChromeState();
86824
+ const msgidStr = request$1.params.arguments?.msgid;
86825
+ if (!msgidStr) return refreshResultConsole;
86826
+ const msgid = parseInt(msgidStr);
86827
+ try {
86828
+ return { messages: [...((await callMcpMethod(mcpServer, "tools/call", {
86829
+ name: "chrome_devtools",
86830
+ arguments: {
86831
+ useTool: "chrome_get_console_message",
86832
+ hasDefinitions: ["chrome_get_console_message"],
86833
+ chrome_get_console_message: { msgid }
86834
+ }
86835
+ }))?.content || []).map((item) => ({
86836
+ role: "user",
86837
+ content: item
86838
+ }))] };
86839
+ } catch (error$1) {
86840
+ return { messages: [{
86841
+ role: "user",
86842
+ content: {
86843
+ type: "text",
86844
+ text: `Error getting console message: ${error$1 instanceof Error ? error$1.message : String(error$1)}`
86845
+ }
86846
+ }] };
86847
+ }
86848
+ }
86803
86849
  default: throw new Error(`Unknown promptId: ${promptName}`);
86804
86850
  }
86805
86851
  });
@@ -88206,10 +88252,10 @@ if (import.meta.env.DEV) {
88206
88252
  },
88207
88253
  async configureServer(server) {
88208
88254
  if (enableMcp) {
88209
- const host = server.config.server.host;
88255
+ const viteHost = server.config.server.host;
88210
88256
  const serverContext = {
88211
- host: typeof host === "string" ? host : host === true ? "0.0.0.0" : "localhost",
88212
- port: server.config.server.port || 5173
88257
+ host: options.host ?? (typeof viteHost === "string" ? viteHost : viteHost === true ? "0.0.0.0" : "localhost"),
88258
+ port: options.port ?? server.config.server.port ?? 5173
88213
88259
  };
88214
88260
  const sseUrl = `http://${serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host}:${serverContext.port}/__mcp__/sse?puppetId=chrome`;
88215
88261
  console.log(`[dev-inspector] 📡 MCP: ${sseUrl}\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpc-tech/unplugin-dev-inspector-mcp",
3
- "version": "0.0.2-beta.29",
3
+ "version": "0.0.2-beta.30",
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",