Skip to main content
Glama
allure-testops-mcp

allure-testops-mcp

allure-testops-mcp

PyPI Python License: MIT Tests

Allure TestOps 的 MCP 服务器。允许 LLM 智能体(Claude Code、Cursor、OpenCode 等)通过 Allure REST API 查询项目、测试运行(launches)、测试用例和测试结果。

基于 Python、FastMCP 和 stdio 传输协议。

适用于任何 Allure TestOps 实例 — SaaS 版 qameta.io 或自托管/本地部署版。专为企业网络设计:支持配置代理绕过、可选的 SSL 验证开关以及 API 令牌认证。

设计亮点

  • 工具注解 — 每个工具都标记为 readOnlyHint: True / openWorldHint: True。所有 6 个工具均为只读;MCP 客户端不会要求确认。

  • 每个工具均提供结构化输出 — 每个工具都声明了 TypedDict 返回类型,因此 FastMCP 会自动生成 outputSchema,且每个结果都包含 structuredContent(类型化负载)和预渲染的 Markdown 文本块。

  • 结构化错误处理 — 将认证、404、403、429、5xx 和缺少环境变量等错误转换为可操作的消息(例如:“认证失败 — 请验证 ALLURE_TOKEN 是否具有 API 权限”)。

  • Pydantic 输入验证 — 每个参数都有类型约束(范围、长度、字面量),并自动公开为 JSON Schema。

  • 分页 — 列表工具返回一个包含 page、total、has_more 和 next_page 的 pagination 块。

  • 通过 MCP 上下文报告进度 — 执行多次 API 调用的工具(allure_get_project_statistics、allure_search_failed_tests)以及 allure_list_test_cases 会发出 ctx.report_progress + ctx.info 事件,以便兼容的客户端渲染进度条和步骤标签。

Related MCP server: Allure TestOps MCP

功能

涵盖日常 Allure TestOps 工作流的 6 个工具:

发现

  • allure_list_projects — 获取所有项目(包含 ID、名称、缩写)

  • allure_get_project_statistics — 获取测试用例计数、自动化率、最近一次运行摘要

运行与结果

  • allure_list_launches — 获取包含通过/失败统计信息的近期运行记录

  • allure_get_test_results — 获取某次运行中的测试结果(可按状态过滤)

  • allure_search_failed_tests — 获取最近一次或指定运行中 FAILED/BROKEN 的测试

测试用例

  • allure_list_test_cases — 获取测试用例,支持自动化/手动过滤(每个结果还包含其层级,例如 UNIT / API / E2E)

安装

需要 Python 3.10+。

# via uvx (recommended)
uvx --from allure-testops-mcp allure-testops-mcp

# or via pipx
pipx install allure-testops-mcp

配置

简短版本 — claude mcp add:

claude mcp add allure -s project \
  --env ALLURE_URL=https://allure.example.com \
  --env ALLURE_TOKEN=your-api-token \
  --env ALLURE_SSL_VERIFY=true \
  -- uvx --from allure-testops-mcp allure-testops-mcp

或者在 ~/.claude.json / 项目 .mcp.json 中配置:

{
  "mcpServers": {
    "allure": {
      "type": "stdio",
      "command": "uvx",
      "args": ["--from", "allure-testops-mcp", "allure-testops-mcp"],
      "env": {
        "ALLURE_URL": "https://allure.example.com",
        "ALLURE_TOKEN": "${ALLURE_TOKEN}",
        "ALLURE_SSL_VERIFY": "true"
      }
    }
  }
}

查看 .env.example 获取所有支持的环境变量模板。

检查:

claude mcp list
# allure: uvx --from allure-testops-mcp allure-testops-mcp - ✓ Connected

环境变量

变量

必需

描述

ALLURE_URL

是

Allure TestOps URL (例如 https://allure.example.com)

ALLURE_TOKEN

是

Allure TestOps 的 API 令牌 (个人资料 → API 令牌)

ALLURE_SSL_VERIFY

否

true/false。对于自签名企业证书,请设置为 false。默认:true。

使用示例

在 Claude Code 中:

  • “列出所有 Allure 项目”

  • “显示项目 63 的最近 10 次运行”

  • “项目 175 最近一次运行中失败的测试”

  • “项目 842 的自动化率”

  • “运行 12345 中状态为 FAILED 的测试结果”

安全考量

  • API 令牌从 ALLURE_TOKEN 环境变量读取 — 绝不会在命令行中传递,也不会写入日志。

  • 机密信息不会在工具响应中回显(没有 stat.request_headers 转储,没有 session.auth 反射)。

  • 自签名 SSL 可通过 ALLURE_SSL_VERIFY=false 选择性开启 — 默认为 true。在公共网络上禁用验证存在安全风险;仅在受信任的企业实例中使用。

  • 禁用代理发现 (session.trust_env = False) — MCP 会刻意忽略 HTTP_PROXY/HTTPS_PROXY 环境变量,因此会话不会被静默路由到非预期的代理。如果您的 Allure 实例只能通过代理访问,请在 requests 可以直接解析的环境中运行 MCP。

  • 未公开写操作 — 所有 6 个工具均为只读。即使 API 令牌具有写权限,此 MCP 服务器也无法在 Allure TestOps 中创建、修改或删除任何内容。

  • 通过 Pydantic 进行输入验证 — 每个工具参数都有类型和边界限制(ID 必须 ≥ 1,分页上限为 200-500)。

速率限制

Allure TestOps 强制执行实例级速率限制(API 令牌通常约为每分钟 60 次请求)。当遇到 HTTP 429 时,MCP 会返回一个可操作的错误,建议您:

  • 等待 30-60 秒后再重试。

  • 减小 size 参数(测试结果默认为 50,项目默认为 200)。

  • 使用更小的页面大小进行分页。

有两个工具在内部执行多次 API 调用:

  • allure_get_project_statistics — 3 次调用(TC 计数 + 运行记录 + 运行统计)。

  • allure_search_failed_tests — 2-3 次调用(解析最新运行 + FAILED + BROKEN)。

两者都使用 MCP Context 来报告每一步的进度;allure_list_test_cases 也会发出单个进度事件。请在兼容的客户端中监控进度流。

开发

git clone https://github.com/mshegolev/allure-testops-mcp.git
cd allure-testops-mcp
pip install -e '.[dev]'
pytest

直接运行服务器(stdio 传输,等待 stdin 的 MCP 消息):

ALLURE_URL=... ALLURE_TOKEN=... allure-testops-mcp

许可证

MIT © Mikhail Shchegolev

Available Tools

11 tools
allure_get_project_statisticsA
Read-onlyIdempotent

Get summary statistics for an Allure project.

Returns TC count, automation rate, and the last closed launch's pass/fail breakdown. Performs 3-4 API calls — progress is reported via MCP Context (visible as progress updates in compatible clients).

Args: project_id: Allure project ID (see allure_list_projects). ctx: MCP Context injected by FastMCP (used for progress reporting; never supplied by the agent directly).

Returns: dict with keys: - project_id (int) - total_test_cases (int) - automated_test_cases (int) - manual_test_cases (int) - automation_rate_pct (float) - last_launch_id (int | None): latest closed launch - last_launch_name (str | None) - last_launch_passed / last_launch_failed / last_launch_broken (int) - last_launch_total (int) - recent_launches_count (int): launches examined to find the latest closed one

Examples: - "How automated is project 63?" -> project_id=63, read automation_rate_pct - "What was the last passing run for project 175?" -> read last_launch_passed

Don't use when:
- You need per-test detail (use ``allure_get_test_results``).
- You need the full launch history (use ``allure_list_launches``).

Inputs: project_id (required). Returns: project_id, total_test_cases, automated_test_cases, manual_test_cases, +8 more

allure_get_test_caseA
Read-onlyIdempotent

Get one test case's full detail — fields, status/layer, tags, and steps.

Unlike allure_list_test_cases (summaries), this returns the body of a single test case: description, precondition, expected result, and the manual scenario steps (flattened with a depth marker). Use it to read or review the actual content of a test case.

Returns: dict with id, name, project_id, automated, description, precondition, expected_result, status, layer, tags and steps (each: depth, keyword, name, expected_result). steps is empty when include_scenario is false or the case has none.

Inputs: test_case_id (required), include_scenario. Returns: id, name, project_id, automated, +9 more

allure_get_test_case_custom_fieldsA
Read-onlyIdempotent

List the custom-field values set on a test case.

Returns each value flattened to field_id / field_name (the custom field) and value_id / value_name (the chosen value) — e.g. field "Priority" → value "High". These are not included in allure_get_test_case; fetch them here when you need a test case's custom-field assignments.

Inputs: test_case_id (required). Returns: test_case_id, count, custom_fields

allure_get_test_resultsA
Read-onlyIdempotent

Get individual test results inside a launch, optionally filtered by status.

Args: launch_id: Allure launch ID (from allure_list_launches). status: Filter — PASSED / FAILED / BROKEN / SKIPPED. None returns all. page: 0-based page index. size: Items per page (1-200; default 50).

Returns: dict with keys: - launch_id (int) - count (int) - pagination (dict) - results (list): each with id / name / status / duration_ms / error (first 300 chars of statusMessage)

Examples: - "FAILED tests in launch 12345" -> launch_id=12345, status="FAILED" - "All results in launch X, second page" -> launch_id=X, page=1

Don't use when:
- You want only FAILED+BROKEN (``allure_search_failed_tests`` does both in one call).

Inputs: launch_id (required), status, page, size. Returns: launch_id, count, pagination, results

allure_list_custom_fieldsA
Read-onlyIdempotent

List the custom fields defined on a project (its schema).

Returns each field's field_id, name, single_select and required. Use it to discover which custom fields a project has before reading a test case's values with allure_get_test_case_custom_fields. Built-in metadata fields (Epic/Feature/Story/Component/Suite) use negative ids; project-specific custom fields use positive ids.

Inputs: project_id (required). Returns: project_id, count, custom_fields

allure_list_launchesA
Read-onlyIdempotent

List recent launches for a project, newest first.

Each launch carries a pass/fail/broken/skipped breakdown from Allure's statistic field. Pagination info is returned in the pagination block (use next_page to continue).

Args: project_id: Allure project ID. page: 0-based page index. size: Items per page (1-100; 20 is usually enough for triage).

Returns: dict with keys: - project_id (int) - count (int): items in this response - pagination (dict): page / size / total / total_pages / has_more / next_page - launches (list): each with id / name / status / created_date / passed / failed / broken / skipped / total

Examples: - "Last 10 launches for project 63" -> project_id=63, size=10 - "Older launches beyond page 1" -> repeat with page=1

Don't use when:
- You need test results inside a launch (``allure_get_test_results``).
- You need just the latest FAILED/BROKEN tests (``allure_search_failed_tests``).

Inputs: project_id (required), page, size. Returns: project_id, count, pagination, launches

allure_list_layersA
Read-onlyIdempotent

List the test layers defined in a project (id, name).

Use this to discover valid layer names/ids before setting a layer on allure_create_test_case / allure_update_test_case. Built-in layers use negative ids (e.g. API Tests = -3).

Returns: dict with project_id, count and layers (each: id, name).

Inputs: project_id (required). Returns: project_id, count, layers

allure_list_projectsA
Read-onlyIdempotent

List all projects in the Allure TestOps instance.

Use this first to discover which project IDs exist — all other tools take a project_id that you can look up here.

Returns: dict with keys: - count (int): number of projects in this response - projects (list): each item has id, name, abbreviation

Examples: - "Which projects exist in Allure?" -> default call, take the names/ids - "Find project by abbreviation" -> iterate projects and match

Don't use when:
- You already know the project id (skip discovery, go straight to the target tool).

Inputs: page, size. Returns: count, projects

allure_list_statusesA
Read-onlyIdempotent

List the test-case statuses defined in a project (id, name, color).

Use this to discover valid status names/ids before setting a status on allure_create_test_case / allure_update_test_case. Built-in statuses use negative ids (e.g. Draft = -1).

Returns: dict with project_id, count and statuses (each: id, name, color).

Inputs: project_id (required). Returns: project_id, count, statuses

allure_list_test_casesA
Read-onlyIdempotent

List test cases for a project with optional automation and ownership filters.

Each TC carries id, name, automated, status, layer (e.g. UNIT, API, E2E), the createdBy / lastModifiedBy audit usernames, and a flat list of tag names. Caveat: the audit fields and tags are only populated when owner is set, because Allure's plain /testcase endpoint returns a compact projection that omits them — the owner path uses __search which returns the full projection.

Args: project_id: Allure project ID. ctx: MCP Context (auto-injected by FastMCP for progress reporting). automated: True — only automated, False — only manual, None — both. owner: Optional Allure username. When set, the response is narrowed to TCs where createdBy = owner OR lastModifiedBy = owner (case-sensitive, exact match), enforced server-side via Allure's RQL __search endpoint. The username must match [A-Za-z0-9._@-]+ — anything else is rejected at the MCP input layer (Pydantic pattern) to prevent RQL injection.

    **Why "creator/modifier" and not "owner".** Allure TestOps does
    not expose a separate ``owner`` field in RQL on most
    deployments — the closest stable proxy for "TCs I touched" is
    the union of ``createdBy`` and ``lastModifiedBy``.

    **Trade-off when ``owner`` is set.** ``__search`` does not
    accept the ``automated`` query parameter, so an ``automated``
    filter combined with ``owner`` is applied **client-side after
    the page is fetched**. ``pagination`` then reflects the raw
    owner-filtered set, not the further automation-filtered view —
    a fetched page of 50 may shrink. Raise ``size`` (max 200) or
    iterate ``page`` for full coverage.
page: 0-based page index.
size: Items per page (1-200; default 50).

Returns: dict with keys: - project_id (int) - count (int): items in this response (post any client-side automated filter) - pagination (dict): raw Allure paging - test_cases (list): each item carries id / name / automated / status / layer / created_by / last_modified_by / tags

Examples: - "How many manual TCs does project 63 have?" -> project_id=63, automated=False, read pagination.total - "First 200 automated TCs" -> automated=True, size=200 - "My manual TCs in project 63" -> project_id=63, automated=False, owner="jdoe", size=200

Don't use when:
- You need just the automation % (``allure_get_project_statistics``).

Inputs: project_id (required), automated, owner, page, +1 more. Returns: project_id, count, pagination, test_cases

allure_search_failed_testsA
Read-onlyIdempotent

Find FAILED and BROKEN tests in the most recent (or given) launch.

Useful for triage: "what's broken in the latest run" without listing every test. Performs up to 3 API calls; progress reported via MCP Context.

Args: project_id: Allure project ID. launch_id: Specific launch ID. If None, the latest launch is used. limit: Max failures per status (so up to 2 * limit total). ctx: MCP Context (auto-injected).

Returns: dict with keys: - launch_id (int): the resolved launch (latest if not passed in) - failed_count (int) - results (list): id / name / status / duration_ms / error

Examples: - "What's failing in project 63 right now?" -> project_id=63 - "Failures in launch 98765" -> project_id=N, launch_id=98765

Don't use when:
- You need PASSED tests too (use ``allure_get_test_results`` without status filter).

Inputs: project_id (required), launch_id, limit. Returns: launch_id, failed_count, results, reason

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.5/5.0

    Scored across 11 tools

    Disambiguation5/5

    Each tool targets a distinct entity or operation (projects, statistics, test cases, launches, results, failures, custom fields, layers, statuses) with clear boundaries and explicit 'Don't use when' guidance to prevent misselection.

    Naming Consistency5/5

    All tools follow a consistent 'allure_verb_noun' pattern (e.g., allure_list_projects, allure_get_test_case), making the naming predictable and easy to navigate.

    Tool Count5/5

    With 11 tools, the set is well-scoped for a test management server, covering essential query and list operations without being overwhelming.

    Completeness3/5

    The tools are heavily read-focused, missing create/update/delete operations for test cases and other entities, which are fundamental to full lifecycle management. The descriptions reference 'allure_create_test_case' but it is not included.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      A
      maintenance
      AI-native Model Context Protocol (MCP) server for TestRail. Lets Claude, Cursor, Windsurf, and other AI assistants browse projects, create and update test cases, kick off test runs, and record results through natural-language conversation — with strongly-typed tool schemas and per-project custom field validation that helps LLMs generate valid TestRail requests on the first try.
      27
      1,151 npm
      45
      Apache 2.0
    • A
      license
      B
      quality
      B
      maintenance
      An MCP server for Allure TestOps that enables AI agents to manage test cases, defects, test plans, and other test management entities with clear, easy-to-use tools and helpful error guidance.
      70
      408 PyPI
      8
      Apache 2.0