MCP server for generating API test cases from Swagger/OpenAPI specs

MCP server for generating API test cases from Swagger/OpenAPI specs

swagger-testcase-mcp•byeyaushev

Generates structured, categorized test cases from Swagger/OpenAPI specifications and exports them for test management systems and test runners.

License: Not specified•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Parses Swagger 2.0 and OpenAPI 3.x specs in JSON or YAML from URLs, internal URLs, localhost, or local files.
  • •Generates test cases across eight categories including positive, negative, boundary, auth, business logic, security, idempotency, and pagination.
  • •Exports test cases in multiple formats such as Markdown, JSON, CSV, Gherkin, Postman, k6, pytest, and TestRail CSV.
  • •Validates spec quality with scoring and compares spec versions to detect breaking changes.

BEST FOR

  • •QA teams that want to bootstrap categorized test cases from an existing API specification.
  • •Teams importing generated test cases into TestRail, Allure TestOps, Postman, or generic CSV-based test management systems.

ABOUT SWAGGER-TESTCASE-MCP

MCP server for generating API test cases from Swagger/OpenAPI specs is cataloged as an MCP server attributed to eyaushev. Generates structured, categorized test cases from Swagger/OpenAPI specifications and exports them for test management systems and test runners. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for MCP server for generating API test cases from Swagger/OpenAPI specs are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Does the generated coverage include business logic rules from the spec?

No; business logic rules not described in the OpenAPI spec are not covered automatically, though users can ask the LLM in the MCP client to extend generated test cases with business context.

Can it load specs behind authentication or on internal networks?

Yes; the server can load specs behind authentication using Authorization or custom headers, and since it runs locally, VPN or proxy settings on the machine apply.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 5babb27c951f · 采集于 2026-11-13 10:47:08 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

swagger-testcase-mcp

npm version License: MIT Node.js

MCP server for API testing: generates test cases, validates specs, compares versions, and creates mock data from Swagger/OpenAPI specifications.

Feed it your API spec URL — get structured, categorized test cases (positive, negative, boundary, auth, security, idempotency, pagination) ready for manual testing or import into your TMS.

Why

  • Writing test cases manually is slow. A single endpoint with 10+ parameters can require 30-50 test cases across positive, negative, boundary, and security scenarios. Multiply that by dozens of endpoints — and you're spending days on routine work instead of actual testing.
  • Negative and boundary cases get skipped. Under deadline pressure, QA focuses on happy paths. Edge cases, invalid inputs, and security checks are the first to be cut — and the first to cause production incidents.
  • Specs change faster than test docs, and internal APIs get left behind. New endpoints, renamed fields, changed constraints — keeping test cases in sync is constant overhead. Corporate APIs behind VPN or custom auth make it even harder, since most tooling doesn't support authenticated spec access.
  • Getting test cases into your TMS takes extra steps. Even if you write great test cases, formatting them for TestRail, Allure, or Postman import is tedious work that adds no value.

This tool automates the baseline: point it at any Swagger/OpenAPI spec (public, internal, localhost), get categorized test cases in seconds, and save ready-to-import files for your TMS or test runner. You focus on business logic and exploratory testing — the tool handles the rest.

Features

  • Parses Swagger 2.0 and OpenAPI 3.x — JSON and YAML
  • Smart test case generation — analyzes parameters, schemas, constraints, response codes, and security to produce relevant test cases
  • 8 test categories — positive, negative, boundary, authorization, business logic, security injection, idempotency, pagination & sorting
  • 9 export formats — Markdown, JSON, CSV, Allure CSV, Gherkin, Postman, k6, pytest, TestRail CSV (two templates: Steps and Text)
  • Spec validation — quality scoring with 11 rules and actionable suggestions
  • Spec comparison — diff two versions with breaking change detection
  • Mock data generation — realistic test data from schemas with locale support
  • Coverage analysis — identify gaps in test coverage with prioritized recommendations
  • Auto-save to file — exports are saved to the working directory automatically, no manual copy-paste
  • Configurable generation — filter by category, priority, locale, custom preconditions
  • Batch generation — filter by tag, HTTP method, path prefix, deprecated status
  • Works with any MCP client — Claude Desktop, Cursor, VS Code + Cline, etc.

Generated test case categories

CategoryWhat it covers
✅ PositiveHappy path with required fields, happy path with all fields
❌ NegativeMissing required fields, invalid types, empty strings, nulls, invalid enums, empty body
📏 BoundaryMin/max values for numbers, minLength/maxLength for strings
🔐 AuthNo token, invalid token, insufficient permissions
💼 Business Logic404 for non-existent resources, 409 conflicts, 429 rate limiting, concurrency
🛡️ SecurityXSS, SQL injection, path traversal, command injection, CRLF injection
🔄 IdempotencyRepeated PUT/DELETE, POST with Idempotency-Key
📄 PaginationFirst/last page, negative offset, zero limit, invalid sort fields

Installation

npm install -g swagger-testcase-mcp

Or run directly with npx:

npx swagger-testcase-mcp

Configuration

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "swagger-testcase-mcp": {
      "command": "npx",
      "args": ["-y", "swagger-testcase-mcp"]
    }
  }
}
Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "swagger-testcase-mcp": {
      "command": "npx",
      "args": ["-y", "swagger-testcase-mcp"]
    }
  }
}
VS Code + Claude Code

Add to .vscode/mcp.json:

{
  "servers": {
    "swagger-testcase-mcp": {
      "command": "npx",
      "args": ["-y", "swagger-testcase-mcp"]
    }
  }
}
VS Code + Cline

Add to Cline MCP settings:

{
  "swagger-testcase-mcp": {
    "command": "npx",
    "args": ["-y", "swagger-testcase-mcp"]
  }
}
JetBrains (WebStorm, IntelliJ, PyCharm)

Go to Settings → Tools → AI Assistant → MCP Servers → Add, select stdio and fill in:

  • Command: npx
  • Arguments: -y swagger-testcase-mcp

Or add manually to the MCP config file:

{
  "servers": {
    "swagger-testcase-mcp": {
      "command": "npx",
      "args": ["-y", "swagger-testcase-mcp"]
    }
  }
}
Windsurf

Add to ~/.windsurf/mcp.json:

{
  "mcpServers": {
    "swagger-testcase-mcp": {
      "command": "npx",
      "args": ["-y", "swagger-testcase-mcp"]
    }
  }
}

Quick Start

1. "Load the spec from https://petstore3.swagger.io/api/v3/openapi.json"
2. "Generate test cases for POST /pet"
3. "Export as Postman collection"

Here is what the generated output looks like (markdown export):

## Positive Tests (1)

### TC-001: POST /pet — happy path with required fields only

- **Priority:** high
- **Preconditions:** Valid authentication credentials are available
- **Steps:**
  1. Send POST request to /pet
  2. Include only required parameters/fields with valid values
  3. Verify response status and body
- **Input:** `{"name":"Buddy","photoUrls":["https://example.com/photo.jpg"]}`
- **Expected Result:** Returns success response with expected data
- **Expected Status:** 200

## Negative Tests (2)

### TC-002: POST /pet — missing required field "name"

- **Priority:** high
- **Preconditions:** Valid authentication credentials are available
- **Steps:**
  1. Send POST request to /pet
  2. Omit required field "name"
  3. Verify error response
- **Input:** `{"_omit":"name"}`
- **Expected Result:** Returns validation error indicating "name" is required
- **Expected Status:** 422

### TC-003: POST /pet — invalid type for "name"

- **Priority:** medium
- **Preconditions:** Valid authentication credentials are available
- **Steps:**
  1. Send POST request to /pet
  2. Set "name" to invalid type value: 12345
  3. Verify error response
- **Input:** `{"name":12345}`
- **Expected Result:** Returns validation error for invalid type of "name"
- **Expected Status:** 422

The generator produces test cases across 8 categories (positive, negative, boundary, auth, business logic, security, idempotency, pagination) -- the example above shows just a small subset. Use generate_test_cases_batch to cover an entire API at once.

For detailed examples of every tool and workflow, see EXAMPLES.md.

Available tools

ToolDescription
fetch_swaggerLoad and parse a spec from URL, internal URL, or local file (with optional auth)
analyze_endpointGet detailed info about a specific endpoint
generate_test_casesGenerate test cases for one endpoint (with optional config)
generate_test_cases_batchGenerate test cases for multiple endpoints (filter by tag/method/path prefix)
export_test_casesExport test cases and save to file (markdown, json, csv, allure_csv, gherkin, postman, k6, pytest, testrail_csv, testrail_csv_text)
compare_specsCompare two spec versions, detect breaking changes
validate_specValidate spec quality (score 0-100, 12 rules)
generate_mock_dataGenerate realistic mock data from schemas
suggest_missing_testsAnalyze test coverage and suggest improvements
clear_cacheClear cached specs and/or test cases

Generation config

All generation tools accept an optional config parameter:

{
  "config": {
    "categories": ["positive", "negative", "security"],
    "priorityFilter": ["high"],
    "maxFieldsForNegative": 15,
    "locale": "ru",
    "customPreconditions": ["Database seeded with test data"],
    "skipDeprecated": true
  }
}
ParameterDescription
categoriesWhich test categories to generate: positive, negative, boundary, auth, business_logic, security, idempotency, pagination. Default: all
priorityFilterOnly generate cases with these priorities: high, medium, low. Default: all
maxFieldsForNegativeMax number of fields for invalid-type negative cases. Default: 10
localeLanguage for test case text: en, ru. Default: en
customPreconditionsAdditional preconditions added to all generated cases
skipDeprecatedSkip deprecated endpoints in batch generation. Default: false

Export to file

All exports are automatically saved to the working directory. The filename is generated from the endpoint and format:

test-cases_POST__pet_postman.json
test-cases_GET__users_testrail_csv.csv
test-cases_POST__orders_k6.js

You can also specify a custom path:

"Export as postman to /path/to/my-collection.json"
FormatFile extension
markdown.md
json.json
csv, allure_csv, testrail_csv, testrail_csv_text.csv
gherkin.feature
postman.json
k6.js
pytest.py

Limitations

The tool generates test cases based on what is described in the OpenAPI spec — parameters, schemas, constraints, response codes, and security definitions. It does not cover:

  • Business logic — rules like "discount cannot exceed 50% for non-admin users" or "order requires at least one item in stock" are not part of the spec and won't produce test cases automatically
  • Cross-endpoint dependencies — the tool works with each endpoint in isolation. It won't generate chains like "create user → create order → check status"
  • Custom validation rules — constraints beyond what OpenAPI supports (e.g., conditional field requirements, cross-field validation) are not detected

How to compensate: since the tool runs inside an MCP client (Claude, Cursor, etc.), you can describe your business rules in the chat and ask the LLM to extend or adjust the generated test cases. The tool provides the baseline, the LLM adds the context.

Tip: The better your OpenAPI spec (constraints, enums, examples, descriptions), the more relevant the generated test cases will be. Use validate_spec to check your spec quality and get suggestions for improvement.

Supported sources

Works with any Swagger/OpenAPI spec — public, internal corporate network, localhost, or local files.

Public and local specs

"Load the spec from https://petstore3.swagger.io/api/v3/openapi.json"
"Load the spec from /path/to/swagger.json"
"Load the spec from ./api-spec.yaml"
"Load the spec from http://localhost:8080/v3/api-docs"

Internal corporate APIs

Access specs behind authentication — VPN, SSO, or internal networks:

"Load the spec from https://internal-api.company.com/docs/swagger.json with auth_header Bearer eyJhbGci..."
{
  "source": "https://internal-api.company.com/docs/swagger.json",
  "auth_header": "Bearer eyJhbGciOiJIUzI1NiIs..."
}
{
  "source": "https://internal-api.company.com/docs/swagger.json",
  "auth_header": "Basic dXNlcjpwYXNz"
}
{
  "source": "https://internal-api.company.com/docs/swagger.json",
  "headers": { "X-API-Key": "abc123" }
}

Tip: If your spec is behind a corporate VPN, make sure the MCP server process has network access to the internal URL. The server runs locally, so VPN or proxy settings on your machine apply automatically.

Integration with TMS

Allure TestOps

  1. Generate test cases and export as allure_csv
  2. Import via the Allure TestOps migration tool (configure fieldMapping to match the columns below)
  3. Columns: Name, Description, Precondition, Steps, Expected Result, Layer, Tags
  4. Or combine with the Allure TestOps MCP server to create test cases directly via API

Note: CSV import through the Allure TestOps UI was removed in version 25.3.4. Use the migration tool or API integration instead.

"Generate test cases for POST /pet"
"Export as allure_csv"

TestRail

Two export formats are available:

  • testrail_csv — Steps template (one row per step). Expected result is attached to the last step of each test case; intermediate steps have empty expected results.
  • testrail_csv_text — Text template (all steps in one field). Simpler, works with any TestRail configuration.

Steps template (recommended):

  1. Export as testrail_csv
  2. In TestRail, go to Test Cases → Import from CSV
  3. Select the "Test Case (Steps)" template
  4. Map columns: Title, Section, Type, Priority, Preconditions, Step, Expected Result
"Generate test cases for all endpoints tagged 'users'"
"Export as testrail_csv"

Text template:

"Export as testrail_csv_text"

Most TMS platforms support CSV import. Use the csv format and map columns to your TMS fields during import.

  • Qase — map title, preconditions, steps, expected_result, priority
  • Zephyr Scale — map Name, Precondition, Test Script (Plain Text), Priority, Folder
  • TestLink — use the standard CSV import wizard
"Generate test cases for GET /users"
"Export as csv"

Working with Postman

Import as Postman Collection

Generate test cases and export as a Postman Collection v2.1 that can be imported directly into Postman or run via Newman in CI:

"Load the spec from https://internal-api.company.com/docs/swagger.json with auth_header Bearer eyJ..."
"Generate test cases for POST /users"
"Export as postman"

The exported collection includes:

  • Organized folders by test category (positive, negative, security, etc.)
  • Pre-configured HTTP method, URL, headers, and request body for each test case
  • Auto-generated test scripts with expected status code assertions

Import into Postman

  1. Open Postman → Import → drag the exported JSON file
  2. The collection appears with folders for each endpoint
  3. Set up an environment with baseUrl variable pointing to your API

Run with Newman (CI)

newman run exported-collection.json \
  --environment env.json \
  --reporters cli,junit

Development

git clone https://github.com/eyaushev/swagger-testcase-mcp.git
cd swagger-testcase-mcp
npm install
npm run build
npm test
npm start

License

MIT

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for MCP server for generating API test cases from Swagger/OpenAPI specs from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/swagger-testcase-mcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools