昆蒂努伊mcp
轻量级MCP服务器 Qontinui跑者 -实现人工智能驱动的视觉自动化。
安装
pip install qontinui-mcp快速开始
- 启动Qontinui Runner (桌面应用程序)
- 配置您的AI客户端 (克劳德桌面、克劳德代码、光标等)
添加到MCP配置中:
{
"mcpServers": {
"qontinui": {
"command": "qontinui-mcp",
"args": []
}
}
}- 通过AI运行工作流
AI现在可以:
- 加载工作流配置文件
- 运行可视化自动化工作流
- 监控执行状态
- 控制要使用的监视器
配置
环境变量:
| 变量 | 描述 | 默认值 |
|---|---|---|
QONTINUI_RUNNER_HOST | 运行程序主机地址 | 自动检测到(WSL感知) |
QONTINUI_RUNNER_PORT | 运行器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提示
常见自动化任务的参数化提示模板。提示来自运行器的聚合上下文,以提供结构化的调试、分析和验证工作流。
| 提示 | 描述 | 参数 |
|---|---|---|
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服务器缓存工具,并在以下情况下使缓存无效:
- 运行者的工具版本更改(加载配置,添加/删除测试)
- 缓存时间超过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方案进行只读数据访问,以访问跑步者数据。
URI方案: qontinui://{type}/{id}
资源类型:
| URI模式 | 描述 | MIME类型 |
|---|---|---|
qontinui://config/current | 当前加载的工作流配置 | application/json |
qontinui://logs/{type} | JSONL日志文件(通用、动作、图像识别、剧作家) | 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 | 获取跑步者状态 |
list_monitors | READ_ONLY | 列出可用监视器 |
load_config | MODIFY | 加载工作流配置文件 |
ensure_config_loaded | MODIFY | 加载配置(如果尚未加载) |
get_loaded_config | READ_ONLY | 获取加载的配置信息 |
run_workflow | EXECUTE | 按名称运行工作流 |
stop_execution | 危险 | 停止当前执行 |
任务管理工具
| 工具 | 权限 | 描述 |
|---|---|---|
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 | 获取任务运行的剧作家结果 |
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 | 读取运行程序JSONL日志文件 |
日志类型:
general-一般执行者事件actions-工作流动作/树事件image-recognition-带有匹配细节的图像识别结果playwright-剧作家测试执行结果
DOM捕获工具
| 工具 | 权限 | 描述 |
|---|---|---|
list_dom_captures | READ_ONLY | 列出DOM捕获 |
get_dom_capture | READ_ONLY | 获取DOM捕获元数据 |
get_dom_capture_html | READ_ONLY | 获取DOM捕获HTML内容 |
AWAS(人工智能网络行动标准)工具
用于与支持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服务器是一个精简的包装器,它:
- 通过MCP协议公开跑步者功能
- 为工具调用提供权限控制
- 缓存工具定义以提高性能
- 聚合结构化提示的上下文
- 通过SSE流式传输事件以进行实时监控
许可证
根据GNU Affero通用公共许可证v3.0或更高版本(AGPL-3.0或更高)授权。看 许可证 完整条款。
