Skip to main content
Glama
Qontinui MCP Server
by qontinui

qontinui-mcp

用于 Qontinui Runner 的轻量级 MCP 服务器 - 实现 AI 驱动的视觉自动化。

安装

pip install qontinui-mcp

Related MCP server: computer-mcp

快速入门

  1. 启动 Qontinui Runner (桌面应用程序)

  2. 配置您的 AI 客户端 (Claude Desktop, Claude Code, Cursor 等)

添加到您的 MCP 配置中:

{
  "mcpServers": {
    "qontinui": {
      "command": "qontinui-mcp",
      "args": []
    }
  }
}
  1. 通过 AI 运行工作流

AI 现在可以:

  • 加载工作流配置文件

  • 运行视觉自动化工作流

  • 监控执行状态

  • 控制使用哪个显示器

配置

环境变量:

变量

描述

默认值

QONTINUI_RUNNER_HOST

Runner 主机地址

自动检测 (支持 WSL)

QONTINUI_RUNNER_PORT

Runner HTTP 端口

9876

QONTINUI_RESULTS_DIR

自动化结果目录

.automation-results

QONTINUI_DEV_LOGS_DIR

开发日志目录

.dev-logs

功能

区域 A:SSE 事件流

通过服务器发送事件 (SSE) 进行实时事件流传输,用于监控工作流执行。

端点: /sse/events

客户端用法:

from qontinui_mcp.client import QontinuiClient

client = QontinuiClient()

def handle_event(event: dict):
    print(f"Event: {event['event_type']} - {event}")

await client.subscribe_events(callback=handle_event, timeout=60)

事件类型:

  • qontinui/execution_started - 工作流开始

  • qontinui/execution_progress - 步骤完成

  • qontinui/execution_completed - 工作流结束

  • qontinui/test_started - 测试开始

  • qontinui/test_completed - 测试结束

  • qontinui/image_recognition - 匹配成功/失败

  • qontinui/error - 发生错误

  • qontinui/warning - 非致命问题

区域 B:MCP 提示词

针对常见自动化任务的参数化提示词模板。提示词聚合来自 Runner 的上下文,以提供结构化的调试、分析和验证工作流。

提示词

描述

参数

debug_test_failure

使用结构化调试方法分析测试失败

test_id (必填), include_screenshots

analyze_screenshot

对截图进行视觉分析以进行 UI 验证

screenshot_id (必填), focus_area

fix_playwright_failure

修复失败的 Playwright 测试的结构化工作流

spec_name (必填), error_message

verify_workflow_state

验证当前 GUI 状态是否符合预期工作流状态

state_name (必填), workflow_name

create_verification_test

为 UI 行为生成验证测试

behavior_description (必填), test_type

analyze_automation_run

审查自动化运行结果并识别问题

run_id, focus_on_failures

debug_image_recognition

调试模板匹配和图像识别问题

template_name, last_n_attempts

summarize_task_progress

包含执行进度的任务状态摘要

task_run_id

analyze_verification_failure

分析验证标准失败的原因

task_id (必填), criterion_id

create_verification_plan

为功能生成验证计划

feature_description (必填), strategy

区域 C:工具缓存

基于版本的工具缓存,以优化 MCP 工具列表请求。

端点: /tool-version

响应:

{
  "version": "abc123...",
  "tool_count": 35,
  "test_count": 12
}

MCP 服务器在以下情况下缓存工具并使缓存失效:

  • Runner 的工具版本发生变化(配置已加载,测试已添加/删除)

  • 缓存超过 5 分钟(回退机制)

区域 E:权限系统

受 OpenCode 权限系统启发,对工具调用进行细粒度的权限控制。

权限级别:

级别

描述

示例工具

READ_ONLY

仅读取数据的安全操作

get_executor_status, list_monitors, read_runner_logs

EXECUTE

运行工作流或测试的操作

run_workflow, execute_test, execute_python

MODIFY

更改数据的操作

create_test, update_test, load_config

DANGEROUS

可能中断执行的操作

stop_execution, restart_runner

配置:

from qontinui_mcp.permissions import get_permission_service, PermissionLevel

service = get_permission_service()

# Auto-approve only read operations (default)
service.configure(auto_approve_levels={PermissionLevel.READ_ONLY})

# Auto-approve all operations (trusted context)
service.auto_approve_all()

# Custom permission handler
service.on_request = lambda req: input(f"Allow {req.tool_name}? (y/n)") == "y"

区域 F:MCP 资源

通过 URI 方案进行只读数据访问,用于访问 Runner 数据。

URI 方案: qontinui://{type}/{id}

资源类型:

URI 模式

描述

MIME 类型

qontinui://config/current

当前加载的工作流配置

application/json

qontinui://logs/{type}

JSONL 日志文件 (常规、操作、图像识别、Playwright)

application/jsonl

qontinui://screenshots/{id}

截图元数据和文件路径

image/png

qontinui://tests/{id}

验证测试定义

application/json

qontinui://dom/{id}

DOM 捕获 HTML 内容

text/html

qontinui://task-runs/{id}

任务运行详情

application/json

区域 G:内联 Python 执行

通过 uvx 执行任意 Python 代码,并可选择进行依赖隔离。

工具: execute_python

参数:

  • code (必填): 要执行的 Python 代码

  • dependencies: 要安装的 pip 包列表

  • timeout_seconds: 执行超时时间 (默认: 30)

  • working_directory: 执行的工作目录

示例:

# Simple calculation
result = await client.execute_python(
    code="return {'sum': 1 + 2, 'product': 3 * 4}"
)
# result.data["return_value"] == {"sum": 3, "product": 12}

# With dependencies
result = await client.execute_python(
    code="""
    import requests
    resp = requests.get('https://api.example.com/data')
    return resp.json()
    """,
    dependencies=["requests"],
)

区域 H:代理生成

通过生成具有特定任务的子代理来进行分层任务分解。

工具: spawn_sub_agent

参数:

  • task (必填): 子代理的任务描述

  • tools: 限制子代理使用的工具名称列表

  • max_iterations: 最大轮次/迭代次数 (默认: 10)

  • context: 提供的额外上下文

示例:

result = await client.spawn_sub_agent(
    task="Verify that the login form works correctly",
    tools=["run_workflow", "capture_screenshot", "execute_test"],
    max_iterations=5,
    context="The login page is at /login with username and password fields."
)

可用工具

核心工具

工具

权限

描述

get_executor_status

READ_ONLY

获取 Runner 状态

list_monitors

READ_ONLY

列出可用显示器

load_config

MODIFY

加载工作流配置文件

ensure_config_loaded

MODIFY

如果尚未加载则加载配置

get_loaded_config

READ_ONLY

获取已加载的配置信息

run_workflow

EXECUTE

按名称运行工作流

stop_execution

DANGEROUS

停止当前执行

任务管理工具

工具

权限

描述

get_task_runs

READ_ONLY

获取所有任务运行

get_task_run

READ_ONLY

获取特定任务运行详情

get_task_run_events

READ_ONLY

获取任务运行的事件

get_task_run_screenshots

READ_ONLY

获取任务运行的截图

get_task_run_playwright_results

READ_ONLY

获取任务运行的 Playwright 结果

migrate_task_run_logs

EXECUTE

将 JSONL 日志迁移到 SQLite

自动化运行工具

工具

权限

描述

get_automation_runs

READ_ONLY

获取最近的自动化运行

get_automation_run

READ_ONLY

获取特定自动化运行详情

测试管理工具

工具

权限

描述

list_tests

READ_ONLY

列出所有验证测试

get_test

READ_ONLY

按 ID 获取测试

execute_test

EXECUTE

执行验证测试

list_test_results

READ_ONLY

列出测试结果

get_test_history

READ_ONLY

获取测试历史摘要

create_test

MODIFY

创建新的验证测试

update_test

MODIFY

更新现有测试

delete_test

MODIFY

删除验证测试

测试类型:

  • playwright_cdp - 使用 Playwright 进行浏览器 DOM 断言

  • qontinui_vision - 使用图像识别进行视觉验证

  • python_script - 自定义 Python 验证逻辑

  • repository_test - 运行 pytest、Jest 或其他测试框架

日志工具

工具

权限

描述

list_screenshots

READ_ONLY

列出可用截图

read_runner_logs

READ_ONLY

读取 Runner JSONL 日志文件

日志类型:

  • general - 常规执行程序事件

  • actions - 工作流操作/树事件

  • image-recognition - 带有匹配详情的图像识别结果

  • playwright - Playwright 测试执行结果

DOM 捕获工具

工具

权限

描述

list_dom_captures

READ_ONLY

列出 DOM 捕获

get_dom_capture

READ_ONLY

获取 DOM 捕获元数据

get_dom_capture_html

READ_ONLY

获取 DOM 捕获 HTML 内容

AWAS (AI Web Action Standard) 工具

用于与支持 AWAS 标准的网站进行交互的工具。

工具

权限

描述

awas_discover

EXECUTE

为网站发现 AWAS 清单

awas_check_support

READ_ONLY

检查网站是否支持 AWAS

awas_list_actions

READ_ONLY

列出可用的 AWAS 操作

awas_execute

EXECUTE

执行 AWAS 操作

高级工具

工具

权限

描述

execute_python

EXECUTE

执行内联 Python 代码

spawn_sub_agent

EXECUTE

生成具有特定任务的子代理

示例用法

基本工作流执行

# In an AI conversation:
"Load the config at /path/to/workflow.json and run the 'login_test' workflow on the left monitor"

测试驱动验证

# Create a verification test
"Create a Playwright test that verifies the login button is visible and enabled"

# Execute the test
"Run the login_button_visible test and show me the results"

# Debug failures
"Use the debug_test_failure prompt for test abc123 with screenshots"

自动化分析

# Analyze a failed automation run
"Analyze the most recent automation run and identify why it failed"

# Debug image recognition
"Debug the template matching for the 'submit_button' template"

开发

# Clone
git clone https://github.com/qontinui/qontinui-mcp
cd qontinui-mcp

# Install dependencies
poetry install

# Run server locally
poetry run qontinui-mcp

# Run type checking
poetry run mypy src/

# Run linting
poetry run ruff check src/

架构

qontinui-mcp (MCP Server)
    |
    v
QontinuiClient (HTTP Client)
    |
    v
qontinui-runner (Desktop App, port 9876)
    |
    v
Python Subprocess (Qontinui Execution)

MCP 服务器是一个轻量级包装器,它:

  1. 通过 MCP 协议公开 Runner 功能

  2. 为工具调用提供权限控制

  3. 缓存工具定义以提高性能

  4. 为结构化提示词聚合上下文

  5. 通过 SSE 流式传输事件以进行实时监控

许可证

根据 GNU Affero 通用公共许可证 v3.0 或更高版本 (AGPL-3.0-or-later) 授权。有关完整条款,请参阅 LICENSE。

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers