what-devtools-mcp 0.6.4 → 0.6.6

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/client.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ export interface DevToolsMCPConnection {
2
+ disconnect(): void;
3
+ readonly isConnected: boolean;
4
+ readonly eventCount: number;
5
+ }
6
+
7
+ export interface ConnectDevToolsMCPOptions {
8
+ port?: number;
9
+ token?: string;
10
+ /** Hostname used by the browser client for token discovery and the bridge WebSocket. Defaults to 127.0.0.1. */
11
+ host?: string;
12
+ }
13
+
14
+ export function connectDevToolsMCP(options?: ConnectDevToolsMCPOptions): DevToolsMCPConnection;
package/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ // CLI entrypoint package. Import browser/client helpers from `what-devtools-mcp/client`
2
+ // and Vite integration from `what-devtools-mcp/vite-plugin`.
3
+ export {};
package/package.json CHANGED
@@ -1,18 +1,30 @@
1
1
  {
2
2
  "name": "what-devtools-mcp",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "description": "MCP server bridging AI agents to live What Framework app state via WebSocket",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "what-devtools-mcp": "src/index.js"
8
8
  },
9
9
  "exports": {
10
- ".": "./src/index.js",
11
- "./client": "./src/client.js",
12
- "./vite-plugin": "./src/vite-plugin.js"
10
+ ".": {
11
+ "types": "./index.d.ts",
12
+ "import": "./src/index.js"
13
+ },
14
+ "./client": {
15
+ "types": "./client.d.ts",
16
+ "import": "./src/client.js"
17
+ },
18
+ "./vite-plugin": {
19
+ "types": "./vite-plugin.d.ts",
20
+ "import": "./src/vite-plugin.js"
21
+ }
13
22
  },
14
23
  "files": [
15
- "src"
24
+ "src",
25
+ "index.d.ts",
26
+ "client.d.ts",
27
+ "vite-plugin.d.ts"
16
28
  ],
17
29
  "dependencies": {
18
30
  "@modelcontextprotocol/sdk": "^1.0.0",
@@ -20,7 +32,7 @@
20
32
  "zod": "^3.25.0"
21
33
  },
22
34
  "peerDependencies": {
23
- "what-devtools": "^0.6.3"
35
+ "what-devtools": "^0.6.5"
24
36
  },
25
37
  "keywords": [
26
38
  "what-framework",
@@ -29,5 +41,14 @@
29
41
  "model-context-protocol",
30
42
  "ai-debugging"
31
43
  ],
32
- "license": "MIT"
44
+ "license": "MIT",
45
+ "types": "index.d.ts",
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/CelsianJs/what-framework.git"
49
+ },
50
+ "homepage": "https://whatfw.com",
51
+ "bugs": {
52
+ "url": "https://github.com/CelsianJs/what-framework/issues"
53
+ }
33
54
  }
package/src/client.js CHANGED
@@ -21,7 +21,7 @@ function logGrouped(badge, badgeStyle, title, data) {
21
21
  console.groupEnd();
22
22
  }
23
23
 
24
- export function connectDevToolsMCP({ port = 9229, token = '' } = {}) {
24
+ export function connectDevToolsMCP({ port = 9229, token = '', host = '127.0.0.1' } = {}) {
25
25
  // Never connect in production
26
26
  if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'production') {
27
27
  return { disconnect() {}, isConnected: false, eventCount: 0 };
@@ -61,7 +61,7 @@ export function connectDevToolsMCP({ port = 9229, token = '' } = {}) {
61
61
 
62
62
  const discoveryPort = port + 1;
63
63
  try {
64
- const res = await fetch(`http://localhost:${discoveryPort}/__what_mcp_token`);
64
+ const res = await fetch(`http://${host}:${discoveryPort}/__what_mcp_token`);
65
65
  if (res.ok) {
66
66
  const data = await res.json();
67
67
  discoveredToken = data.token;
@@ -75,13 +75,13 @@ export function connectDevToolsMCP({ port = 9229, token = '' } = {}) {
75
75
  return false;
76
76
  }
77
77
 
78
- log('MCP', BADGE, `Connecting to bridge on ws://localhost:${port}`);
78
+ log('MCP', BADGE, `Connecting to bridge on ws://${host}:${port}`);
79
79
 
80
80
  function connect() {
81
81
  reconnectAttempts++;
82
82
  try {
83
83
  const tokenParam = discoveredToken ? `?token=${encodeURIComponent(discoveredToken)}` : '';
84
- ws = new WebSocket(`ws://localhost:${discoveredPort}${tokenParam}`);
84
+ ws = new WebSocket(`ws://${host}:${discoveredPort}${tokenParam}`);
85
85
  } catch {
86
86
  if (reconnectAttempts <= 1) {
87
87
  log('MCP', BADGE_WARN, 'Bridge not available — retrying silently in background');
@@ -32,7 +32,7 @@ function resolveToken(explicitToken) {
32
32
  return '';
33
33
  }
34
34
 
35
- export default function whatDevToolsMCP({ port = 9229, token = '' } = {}) {
35
+ export default function whatDevToolsMCP({ port = 9229, token = '', host = '127.0.0.1' } = {}) {
36
36
  return {
37
37
  name: 'what-devtools-mcp',
38
38
  apply: 'serve',
@@ -47,7 +47,7 @@ Promise.all([
47
47
  import('what-devtools-mcp/client'),
48
48
  ]).then(([core, devtools, mcp]) => {
49
49
  devtools.installDevTools(core);
50
- mcp.connectDevToolsMCP({ port: ${port}, token: ${JSON.stringify(tokenValue)} });
50
+ mcp.connectDevToolsMCP({ port: ${port}, token: ${JSON.stringify(tokenValue)}, host: ${JSON.stringify(host)} });
51
51
  }).catch((error) => {
52
52
  console.warn(
53
53
  '[what-devtools-mcp] DevTools injection failed. Install what-core, what-devtools, and what-devtools-mcp, then verify Vite aliases/package exports.',
@@ -0,0 +1,8 @@
1
+ export interface WhatDevToolsMCPOptions {
2
+ port?: number;
3
+ token?: string;
4
+ /** Hostname injected into connectDevToolsMCP(). Defaults to 127.0.0.1. */
5
+ host?: string;
6
+ }
7
+
8
+ export default function whatDevToolsMCP(options?: WhatDevToolsMCPOptions): any;