chrome-devtools-mcp-for-extension 0.22.3 → 0.22.5
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/build/src/main.js +8 -9
- package/build/src/tools/chatgpt-web.js +14 -7
- package/package.json +1 -1
package/build/src/main.js
CHANGED
|
@@ -44,7 +44,6 @@ import { McpContext } from './McpContext.js';
|
|
|
44
44
|
import { McpResponse } from './McpResponse.js';
|
|
45
45
|
import { Mutex } from './Mutex.js';
|
|
46
46
|
import { resolveRoots } from './roots-manager.js';
|
|
47
|
-
import { runStartupCheck } from './startup-check.js';
|
|
48
47
|
import { setProjectRoot } from './project-root-state.js';
|
|
49
48
|
import { setupGraceful } from './graceful.js';
|
|
50
49
|
import * as bookmarkTools from './tools/bookmarks.js';
|
|
@@ -175,14 +174,14 @@ async function getContext() {
|
|
|
175
174
|
},
|
|
176
175
|
};
|
|
177
176
|
context = await McpContext.from(browser, logger, browserFactory, connectionOptions);
|
|
178
|
-
//
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
177
|
+
// UI health check disabled - causes duplicate ChatGPT tabs
|
|
178
|
+
// TODO: Re-enable after fixing tab management
|
|
179
|
+
// if (!uiHealthCheckRun) {
|
|
180
|
+
// uiHealthCheckRun = true;
|
|
181
|
+
// runStartupCheck(browser).catch(err => {
|
|
182
|
+
// logger(`Startup check failed: ${err}`);
|
|
183
|
+
// });
|
|
184
|
+
// }
|
|
186
185
|
}
|
|
187
186
|
return context;
|
|
188
187
|
}
|
|
@@ -40,6 +40,7 @@ async function navigateWithRetry(page, url, options = { waitUntil: 'networkidle2
|
|
|
40
40
|
/**
|
|
41
41
|
* Find or create a dedicated ChatGPT tab
|
|
42
42
|
* Returns existing ChatGPT tab if found, otherwise creates a new one
|
|
43
|
+
* Also returns whether navigation is needed
|
|
43
44
|
*/
|
|
44
45
|
async function getOrCreateChatGPTPage(context) {
|
|
45
46
|
// Refresh pages list
|
|
@@ -49,12 +50,13 @@ async function getOrCreateChatGPTPage(context) {
|
|
|
49
50
|
for (const page of pages) {
|
|
50
51
|
const url = page.url();
|
|
51
52
|
if (url.includes('chatgpt.com') || url.includes('chat.openai.com')) {
|
|
52
|
-
|
|
53
|
+
// Already on ChatGPT - no navigation needed
|
|
54
|
+
return { page, needsNavigation: false };
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
// No ChatGPT tab found, create a new one
|
|
56
58
|
const newPage = await context.newPage();
|
|
57
|
-
return newPage;
|
|
59
|
+
return { page: newPage, needsNavigation: true };
|
|
58
60
|
}
|
|
59
61
|
/**
|
|
60
62
|
* Path to store chat session data
|
|
@@ -228,13 +230,18 @@ export const askChatGPTWeb = defineTool({
|
|
|
228
230
|
// Determine project name
|
|
229
231
|
const project = projectName || path.basename(process.cwd()) || 'unknown-project';
|
|
230
232
|
// Get or create a dedicated ChatGPT tab
|
|
231
|
-
const page = await getOrCreateChatGPTPage(context);
|
|
233
|
+
const { page, needsNavigation } = await getOrCreateChatGPTPage(context);
|
|
232
234
|
try {
|
|
233
|
-
// Step 1: Navigate to ChatGPT
|
|
235
|
+
// Step 1: Navigate to ChatGPT (only if not already there)
|
|
234
236
|
response.appendResponseLine('ChatGPTに接続中...');
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
237
|
+
if (needsNavigation) {
|
|
238
|
+
await navigateWithRetry(page, CHATGPT_CONFIG.DEFAULT_URL, { waitUntil: 'networkidle2' });
|
|
239
|
+
// Wait for page to fully render (ChatGPT takes time to load UI)
|
|
240
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
response.appendResponseLine('✅ 既存のChatGPTタブを再利用');
|
|
244
|
+
}
|
|
238
245
|
// Step 2: Check if login is required (don't wait - stop immediately)
|
|
239
246
|
const needsLogin = await isLoginRequired(page);
|
|
240
247
|
if (needsLogin) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chrome-devtools-mcp-for-extension",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.5",
|
|
4
4
|
"description": "MCP server for Chrome extension development with Web Store automation. Fork of chrome-devtools-mcp with extension-specific tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": "./scripts/cli.mjs",
|