Skip to main content

Model Context Protocol server for Zephyr Scale Cloud

Project description

MCP Zephyr Scale Cloud Server

A Model Context Protocol (MCP) server for Zephyr Scale Cloud, enabling AI assistants to interact with test management capabilities.

Features

โœ… Currently Implemented:

  • ๐Ÿฉบ API Health Monitoring - Check connectivity and authentication status
  • โญ Priority Management - Create, read, update priorities across projects
  • ๐Ÿ“Š Status Management - Manage test execution statuses with type filtering
  • ๐Ÿ“ Folder Management - Organize test artifacts with hierarchical folder structure
  • ๐Ÿงช Test Case Management - Full CRUD operations for test cases with metadata
  • ๐Ÿ“ Test Steps & Scripts - Manage test step definitions and scripts (plain/BDD)
  • ๐Ÿ”— Test Case Links - Link test cases to Jira issues and web resources
  • ๐Ÿ“‹ Test Case Retrieval - Advanced pagination and filtering capabilities
  • ๐Ÿ“š Version Management - Test case version history and retrieval
  • ๐Ÿ”ง Production Ready - Server lifespan management and structured logging
  • ๐Ÿงช Comprehensive Testing - Unit tests, integration tests, and CI/CD pipeline
  • ๐Ÿ“ Type Safety - Pydantic schema validation for all API operations

๐Ÿšง Planned Features:

Based on the Zephyr Scale Cloud API documentation, the following major categories are planned for implementation:

  • ๐Ÿ”„ Test Cycle Management - Create, read, update test cycles with metadata
  • ๐Ÿ“ˆ Test Execution Management - Create, read, update test executions and results
  • ๐Ÿ“‹ Test Plan Management - Test plan operations and organization
  • ๐ŸŒ Environment Management - Test environment configuration and management
  • ๐Ÿ‘ฅ Project Management - Project information and configuration
  • ๐Ÿ”— Advanced Link Management - Delete links and enhanced link operations
  • ๐Ÿค– Automation Integration - Custom, Cucumber, and JUnit test execution automation
  • ๐Ÿ“Š Issue Link Coverage - Comprehensive Jira issue link coverage tracking

Installation

Using Poetry (recommended):

git clone https://github.com/basterboy/mcp-zephyr-scale-cloud.git
cd mcp-zephyr-scale-cloud
poetry install

Or using pip:

pip install mcp-zephyr-scale-cloud

Configuration

Create a .env file with your Zephyr Scale Cloud credentials:

ZEPHYR_SCALE_API_TOKEN=your_api_token_here
ZEPHYR_SCALE_BASE_URL=https://api.zephyrscale.smartbear.com/v2

# Optional: Default project key for tools that support it
ZEPHYR_SCALE_DEFAULT_PROJECT_KEY=MYPROJ

Environment Variable Fallback

Many tools now support automatic project key resolution. If you have access to multiple projects, you can set ZEPHYR_SCALE_DEFAULT_PROJECT_KEY to avoid specifying the project key in every tool call. Tools like get_test_cases, get_folders, and others will automatically use this default when no explicit project key is provided.

Installation

Option 1: Install from GitHub Releases (Recommended)

Download and install the latest release directly from GitHub:

# Download the latest wheel file from GitHub releases
pip install https://github.com/basterboy/mcp-zephyr-scale-cloud/releases/download/v0.1.4/mcp_zephyr_scale_cloud-0.1.4-py3-none-any.whl

Or install from the source distribution:

pip install https://github.com/basterboy/mcp-zephyr-scale-cloud/releases/download/v0.1.4/mcp_zephyr_scale_cloud-0.1.4.tar.gz

Option 2: Install from PyPI (Recommended)

Install directly from the Python Package Index:

pip install mcp-zephyr-scale-cloud

Option 3: Install from Source

For development or latest features:

git clone https://github.com/basterboy/mcp-zephyr-scale-cloud.git
cd mcp-zephyr-scale-cloud
pip install .

Verify Installation

After installation, verify it works:

python -c "import mcp_zephyr_scale_cloud; print('โœ… Successfully installed!')"

Integration with Cursor

After installing the package, add the following to your Cursor configuration:

{
  "mcpServers": {
    "zephyr-scale-cloud": {
      "command": "mcp-zephyr-scale-cloud",
      "env": {
        "ZEPHYR_SCALE_API_TOKEN": "your-zephyr-api-token",
        "ZEPHYR_SCALE_BASE_URL": "https://api.zephyrscale.smartbear.com/v2",
        "ZEPHYR_SCALE_DEFAULT_PROJECT_KEY": "YOURPROJ"
      }
    }
  }
}

Configuration Options:

  • ZEPHYR_SCALE_API_TOKEN: Your Zephyr Scale API token (required)
  • ZEPHYR_SCALE_BASE_URL: API base URL (optional, defaults to https://api.zephyrscale.smartbear.com/v2)
  • ZEPHYR_SCALE_DEFAULT_PROJECT_KEY: Default project key for tools that support it (optional)

EU Region Users:

If you're using Zephyr Scale in the EU region, set:

"ZEPHYR_SCALE_BASE_URL": "https://eu.api.zephyrscale.smartbear.com/v2"

Quick Start

  1. Set up environment variables:
cp env.template .env
# Edit .env with your Zephyr Scale API token
  1. Install and run:
poetry install
poetry run mcp-zephyr-scale-cloud

Development

  1. Clone the repository:
git clone https://github.com/basterboy/mcp-zephyr-scale-cloud.git
cd mcp-zephyr-scale-cloud
  1. Install dependencies:
poetry install --with dev
  1. Run tests:
# Run all tests
make test

# Or specific test types
make test-unit          # Unit tests only
make test-integration   # Integration tests only  
make test-fast         # Fast tests (no coverage)
make test-coverage     # Tests with detailed coverage

# Or use Poetry directly
poetry run pytest
  1. Run code quality checks:
# Run all quality checks
make lint

# Or individual tools
poetry run black .      # Code formatting
poetry run isort .      # Import sorting
poetry run ruff check . # Linting
poetry run mypy src/    # Type checking
  1. Auto-fix code issues:
make format  # Fix formatting and imports

Recent Improvements

๐Ÿš€ Major Updates:

  • Test Case Management: Full CRUD operations for test cases with advanced metadata support
  • Performance Optimization: Added comprehensive pagination guidance with max_results=1000 recommendations
  • Link Management: Test case linking to Jira issues and web resources
  • Version Control: Test case version history and retrieval capabilities
  • Environment Integration: Automatic project key resolution from environment variables
  • Enhanced Error Handling: Improved validation and user-friendly error messages

๐Ÿ”ง Technical Improvements:

  • Schema Simplification: Streamlined update operations using Pydantic model_dump()
  • Validation Enhancement: Comprehensive input validation with helpful error guidance
  • Code Quality: Extensive refactoring for maintainability and performance
  • Test Coverage: Expanded test suite covering all new functionality

Architecture

This project implements an MCP Server that connects AI assistants to Zephyr Scale Cloud:

AI Assistant (Claude) 
    โ†“ (MCP Protocol)
MCP Server (server.py) 
    โ†“ (HTTP Requests)
Zephyr Scale Cloud API

Project Structure

src/mcp_zephyr_scale_cloud/
โ”œโ”€โ”€ server.py              # MCP Server - exposes tools to AI assistants
โ”œโ”€โ”€ config.py              # Configuration management
โ”œโ”€โ”€ schemas/               # Pydantic schemas for data validation
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ base.py           # Base schemas and common types
โ”‚   โ”œโ”€โ”€ common.py         # Shared entity schemas
โ”‚   โ”œโ”€โ”€ priority.py       # Priority-specific schemas
โ”‚   โ”œโ”€โ”€ status.py         # Status-specific schemas
โ”‚   โ”œโ”€โ”€ folder.py         # Folder-specific schemas
โ”‚   โ”œโ”€โ”€ test_case.py      # Test case schemas with pagination support
โ”‚   โ”œโ”€โ”€ test_script.py    # Test script schemas
โ”‚   โ”œโ”€โ”€ test_step.py      # Test step schemas
โ”‚   โ””โ”€โ”€ version.py        # Version-specific schemas
โ”œโ”€โ”€ utils/                 # Utility functions
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ validation.py     # Input validation utilities
โ””โ”€โ”€ clients/
    โ”œโ”€โ”€ __init__.py
    โ””โ”€โ”€ zephyr_client.py   # Schema-based HTTP Client

Key Concepts

  • MCP Server (server.py): Handles the Model Context Protocol, exposes tools/resources to AI assistants with advanced lifespan management
  • HTTP Client (clients/zephyr_client.py): Schema-based client making type-safe REST API calls to Zephyr Scale Cloud
  • Pydantic Schemas (schemas/): Data validation and serialization using Pydantic models
  • Validation Utils (utils/validation.py): Input validation with comprehensive error handling
  • Configuration (config.py): Manages API tokens and settings
  • Server Lifespan: Startup validation, API connectivity testing, and graceful shutdown management

Advanced Features

๐Ÿš€ Server Lifespan Management

This MCP server implements advanced server lifespan management for robust production deployment:

  • Startup Validation: Validates configuration and tests API connectivity before accepting requests
  • Fast Failure: Reports configuration errors immediately on startup
  • Health Monitoring: Automatically tests Zephyr Scale API accessibility during initialization
  • Graceful Shutdown: Properly cleans up resources when the server stops
  • Structured Logging: Uses Python's logging module with proper log levels for production environments

Benefits:

  • ๐Ÿ”ง Better Developer Experience: Clear error messages if API token is missing
  • ๐Ÿšจ Production Ready: Fails fast instead of silently accepting broken configurations
  • ๐Ÿ“Š Monitoring: Easy to detect configuration and connectivity issues
  • ๐Ÿงน Resource Management: Proper cleanup prevents resource leaks

Testing

This project includes comprehensive testing to ensure reliability:

๐Ÿงช Test Structure

tests/
โ”œโ”€โ”€ test_basic.py           # Basic functionality tests
โ”œโ”€โ”€ unit/                   # Unit tests for individual components
โ”‚   โ”œโ”€โ”€ test_config.py      # Configuration tests
โ”‚   โ”œโ”€โ”€ test_schemas.py     # Pydantic schema tests
โ”‚   โ”œโ”€โ”€ test_validation.py  # Validation utility tests
โ”‚   โ””โ”€โ”€ test_zephyr_client.py # HTTP client tests
โ”œโ”€โ”€ integration/            # Integration tests
โ”‚   โ””โ”€โ”€ test_mcp_server.py  # MCP server integration tests
โ””โ”€โ”€ conftest.py            # Shared test fixtures

๐Ÿš€ Running Tests

# Quick test run
make test-fast

# Full test suite with coverage
make test

# Continuous testing during development
poetry run pytest tests/ --tb=short -x

# Test specific functionality
poetry run pytest tests/test_basic.py -v

๐Ÿ“Š Test Coverage

  • Unit Tests: Test individual components in isolation
  • Integration Tests: Test MCP server functionality end-to-end
  • Schema Tests: Validate Pydantic models and API contracts
  • Validation Tests: Ensure input validation works correctly

๐Ÿ”ง CI/CD

Tests run automatically on:

  • GitHub Actions: On push/PR to main branch
  • Multiple Python versions: 3.10, 3.11, 3.12
  • Code quality checks: Formatting, linting, type checking

MCP Tools

This server provides 25 MCP tools for Zephyr Scale Cloud integration:

Category Tools Description
Health 1 tool API connectivity and authentication
Priorities 4 tools Full CRUD operations for priority management
Statuses 4 tools Full CRUD operations for status management
Folders 3 tools Folder management and organization
Test Steps 2 tools Test step retrieval and creation
Test Scripts 2 tools Test script retrieval and creation
Test Cases 7 tools Complete test case management suite
Test Case Links 2 tools Link management for test cases
Total 25 tools Production-ready MCP server

Currently Available:

๐Ÿฉบ Health & Connectivity

  • healthcheck - Check Zephyr Scale Cloud API connectivity and authentication status

โญ Priority Management

  • get_priorities - Get all priorities with optional project filtering
  • get_priority - Get details of a specific priority by ID
  • create_priority - Create a new priority in a project
  • update_priority - Update an existing priority

๐Ÿ“Š Status Management

  • get_statuses - Get all statuses with optional project and type filtering
  • get_status - Get details of a specific status by ID
  • create_status - Create a new status in a project
  • update_status - Update an existing status

๐Ÿ“ Folder Management

  • get_folders - Get all folders with optional project and type filtering
  • get_folder - Get details of a specific folder by ID
  • create_folder - Create a new folder in a project

๐Ÿ“ Test Step Management

  • get_test_steps - Retrieve test steps for a specific test case with pagination support
  • create_test_steps - Create test steps for a test case with APPEND/OVERWRITE modes

๐Ÿ“„ Test Script Management

  • get_test_script - Retrieve test script for a specific test case
  • create_test_script - Create or update test script with plain text or BDD format

๐Ÿ“‹ Test Case Management

  • get_test_case - Get detailed test case information including metadata, status, priority, and content
  • get_test_cases - Retrieve test cases with advanced offset-based pagination and filtering
  • create_test_case - Create new test cases with comprehensive metadata support
  • update_test_case - Update existing test cases with validation and error handling
  • get_test_case_versions - Retrieve version history for test cases
  • get_test_case_version - Get specific version of a test case
  • get_links - Get all links (issues + web links) associated with a test case

๐Ÿ”— Test Case Links

  • create_issue_link - Link test cases to Jira issues for traceability
  • create_web_link - Add web links to test cases for documentation

๐Ÿ“Š Status Operations Guide

Status operations allow you to manage test execution statuses in Zephyr Scale Cloud. Each status can be associated with different entity types:

Status Types:

  • TEST_CASE - For test case statuses
  • TEST_PLAN - For test plan statuses
  • TEST_CYCLE - For test cycle statuses
  • TEST_EXECUTION - For test execution statuses

Example Usage:

# Get all statuses for a specific project and type
statuses = await get_statuses(
    project_key="MYPROJ",
    status_type="TEST_EXECUTION",
    max_results=100
)

# Create a new test execution status
new_status = await create_status(
    project_key="MYPROJ",
    name="In Review",
    status_type="TEST_EXECUTION",
    description="Test is under review",
    color="#FFA500"
)

# Update an existing status
updated = await update_status(
    status_id=123,
    project_id=456,
    name="Reviewed",
    index=5,
    description="Test has been reviewed and approved"
)

Status Properties:

  • Name: Human-readable status name (max 255 chars)
  • Type: One of the four status types listed above
  • Description: Optional detailed description (max 255 chars)
  • Color: Optional hex color code (e.g., '#FF0000')
  • Index: Position/order in status lists
  • Default: Whether this is the default status for the type
  • Archived: Whether the status is archived

๐Ÿ“ Folder Operations Guide

Folder operations allow you to organize and manage test artifacts in Zephyr Scale Cloud. Folders provide hierarchical structure for test cases, test plans, and test cycles.

Folder Types:

  • TEST_CASE - For organizing test cases
  • TEST_PLAN - For organizing test plans
  • TEST_CYCLE - For organizing test cycles

Example Usage:

# Get all folders for a specific project and type
folders = await get_folders(
    project_key="MYPROJ",
    folder_type="TEST_CASE",
    max_results=100
)

# Create a new root folder
root_folder = await create_folder(
    name="Smoke Tests",
    project_key="MYPROJ",
    folder_type="TEST_CASE"
    # parent_id is None for root folders
)

# Create a child folder
child_folder = await create_folder(
    name="Login Tests",
    project_key="MYPROJ", 
    folder_type="TEST_CASE",
    parent_id=123  # ID of the parent folder
)

# Get details of a specific folder
folder_details = await get_folder(folder_id=456)

Folder Properties:

  • Name: Human-readable folder name (1-255 chars)
  • Type: One of the three folder types listed above
  • Project Key: Jira project key where the folder belongs
  • Parent ID: ID of parent folder (null for root folders)
  • Index: Position/order within the parent folder
  • ID: Unique identifier assigned by Zephyr Scale

Folder Hierarchy:

  • Folders can be nested to create hierarchical organization
  • Root folders have parent_id = null
  • Child folders reference their parent via parent_id
  • Each folder type maintains its own hierarchy within a project

๐Ÿ”ง Test Case Management Guide

The test case management tools provide comprehensive CRUD operations for managing test cases in Zephyr Scale Cloud.

Key Features:

  • Full CRUD Operations: Create, read, update, and retrieve test cases
  • Advanced Pagination: Efficient offset-based pagination with performance optimizations
  • Version Management: Access to test case version history
  • Link Management: Connect test cases to Jira issues and web resources
  • Rich Metadata: Support for priorities, statuses, folders, components, and custom fields
  • Environment Integration: Automatic project key resolution from environment variables

Pagination Performance Tips:

  • Use max_results=1000 for fastest bulk data retrieval
  • Follow offset-based pagination: start_at = current_start_at + max_results
  • Ensure start_at is a multiple of max_results (API requirement)
  • Check len(values) < max_results to detect the last page

Example Usage:

# Get test cases with maximum performance
test_cases = await get_test_cases(
    project_key="MYPROJ",
    max_results=1000,  # Maximum for best performance
    start_at=0
)

# Create a comprehensive test case
new_test_case = await create_test_case(
    name="Login functionality test",
    project_key="MYPROJ",
    objective="Verify user can log in successfully",
    priority_name="High",
    status_name="Draft",
    folder_id=123,
    labels=["smoke", "authentication"]
)

# Update test case with validation
updated = await update_test_case(
    test_case_key="MYPROJ-T123",
    name="Updated login test",
    priority_id=456,
    status_id=789
)

# Link to Jira issue for traceability
link_result = await create_issue_link(
    test_case_key="MYPROJ-T123",
    issue_id=456789
)

License

MIT License - see LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_zephyr_scale_cloud-0.1.4.tar.gz (36.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_zephyr_scale_cloud-0.1.4-py3-none-any.whl (38.7 kB view details)

Uploaded Python 3

File details

Details for the file mcp_zephyr_scale_cloud-0.1.4.tar.gz.

File metadata

  • Download URL: mcp_zephyr_scale_cloud-0.1.4.tar.gz
  • Upload date:
  • Size: 36.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for mcp_zephyr_scale_cloud-0.1.4.tar.gz
Algorithm Hash digest
SHA256 fb8fd30fd6fee24ee4faec445c9260e2bf0379a58b087f13f6f7df9f1ed4ca47
MD5 da31f784f2d59c83c1aca244fb0c69ee
BLAKE2b-256 9a898161b25762f584137ed6c416e866d2eb4a559e787e912ac0ab791ecfb745

See more details on using hashes here.

File details

Details for the file mcp_zephyr_scale_cloud-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_zephyr_scale_cloud-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 50a64a143b7f607d4e4387dbf15a3a2c9a19589d075c7b9c0da60332ed7900ea
MD5 167f420bd10570d02d45675b10adf5e2
BLAKE2b-256 658c16f731555f1e0480d918d221a6252d786076f3b937ad2654fa44c0a2cd4b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page