Skip to content

zephyr_create_test_script: "fetch failed" on every POST call (v0.15.0) #394

@ppetipp

Description

@ppetipp

Bug Report

Package: @smartbear/mcp v0.15.0
Tool: zephyr_create_test_script
Affects: All POST calls to /testcases/{key}/testscript

Steps to Reproduce

  1. Configure @smartbear/mcp with a valid ZEPHYR_API_TOKEN
  2. Call zephyr_create_test_script with a valid test case key, type: "bdd", and a Gherkin step text
  3. Observe the error

Expected Behavior

The test script is created and the tool returns a success response.

Actual Behavior

Error: fetch failed

The error occurs consistently on every attempt. Note: zephyr_get_test_script (GET on the same endpoint) works fine — only the POST call fails.

Root Cause (suspected)

Looking at src/zephyr/tool/test-case/create-test-script.ts, the post() call has no try-catch. Any exception (network error, API validation error, etc.) propagates uncaught → the MCP runtime catches it as a generic "fetch failed" with no further detail.

Additionally, the tool returns content: [] on success, so even a successful call discards the API response body — making debugging impossible from the client side.

Workaround

A direct HTTP call to the same endpoint works correctly:

import json, urllib.request

token = "<ZEPHYR_API_TOKEN>"
payload = json.dumps({"type": "bdd", "text": "Given ...\nWhen ...\nThen ..."}).encode()
req = urllib.request.Request(
    "https://api.zephyrscale.smartbear.com/v2/testcases/PROJ-TXXX/testscript",
    data=payload,
    headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"},
    method="POST"
)
with urllib.request.urlopen(req) as r:
    print(r.status, r.read().decode())

Environment

  • @smartbear/mcp version: 0.15.0
  • Platform: Linux
  • MCP client: Claude Code + Windsurf (Codeium)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions