Skip to main content
Glama
TuanLdv

ai-testcase-designer-mcp

by TuanLdv

🤖 AI 测试用例生成器 MCP

一个模型上下文协议(MCP)服务器,可根据端点元数据直接生成全面的API 测试计划(包括正向、负向及边界/异常用例)——由**大语言模型(LLM)**驱动。

这是一个基于 TypeScript 的模型上下文协议(MCP)服务器,专为 QA 工程师设计。它通过以下方式演示 MCP 的核心概念:

  • 提供 AI 驱动的工具,根据 API 端点和请求负载生成详尽的测试用例计划

  • 通过提示词驱动集成 LLM,确保测试质量与覆盖率

  • 采用可扩展架构,便于未来集成自动化工具

✨ 功能特性

  • 🔌 符合 MCP 规范的服务器stdio 传输)。

  • 📝 工具:generate_excel

    • 输入:端点、HTTP 方法、请求负载、额外上下文。

    • 输入选项

      • 直接指定端点详情:端点、HTTP 方法、请求负载

      • 使用 extraContext 提供任何额外的测试说明或约束条件

    • 输出:📊 Excel 测试计划,包含以下列:序号、测试名称、前置条件、测试步骤、预期结果

  • 🧠 基于提示词驱动的测试生成,支持可配置的 LLM(Groq、OpenAI、Anthropic)。

  • 📜 使用 Winston 提供详细的日志记录。

Related MCP server: ai-testcase-generator-mcp

🏗️ 架构

flowchart TD
    A[Claude / MCP Client] -->|Run Tool| B[MCP Server]
    B -->|Prompt| C[LLM API]
    C -->|Test Cases JSON| B
    B -->|Excel Export| D[(Test Plan .xlsx)]
    B -->|Logs| E[Server Log File]

📂 项目结构

ai-testcase-designer-mcp/
├── build/                         # Compiled JavaScript output
├── assets/                        # Demo gifs, images, and sample files
│    ├── demo.gif
│    ├── excel_preview.png
│    └── sample_chat_message.txt
├── configs/
│    └── config.json               # Server/tool config
├── src/
│    ├── index.ts                  # Main server entry point (MCP interface & routing)
│    ├── excel.ts                  # Excel file creation & writing logic (modular)
│    ├── logger.ts                 # Winston logger configuration & log writing (modular)
│    └── prompts/
│         └── testcase_prompt.txt  # Prompt template for LLM-based test generation
├── package.json
├── tsconfig.json
├── README.md
└── .gitignore
  • src/excel.ts:处理所有 Excel(.xlsx)文件创建和测试计划导出(模块化设计)。

  • src/logger.ts:使用 Winston 提供跨 MCP 服务器的模块化日志功能。

  • src/prompts/:包含用于 LLM 驱动测试生成的提示词模板。

  • assets/:演示 GIF、Excel 示例预览和聊天提示词示例。


🎥 演示

以下是 MCP 生成测试用例并导出为 Excel 的演示:

AI 测试用例设计器演示

🔍 Excel 预览

以下是所生成测试用例的快速预览:

Excel 预览

开发

安装依赖:

npm install

构建服务器:

npm run build

开发模式(自动重建):

npm run watch

⚙️ 安装

请按照以下步骤在本地设置 AI 测试用例设计器 MCP 服务器:

  1. 克隆仓库

    git clone 
    cd ai-testcase-designer-mcp
  2. 安装依赖

    npm install
  3. 构建服务器

    npm run build
  4. 在 MCP 客户端中配置服务器

    a. Claude Desktop 或任何兼容 MCP 的客户端

    • 添加以下服务器配置:

      • 在 macOS 上:
        ~/Library/Application Support/Claude/claude_desktop_config.json

      • 在 Windows 上:
        %APPDATA%/Claude/claude_desktop_config.json

    {
      "mcpServers": {
        "ai-testcase-designer-mcp": {
          "disabled": false,
          "timeout": 60,
          "command": "node",
          "args": [
            "c:/Auto_WS/ai-testcase-designer-mcp/build/index.js"
          ],
          "transportType": "stdio"
        }
      }
    }

    b. Cline(VS Code 扩展)

    快速开始:

    1. VS Code 市场 安装 Cline

    2. 打开 Cline 侧边栏(从 VS Code 活动栏)。

    3. 转到“MCP 服务器”部分,点击“添加新的 MCP 服务器”。

    4. 填写服务器详细信息:

      {
        "mcpServers": {
          "ai-testcase-designer-mcp": {
            "disabled": false,
            "timeout": 60,
            "command": "node",
            "args": [
              "c:/Auto_WS/ai-testcase-designer-mcp/build/index.js"
            ],
            "transportType": "stdio"
          }
        }
      }
    5. 测试连接并保存。

    有关可视化分步指南,请参阅下文:

    Cline MCP 服务器添加步骤

    Cline MCP 服务器连接成功

    有关详细的 Cline 指南,请参阅官方文档:
    cline.bot/getting-started/installing-cline#vs-code-marketplace%3A-step-by-step-setup

c. Hermes Agent

  • ~/.hermes/config.yamlmcp_servers 下添加以下服务器配置:

mcp_servers:
  ai-testcase-designer-mcp:
    command: "node"
    args: ["/absolute/path/to/ai-testcase-designer-mcp/build/index.js"]

🔑 API 密钥与工作目录设置

要使用 AI 测试用例设计器 MCP 服务器:

  1. 从此处免费获取你的 Groq API 密钥:https://console.groq.com/keys

  2. 准备一个工作目录(WORK_DIR),用于保存生成的 Excel 测试计划和服务器日志。

按如下方式更新你的 config.json 文件:

{
  "MODEL_API_KEY": "gsk_7Ma3Fabcd <your-api-key-here>",
  "WORK_DIR": "C:/Auto_WS/ai-testcase-designer-mcp"
}

使用方法

  1. 🖥️ 打开 Claude Desktop(或任何兼容 MCP 的客户端)。

  2. 📂 下载示例聊天消息sample_chat_message.txt 并复制其内容。

  3. ✉️ 将内容粘贴到聊天框中并发送消息:AI 将生成详细的测试用例并导出为 Excel 格式。

  4. 💾 生成的 Excel 文件和服务器日志将保存在你的 WORK_DIR 文件夹中。

▶️ 示例请求

{
  "name": "generate_tests_excel",
  "arguments": {
    "endpoint": "https://api.example.com/v1/users",
    "method": "POST",
    "payload": {
      "name": "John Doe",
      "email": "john@example.com"
    },
    "extraContext": "Focus on invalid email and empty payload scenarios."
  }
}

📊 示例 Excel 输出

序号

测试名称

前置条件

测试步骤

预期结果

1

有效用户创建

数据库为空

发送包含有效负载的 POST 请求

用户创建成功

2

缺少邮箱

数据库为空

发送仅包含姓名的 POST 请求

返回 400 验证错误

3

无效邮箱

数据库为空

发送包含无效邮箱格式的 POST 请求

返回 422 错误消息

📂 文件输出

文件将写入:./workdir/generated/


示例日志输出

2025-09-13T10:22:11 [info]: [Step1] Incoming request: endpoint=/v1/users, method=POST
2025-09-13T10:22:11 [info]: [Step2] Building LLM prompt...
2025-09-13T10:22:13 [info]: [Step5] Converting LLM JSON to Excel rows (15 test cases)

调试

npm run inspector

Inspector 将提供一个 URL,用于在浏览器中访问调试工具。

许可证

本项目采用 MIT 许可证。
有关详细信息,请参阅 LICENSE 文件。

Install Server
A
license - permissive license
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Servers

  • A
    license
    A
    quality
    F
    maintenance
    MCP server for API test case generation from Swagger/OpenAPI specs. Parses Swagger 2.0 and OpenAPI 3.x, generates test cases across 8 categories (positive, negative, boundary, auth, security, idempotency, pagination, business logic), and exports to Postman, TestRail, Allure, k6, pytest, Gherkin, and CSV. Supports internal corporate APIs with auth headers. Auto-saves export files to your working di
    10
    11
    2
    MIT
  • A
    license
    B
    quality
    C
    maintenance
    Enables QA/SDET engineers to test APIs by ingesting Swagger/OpenAPI specs and Postman collections, generating and executing tests in multiple languages and frameworks with real-time progress tracking.
    11
    81
    6
    MIT

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TuanLdv/testcase-generator-mcp-starter-qc'

If you have feedback or need assistance with the MCP directory API, please join our Discord server