@debugelectron/debug-electron-mcp 1.6.9 → 1.7.0

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.
@@ -0,0 +1,24 @@
1
+ export interface ProjectConfig {
2
+ port: number;
3
+ windowTitlePattern?: string;
4
+ }
5
+ export interface RegistryConfig {
6
+ portRange: [number, number];
7
+ projects: Record<string, ProjectConfig>;
8
+ }
9
+ declare class ProjectRegistry {
10
+ private config;
11
+ private configPath;
12
+ private static instance;
13
+ private constructor();
14
+ static getInstance(): ProjectRegistry;
15
+ register(name: string, port?: number, windowTitlePattern?: string): ProjectConfig;
16
+ unregister(name: string): boolean;
17
+ resolve(name: string): ProjectConfig | undefined;
18
+ list(): Record<string, ProjectConfig>;
19
+ getNextFreePort(): number;
20
+ save(): void;
21
+ load(): void;
22
+ }
23
+ export declare const projectRegistry: ProjectRegistry;
24
+ export {};
package/dist/schemas.d.ts CHANGED
@@ -47,8 +47,11 @@ export declare const SendCommandToElectronSchema: z.ZodObject<{
47
47
  }>>;
48
48
  targetId: z.ZodOptional<z.ZodString>;
49
49
  windowTitle: z.ZodOptional<z.ZodString>;
50
+ projectName: z.ZodOptional<z.ZodString>;
50
51
  }, "strip", z.ZodTypeAny, {
51
52
  command: string;
53
+ projectName?: string | undefined;
54
+ targetId?: string | undefined;
52
55
  windowTitle?: string | undefined;
53
56
  args?: {
54
57
  text?: string | undefined;
@@ -58,9 +61,10 @@ export declare const SendCommandToElectronSchema: z.ZodObject<{
58
61
  selector?: string | undefined;
59
62
  placeholder?: string | undefined;
60
63
  } | undefined;
61
- targetId?: string | undefined;
62
64
  }, {
63
65
  command: string;
66
+ projectName?: string | undefined;
67
+ targetId?: string | undefined;
64
68
  windowTitle?: string | undefined;
65
69
  args?: {
66
70
  text?: string | undefined;
@@ -70,45 +74,80 @@ export declare const SendCommandToElectronSchema: z.ZodObject<{
70
74
  selector?: string | undefined;
71
75
  placeholder?: string | undefined;
72
76
  } | undefined;
73
- targetId?: string | undefined;
74
77
  }>;
75
78
  export declare const TakeScreenshotSchema: z.ZodObject<{
76
79
  outputPath: z.ZodOptional<z.ZodString>;
80
+ targetId: z.ZodOptional<z.ZodString>;
77
81
  windowTitle: z.ZodOptional<z.ZodString>;
82
+ projectName: z.ZodOptional<z.ZodString>;
78
83
  }, "strip", z.ZodTypeAny, {
84
+ projectName?: string | undefined;
79
85
  outputPath?: string | undefined;
86
+ targetId?: string | undefined;
80
87
  windowTitle?: string | undefined;
81
88
  }, {
89
+ projectName?: string | undefined;
82
90
  outputPath?: string | undefined;
91
+ targetId?: string | undefined;
83
92
  windowTitle?: string | undefined;
84
93
  }>;
85
94
  export declare const ReadElectronLogsSchema: z.ZodObject<{
86
95
  logType: z.ZodOptional<z.ZodEnum<["console", "main", "renderer", "all"]>>;
87
96
  lines: z.ZodOptional<z.ZodNumber>;
88
97
  follow: z.ZodOptional<z.ZodBoolean>;
98
+ projectName: z.ZodOptional<z.ZodString>;
89
99
  }, "strip", z.ZodTypeAny, {
100
+ projectName?: string | undefined;
90
101
  logType?: "console" | "main" | "renderer" | "all" | undefined;
91
102
  lines?: number | undefined;
92
103
  follow?: boolean | undefined;
93
104
  }, {
105
+ projectName?: string | undefined;
94
106
  logType?: "console" | "main" | "renderer" | "all" | undefined;
95
107
  lines?: number | undefined;
96
108
  follow?: boolean | undefined;
97
109
  }>;
98
110
  export declare const GetElectronWindowInfoSchema: z.ZodObject<{
99
111
  includeChildren: z.ZodOptional<z.ZodBoolean>;
112
+ projectName: z.ZodOptional<z.ZodString>;
100
113
  }, "strip", z.ZodTypeAny, {
101
114
  includeChildren?: boolean | undefined;
115
+ projectName?: string | undefined;
102
116
  }, {
103
117
  includeChildren?: boolean | undefined;
118
+ projectName?: string | undefined;
104
119
  }>;
105
120
  export declare const ListElectronWindowsSchema: z.ZodObject<{
106
121
  includeDevTools: z.ZodOptional<z.ZodBoolean>;
122
+ projectName: z.ZodOptional<z.ZodString>;
107
123
  }, "strip", z.ZodTypeAny, {
124
+ projectName?: string | undefined;
108
125
  includeDevTools?: boolean | undefined;
109
126
  }, {
127
+ projectName?: string | undefined;
110
128
  includeDevTools?: boolean | undefined;
111
129
  }>;
130
+ export declare const RegisterProjectSchema: z.ZodObject<{
131
+ projectName: z.ZodString;
132
+ port: z.ZodOptional<z.ZodNumber>;
133
+ windowTitlePattern: z.ZodOptional<z.ZodString>;
134
+ }, "strip", z.ZodTypeAny, {
135
+ projectName: string;
136
+ port?: number | undefined;
137
+ windowTitlePattern?: string | undefined;
138
+ }, {
139
+ projectName: string;
140
+ port?: number | undefined;
141
+ windowTitlePattern?: string | undefined;
142
+ }>;
143
+ export declare const UnregisterProjectSchema: z.ZodObject<{
144
+ projectName: z.ZodString;
145
+ }, "strip", z.ZodTypeAny, {
146
+ projectName: string;
147
+ }, {
148
+ projectName: string;
149
+ }>;
150
+ export declare const ListProjectsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
112
151
  export type ToolInput = {
113
152
  type: 'object';
114
153
  properties: Record<string, any>;
@@ -1,7 +1,18 @@
1
+ /** Options for taking a screenshot */
2
+ export interface ScreenshotOptions {
3
+ /** Path to save the screenshot (optional, defaults to in-memory only) */
4
+ outputPath?: string;
5
+ /** CDP target ID to screenshot a specific window (exact match, takes priority over windowTitle) */
6
+ targetId?: string;
7
+ /** Window title to screenshot (case-insensitive partial match) */
8
+ windowTitle?: string;
9
+ /** Specific ports to scan (overrides default port scanning) */
10
+ ports?: number[];
11
+ }
1
12
  /**
2
13
  * Take a screenshot of the running Electron application using Chrome DevTools Protocol
3
14
  */
4
- export declare function takeScreenshot(outputPath?: string, windowTitle?: string): Promise<{
15
+ export declare function takeScreenshot(options?: ScreenshotOptions): Promise<{
5
16
  filePath?: string;
6
17
  base64: string;
7
18
  data: string;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Start the MCP server in HTTP mode using StreamableHTTPServerTransport.
3
+ * Uses only Node built-in http — no express or other dependencies.
4
+ * Supports multiple concurrent AI client sessions.
5
+ */
6
+ export declare function startHttpServer(port?: number): Promise<void>;
package/dist/tools.d.ts CHANGED
@@ -4,7 +4,10 @@ export declare enum ToolName {
4
4
  TAKE_SCREENSHOT = "take_screenshot",
5
5
  READ_ELECTRON_LOGS = "read_electron_logs",
6
6
  GET_ELECTRON_WINDOW_INFO = "get_electron_window_info",
7
- LIST_ELECTRON_WINDOWS = "list_electron_windows"
7
+ LIST_ELECTRON_WINDOWS = "list_electron_windows",
8
+ REGISTER_PROJECT = "register_project",
9
+ UNREGISTER_PROJECT = "unregister_project",
10
+ LIST_PROJECTS = "list_projects"
8
11
  }
9
12
  export declare const tools: {
10
13
  name: ToolName;
@@ -18,6 +18,8 @@ export interface WindowTargetOptions {
18
18
  targetId?: string;
19
19
  /** Window title (case-insensitive partial match) */
20
20
  windowTitle?: string;
21
+ /** Specific ports to scan (overrides default port scanning) */
22
+ ports?: number[];
21
23
  }
22
24
  /**
23
25
  * Find and connect to a running Electron application.
@@ -30,8 +30,10 @@ export interface ElectronWindowResult {
30
30
  }
31
31
  /**
32
32
  * Scan for running Electron applications with DevTools enabled
33
+ * @param ports - Optional list of specific ports to scan. When provided, only these ports are checked.
34
+ * When omitted, scans the default hardcoded port ranges.
33
35
  */
34
- export declare function scanForElectronApps(): Promise<ElectronAppInfo[]>;
36
+ export declare function scanForElectronApps(ports?: number[]): Promise<ElectronAppInfo[]>;
35
37
  /**
36
38
  * Get detailed process information for running Electron applications
37
39
  */
@@ -43,10 +45,13 @@ export declare function findMainTarget(targets: any[]): any | null;
43
45
  /**
44
46
  * List all available Electron window targets across all detected apps.
45
47
  * @param includeDevTools - Whether to include DevTools windows (default: false)
48
+ * @param ports - Optional list of specific ports to scan
46
49
  * @returns Array of window targets with id, title, url, port, and type
47
50
  */
48
- export declare function listElectronWindows(includeDevTools?: boolean): Promise<ElectronWindowTarget[]>;
51
+ export declare function listElectronWindows(includeDevTools?: boolean, ports?: number[]): Promise<ElectronWindowTarget[]>;
49
52
  /**
50
53
  * Get window information from any running Electron app
54
+ * @param includeChildren - Whether to include child/DevTools windows
55
+ * @param ports - Optional list of specific ports to scan
51
56
  */
52
- export declare function getElectronWindowInfo(includeChildren?: boolean): Promise<ElectronWindowResult>;
57
+ export declare function getElectronWindowInfo(includeChildren?: boolean, ports?: number[]): Promise<ElectronWindowResult>;
@@ -6,6 +6,12 @@ export interface CommandArgs {
6
6
  placeholder?: string;
7
7
  message?: string;
8
8
  code?: string;
9
+ duration?: number;
10
+ timeout?: number;
11
+ startSelector?: string;
12
+ endSelector?: string;
13
+ attribute?: string;
14
+ slowly?: boolean;
9
15
  }
10
16
  /**
11
17
  * Enhanced command executor with improved React support.
@@ -7,5 +7,9 @@ export interface LogEntry {
7
7
  }
8
8
  /**
9
9
  * Read logs from running Electron applications
10
+ * @param logType - Type of logs to read
11
+ * @param lines - Number of recent lines to read
12
+ * @param follow - Whether to follow/tail the logs
13
+ * @param ports - Optional list of specific ports to scan
10
14
  */
11
- export declare function readElectronLogs(logType?: LogType, lines?: number, follow?: boolean): Promise<string>;
15
+ export declare function readElectronLogs(logType?: LogType, lines?: number, follow?: boolean, ports?: number[]): Promise<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@debugelectron/debug-electron-mcp",
3
- "version": "1.6.9",
3
+ "version": "1.7.0",
4
4
  "description": "MCP server for Electron application automation and management. See MCP_USAGE_GUIDE.md for proper argument structure examples.",
5
5
  "main": "dist/index.js",
6
6
  "publishConfig": {
@@ -18,6 +18,7 @@
18
18
  "dev": "tsx src/index.ts",
19
19
  "dev:watch": "tsx --watch src/index.ts",
20
20
  "start": "node dist/index.js",
21
+ "serve": "node dist/index.js serve",
21
22
  "watch": "webpack --config webpack.config.ts --mode development --watch",
22
23
  "watch-and-serve": "webpack --config webpack.config.ts --mode development --watch & node --watch dist/index.js",
23
24
  "prepare": "npm run build",
@@ -53,6 +54,8 @@
53
54
  "dependencies": {
54
55
  "@modelcontextprotocol/sdk": "^1.0.0",
55
56
  "@types/ws": "^8.18.1",
57
+ "ajv": "^8.17.1",
58
+ "ajv-formats": "^3.0.1",
56
59
  "electron": "^28.0.0",
57
60
  "playwright": "^1.54.1",
58
61
  "ws": "^8.18.3",