@qulib/mcp 0.6.0 → 0.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.
- package/dist/index.js +49 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
|
14
14
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
15
15
|
const requirePkg = createRequire(import.meta.url);
|
|
16
16
|
const pkg = requirePkg('../package.json');
|
|
17
|
-
import { analyzeApp, detectAuth, exploreAuth, scanRepo, computeAutomationMaturity, } from '@qulib/core';
|
|
17
|
+
import { analyzeApp, detectAuth, exploreAuth, scanRepo, computeAutomationMaturity, scaffoldTests, } from '@qulib/core';
|
|
18
18
|
import { z } from 'zod';
|
|
19
19
|
import { buildAnalyzeAppMcpPayload } from './analyze-app-mcp-payload.js';
|
|
20
20
|
import { log } from './logger.js';
|
|
@@ -261,5 +261,53 @@ mcpServer.registerTool('qulib_score_automation', {
|
|
|
261
261
|
return toolError('QULIB_REPO_SCORE_FAILED', msg, err instanceof Error ? err.stack : undefined);
|
|
262
262
|
}
|
|
263
263
|
});
|
|
264
|
+
const ScaffoldTestsInputSchema = z.object({
|
|
265
|
+
url: z.string().url().describe('URL of the deployed web app to scaffold tests for'),
|
|
266
|
+
framework: z
|
|
267
|
+
.enum(['cypress-e2e', 'playwright'])
|
|
268
|
+
.optional()
|
|
269
|
+
.describe('Test framework to generate. Default: cypress-e2e'),
|
|
270
|
+
maxPagesToScan: z
|
|
271
|
+
.number()
|
|
272
|
+
.int()
|
|
273
|
+
.min(1)
|
|
274
|
+
.max(20)
|
|
275
|
+
.optional()
|
|
276
|
+
.describe('Max pages to crawl when running analyze_app internally. Default: 10'),
|
|
277
|
+
});
|
|
278
|
+
mcpServer.registerTool('qulib_scaffold_tests', {
|
|
279
|
+
description: 'Generate a ready-to-run test scaffold for a deployed web app. Crawls the URL, identifies quality gaps and user flows, then produces framework-specific test files (Cypress or Playwright) plus the project config (cypress.config.ts or playwright.config.ts) and package.json deps. Returns generatedTests (array of {filename, code, outputPath}) and projectConfig so an agent can write the files directly to a repo without any manual test-writing.',
|
|
280
|
+
inputSchema: ScaffoldTestsInputSchema,
|
|
281
|
+
}, async ({ url, framework, maxPagesToScan }) => {
|
|
282
|
+
try {
|
|
283
|
+
log.info(`qulib_scaffold_tests url=${url} framework=${framework ?? 'cypress-e2e'} maxPagesToScan=${maxPagesToScan ?? 10}`);
|
|
284
|
+
const result = await scaffoldTests(url, {
|
|
285
|
+
framework: framework ?? 'cypress-e2e',
|
|
286
|
+
maxPagesToScan: maxPagesToScan ?? 10,
|
|
287
|
+
progressLog: mcpProgressLog,
|
|
288
|
+
telemetry: telemetrySink,
|
|
289
|
+
});
|
|
290
|
+
return {
|
|
291
|
+
content: [
|
|
292
|
+
{
|
|
293
|
+
type: 'text',
|
|
294
|
+
text: JSON.stringify({
|
|
295
|
+
url: result.url,
|
|
296
|
+
framework: result.framework,
|
|
297
|
+
scenarioCount: result.scenarios.length,
|
|
298
|
+
testCount: result.generatedTests.length,
|
|
299
|
+
generatedTests: result.generatedTests,
|
|
300
|
+
projectConfig: result.projectConfig,
|
|
301
|
+
}, null, 2),
|
|
302
|
+
},
|
|
303
|
+
],
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
catch (err) {
|
|
307
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
308
|
+
log.error(`qulib_scaffold_tests failed: ${msg}`);
|
|
309
|
+
return toolError('QULIB_SCAFFOLD_FAILED', msg, err instanceof Error ? err.stack : undefined);
|
|
310
|
+
}
|
|
311
|
+
});
|
|
264
312
|
const transport = new StdioServerTransport();
|
|
265
313
|
await mcpServer.connect(transport);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qulib/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "MCP server for Qulib — AI-callable QA gap analysis",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Tapesh Nagarwal",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
36
|
-
"@qulib/core": "0.
|
|
36
|
+
"@qulib/core": "0.7.0",
|
|
37
37
|
"zod": "^3.23.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|