ai-testcase-generator-mcp

ai-testcase-generator-mcp

Generates comprehensive API test plans (positive, negative, and boundary/edge cases) from endpoint metadata using LLMs, and exports them as Excel files.

Category
访问服务器

README

🤖 AI Testcase Generator MCP

An Model Context Protocol(MCP) server that generates comprehensive API test plans (positive, negative, and boundary/edge cases) directly from endpoint metadata—powered by LLMs.

This is a TypeScript-based Model Context Protocol(MCP) server for QA engineers. It demonstrates core Model Context Protocol concepts by providing:

  • AI-powered tool for generating exhaustive test case plans from API endpoints and payloads
  • Prompt-driven LLM integration for quality and coverage
  • Extensible structure for future automation tooling

✨ Features

  • 🔌 MCP-compliant server (stdio transport).
  • 📝 Tool: generate_tests_excel
    • Input: endpoint, HTTP method, payload, extra context.
    • Input options:
      • Direct endpoint details: endpoint, HTTP method, payload
      • Use extraContext to provide any additional testing notes or constraints
    • OutputPut: 📊 Excel test plan with columns: Sl no, Test Name, Pre-Condition, Steps, Expected Result.
  • 🧠 Prompt-driven test generation with configurable LLM (Groq, OpenAI, Anthropic).
  • 📜 Detailed logging with Winston.

🏗️ Architecture

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]

📂 Project Structure

<details>

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: Handles all Excel (.xlsx) file creation and test plan export (modularized).
  • src/logger.ts: Provides modular logging functionality across the MCP server using Winston.
  • src/prompts/: Contains prompt templates for LLM-driven test generation.
  • assets/: Demo GIFs, Excel sample preview, and chat prompt examples.

</details>

🎥 Demo

Here’s the MCP generating test cases and exporting to Excel:

AI Testcase Designer Demo

🔍 Excel Preview

Below is a quick preview of the generated test cases:

Excel Preview

Development

Install dependencies:

npm install

Build the server:

npm run build

For development with auto-rebuild:

npm run watch

⚙️ Installation

Follow these steps to set up the AI Testcase Designer MCP server locally:

  1. Clone the repository

    git clone https://github.com/yourusername/ai-testcase-designer-mcp.git
    cd ai-testcase-designer-mcp
    
  2. Install dependencies

    npm install
    
  3. Build the server

    npm run build
    
  4. Configure the server in your MCP client

    a. Claude Desktop or any MCP-compatible client

    <details>

    • Add the following server configuration:

      • On MacOS:
        ~/Library/Application Support/Claude/claude_desktop_config.json

      • On 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"
        }
      }
    }
    

    </details>

    b. Cline (VS Code Extension)

    <details> You can also use the AI Testcase Designer MCP server with Cline, the Model Context Protocol VS Code extension.

    Quick Start:

    1. Install Cline from the VS Code Marketplace.
    2. Open the Cline sidebar (from the VS Code activity bar).
    3. Go to the "MCP Servers" section and click "Add New MCP Server".
    4. Fill in the server details:
      {
        "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. Test the connection and save.

    For a visual step-by-step guide, see below:

    Cline MCP Server Add Steps

    Cline MCP Server Connection Success

    For detailed Cline guidance, see the official docs:
    cline.bot/getting-started/installing-cline#vs-code-marketplace%3A-step-by-step-setup

</details>

🔑 API Key & Work Directory Setup

To use the AI Testcase Designer MCP.

  1. Get your Groq API key from here for free: https://console.groq.com/keys
  2. A working directory (WORK_DIR) where generated Excel test plans and server logs will be saved.

Update your config.json file like this:

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

How to Use

  1. 🖥️ Open Claude Desktop (or any MCP-compatible client).
  2. 📂 Download Sample Chat Message: sample_chat_message.txt and copy its content.
  3. ✉️ Paste the content into the chat and send the message: the AI will generate detailed test cases in Excel format.
  4. 💾 Generated Excel files and server logs are saved in your WORK_DIR folder.

▶️ Example Request

{
  "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."
  }
}

📊 Example Excel Output

<details>

Sl no Test Name Pre-Condition Steps Expected Result
1 Valid User Create DB is empty Send POST with valid payload User created successfully
2 Missing Email DB is empty Send POST with name only 400 validation error
3 Invalid Email DB is empty Send POST with invalid email format 422 error message

</details>

📂 Files Output

Files are written to: ./workdir/generated/


Sample Log Output

<details>

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)

</details>

Debugging

<details> Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector, which is available as a package script:

npm run inspector

The Inspector will provide a URL to access debugging tools in your browser.

</details>

License

This project is licensed under the MIT License.
See the LICENSE file for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选