@debugg-ai/debugg-ai-mcp 1.0.48 → 1.0.50

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.
@@ -15,7 +15,36 @@ const logger = new Logger({ module: 'testPageChangesHandler' });
15
15
  // Cache the template UUID and project UUIDs within a server session to avoid re-fetching
16
16
  let cachedTemplateUuid = null;
17
17
  const projectUuidCache = new Map();
18
+ // Concurrency control — max 2 simultaneous browser checks.
19
+ // Additional requests queue and run when a slot opens.
20
+ const MAX_CONCURRENT = 2;
21
+ let running = 0;
22
+ const queue = [];
23
+ async function acquireSlot() {
24
+ if (running < MAX_CONCURRENT) {
25
+ running++;
26
+ return;
27
+ }
28
+ await new Promise((resolve) => queue.push({ resolve }));
29
+ }
30
+ function releaseSlot() {
31
+ running--;
32
+ const next = queue.shift();
33
+ if (next) {
34
+ running++;
35
+ next.resolve();
36
+ }
37
+ }
18
38
  export async function testPageChangesHandler(input, context, progressCallback) {
39
+ await acquireSlot();
40
+ try {
41
+ return await testPageChangesHandlerInner(input, context, progressCallback);
42
+ }
43
+ finally {
44
+ releaseSlot();
45
+ }
46
+ }
47
+ async function testPageChangesHandlerInner(input, context, progressCallback) {
19
48
  const startTime = Date.now();
20
49
  logger.toolStart('check_app_in_browser', input);
21
50
  const client = new DebuggAIServerClient(config.api.key);
package/dist/index.js CHANGED
@@ -164,18 +164,30 @@ async function main() {
164
164
  }));
165
165
  logger.info('Telemetry enabled (PostHog)');
166
166
  }
167
- // Resolve project context (repo project environments/credentials)
168
- // This enriches tool descriptions with available credentials for the detected project.
169
- const projectCtx = await resolveProjectContext();
170
- initTools(projectCtx);
171
- // Create and connect transport
167
+ // Connect transport FIRST so the MCP client handshake succeeds immediately.
168
+ // Tools start with no project context; enriched once the API responds.
169
+ initTools(null);
172
170
  const transport = new StdioServerTransport();
173
171
  await server.connect(transport);
174
- const tools = getTools();
175
172
  logger.info('DebuggAI MCP Server is running and ready to accept requests', {
176
173
  transport: 'stdio',
177
- toolsAvailable: tools.map(t => t.name),
178
- detectedProject: projectCtx?.project.name ?? null,
174
+ toolsAvailable: getTools().map(t => t.name),
175
+ });
176
+ // Resolve project context in the background — enriches tool descriptions
177
+ // with available environments/credentials once the API responds.
178
+ resolveProjectContext().then((projectCtx) => {
179
+ if (projectCtx) {
180
+ initTools(projectCtx);
181
+ logger.info('Tool descriptions enriched with project context', {
182
+ project: projectCtx.project.name,
183
+ environments: projectCtx.environments.length,
184
+ credentials: projectCtx.environments.reduce((n, e) => n + e.credentials.length, 0),
185
+ });
186
+ }
187
+ }).catch((err) => {
188
+ logger.warn('Background project context resolution failed', {
189
+ error: err instanceof Error ? err.message : String(err),
190
+ });
179
191
  });
180
192
  }
181
193
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@debugg-ai/debugg-ai-mcp",
3
- "version": "1.0.48",
3
+ "version": "1.0.50",
4
4
  "description": "Zero-Config, Fully AI-Managed End-to-End Testing for all code gen platforms.",
5
5
  "type": "module",
6
6
  "bin": {