Skip to main content
Glama
sadi-qa

AI QA Agent MCP

by sadi-qa

AI QA Agent MCP

QA Validation

A TypeScript-based Model Context Protocol server that analyzes Playwright JSON and JUnit XML test results and provides structured QA insights to AI clients.

Project Goal

This project demonstrates how an AI client can use MCP tools, resources, and prompts to:

  • Discover supported test-result files

  • Normalize Playwright JSON and JUnit XML reports

  • Calculate test-execution metrics

  • Analyze failed, timed-out, and flaky tests

  • Group failures by probable category

  • Generate structured draft bug reports

  • Generate Markdown QA execution summaries

  • Provide advisory release-quality recommendations

Related MCP server: Quality MCP

Implemented MCP Capabilities

Tools

  • list_test_runs

  • get_test_run_summary

  • analyze_test_failures

  • generate_bug_report

  • generate_qa_summary

Resource

  • test-run://latest

The resource returns the newest supported report as normalized QA execution data.

Prompt

  • prepare_release_quality_report

The prompt guides an AI client through a structured release-quality analysis workflow using the available MCP tools.

Supported Report Formats

  • Playwright JSON

  • JUnit XML

Both formats are converted into one normalized internal test-result model before analysis.

Technology Stack

  • Node.js

  • TypeScript

  • Model Context Protocol TypeScript SDK

  • Zod

  • Fast XML Parser

  • Vitest

  • V8 code coverage

  • Playwright JSON

  • JUnit XML

  • MCP Inspector

  • Codex CLI

  • GitHub Actions

Architecture

Playwright JSON Reports     JUnit XML Reports
          |                         |
          +------------+------------+
                       |
                       v
                 Report Parsers
                       |
                       v
             Normalized Test Results
                       |
                       v
               QA Analysis Services
                       |
                       v
                   MCP Server
              |         |         |
            Tools    Resources   Prompts
              |         |         |
              +---------+---------+
                       |
                       v
             MCP Inspector or AI Client

Project Structure

ai-qa-agent-mcp/
├── .github/
│   └── workflows/
│       └── qa-validation.yml
├── docs/
├── reports/
├── sample-data/
│   ├── json/
│   │   └── playwright-results.json
│   └── junit/
│       └── junit-results.xml
├── src/
│   ├── config/
│   ├── parsers/
│   ├── prompts/
│   ├── resources/
│   ├── services/
│   ├── tools/
│   ├── types/
│   ├── mcp-server.ts
│   └── server.ts
├── tests/
│   ├── integration/
│   │   └── mcp-server.integration.test.ts
│   └── unit/
├── .gitignore
├── package.json
├── README.md
├── tsconfig.build.json
├── tsconfig.json
└── vitest.config.ts

Development Commands

Install dependencies:

npm install

Run the server during development:

npm run dev

Check TypeScript:

npm run typecheck

Run automated tests:

npm test

Run tests with coverage:

npm run test:coverage

Generate the production build:

npm run build

Run type checking, automated tests, and the production build:

npm run check

Run type checking, coverage validation, and the production build:

npm run check:coverage

MCP Integration Testing

The integration suite creates an MCP server and client connected through the SDK's in-memory transport.

It verifies that an MCP client can:

  • Discover all five registered tools

  • Call the JUnit test-run summary tool

  • Discover and read test-run://latest

  • Discover and retrieve prepare_release_quality_report

  • Exchange normalized QA data through the MCP protocol

The reusable MCP server is created by:

src/mcp-server.ts

The production stdio entry point remains:

src/server.ts

Continuous Integration

The QA Validation GitHub Actions workflow runs for:

  • Pull requests targeting main

  • Pushes to main

  • Manual workflow executions

The workflow uses Node.js 24 and runs:

npm ci
npm run check:coverage

The workflow fails when type checking, tests, coverage thresholds, or the production build fail.

Coverage Thresholds

The project enforces these minimum global coverage thresholds:

Metric

Minimum

Current

Statements

80%

82.99%

Branches

65%

70.37%

Functions

90%

92.68%

Lines

80%

82.94%

Coverage reports are generated in text, JSON summary, and HTML formats.

Generated reports are stored under:

coverage/

Example Report Paths

Paths must be relative to the configured approved reports directory.

json/playwright-results.json
junit/junit-results.xml

Security Principles

  • Read-only report access by default

  • Restricted file-system access

  • Safe path resolution

  • Maximum report-size enforcement

  • Input validation for MCP tools

  • No automatic issue creation

  • No secret values in logs

  • Human review required for AI-generated conclusions

  • Release recommendations are advisory only

Quality Validation

The project currently includes automated coverage for:

  • Playwright JSON parsing

  • JUnit XML parsing

  • Shared report-format routing

  • Test-run file discovery

  • Test-execution metric calculation

  • Failure analysis

  • Draft bug-report generation

  • QA-summary generation

  • Latest-test-run resource handling

  • Safe file-path validation

  • MCP tool discovery and invocation

  • MCP resource discovery and reading

  • MCP prompt discovery and retrieval

Current validation result:

17 test files passed
53 tests passed
Coverage thresholds passed
Production build passed

Current Status

Version 0.1.0 is under active development.

Implemented features include five MCP tools, one MCP resource, one MCP prompt, Playwright JSON support, JUnit XML support, unit and integration test coverage, enforced coverage thresholds, and GitHub Actions CI validation.

Available Tools

5 tools
analyze_test_failuresAnalyze Test FailuresA

Analyze failed, timed-out, and flaky tests from an approved Playwright JSON report and group them by probable failure category.

ParametersJSON Schema
NameRequiredDescriptionDefault
reportPathYesPath to the report relative to the approved reports directory, such as json/playwright-results.json.

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description is solely responsible for behavioral transparency. It only states that it analyzes and groups, without disclosing output format, prerequisites, side effects, or error behavior. The term 'approved' suggests a constraint but is not explained, leaving a meaningful transparency gap for a tool that produces a categorized analysis.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that packs the core action, input, and outcome without any filler. Every word adds value, making it highly efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema is present, so the description should explain the return value. It hints at the result ('group them by probable failure category') but does not specify the structure of the output, potential edge cases (e.g., no failures), or how 'approved' is determined. For a tool with one parameter and no nested objects, this is a moderate completeness gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema covers the single parameter fully with a clear description ('Path to the report relative to the approved reports directory, such as json/playwright-results.json.'), earning a baseline of 3. The description's mention of 'approved Playwright JSON report' aligns with the schema but adds no extra semantic detail beyond what is already provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Analyze'), the resource ('failed, timed-out, and flaky tests from an approved Playwright JSON report'), and the outcome ('group them by probable failure category'). This sharply distinguishes it from sibling tools like list_test_runs or generate_bug_report.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when you have an approved Playwright report with failures that need categorizing, but it avoids explicit alternatives or exclusions. It doesn't mention when to choose this over generate_bug_report or get_test_run_summary, leaving the agent to infer based on the tool name and purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

generate_bug_reportGenerate Bug ReportA

Generate a structured draft bug report for one failed, timed-out, or flaky test from an approved Playwright JSON report.

ParametersJSON Schema
NameRequiredDescriptionDefault
testIdYesThe normalized test ID returned by the failure-analysis tool.
reportPathYesPath to the report relative to the approved reports directory.

TDQS

A3.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description must carry the full burden of behavioral disclosure. It mentions the output is a 'draft' and requires an 'approved' report, but does not disclose whether the operation is read-only, if any resources are modified, what permissions are needed, or the exact return format. For a generation tool, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, focused sentence with no redundant words. It efficiently conveys the tool's purpose, input requirements, and output type without adding unnecessary detail.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description explains the tool's purpose and input source but does not elaborate on the output format or any side effects, which is important given the absence of an output schema and annotations. While the tool is relatively simple with only two parameters, the description leaves room for ambiguity about the exact return value and the workflow context (e.g., that it follows failure analysis).

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema provides full descriptions for both parameters (reportPath and testId), so the baseline is 3. The description does not add any extra meaning or constraints beyond what the schema already states, but it does align with the schema by referencing 'approved Playwright JSON report' and 'test'.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function with a specific verb ('Generate') and resource ('structured draft bug report'), and defines the scope ('one failed, timed-out, or flaky test from an approved Playwright JSON report'). It is easily distinguishable from sibling tools like 'analyze_test_failures' and 'generate_qa_summary'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use the tool: for a single test from an approved Playwright report. However, it does not explicitly mention when not to use it or name alternatives, so it lacks the explicit exclusions or alternative guidance that would warrant a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

generate_qa_summaryGenerate QA SummaryB

Generate a complete QA execution summary containing metrics, failure analysis, quality risks, Markdown output, and an advisory release recommendation.

ParametersJSON Schema
NameRequiredDescriptionDefault
reportPathYesPath to the report relative to the approved reports directory, such as json/playwright-results.json.

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry the full burden. It lists what the summary contains, but does not disclose side effects, whether it writes to disk, required permissions, or what happens if the report is missing. This is insufficient for a tool that produces an advisory recommendation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, focused sentence that front-loads the primary action and enumerates the key output components. No wasted words or redundant details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With one well-documented parameter and no output schema, the description covers the high-level purpose and output contents. However, it lacks behavioral details like prerequisites, expected input format, or how the advisory recommendation is determined, which would be useful for complete context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% since reportPath has a clear description. The tool description adds no extra parameter information beyond what the schema already provides, so it meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool generates a complete QA execution summary with specific components (metrics, failure analysis, quality risks, Markdown output, advisory release recommendation). It is distinct enough from siblings but does not explicitly differentiate itself, so it misses the top score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied: the user provides a report path and expects a summary. However, there is no explicit guidance on when to use this tool versus alternatives like get_test_run_summary or analyze_test_failures, and no exclusions or prerequisites are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_test_run_summaryGet Test Run SummaryA

Read an approved Playwright JSON report and calculate pass, failure, skip, timeout, and flaky-test metrics.

ParametersJSON Schema
NameRequiredDescriptionDefault
reportPathYesPath to the report relative to the approved reports directory, such as json/playwright-results.json.

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It conveys that the operation is read-only ('Read') and that it computes metrics, which implies non-destructive behavior. However, it does not mention potential error conditions (e.g., invalid path, unapproved report), return format, or whether it accesses external resources beyond the file. The 'approved' adjective adds some context but is vague.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence that front-loads the action ('Read an approved Playwright JSON report') and immediately enumerates the computed metrics. Every word adds value; there is no redundancy or filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with one parameter and no output schema, the description is nearly complete. It states the input (report path), the action (read), and the output (metrics). It could be improved by specifying that the metrics are returned in a structured format or mentioning any prerequisites, but the current level is sufficient for a straightforward reporting tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100% and the parameter description explicitly explains the path format and location ('relative to the approved reports directory, such as json/playwright-results.json'). The tool description does not add further parameter meaning, but with perfect schema coverage the baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Read an approved Playwright JSON report') and the intended outcome ('calculate pass, failure, skip, timeout, and flaky-test metrics'). This distinguishes it from sibling tools: list_test_runs lists runs, analyze_test_failures focuses on failures, and generate_qa_summary generates a summary. The unique resource ('Playwright JSON report') and metric list make the purpose unmistakable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied by the description: use this tool when you have an approved Playwright JSON report and need high-level metrics. However, it does not explicitly state when to use it instead of siblings (e.g., list_test_runs for listing, analyze_test_failures for failure analysis) or provide any exclusion criteria. The 'approved' qualifier hints at a prerequisite but is not elaborated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_test_runsList Test RunsA

Find available Playwright JSON and JUnit test-result files in the approved reports directory.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must carry the burden of behavioral disclosure. It states the tool reads from a specific directory and filters by file type, implying a read-only operation. However, it does not mention whether the list is sorted, what happens if no files are found, or any access restrictions besides 'approved'. This is adequate but not rich.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that gets straight to the point: 'Find available Playwright JSON and JUnit test-result files in the approved reports directory.' No redundancy or fluff; every word contributes.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple parameterless list tool, the description is complete enough. It specifies the exact files sought and the directory. Without an output schema, it could benefit from mentioning the return format (e.g., list of paths), but for a 'find' operation the output is reasonably inferable. The context of sibling tools suggests it is a discovery step, which is adequately conveyed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so the baseline is 4. The description adds no parameter-specific semantics because there are none to explain. It briefly hints at the scope (directory) but does not need to elaborate further.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: 'Find available Playwright JSON and JUnit test-result files in the approved reports directory.' The verb 'find' plus the specific resource (test-result files) and location (approved reports directory) fully distinguish it from sibling tools like get_test_run_summary or analyze_test_failures, which serve different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage: it is for locating available test result files before running analyses or summaries. However, it does not explicitly mention when to prefer this over siblings or provide exclusions. Given the sibling tools exist, some guidance on 'use this to discover files before invoking summary/analysis' would have been helpful.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv0.1.0
    • First observedanalyze_test_failures
    • First observedgenerate_bug_report
    • First observedgenerate_qa_summary
    • First observedget_test_run_summary
    • First observedlist_test_runs

TDQS

A4/5.0

Scored across 5 tools

Disambiguation5/5

Each tool has a clearly distinct role in the QA workflow: discovery, summary, failure analysis, bug report generation, and full summary. No two tools overlap in purpose.

Naming Consistency5/5

All tool names follow a consistent verb_noun snake_case pattern (list_, get_, analyze_, generate_), making the set predictable and easy to navigate.

Tool Count5/5

With 5 tools, the set is well-scoped for a QA agent: it covers discovery, analysis, and reporting without excess or gaps.

Completeness5/5

The tool surface covers the complete QA report workflow: finding reports, summarizing metrics, analyzing failures, drafting bug reports, and producing a final summary. No obvious missing operations.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers