what-devtools-mcp 0.13.0 → 0.13.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "what-devtools-mcp",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "MCP server bridging AI agents to live What Framework app state via WebSocket",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,9 +8,18 @@
8
8
  },
9
9
  "exports": {
10
10
  ".": "./src/index.js",
11
- "./client": "./src/client.js",
12
- "./vite": "./src/vite-plugin.js",
13
- "./vite-plugin": "./src/vite-plugin.js"
11
+ "./client": {
12
+ "types": "./src/client.d.ts",
13
+ "default": "./src/client.js"
14
+ },
15
+ "./vite": {
16
+ "types": "./src/vite-plugin.d.ts",
17
+ "default": "./src/vite-plugin.js"
18
+ },
19
+ "./vite-plugin": {
20
+ "types": "./src/vite-plugin.d.ts",
21
+ "default": "./src/vite-plugin.js"
22
+ }
14
23
  },
15
24
  "files": [
16
25
  "src"
@@ -0,0 +1,31 @@
1
+ // Types for `what-devtools-mcp/client`.
2
+
3
+ export interface DevToolsMCPConnection {
4
+ /** Stop probing and close the socket. Safe to call more than once. */
5
+ disconnect(): void;
6
+ /** Force an immediate reconnect attempt, resetting the probe back-off. */
7
+ reconnect(): void;
8
+ readonly isConnected: boolean;
9
+ /** Events forwarded to the bridge since the connection opened. */
10
+ readonly eventCount: number;
11
+ }
12
+
13
+ export interface ConnectDevToolsMCPOptions {
14
+ /** Bridge port. Default 9229. */
15
+ port?: number;
16
+ /** Shared secret the bridge requires. */
17
+ token?: string;
18
+ /** Override the discovery endpoint instead of deriving it from `port`. */
19
+ discoveryUrl?: string;
20
+ }
21
+
22
+ /**
23
+ * Connect the running app to the devtools MCP bridge.
24
+ *
25
+ * Returns an inert connection in production (`NODE_ENV === 'production'` or
26
+ * `import.meta.env.PROD`) rather than throwing, so it is safe to call
27
+ * unconditionally.
28
+ */
29
+ export function connectDevToolsMCP(
30
+ options?: ConnectDevToolsMCPOptions,
31
+ ): DevToolsMCPConnection;
@@ -0,0 +1,31 @@
1
+ // Types for `what-devtools-mcp/vite`. This is the export TypeScript users hit
2
+ // first, because it goes in `vite.config.ts`.
3
+
4
+ /** Path the dev server answers bridge-discovery probes on. */
5
+ export const DISCOVERY_PATH: string;
6
+
7
+ export interface WhatDevToolsMCPOptions {
8
+ /** Bridge port. Default 9229. */
9
+ port?: number;
10
+ /** Shared secret required by the bridge. */
11
+ token?: string;
12
+ }
13
+
14
+ // Structural Vite plugin shape — assignable to Vite's `PluginOption` without a
15
+ // hard type dependency on `vite`. Same convention as `what-compiler/vite`.
16
+ export interface WhatDevToolsMCPPlugin {
17
+ name: string;
18
+ apply?: 'serve' | 'build';
19
+ [hook: string]: unknown;
20
+ }
21
+
22
+ /**
23
+ * Vite plugin that injects the devtools MCP client into the dev server.
24
+ *
25
+ * `apply: 'serve'` only: it resolves, loads and injects nothing under
26
+ * `vite build`. `what-devtools` is an optional peer; if it is not installed the
27
+ * plugin degrades to a single log line instead of failing the dev transform.
28
+ */
29
+ export default function whatDevToolsMCP(
30
+ options?: WhatDevToolsMCPOptions,
31
+ ): WhatDevToolsMCPPlugin;