@qulib/mcp 0.9.0 → 0.10.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.
Files changed (3) hide show
  1. package/README.md +8 -7
  2. package/dist/index.js +51 -21
  3. package/package.json +8 -5
package/README.md CHANGED
@@ -47,13 +47,16 @@ For verbose server-side stderr logs while troubleshooting host wiring, add:
47
47
 
48
48
  | Tool | Purpose |
49
49
  |---|---|
50
- | **`qulib_score_confidence`** | **Flagship.** Fuses evidence from `analyze_app`, `qulib_score_automation`, and `qulib_score_api` into one verdict: **ship / caution / hold / block** with a 0–100 confidence score, L1–L5 level, per-source contributions, honesty notes, and recommended next checks. Pass `url` and/or `repoPath`. |
51
- | `analyze_app` | Live-app quality scan: release confidence (0–100), axe-core a11y, broken links, console errors, prioritized gaps. Default payload is summary-first; pass `includeFullReport: true` for all scenarios. Optional form-login / storage-state auth. |
50
+ | **`qulib_score_confidence`** | **Flagship.** Fuses evidence from `qulib_analyze_app`, `qulib_score_automation`, and `qulib_score_api` into one verdict: **ship / caution / hold / block** with a 0–100 confidence score, L1–L5 level, per-source contributions, honesty notes, and recommended next checks. Pass `url` and/or `repoPath`. |
51
+ | `qulib_analyze_app` | Live-app quality scan: release confidence (0–100), axe-core a11y, broken links, console errors, prioritized gaps. Default payload is summary-first; pass `includeFullReport: true` for all scenarios. Optional form-login / storage-state auth. *(Canonical form; legacy alias `analyze_app` kept for backwards compatibility.)* |
52
52
  | `qulib_score_automation` | Score a local repo's test-automation maturity across six dimensions (test coverage breadth, framework adoption, test-id hygiene, CI integration, auth test coverage, component test ratio) — plus a conditional 7th dimension (API coverage) when API endpoints are detected. Returns overall 0–100, level (L1–L5), and top recommendations. Each dimension carries `applicability`; score normalizes over applicable dimensions only. |
53
53
  | `qulib_score_api` | Discover API endpoints in a repo and score their test coverage. Tier1=OpenAPI specs, Tier2=framework routes (Next.js, Express, Fastify, NestJS), Tier3=heuristic opt-in (tRPC). Returns an api-test-coverage dimension score with per-endpoint evidence. |
54
- | `qulib_scaffold_tests` | Generate a ready-to-run test scaffold (Cypress or Playwright config + spec files) by crawling a deployed URL. Returns `generatedTests` and `projectConfig` so an agent can write files directly. Pass `recipes` (e.g. `["auth","a11y"]`) to append proven test patterns. |
55
- | `explore_auth` | List all sign-in paths (OAuth, SSO, forms, magic link) and what the agent must collect before `analyze_app`. Prefer on unfamiliar apps. |
56
- | `detect_auth` | Single-pass auth pattern guess with a recommendation. Lighter than `explore_auth`. |
54
+ | `qulib_scaffold_tests` | Generate a ready-to-run test scaffold (Cypress config + spec files) by crawling a deployed URL. Returns `generatedTests` and `projectConfig` so an agent can write files directly. Pass `recipes` (e.g. `["auth","a11y"]`) to append proven test patterns. Supported framework: `cypress-e2e` (default); `playwright` is not yet implemented. |
55
+ | `qulib_explore_auth` | List all sign-in paths (OAuth, SSO, forms, magic link) and what the agent must collect before `qulib_analyze_app`. Prefer on unfamiliar apps. *(Canonical form; legacy alias `explore_auth` kept for backwards compatibility.)* |
56
+ | `qulib_detect_auth` | Single-pass auth pattern guess with a recommendation. Lighter than `qulib_explore_auth`. *(Canonical form; legacy alias `detect_auth` kept for backwards compatibility.)* |
57
+ | `analyze_app` | Legacy alias for `qulib_analyze_app`. Identical behavior; kept for backwards compatibility through v1.0. |
58
+ | `explore_auth` | Legacy alias for `qulib_explore_auth`. Identical behavior; kept for backwards compatibility through v1.0. |
59
+ | `detect_auth` | Legacy alias for `qulib_detect_auth`. Identical behavior; kept for backwards compatibility through v1.0. |
57
60
 
58
61
  **Example — flagship confidence call:**
59
62
 
@@ -136,8 +139,6 @@ When the model sees **`unrecognizedButtons`**, it can ask the user to register a
136
139
  | Size | Small: top gaps, cost summary, next checks, `repoInventorySummary` (counts only) | Full `gapAnalysis` (all scenarios) and full `repoInventory` (test files, missing test IDs) |
137
140
  | When to use | Routine agent turns, chat context limits | Deep dives, exporting full scenario JSON |
138
141
 
139
- > **0.4.2 note:** The compact response now ships `repoInventorySummary` (route/test/missing-id counts plus framework verdict) instead of the full `repoInventory`. Agents that need the raw `testFiles` or `missingTestIds` arrays should pass `includeFullReport: true`.
140
-
141
142
  Example (full):
142
143
 
143
144
  ```json
package/dist/index.js CHANGED
@@ -43,6 +43,18 @@ const mcpProgressLog = {
43
43
  error: (message) => log.error(message),
44
44
  debug: (message) => log.debug(message),
45
45
  };
46
+ // ---------------------------------------------------------------------------
47
+ // Naming convergence — 0.10 (non-breaking aliases)
48
+ //
49
+ // Three legacy tools predate the qulib_ prefix convention:
50
+ // explore_auth → qulib_explore_auth (alias)
51
+ // detect_auth → qulib_detect_auth (alias)
52
+ // analyze_app → qulib_analyze_app (alias)
53
+ //
54
+ // The legacy names keep working unchanged. New integrations should prefer the
55
+ // qulib_ forms. Both will coexist through 1.0; the legacy names are marked
56
+ // "alias" in their descriptions. Removal is planned for 1.0.
57
+ // ---------------------------------------------------------------------------
46
58
  // NOTE: MCP `auth` shape intentionally flattens the core `AuthConfigSchema` so an LLM
47
59
  // can populate it without nested objects. We translate it back into core's nested
48
60
  // `AuthConfig` (with `credentials: { username, password }` and `selectors: { ... }`)
@@ -118,14 +130,11 @@ const DetectAuthToolInputSchema = z.object({
118
130
  url: z.string().url().describe('Full URL of the deployed app or login page'),
119
131
  timeoutMs: z.number().int().positive().optional().describe('Page load timeout in milliseconds (default 15000)'),
120
132
  });
121
- mcpServer.registerTool('explore_auth', {
122
- description: 'Use this BEFORE analyze_app when scanning unfamiliar apps. Returns all detected sign-in paths with per-path requirements describing what credentials or actions the agent must collect from the user before calling analyze_app. Combines built-in OAuth/SSO labels, user-local patterns from ~/.qulib/providers.json, and heuristic unknown buttons.',
123
- inputSchema: ExploreAuthToolInputSchema,
124
- }, async ({ url, timeoutMs }) => {
133
+ async function handleExploreAuth({ url, timeoutMs, }) {
125
134
  try {
126
- log.info(`explore_auth tool url=${url} timeoutMs=${timeoutMs ?? 20000}`);
135
+ log.info(`explore_auth url=${url} timeoutMs=${timeoutMs ?? 20000}`);
127
136
  const result = await exploreAuth(url, timeoutMs, mcpProgressLog);
128
- log.info(`explore_auth tool done authRequired=${result.authRequired} paths=${result.authPaths.length}`);
137
+ log.info(`explore_auth done authRequired=${result.authRequired} paths=${result.authPaths.length}`);
129
138
  return {
130
139
  content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
131
140
  };
@@ -135,18 +144,24 @@ mcpServer.registerTool('explore_auth', {
135
144
  log.error(`explore_auth failed: ${msg}`);
136
145
  return toolError('QULIB_AUTH_EXPLORE_FAILED', msg, err instanceof Error ? err.stack : undefined);
137
146
  }
138
- });
139
- mcpServer.registerTool('detect_auth', {
140
- description: 'Detect the authentication pattern used by a deployed web app. Returns the auth type (form-login, oauth, magic-link, none, or unknown) and a recommendation for how to configure qulib to scan past it.',
141
- inputSchema: DetectAuthToolInputSchema,
142
- }, async ({ url, timeoutMs }) => {
147
+ }
148
+ const EXPLORE_AUTH_DESCRIPTION = 'Use this BEFORE analyze_app when scanning unfamiliar apps. Returns all detected sign-in paths with per-path requirements describing what credentials or actions the agent must collect from the user before calling analyze_app. Combines built-in OAuth/SSO labels, user-local patterns from ~/.qulib/providers.json, and heuristic unknown buttons.';
149
+ mcpServer.registerTool('explore_auth', {
150
+ description: `${EXPLORE_AUTH_DESCRIPTION} (Alias for new integrations: qulib_explore_auth)`,
151
+ inputSchema: ExploreAuthToolInputSchema,
152
+ }, handleExploreAuth);
153
+ mcpServer.registerTool('qulib_explore_auth', {
154
+ description: `${EXPLORE_AUTH_DESCRIPTION} (Canonical qulib_ form; explore_auth is the legacy alias kept for backwards compatibility.)`,
155
+ inputSchema: ExploreAuthToolInputSchema,
156
+ }, handleExploreAuth);
157
+ async function handleDetectAuth({ url, timeoutMs, }) {
143
158
  try {
144
- log.info(`detect_auth tool url=${url} timeoutMs=${timeoutMs ?? 15000}`);
159
+ log.info(`detect_auth url=${url} timeoutMs=${timeoutMs ?? 15000}`);
145
160
  const result = await detectAuth(url, timeoutMs, mcpProgressLog);
146
161
  const providerSummary = result.oauthButtons.length > 0
147
162
  ? result.oauthButtons.map((b) => b.provider).join(', ')
148
163
  : result.provider ?? 'none';
149
- log.info(`detect_auth tool done type=${result.type} providers=${providerSummary} automatable=${result.type === 'form-login'}`);
164
+ log.info(`detect_auth done type=${result.type} providers=${providerSummary} automatable=${result.type === 'form-login'}`);
150
165
  return {
151
166
  content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
152
167
  };
@@ -156,11 +171,17 @@ mcpServer.registerTool('detect_auth', {
156
171
  log.error(`detect_auth failed: ${msg}`);
157
172
  return toolError('QULIB_AUTH_DETECT_FAILED', msg, err instanceof Error ? err.stack : undefined);
158
173
  }
159
- });
160
- mcpServer.registerTool('analyze_app', {
161
- description: 'Analyze a deployed web app for quality gaps. Default response is summary-first (top gaps, cost summary, next checks). Set includeFullReport for the full gapAnalysis. Set agentSummary for the compact gate-decision payload (pass/warn/fail with honesty notes) — use this when calling from a CI gate or orchestrator. Optional llmMaxOutputTokensPerCall / llmTokenBudget (legacy), testGenerationLimit, enableLlmScenarios align with @qulib/core HarnessConfig.',
162
- inputSchema: AnalyzeInputSchema,
163
- }, async (input) => {
174
+ }
175
+ const DETECT_AUTH_DESCRIPTION = 'Detect the authentication pattern used by a deployed web app. Returns the auth type (form-login, oauth, magic-link, none, or unknown) and a recommendation for how to configure qulib to scan past it.';
176
+ mcpServer.registerTool('detect_auth', {
177
+ description: `${DETECT_AUTH_DESCRIPTION} (Alias for new integrations: qulib_detect_auth)`,
178
+ inputSchema: DetectAuthToolInputSchema,
179
+ }, handleDetectAuth);
180
+ mcpServer.registerTool('qulib_detect_auth', {
181
+ description: `${DETECT_AUTH_DESCRIPTION} (Canonical qulib_ form; detect_auth is the legacy alias kept for backwards compatibility.)`,
182
+ inputSchema: DetectAuthToolInputSchema,
183
+ }, handleDetectAuth);
184
+ async function handleAnalyzeApp(input) {
164
185
  try {
165
186
  const successIndicator = input.auth?.type === 'form-login' &&
166
187
  input.auth.successUrlContains !== undefined &&
@@ -225,7 +246,16 @@ mcpServer.registerTool('analyze_app', {
225
246
  log.error(`analyze_app failed: ${msg}`);
226
247
  return toolError('QULIB_SCAN_FAILED', msg, err instanceof Error ? err.stack : undefined);
227
248
  }
228
- });
249
+ }
250
+ const ANALYZE_APP_DESCRIPTION = 'Analyze a deployed web app for quality gaps. Default response is summary-first (top gaps, cost summary, next checks). Set includeFullReport for the full gapAnalysis. Set agentSummary for the compact gate-decision payload (pass/warn/fail with honesty notes) — use this when calling from a CI gate or orchestrator. Optional llmMaxOutputTokensPerCall / llmTokenBudget (legacy), testGenerationLimit, enableLlmScenarios align with @qulib/core HarnessConfig.';
251
+ mcpServer.registerTool('analyze_app', {
252
+ description: `${ANALYZE_APP_DESCRIPTION} (Alias for new integrations: qulib_analyze_app)`,
253
+ inputSchema: AnalyzeInputSchema,
254
+ }, handleAnalyzeApp);
255
+ mcpServer.registerTool('qulib_analyze_app', {
256
+ description: `${ANALYZE_APP_DESCRIPTION} (Canonical qulib_ form; analyze_app is the legacy alias kept for backwards compatibility.)`,
257
+ inputSchema: AnalyzeInputSchema,
258
+ }, handleAnalyzeApp);
229
259
  mcpServer.registerTool('qulib_score_automation', {
230
260
  description: 'Score an automation repository for QA maturity across six dimensions: test coverage breadth, framework adoption, test-id hygiene, CI integration, auth test coverage, and component test ratio. Returns an overall score (0–100), maturity level (L1–L5), and prioritized recommendations.',
231
261
  inputSchema: ScoreAutomationInputSchema,
@@ -267,7 +297,7 @@ const ScaffoldTestsInputSchema = z.object({
267
297
  framework: z
268
298
  .enum(['cypress-e2e', 'playwright'])
269
299
  .optional()
270
- .describe('Test framework to generate. Default: cypress-e2e'),
300
+ .describe('Test framework to generate. Default and recommended: cypress-e2e. playwright is accepted but not yet implemented (returns an error).'),
271
301
  maxPagesToScan: z
272
302
  .number()
273
303
  .int()
@@ -288,7 +318,7 @@ const ScaffoldTestsInputSchema = z.object({
288
318
  'Example: ["auth", "a11y"] adds 6 ready-to-run test scenarios.'),
289
319
  });
290
320
  mcpServer.registerTool('qulib_scaffold_tests', {
291
- 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. Optionally pass recipes (e.g. ["auth","a11y"]) to append proven NQ-2/CaseLoom-derived test patterns for common flows — auth adds login/logout/protected-route tests, a11y adds heading/landmark/title checks, nav adds deep-link/404 tests, seed adds state-reset helpers.',
321
+ 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 plus the project config 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. Supported framework: cypress-e2e (default). playwright scaffold is experimental and not yet implemented. Optionally pass recipes (e.g. ["auth","a11y"]) to append proven NQ-2/CaseLoom-derived test patterns for common flows — auth adds login/logout/protected-route tests, a11y adds heading/landmark/title checks, nav adds deep-link/404 tests, seed adds state-reset helpers.',
292
322
  inputSchema: ScaffoldTestsInputSchema,
293
323
  }, async ({ url, framework, maxPagesToScan, recipes }) => {
294
324
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qulib/mcp",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "MCP server for Qulib — AI-callable release confidence. Seven tools: fused verdict, live-app scan, automation maturity, API coverage, test scaffold, and auth tools.",
5
5
  "license": "MIT",
6
6
  "author": "Tapesh Nagarwal",
@@ -30,16 +30,16 @@
30
30
  "build": "npm --prefix ../.. run build -w @qulib/core && tsc && chmod +x dist/index.js",
31
31
  "prepublishOnly": "npm run build",
32
32
  "dev": "tsx src/index.ts",
33
- "test": "node --import tsx/esm --test src/__tests__/summarize-analyze-result.test.ts src/__tests__/analyze-app-mcp-payload.test.ts src/__tests__/score-confidence-mcp.test.ts"
33
+ "test": "node --import tsx/esm --test src/__tests__/summarize-analyze-result.test.ts src/__tests__/analyze-app-mcp-payload.test.ts src/__tests__/score-confidence-mcp.test.ts src/__tests__/naming-aliases.test.ts"
34
34
  },
35
35
  "dependencies": {
36
36
  "@modelcontextprotocol/sdk": "^1.0.0",
37
- "@qulib/core": "0.9.0",
37
+ "@qulib/core": "0.10.0",
38
38
  "zod": "^3.23.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "^20.0.0",
42
- "tsx": "^4.11.0",
42
+ "tsx": "^4.22.4",
43
43
  "typescript": "^5.4.0"
44
44
  },
45
45
  "keywords": [
@@ -50,6 +50,9 @@
50
50
  "ship-verdict",
51
51
  "automation-maturity",
52
52
  "accessibility",
53
- "ai"
53
+ "ai",
54
+ "ci-gate",
55
+ "playwright",
56
+ "web-quality"
54
57
  ]
55
58
  }