@qcentriq/mcp

中文文档
0.4.6发布于 2026/11/02Apache-2.0ES Module

Official Model Context Protocol (MCP) server for QCentriq automated test discovery, diagnostics, and execution.

原始使用文档
文档目录22 节
  1. ⚡ Highlights
  2. 🚀 Quick Start
  3. Using npx (No installation needed)
  4. Global Installation
  5. 📋 CLI Options & Environment Variables
  6. ⚙️ Assistant Configuration Guides
  7. 1. Claude Desktop
  8. 2. Cursor IDE
  9. 3. VS Code (Cline / Roo Code)
  10. 4. Windsurf
  11. 5. Zed
  12. 6. Gemini / Antigravity IDE
  13. 7. Claude Code CLI
  14. 🎭 Add Playwright MCP for writing tests (recommended)
  15. 🛠️ Available MCP Tools
  16. 🌐 Remote Discovery & Diagnostics (Cloud REST Endpoints)
  17. ✍️ Authoring (Cloud REST Endpoints, writes require test:wri…
  18. 💻 Local Client Tools (Executed in Your Local Workspace)
  19. 🔄 End-to-End AI Self-Healing Workflow
  20. 🔒 Security & Privacy
  21. 💻 Local Development
  22. 📄 License

@qcentriq/mcp

npm version License Node.js MCP

Official Model Context Protocol (MCP) server for QCentriq automated test discovery, error diagnostics, script retrieval, and local test execution.

Connect your AI coding assistants (Cursor, Claude Desktop, VS Code Cline / Roo Code, Windsurf, Zed, or Gemini / Antigravity) directly to your QCentriq QA projects to inspect test cases, analyze failure logs, retrieve Playwright test scripts, and validate fixes locally.

⚡ Highlights

  • Remote Cloud Discovery & Diagnostics: Instantly query test cases, groups, run logs, failure stack traces, and environment variables via authenticated REST client endpoints.
  • Local Playwright Test Execution: Safely execute tests locally with pytest without triggering unwanted cloud runners. Supports headless and headed modes across Chromium, Firefox, and WebKit.
  • Smart Environment Setup: Probes installed local Python package managers (uv, poetry, conda, or standard venv) and generates ready-to-run setup commands (prefers uv for lightning-fast setup).
  • Direct Workspace Script Saving: Download test scripts and their helper files into a dedicated qcentriq_tests/ workspace directory (kept apart from your own tests/, so an existing conftest.py is never overwritten). Before each local run there, qcentriq_run_local_test refreshes the conftest.py QCentriq cloud runs use with path traversal protections.
  • Zero-Leak Redaction: Automatically filters all outgoing tool payloads, masking API keys (qc_...), bearer tokens, and URL credentials before sending them to the LLM.
  • Strict Stdio Isolation: Protocol JSON-RPC frames communicate cleanly over stdout, while all diagnostic logs route to stderr.

🚀 Quick Start

Using npx (No installation needed)

Launch the MCP server directly using npx:

npx -y @qcentriq/mcp@latest --api-key "qc_your_api_key_here"

Or pass your configuration via environment variables:

export QCENTRIQ_API_KEY="qc_your_api_key_here"
export QCENTRIQ_BASE_URL="https://api.qcentriq.com" # Optional, defaults to production
export QCENTRIQ_PROJECT_ID="your-project-uuid"      # Optional default project ID

npx -y @qcentriq/mcp@latest

Global Installation

npm install -g @qcentriq/mcp
qcentriq-mcp --api-key "qc_your_api_key_here"

📋 CLI Options & Environment Variables

CLI OptionEnvironment VariableDefaultDescription
-k, --api-key <key>QCENTRIQ_API_KEY(Required)Your QCentriq API key (qc_...).
-u, --base-url <url>QCENTRIQ_BASE_URLhttps://api.qcentriq.comBase URL of the QCentriq backend API.
-p, --project-id <id>QCENTRIQ_PROJECT_IDundefinedOptional default project UUID (inferred from API key if omitted).
-d, --debugDEBUG or QCENTRIQ_DEBUGfalseEnable verbose debug logging to stderr.
-h, --help——Display CLI usage information and flags.

⚙️ Assistant Configuration Guides

1. Claude Desktop

Add QCentriq to your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "qcentriq": {
      "command": "npx",
      "args": ["-y", "@qcentriq/mcp@latest"],
      "env": {
        "QCENTRIQ_API_KEY": "qc_your_api_key_here",
        "QCENTRIQ_BASE_URL": "https://api.qcentriq.com",
        "QCENTRIQ_PROJECT_ID": "optional-default-project-uuid"
      }
    }
  }
}

2. Cursor IDE

In Cursor, open Settings $\to$ Features $\to$ MCP Servers $\to$ Add New MCP Server, or edit ~/.cursor/mcp.json (or .cursor/mcp.json in your repository root):

{
  "mcpServers": {
    "qcentriq": {
      "command": "npx",
      "args": ["-y", "@qcentriq/mcp@latest"],
      "env": {
        "QCENTRIQ_API_KEY": "qc_your_api_key_here",
        "QCENTRIQ_BASE_URL": "https://api.qcentriq.com"
      }
    }
  }
}

3. VS Code (Cline / Roo Code)

In VS Code with the Cline or Roo Code extension, open cline_mcp_settings.json:

{
  "mcpServers": {
    "qcentriq": {
      "command": "npx",
      "args": ["-y", "@qcentriq/mcp@latest"],
      "env": {
        "QCENTRIQ_API_KEY": "qc_your_api_key_here"
      },
      "disabled": false,
      "autoApprove": [
        "qcentriq_list_tests",
        "qcentriq_get_test",
        "qcentriq_get_test_groups",
        "qcentriq_get_test_run_logs"
      ]
    }
  }
}

4. Windsurf

In ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "qcentriq": {
      "command": "npx",
      "args": ["-y", "@qcentriq/mcp@latest"],
      "env": {
        "QCENTRIQ_API_KEY": "qc_your_api_key_here"
      }
    }
  }
}

5. Zed

In your Zed settings.json (under experimental.context_servers):

{
  "context_servers": {
    "qcentriq": {
      "command": "npx",
      "args": ["-y", "@qcentriq/mcp@latest"],
      "env": {
        "QCENTRIQ_API_KEY": "qc_your_api_key_here"
      }
    }
  }
}

6. Gemini / Antigravity IDE

In ~/.gemini/config/mcp_config.json (or .agents/mcp_config.json in workspace):

{
  "mcpServers": {
    "qcentriq": {
      "command": "npx",
      "args": ["-y", "@qcentriq/mcp@latest"],
      "env": {
        "QCENTRIQ_API_KEY": "qc_your_api_key_here",
        "QCENTRIQ_BASE_URL": "https://api.qcentriq.com"
      }
    }
  }
}

7. Claude Code CLI

Add the QCentriq MCP server using the Claude CLI:

claude mcp add qcentriq -- npx -y @qcentriq/mcp@latest --api-key "qc_your_api_key_here"

Before writing a test plan or script, the assistant is told to explore your app in a real browser with the Playwright MCP server. That way, URLs, labels and selectors come from the pages themselves instead of guesses. QCentriq MCP cannot call Playwright MCP itself, so add it to the same client next to qcentriq:

{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["@playwright/mcp@latest"]
    }
  }
}

With Claude Code: claude mcp add playwright -- npx @playwright/mcp@latest. If Playwright MCP is not connected, the assistant should say so before it writes a plan.

Sites behind HTTP basic auth (common on staging) answer 401 with a blank page until the browser logs in. The assistant is told to notice this and continue on its own. It takes the credentials from your request, or from the environment's BASIC_AUTH_USERNAME / BASIC_AUTH_PASSWORD variables (or the keys that QCENTRIQ_BASIC_AUTH_USERNAME_KEY / QCENTRIQ_BASIC_AUTH_PASSWORD_KEY name). Then it reopens the site with them in the URL, and Chromium remembers them for the rest of the session. It asks you only when the credentials are stored as secrets, because QCentriq never sends secret values to the assistant. To avoid that question, give Playwright MCP the credentials up front by starting it with --config playwright-mcp.json:

{
  "browser": {
    "contextOptions": {
      "httpCredentials": { "username": "staging-user", "password": "staging-password" }
    }
  }
}

Scripts never contain the credentials. The conftest.py QCentriq ships applies them from BASIC_AUTH_USERNAME / BASIC_AUTH_PASSWORD, which the assistant passes to qcentriq_run_local_test in env_vars for local runs.

🛠️ Available MCP Tools

The QCentriq MCP Server cleanly separates remote cloud discovery/diagnostics (connected via authenticated REST endpoints to /api/v1/mcp-client/) and local client operations (executed purely inside your machine's local workspace):

🌐 Remote Discovery & Diagnostics (Cloud REST Endpoints)

Tool NameDescriptionKey Arguments
qcentriq_list_testsDiscover test cases and test groups with status, priority, and update timestamps. Script availability is highlighted.project_id (uuid), group_id (uuid), priority ("low"|"medium"|"high"|"critical"), test_type ("web"|"api"|"mobile"), limit (int), offset (int)
qcentriq_get_testRetrieve full test case definitions, step descriptions, preconditions, latest execution diagnostics, and error stack traces.test_case_id (uuid, required), project_id (uuid)
qcentriq_get_test_groupsDiscover and inspect test groups, member test cases, test counts, and script availability.project_id (uuid), group_id (uuid), limit (int), offset (int)
qcentriq_download_scriptDownload Playwright Python test script and its helper files and save them to ./qcentriq_tests/ (the same directory qcentriq_save_script uses). Pass save_to_disk=false to only return the content.group_id (uuid, required), project_id (uuid), include_fixtures (bool, default true), save_to_disk (bool, default true), destination_dir (string, default "./qcentriq_tests")
qcentriq_get_environmentRetrieve target environment configuration, base URL (BASE_URL), environment variables, and required secret variable names for local execution.project_id (uuid), environment_id (uuid), environment_name (string)
qcentriq_get_test_run_logsFetch execution history, logs, stdout/stderr, and stack traces across single-case and suite runs.test_case_id (uuid, required), project_id (uuid), run_id (uuid), status ("failed"|"passed"|"error"), latest_only (bool), from_date (ISO date), to_date (ISO date), limit (int), offset (int)

✍️ Authoring (Cloud REST Endpoints, writes require test:write)

The intended order is: qcentriq_get_authoring_guide and qcentriq_get_environment, then explore the app with Playwright MCP, then qcentriq_create_plan, then write the script, run it with qcentriq_run_local_test until it passes, and upload it with qcentriq_save_group_script. The server sends this order to the assistant as its MCP instructions.

Both write tools send to QCentriq as soon as they are called; your MCP client's own tool-approval prompt is the check before an upload (see Security & Privacy).

Tool NameDescriptionKey Arguments
qcentriq_get_authoring_guideFetch the contract for plans and scripts: the TaskPlan JSON schema, the ${VAR} environment-variable convention, the @allure.id rules, and the available conftest fixtures. Read-only.—
qcentriq_create_planCreate test groups and test cases from an authored plan. Returns one UUID per created test case. A case whose flow failed in the browser can be created with status: "blocked" and an evidence block_reason; QCentriq re-validates it live and keeps it blocked only if it sees the same failure (block_source shows client until then). Writes.plan (object, required), project_id (uuid)
qcentriq_save_group_scriptValidate and store a test script for a group, replacing the existing one. Every unblocked case in the group must appear exactly once as @allure.id('<case_id>'); blocked cases may be left out. Only uploads a script that passed qcentriq_run_local_test with this exact content (see Local pass before upload). Checked against the version from the last download or save of the group in this session, so someone else's newer edit is refused as a conflict instead of overwritten. Writes.group_id (uuid, required), content (string, required), project_id (uuid), filename (string), fixtures (array)
qcentriq_update_test_caseEdit an existing test case (title, description, priority, preconditions, steps, expected result, target URL) instead of creating a duplicate. Requires last_updated_at from qcentriq_get_test; a newer edit by someone else is refused as a conflict. Reports script_stale when the change means the group script needs updating. Blocked status is not editable. Writes.test_case_id (uuid, required), expected_last_updated_at (string, required), plus the fields to change, project_id (uuid)
qcentriq_recheck_blocked_caseAsk QCentriq to re-validate a blocked test case against the live site. QCentriq's own agent decides the verdict: active unblocks the case and adds it to the group script (in a group whose script you wrote, you add the test yourself), blocked refreshes block_reason. The caller cannot set the verdict. Can take several minutes (client timeout 7 min). Writes.test_case_id (uuid, required), project_id (uuid)

💻 Local Client Tools (Executed in Your Local Workspace)

Tool NameDescriptionKey Arguments
qcentriq_get_setup_instructionsDetect which Python package managers (uv, poetry, conda, venv) are installed on the local system and return step-by-step commands to create a virtual environment matching the QCentriq runner container. If none are installed, the steps start by installing uv. (Read-only instructions, never runs commands).preferred_manager ("uv"|"poetry"|"conda"|"venv"), working_dir (string), env_name (string, default "qcentriq-tests"), python_version (string, default "3.12"), playwright_version (string, default "1.56.0")
qcentriq_save_scriptSave downloaded test scripts and fixtures directly into the local workspace (defaults to ./qcentriq_tests/) with path traversal guards.file_name (string, required), content (string, required), conftest_content (string), destination_dir (string, default "./qcentriq_tests")
qcentriq_run_local_testRun the test locally via pytest. Captures stdout, stderr, execution duration, and exit codes without triggering cloud runners. A whole-file pass qualifies that exact script for qcentriq_save_group_script. If no Python package manager is installed, it tells you to install uv first.file_path (string, required), test_name (string), headless (bool, default true), browser ("chromium"|"firefox"|"webkit", default "chromium"), base_url (url), env_vars (record), extra_args (array), timeout_seconds (int, default 60), working_dir (string)

🔄 End-to-End AI Self-Healing Workflow

Here is how an AI assistant (e.g. Cursor or Claude) uses @qcentriq/mcp to diagnose and fix a failing test:

sequenceDiagram
    autonumber
    actor User
    participant AI as AI Assistant
    participant MCP as QCentriq MCP Server
    participant API as QCentriq Cloud API
    participant Local as Local Workspace & Subprocess

    User->>AI: "Fix the failing login test in QCentriq"
    AI->>MCP: qcentriq_list_tests(priority="high")
    MCP->>API: GET /api/v1/mcp-client/tests
    API-->>MCP: Test cases metadata
    MCP-->>AI: List of tests

    AI->>MCP: qcentriq_get_test_run_logs(test_case_id="...")
    MCP->>API: GET /api/v1/mcp-client/tests/{id}/run-logs
    API-->>MCP: Failure trace (e.g. SelectorTimeoutError)
    MCP-->>AI: Error diagnostics & stack trace

    AI->>MCP: qcentriq_get_setup_instructions()
    MCP-->>AI: Recommended setup commands (uv venv, uv pip install ...)

    AI->>MCP: qcentriq_download_script(group_id="...")
    MCP->>API: GET /api/v1/mcp-client/groups/{id}/script
    API-->>MCP: Script & helper files
    MCP->>Local: Write qcentriq_tests/test_login.py
    MCP-->>AI: File paths confirmed

    AI->>Local: Inspect and update selector in test_login.py
    AI->>MCP: qcentriq_run_local_test(file_path="qcentriq_tests/test_login.py", headless=false)
    MCP->>Local: Run pytest with Playwright
    Local-->>MCP: Test result (PASSED)
    MCP-->>AI: PASSED (exit code 0, 1.42s)
    AI->>User: "Fixed selector in qcentriq_tests/test_login.py and verified locally!"

🔒 Security & Privacy

  • Safe Network Boundary: The client MCP server connects exclusively to ${baseUrl}/api/v1/mcp-client/ using HTTPS. Discovery and diagnostics tools only read. The authoring tools qcentriq_create_plan, qcentriq_update_test_case, qcentriq_save_group_script and qcentriq_recheck_blocked_case write to your project (creating and editing test groups/cases, replacing a group's script, and unblocking a case when QCentriq's live recheck confirms it works), and the backend rejects them unless the API key carries the test:write scope.
  • Local Pass Before Upload: qcentriq_save_group_script refuses a script unless that exact content passed qcentriq_run_local_test in the current server session, as a whole file: no test_name, node id, or -k/-m/--deselect/--lf-style filters, and at least one test passed (not all skipped). Each companion file must match the file that sat next to the script during that run and not have changed since. Passing runs are kept in memory, so after a restart the script has to be run again. If no Python package manager is installed, the refusal says to install uv first (recommended), then use qcentriq_get_setup_instructions.
  • Client-Side Control: Test executions, script modifications, and environment setups happen locally on your machine. No local code or files are uploaded without your knowledge.
  • Zero-Leak Redaction: The server actively scans and redacts API keys (qc_...), bearer tokens, and embedded basic-auth credentials before returning data to the LLM.
  • Filesystem Security: Path traversal attacks (e.g. ../../etc/passwd) are blocked when writing test scripts and fixtures to disk.
  • Stdio Integrity: All server diagnostic logs are strictly routed to stderr. Standard output (stdout) is reserved purely for JSON-RPC 2.0 communication.

💻 Local Development

# Clone the repository
git clone https://github.com/qcentriq/qcentriq.git
cd packages/qcentriq-mcp

# Install dependencies
npm install

# Run typecheck
npm run typecheck

# Run test suite
npm test

# Build production bundle with tsup
npm run build

# Run local development server with live reload
QCENTRIQ_API_KEY="qc_your_key" QCENTRIQ_BASE_URL="http://localhost:8787" npm run dev

📄 License

Apache-2.0 © QCentriq

版本与发布记录

@qcentriq/mcp 共发布 12 个版本,首次发布于 2026/09/09;过去 12 个月发布了 12 个版本。

版本发布日期距今
0.4.6latest2026/11/021 天前
0.4.52026/10/268 天前
0.4.42026/10/1420 天前
0.4.32026/10/0727 天前
0.4.22026/10/0628 天前
0.4.12026/10/011 个月前

关于 @qcentriq/mcp 的常见问题

@qcentriq/mcp 是什么?

用于QCentriq自动测试发现、诊断和执行的官方模型上下文协议(MCP)服务器。

如何安装 @qcentriq/mcp?

在项目目录运行 npm install @qcentriq/mcp,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 qcentriq-mcp,可以用 npx qcentriq-mcp 直接运行。

@qcentriq/mcp 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/qcentriq__mcp 是否存在。

@qcentriq/mcp 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@qcentriq/mcp 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.12.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@qcentriq/mcp 可以商用吗?

@qcentriq/mcp 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@qcentriq/mcp 还在维护吗?

最新版本 0.4.6 发布于 2026/11/02(1 天前);至今共发布 12 个版本,其中过去 12 个月发布了 12 个;首次发布于 2026/09/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。