Skip to main content
Glama

@assert-click/mcp

Assert 的 MCP 服务器 — 让您的 AI 编码助手无需离开聊天界面即可生成、运行和检查 E2E 测试。

用简单的英语描述用户流程。Assert 会生成 Playwright 测试,在真实的浏览器中执行它,并返回步骤级的测试结果和失败截图 — 所有这些都只需在 Cursor、Claude、Windsurf 或任何兼容 MCP 的代理中进行一次工具调用即可完成。

在 assert.click 免费注册 以在使用此包之前获取您的 API 密钥和项目 ID。

您的代理可以做什么

  • 生成 — 描述一个流程,获取可保存并运行的 Markdown 场景

  • 运行 — 针对真实的 Chromium 浏览器执行已保存的场景或即时 Markdown

  • 检查 — 获取步骤级的通过/失败状态、错误消息和失败截图 URL

  • 列表 — 浏览项目的已保存场景

Related MCP server: aiTest MCP Server

要求

  • Node.js >=18.17

  • 项目范围的 Assert 密钥 — 在 assert.click 获取

设置

1. 在您的仓库中创建 assert.config.json:

{
  "projectApiKey": "assert_project_key_here",
  "projectId": "project_123"
}

2. 将 MCP 服务器添加到您的代理配置中:

{
  "mcpServers": {
    "assert": {
      "command": "npx",
      "args": ["-y", "@assert-click/mcp"],
      "env": {
        "ASSERT_CONFIG": "/absolute/path/to/assert.config.json"
      }
    }
  }
}

就是这样。您的代理现在可以访问所有四个 Assert 工具。

环境变量

  • ASSERT_API_KEY: API 密钥(存储在 assert.config.json 中的替代方案)

  • ASSERT_PROJECT_ID: 可选的默认项目 ID

  • ASSERT_CONFIG: 可选的配置文件或目录路径

配置文件

MCP 服务器将从当前目录向上查找这些文件:

  • assert.config.json

  • assert.config.local.json

assert.config.local.json 会合并在 assert.config.json 之上。

如果您更喜欢基于环境变量的密钥而不是提交密钥:

{
  "projectApiKeyEnv": "ASSERT_API_KEY",
  "projectId": "project_123"
}

工具

assert_generate

根据简单的英语描述生成 Markdown 场景。

输入:

  • description: string — 用户应该能够做什么

  • url: string — 起始 URL

  • project_id?: string

  • save?: boolean — 保存到项目(默认:true)

返回:

{
  "scenario_id": "scenario_123",
  "markdown": "URL: https://example.com/login\nSCENARIO: Login\nPROCESS:\n  - Fill \"email\" with \"user@example.com\"\nEXPECT: Dashboard",
  "saved": true
}

assert_run

在真实的浏览器中执行已保存的场景或即时 Markdown。

输入:

  • scenario_id?: string

  • markdown?: string

  • project_id?: string

  • request_id?: string

必须提供 scenario_id 或 markdown 中的一个。

返回:

{
  "run_id": "run_123",
  "status": "queued",
  "estimated_duration_seconds": null
}

assert_status

获取运行的步骤级结果。

输入:

  • run_id: string

返回:

{
  "run_id": "run_123",
  "status": "passed",
  "duration_ms": 4200,
  "steps": [
    {
      "description": "Fill email",
      "status": "passed",
      "error": null,
      "screenshot_url": null
    }
  ],
  "failure_summary": null,
  "full_log_url": null
}

assert_list

列出项目的已保存场景。

输入:

  • project_id?: string

  • cursor?: string

  • limit?: number

返回:

{
  "scenarios": [
    {
      "id": "scenario_123",
      "name": "Login flow",
      "project_id": "project_123",
      "last_run_status": "passed",
      "last_run_at": "2026-03-31T10:00:00.000Z",
      "url": "https://example.com/login"
    }
  ],
  "next_cursor": null
}

错误

错误以结构化 JSON 形式返回:

{
  "error": {
    "code": "INVALID_API_KEY",
    "message": "The ASSERT_API_KEY is invalid or missing.",
    "field": null
  }
}

常见代码:

  • INVALID_API_KEY

  • SCENARIO_NOT_FOUND

  • RUN_NOT_FOUND

  • VALIDATION_ERROR

  • UPSTREAM_ERROR

许可证

MIT

Available Tools

4 tools
assert_generateA

Generate a ready-to-run E2E test scenario in Assert Markdown format from a plain-English description. Optionally save it to Assert for later execution.

Inputs: description (required), url (required), project_id, save.

assert_listA

List existing E2E test scenarios saved in Assert. Use this to audit coverage before generating new tests. Supports filtering by project and pagination.

Inputs: project_id, cursor, limit.

assert_runA

Execute a test scenario and return a run ID. Accepts either a saved scenario_id or ad-hoc markdown. Runs are async — use assert_status to poll for completion.

Inputs: scenario_id, markdown, project_id, request_id.

assert_statusA

Poll a test run for its current status and step-level results. Returns pass/fail with actionable failure details and screenshot URLs for failed steps.

Inputs: run_id (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.3/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no overlap: generate creates tests, list retrieves existing ones, run executes tests, and status checks results. The descriptions explicitly differentiate their functions, making it easy for an agent to select the right tool without confusion.

    Naming Consistency5/5

    All tool names follow a consistent 'assert_verb' pattern (assert_generate, assert_list, assert_run, assert_status), using snake_case and clear action verbs. This predictability enhances usability and reduces cognitive load for agents.

    Tool Count5/5

    With 4 tools, the server is well-scoped for E2E test management, covering the full lifecycle: generate, list, run, and status check. Each tool earns its place without bloat, making the set efficient and focused on its domain.

    Completeness5/5

    The toolset provides complete CRUD-like coverage for E2E test scenarios: create (generate), read (list), execute (run), and monitor (status). There are no obvious gaps, as it supports both saved and ad-hoc tests with actionable feedback, enabling seamless agent workflows.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers