Skip to main content
Glama

🤖 RobotMCP - AI 驱动的测试自动化桥梁

Python Robot Framework FastMCP License

输入通俗英语,输出真正的 Robot Framework 测试——由 AI 代理替你完成输入。

RobotMCP(rf-mcp)是一个模型上下文协议(MCP)服务器,让你的编码代理掌握 Robot Framework 的能力。代理可以发现关键字,实时 针对 Browser、Selenium、Appium、Requests、数据库或桌面运行步骤,观察实际发生的情况,并且——一旦步骤通过——为你编写一份干净的 .robot 套件。没有猜测的定位器,没有幻觉关键字,没有“在我机器上能跑”。基于 Robot Framework 构建:开源,且持续演进。

刚接触 rf-mcp? 请跳转到 快速入门。想要完整了解?请参阅 MCP 工具参考配置实战示例

📺 视频教程

RobotMCP 教程

介绍

https://github.com/user-attachments/assets/ad89064f-cab3-4ae6-a4c4-5e8c241301a1


✨ 快速开始

三条命令和一句话。这就是全部设置。

1️⃣ 将其安装为工具

前置要求?

  • 安装 Python +v3.12

  • 以管理员身份在 PowerShell 中运行 > winget install astral-sh.uv # 以启用 uv 命令

  • 安装 VScode 及扩展(GitHub Copilot 并完成登录) # 以启用代理终端

  • 安装 VScode 扩展 Material Icon themes、Save Typing、Dracula、Robocorp # 以启用 robot framework

# Everything (Browser, Selenium, Appium, Requests, Database)
uv tool install "rf-mcp[all]"

# ...or just what you need — API testing is pure Python, nothing else to do:
uv tool install "rf-mcp[api]"

这会将 robotmcp 命令添加到你的 PATH。额外选项决定附带哪些测试库——请参阅安装部分的额外选项表

2️⃣ 将其接入你的编码代理

robotmcp init            # detects libraries, prints the MCP config to paste
robotmcp install         # registers rf-mcp into the agents it finds

robotmcp install 会为 Claude Code、Codex、GitHub Copilot、opencode、Gemini CLI、Kilo Code、goose 和 Cursor 写入正确的 MCP 配置——每种格式各不相同,且不会影响你的其他服务器。想手动操作?每个代理都接受:

{ "mcpServers": { "robotmcp": { "command": "robotmcp" } } }
{
  "servers": {
    "robotmcp": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "-m", "robotmcp.server"],
      "env": { "UV_COMPILE_BYTECODE": "1" }
    }
  }
}

UV_COMPILE_BYTECODE=1 会在安装时预编译依赖树。如果没有它,安装/升级后的首次服务器启动会在 MCP 握手完成前花费数秒进行 .pyc 编译(某些客户端会超时并显示服务器不可用)。这是一次性的安装时成本。

HTTP

使用 HTTP 传输启动 MCP 服务器:

uv run -m robotmcp.server --transport http --host 127.0.0.1 --port 8000

然后配置你的 AI 代理:

{
  "servers": {
    "robotmcp": {
      "type": "http",
      "url": "http://localhost:8000/mcp"
    }
  }
}

Claude Code

claude mcp add rf-mcp -- uvx rf-mcp

3️⃣ 开始测试——只需提问

Use #robotmcp to create a TestSuite and execute it step wise.
Create a test for https://www.saucedemo.com/ that:
- Logs in to https://www.saucedemo.com/ with valid credentials
- Adds two items to cart
- Completes checkout process
- Verifies success message

Use Selenium Library.
Execute the test suite stepwise and build the final version afterwards.

就这样。 rf-mcp 会引导代理完成发现、实时执行和套件生成——你只需描述测试。


Related MCP server: robotframework-mcp

📚 文档

指南

内容

快速入门

安装、接入代理、运行你的第一个测试

MCP 工具参考

rf-mcp 向代理暴露的每个工具——参数、返回值、何时使用

配置

每个 ROBOTMCP_* 环境变量和 CLI 标志

示例

可复制粘贴的 Web / API / 移动端 / 桌面 / BDD / 数据驱动演练

库插件

让 rf-mcp 了解你自己的 Robot Framework 库

指令模板

按项目调整代理行为


🛠️ 安装

快速开始 涵盖了推荐路径(uv tool install)。本节包含额外选项表、替代安装方法以及完整的代理注册详情。

额外选项

额外选项决定附带哪些 Robot Framework 库:

额外选项

添加内容

安装后

api

RequestsLibrary

web

SeleniumLibrary + Browser

Selenium:无(Selenium Manager 获取驱动程序);Browser:robotmcp init --browsers

mobile

AppiumLibrary

Appium 服务器(外部)

database

DatabaseLibrary

一个数据库驱动程序

desktop

PlatynUI 原生桌面(Windows/Linux)

Python 3.12+

frontend

Django 仪表盘

memory

持久化语义记忆(sqlite-vec + model2vec)

ROBOTMCP_MEMORY_ENABLED=true

all

上述所有 Robot Framework 库(在 Python 3.12+ 上包含 desktop

如上所述

Browser Library 还需要 Playwright 浏览器——在 rf-mcp 自己的环境中运行一次 robotmcp init --browsers(或 rfbrowser init)。Node.js 仅 Browser 需要。

其他安装方法

pip install "rf-mcp[all]"                 # pip instead of uv
uv add "rf-mcp[all]" && uv sync           # into an existing uv project

# From source (development)
git clone https://github.com/manykarim/rf-mcp.git && cd rf-mcp
uv sync --all-extras --dev

Docker

预构建镜像(用于 CI 的无头模式,以及用于可视化调试的 VNC 镜像):

docker pull ghcr.io/manykarim/rf-mcp:latest          # headless
docker run -p 8000:8000 -p 8001:8001 ghcr.io/manykarim/rf-mcp:latest    # HTTP + frontend
docker run -it --rm ghcr.io/manykarim/rf-mcp:latest uv run robotmcp     # STDIO

docker pull ghcr.io/manykarim/rf-mcp-vnc:latest      # X11 desktop over VNC/noVNC
docker run -p 8000:8000 -p 8001:8001 -p 5900:5900 -p 6080:6080 ghcr.io/manykarim/rf-mcp-vnc:latest

无头模式捆绑了 Chromium、Firefox ESR 和 Playwright 浏览器。VNC 端口:8000(MCP HTTP)、8001(前端)、5900(VNC)、6080(noVNC——http://localhost:6080/vnc.html)。

注册到编码代理

robotmcp list                              # supported agents + what's detected/registered
robotmcp install                           # interactive: registers into detected agents
robotmcp install --agents claude-code,codex,gemini
robotmcp install --agents all --scope user
robotmcp install --dry-run                 # show the plan, write nothing
robotmcp uninstall                         # safe, reversible removal

支持的代理(每种写入自己的文件/格式,其他 MCP 服务器保留):Claude Code、OpenAI Codex、GitHub Copilot、opencode、Gemini CLI、Kilo Code、goose、Cursor(以及 pi,在其配置约定确认前列为计划中)。

使用你项目的环境。 安装到具有自己设置环境(uv、poetry、pdm、pipenv、rye、hatch 或普通 .venv)的项目中,rf-mcp 将针对环境运行——因此它能看到你项目的库、关键字和资源,而不仅仅是捆绑的。它会启动解析后的命令,并在写入配置之前验证你的库是否可达;盲目的或损坏的命令会被拒绝。全局 uvx / uv tool 安装仍可为每个项目服务,无需逐项目设置。使用 -C <dir> 指定,使用 --into-project 选择将 rf-mcp 安装到项目环境中,并运行 robotmcp doctor --project-dir <dir> 查看启动时能访问到你的哪些库。

范围。 安装默认使用 --scope project(写入当前项目,例如 ./.mcp.json),前提是代理支持;使用 --scope user 进行全局(主目录)安装。goose 仅支持用户范围;GitHub Copilot 仅支持项目范围。

安全且可逆。 每次更改都记录在哈希跟踪的清单中(~/.local/state/robotmcp/install-manifest.json)。robotmcp uninstall 仅删除自安装以来未更改的条目——手动编辑的条目会保留并报告,且不会触及无关的服务器。更愿意自己编辑配置?添加 { "mcpServers": { "robotmcp": { "command": "robotmcp" } } }

🔌 库插件

通过插件系统使用自定义库扩展 RobotMCP。提供两种发现模式:

  • 入口点robotmcp.library_plugins)用于打包的插件。

  • 清单文件(JSON)位于 .robotmcp/plugins/ 下,用于工作区覆盖。

有关详细说明,请参阅库插件编写指南,并探索 examples/plugins/sample_plugin 中的示例插件以快速上手。


🖥️ 前端仪表盘

RobotMCP 附带一个可选的基于 Django 的仪表盘,可镜像活动会话、关键字和工具活动。

RobotMCP 前端仪表盘

  1. 安装前端额外选项

    pip install rf-mcp[frontend]
  2. 启用前端启动 MCP 服务器

    uv run -m robotmcp.server --with-frontend
    • 默认 URL:http://127.0.0.1:8001/

    • 快速切换:--frontend-host--frontend-port--frontend-base-path

    • 环境变量等效项:ROBOTMCP_ENABLE_FRONTEND=1ROBOTMCP_FRONTEND_HOSTROBOTMCP_FRONTEND_PORTROBOTMCP_FRONTEND_BASE_PATHROBOTMCP_FRONTEND_DEBUG

  3. 将你的 MCP 客户端(Cline、Claude Desktop 等)连接到同一服务器进程——会话激活后,仪表盘会自动流式传输事件。

要禁用某次运行的仪表盘,请省略该标志或传递 --without-frontend


📋 指令模板

RobotMCP 通过 MCP initialize 响应向 LLM 发送服务器级指令,引导它们在执行关键字之前先发现关键字。这显著减少了失败的工具调用和浪费的令牌,尤其是对于较小的 LLM。

配置

三个环境变量控制指令行为:

变量

默认

ROBOTMCP_INSTRUCTIONS

off / default / custom

default

ROBOTMCP_INSTRUCTIONS_TEMPLATE

minimal / standard / detailed / browser-focused / api-focused

standard

ROBOTMCP_INSTRUCTIONS_FILE

.txt.md 文件的路径

(无,mode=custom 时必需)

ROBOTMCP_LOG_LEVEL

DEBUG / INFO / WARNING / ERROR — stderr 日志详细程度

WARNING

ROBOTMCP_MCP_LOG_NOTIFICATIONS

设置为 1 以同时将日志作为 MCP notifications/message(结构化、带级别标签)转发给客户端

(关闭)

输出与日志。 MCP stdio 通道(stdout)仅承载 JSON-RPC;所有日志和一行就绪横幅都发送到 stderr。日志默认级别为 WARNING,以免淹没客户端——设置 ROBOTMCP_LOG_LEVEL=INFO/DEBUG 以进行故障排除。日志永远不会阻塞执行(在后台线程上以溢出丢弃方式排空),并且 fd 1 永远不会被重定向出传输层。

内置模板

模板

~Token 数

适用场景

minimal

~40

高性能 LLM(Claude Opus、GPT-4)——仅需简要提醒

standard

~400

中端 LLM(Claude Sonnet、GPT-4o)——均衡的工作流指南

detailed

~600

小型 LLM(Claude Haiku、GPT-4o-mini)——带示例的分步指导

browser-focused

~350

仅限 Web 的测试场景

api-focused

~300

仅限 API 的测试场景

示例

{
  "servers": {
    "robotmcp": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "-m", "robotmcp.server"],
      "env": {
        "ROBOTMCP_INSTRUCTIONS": "default",
        "ROBOTMCP_INSTRUCTIONS_TEMPLATE": "detailed"
      }
    }
  }
}

自定义指令

设置 ROBOTMCP_INSTRUCTIONS=custom,并通过 ROBOTMCP_INSTRUCTIONS_FILE 提供文件。自定义文件支持 {available_tools} 占位符替换。允许的扩展名:.txt.md.instruction.instructions。如果文件缺失或验证失败,服务器会自动回退到 standard 模板。

完整指南请参阅 docs/INSTRUCTION_TEMPLATES_GUIDE.md


🪝 调试附加桥接

https://github.com/user-attachments/assets/8d87cd6e-c32e-4481-9f37-48b83f69f72f

RobotMCP 内置 robotmcp.attach.McpAttach,这是一个轻量级的 Robot Framework 库,通过 localhost HTTP 桥接暴露实时的 ExecutionContext。当您从 VS Code(RobotCode)或其他 IDE 调试测试套件时,该桥接让 RobotMCP 复用进程内的变量、导入和关键字搜索顺序,而无需创建独立的上下文。

MCP 服务器设置

带传递环境变量的调试桥接示例配置

使用 UV

{
  "servers": {
    "RobotMCP": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "src/robotmcp/server.py"],
      "env": {
        "ROBOTMCP_ATTACH_HOST": "127.0.0.1",
        "ROBOTMCP_ATTACH_PORT": "7317",
        "ROBOTMCP_ATTACH_TOKEN": "change-me",
        "ROBOTMCP_ATTACH_DEFAULT": "auto"
      }
    }
  }
}

使用 Docker

{
  "servers": {
    "RobotMCP": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "ghcr.io/manykarim/rf-mcp:latest", "uv", "run", "robotmcp"],
      "env": {
        "ROBOTMCP_ATTACH_HOST": "127.0.0.1",
        "ROBOTMCP_ATTACH_PORT": "7317",
        "ROBOTMCP_ATTACH_TOKEN": "change-me",
        "ROBOTMCP_ATTACH_DEFAULT": "auto"
      }
    }
  }
}

Robot Framework 设置

在您正在调试的测试套件中导入该库并启动服务循环:

*** Settings ***
Library    robotmcp.attach.McpAttach    token=${DEBUG_TOKEN}

*** Variables ***
${DEBUG_TOKEN}    change-me

*** Test Cases ***
Serve From Debugger
    MCP Serve    port=7317    token=${DEBUG_TOKEN}    mode=blocking    poll_ms=100
    [Teardown]    MCP Stop
  • MCP Serve port=7317 token=${TOKEN} mode=blocking|step poll_ms=100 — 启动 HTTP 服务器(如果尚未运行)并处理桥接命令。在关键字主体执行期间使用 mode=step 以仅处理一个排队的请求。

  • MCP Stop — 向服务循环发出退出信号(可从测试套件或通过 RobotMCP 的 attach_stop_bridge 远程调用)。

  • MCP Process Once — 处理单个待处理请求并立即返回;适用于测试套件在测试操作之间轮询的场景。

  • MCP StartMCP Serve 的别名,用于向后兼容。

桥接默认绑定到 127.0.0.1,并期望客户端在 X-MCP-Token 头中发送共享令牌。

配置 RobotMCP 进行附加

通过环境变量提供桥接连接信息来启动 robotmcp.server 并启用附加路由(令牌必须与测试套件匹配):

export ROBOTMCP_ATTACH_HOST=127.0.0.1
export ROBOTMCP_ATTACH_PORT=7317          # optional, defaults to 7317
export ROBOTMCP_ATTACH_TOKEN=change-me    # optional, defaults to 'change-me'
export ROBOTMCP_ATTACH_DEFAULT=auto       # auto|force|off (auto routes when reachable)
export ROBOTMCP_ATTACH_STRICT=0           # set to 1/true to fail when bridge is unreachable
uv run python -m robotmcp.server

当设置了 ROBOTMCP_ATTACH_HOST 时,execute_step(..., use_context=true) 及其他上下文感知工具会首先尝试在实时调试会话中运行。使用新的 MCP 工具从任何代理管理桥接:

  • attach_status — 报告桥接的配置、可达性和诊断信息(/diagnostics)。

  • attach_stop_bridge — 发送 /stop 命令,进而触发被调试测试套件中的 MCP Stop


🎪 示例工作流

🌐 Web 应用测试(BDD)

提示词:

Use RobotMCP to create a test suite and execute it step wise.
It shall:

- Open https://demoshop.makrocode.de/
- Add item to cart
- Assert item was added to cart
- Add another item to cart
- Assert another item was added to cart
- Checkout
- Assert checkout was successful

Execute step by step and build final test suite afterwards
Create in BDD style and use Keywords with embedded arguments when applicable

结果: 采用 Given/When/Then 关键字、嵌入参数和提取变量的 BDD 风格 Robot Framework 测试套件。

🌐 Web 应用测试(数据驱动)

提示词:

Use RobotMCP to create a test suite and execute it step wise.
It shall:

- Open https://saucedemo.com
- Login with different user/password combinations
- Assert message or login

Execute step by step and build final test suite afterwards
Create in datadriven style and add multiple test rows with different scenarios
Use Test Template setting in suite

结果: 使用 Test Template 和参数化行覆盖每个登录场景的数据驱动 Robot Framework 测试套件。

📱 移动应用测试

提示词:

Use RobotMCP to create a TestSuite and execute it step wise.
It shall:
- Launch app from tests/appium/SauceLabs.apk
- Perform login flow
- Add products to cart
- Complete purchase

Appium server is running at http://localhost:4723
Execute the test suite stepwise and build the final version afterwards.

结果: 使用 AppiumLibrary 关键字和设备能力的移动测试套件。

🔌 API 测试

提示词:

Read the Restful Booker API documentation at https://restful-booker.herokuapp.com.
Use RobotMCP to create a TestSuite and execute it step wise.
It shall:

- Create a new booking
- Authenticate as admin
- Update the booking
- Delete the booking
- Verify each response

Execute the test suite stepwise and build the final version afterwards.

结果: 使用 RequestsLibrary 并带有适当错误处理的 API 测试套件。

🧪 XML/数据库测试

提示词:

Create a xml file with books and authors.
Use RobotMCP to create a TestSuite and execute it step wise.
It shall:
- Parse XML structure
- Validate specific nodes and attributes
- Assert content values
- Check XML schema compliance

Execute the test suite stepwise and build the final version afterwards.

结果: 使用 Robot Framework 的 XML 库进行 XML 处理测试。


🔍 MCP 工具

rf-mcp 以 MCP 工具的形式向代理暴露其能力,按用途分组:规划与编排、会话与执行、发现与文档、可观测性与诊断、测试套件生命周期、定位器指导、视觉验证,以及可选的持久化记忆。

完整参考: docs/MCP_TOOLS.md — 每个工具的参数、返回值及适用场景。您的代理会直接读取这些描述;您很少需要手动调用它们。

🧪 BDD 与数据驱动测试生成

BDD 风格(Given/When/Then)

提示词:

Use RobotMCP to create a test suite and execute it step wise.
It shall:

- Open https://demoshop.makrocode.de/
- Add item to cart
- Assert item was added to cart
- Add another item to cart
- Assert another item was added to cart
- Checkout
- Assert checkout was successful

Execute step by step and build final test suite afterwards
Create in BDD style and use Keywords with embedded arguments when applicable

结果: RobotMCP 逐步执行每个步骤,在操作之间检查 DOM,并生成带有 Given/When/Then 关键字的 BDD 风格测试套件:

*** Test Cases ***
Demoshop BDD Purchase Workflow
    Given the demoshop is open
    When the user adds the first product to cart
    Then the cart should contain 1 item
    When the user adds the second product to cart
    Then the cart should contain 2 items
    When the user proceeds to checkout
    And the user fills in the checkout form
    And the user places the order
    Then the order confirmation should be displayed

*** Keywords ***
the demoshop is open
    New Browser    chromium
    New Context
    New Page    ${DEMOSHOP_URL}

the user adds the first product to cart
    Click    ${FIRST_PRODUCT_BUTTON}

在逐步执行期间,使用 execute_step 上的 bdd_groupbdd_intent 来控制步骤如何分组为行为关键字。最后调用 build_test_suite(bdd_style=True)

数据驱动模板

提示词:

Use RobotMCP to create a test suite and execute it step wise.
It shall:

- Open https://saucedemo.com
- Login with different user/password combinations
- Assert message or login

Execute step by step and build final test suite afterwards
Create in datadriven style and add multiple test rows with different scenarios
Use Test Template setting in suite

结果: RobotMCP 使用 Test Template 和命名数据行构建参数化测试套件:

*** Settings ***
Library         Browser
Test Template   Verify Login

*** Test Cases ***          USERNAME            PASSWORD        EXPECTED
Valid User                  standard_user       secret_sauce    Products
Locked Out User             locked_out_user     secret_sauce    locked out
Invalid Password            standard_user       wrong_pass      Username and password do not match

使用 manage_session(action="start_test", template="Verify Login") 设置模板关键字,然后使用 manage_session(action="add_data_row", test_name="Valid User", args=["standard_user", "secret_sauce", "Products"]) 添加每一行。


🧠 小型 LLM 优化

RobotMCP 包含针对小型和中型 LLM(8K-32K 上下文窗口)的优化,可减少 token 开销并提高工具调用准确性。

动态工具配置文件

根据工作流阶段控制哪些工具对 LLM 可见。较小的模型看到更少、更紧凑的工具:

manage_session(action="set_tool_profile", tool_profile="browser_exec")

配置文件:browser_execapi_execdiscoveryminimal_execfull。将工具描述开销从约 7,000 个 token 减少到约 1,000 个。也可以通过 ROBOTMCP_TOOL_PROFILE 环境变量设置。

响应详细程度

控制响应详细程度以减少 token 消耗。大多数工具可通过 detail_level 参数使用:

  • minimal — 仅输出必要内容(减少 60-80% 的 token)

  • standard — 均衡输出(默认)

  • full — 完整详细输出

通过 ROBOTMCP_OUTPUT_VERBOSITY=compact|standard|verbose 设置默认值。

增量状态响应

get_session_state 支持增量响应,仅返回自上次调用以来发生变化的部分:

# First call returns full state (version 1):
get_session_state(session_id="...", sections=["variables", "page_source"])

# Subsequent calls return only what changed:
get_session_state(session_id="...", mode="delta", since_version=1)

mode="auto"(默认)模式下,当存在先前版本时,服务器会自动返回增量响应。对于多步骤工作流(仅变量或页面内容在步骤之间变化),这可将 token 使用量减少 50-80%。

工件外部化

大型输出(HTML 页面源码、执行日志、堆栈跟踪)会自动外部化为可获取的工件,而不是内联在响应中:

# Response includes artifact_id instead of full content:
{"result": "...", "artifact_id": "abc123", "artifact_hint": "Full page source available via fetch_artifact"}

# Fetch when needed:
fetch_artifact(artifact_id="abc123")

这使工具响应保持紧凑,同时保留按需访问完整输出的能力。

意图操作

intent_action 工具为常见测试操作提供了与库无关的入口点。它不需要 LLM 知道特定库的关键字名称和定位器语法,而是表达意图:

intent_action(intent="click", target="text=Login", session_id="...")
intent_action(intent="fill", target="#username", value="testuser", session_id="...")

服务器将意图 + 目标解析为会话活动库(Browser、SeleniumLibrary 或 AppiumLibrary)对应的正确关键字和定位器格式。

导航回退

intent_action(intent="navigate") 因没有打开浏览器或页面而失败时,服务器会自动打开浏览器/页面并重试:

  • Browser 库:执行 New Browser + New Page(如果浏览器已存在则仅执行 New Page

  • SeleniumLibrary:执行 Open Browser about:blank chrome

响应中包含 fallback_applied: truefallback_steps 计数。每个会话可节省 2-4 次工具调用。

批量执行

execute_batch 工具在单次 MCP 调用中执行多个关键字,将 N 次往返减少为 1 次。步骤可以通过 ${STEP_N} 变量引用前面步骤的结果:

execute_batch(session_id="...", steps=[
    {"keyword": "Go To", "args": ["https://example.com"]},
    {"keyword": "Get Title", "assign_to": "title"},
    {"keyword": "Should Be Equal", "args": ["${STEP_2}", "Example Domain"]}
], on_failure="recover")

如果某个步骤失败,resume_batch 允许您插入修复步骤并从失败点重试。

严格模式提示

当 Browser 库关键字因选择器匹配多个元素(Playwright 严格模式)而失败时,错误响应会包含提示,建议使用 >> nth=0(从零开始的索引)或 >> visible=true 选择器链,并附上使用实际关键字名称和元素数量的具体示例。

类型约束参数

所有 action/mode/strategy 参数都使用 Literal 类型,在 JSON Schema 中生成 enum 约束。这消除了幻觉值(例如,action="setup" 而不是 action="init")。所有值都接受不区分大小写的输入。

自动参数强制转换

常见的小型 LLM 错误会在服务器端自动纠正:

  • JSON 字符串化的数组("[\"Browser\"]")会被解析为原生数组

  • 逗号分隔的字符串("Browser,BuiltIn")会被拆分为列表

  • 已弃用的关键字(GET)会被映射到当前等效项(GET On Session

指令模板

可配置的服务器级指令引导 LLM 遵循"先发现后行动"模式。选择适合您 LLM 能力的模板大小——从适用于 Claude Opus 的 minimal(约 40 个 token)到适用于 Claude Haiku 的 detailed(约 600 个 token)。请参阅上文 指令模板


🧠 持久化语义记忆

RobotMCP 可以从过去的会话中学习并回忆成功的模式、定位器和错误修复——减少重复测试场景中的试错。

工作原理

记忆由 sqlite-vec(向量搜索)和 model2vec(256 维嵌入)驱动。启用后,服务器会:

  1. 存储每次工具调用后的成功步骤序列、有效定位器和错误→修复映射

  2. 回忆相关记忆并将其作为提示注入工具响应(例如,execute_step 失败时包含先前的修复方案,get_session_state 包含先前成功的步骤模式)

  3. 跨会话学习——热数据库在服务器重启后仍然保留

安装

pip install rf-mcp[memory]
# or
uv pip install rf-mcp[memory]

配置

通过环境变量启用:

{
  "servers": {
    "robotmcp": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "-m", "robotmcp.server"],
      "env": {
        "ROBOTMCP_MEMORY_ENABLED": "true",
        "ROBOTMCP_MEMORY_DB_PATH": "./memory.db"
      }
    }
  }
}

记忆 MCP 工具

启用记忆后,会额外提供五个工具:

工具

描述

recall_step

回忆先前成功的步骤序列。在构建新的测试步骤之前调用,以复用经过验证的模式。

recall_fix

回忆已知的错误修复方案。在 execute_step 失败后、重试之前立即调用。

recall_locator

回忆 UI 元素的有效定位器。在检查熟悉元素的 DOM 之前调用。

store_knowledge

存储领域知识(例如,站点结构、认证流程)以供将来回忆。

get_memory_status

在会话开始时检查记忆可用性和统计信息。

响应增强

记忆提示会自动注入到现有工具响应中——无需 LLM 配合:

  • execute_step 失败:错误响应中包含先前的修复方案和有效定位器

  • get_session_state:包含该场景先前成功的步骤模式

  • analyze_scenario:建议从过去会话中回忆的步骤序列

所有记忆查找都有 50ms 超时,以避免影响响应延迟。

基准测试结果

在 8 个场景(72 次 opencode 调用,每次 3 次迭代)中使用 qwen/qwen3-coder 进行测试:

场景类型

最佳结果

记忆召回率

复杂 Web 流程(结账)

-23% 调用,-22% 令牌

3/3 次迭代

重度探索式浏览

最佳迭代 -44% 调用

3/3 次迭代

API 错误恢复

-3% 调用 ±3%(最紧凑 CI)

3/3 次迭代

记忆优势在复杂、多步骤场景中最为显著,在这些场景中,过去的定位器和步骤序列可减少探索性工具调用。


⚙️ 配置

rf-mcp 以合理的默认设置运行;当您需要调整时,一切都可以通过环境变量实现——指令模板、attach 桥接、输出/令牌经济性、记忆、前端仪表盘、PlatynUI 桌面安全等。

完整参考: docs/CONFIGURATION.md — 每个 ROBOTMCP_* 变量及其可接受值和默认值,以及 robotmcp CLI 标志和子命令。

🤝 贡献

我们欢迎贡献!以下是入门方法:

  1. Fork 仓库

  2. Clone 您的 fork 到本地

  3. 安装开发依赖:uv sync

  4. 创建功能分支

  5. 添加新功能的全面测试

  6. 运行测试:uv run pytest tests/

  7. 提交 pull request

📝 更新日志

  • v0.34.0 – 原生桌面自动化(rf-mcp[desktop]、PlatynUI、Windows 就绪);项目感知安装程序,使用您项目自身的库;更精简的代理指令;修复冷启动挂起、Windows 试运行死锁和生成套件路径问题;在 FastMCP 3 上恢复工具配置文件

  • v0.31.1 – 打包清理(从 sdist 中排除测试/示例)

  • v0.31.0 – BDD/数据驱动生成、命名空间架构修复、持久记忆、71-88% 令牌减少

  • v0.30.1 – FastMCP 3.x 兼容层

  • v0.30.0 – 小型 LLM 优化(工具配置文件、意图操作、响应优化、类型约束)

  • v0.29.0 – 指令模板、多测试会话、批量执行、智能超时

📄 许可证

Apache 2.0 许可证 - 详情请参阅 LICENSE 文件。


⭐ 如果 RobotMCP 对您的测试自动化之旅有所帮助,请在 GitHub 上为我们点星!

为 Robot Framework 和 AI 自动化社区倾心打造。

Install Server
A
license - permissive license
B
quality
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    RobotMCP is a comprehensive Model Context Protocol (MCP) server that bridges the gap between human language and Robot Framework automation. It enables AI agents to understand test intentions, execute steps interactively, and generate complete test suites from successful executions.
    19
    112
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables generating Robot Framework test cases with SeleniumLibrary, creating page object models, and performing performance monitoring through natural language.
    19
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI models (Claude, ChatGPT, GitHub Copilot) to run and analyze local tests, rerun failures, and orchestrate QA workflows using existing UI and API test frameworks.
    7
    MIT

View all related MCP servers

Related MCP Connectors

  • AI-powered browser automation — navigate, click, fill forms, and extract data from any website.

  • AI QA tester — real browsers scan sites for bugs, SEO, perf, and accessibility issues via chat.

  • AI Agent with Architectural Memory. Impact analysis (free), tests and code from the graph (pro).

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/carlos-eduardo-1984/RobotFrameworkMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server