mcpField
R
RobotFrameworkLibrary-to-MCP

RobotFrameworkLibrary-to-MCP

本地服务
github.com/noubar开发工具226 周前更新

关于 RobotFrameworkLibrary-to-MCP

RobotFrameworkLibrary-to-MCP 提供一种将 Robot Framework 库转换为 MCP 服务的方法,适用于希望把现有库关键字提供给 MCP 客户端的开发者。通过为库添加 to_mcp 方法,可将关键字注册为工具并以 stdio 运行。

主要功能

  1. 01将库关键字注册为 MCP 工具
  2. 02为库添加 to_mcp 方法
  3. 03通过 stdio 运行服务
  4. 04配置 MCP 客户端连接

适用场景

  1. 01将现有 Robot Framework 库接入 MCP
  2. 02让 MCP 客户端调用库关键字

MCP 相关

该项目介绍如何把 Robot Framework 库的关键字注册为 MCP 工具,并以 stdio 传输运行服务,供 MCP 客户端连接。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

RobotFrameworkLibrary-to-MCP

如何将任意 Robot Framework 库转换为 MCP 服务

操作步骤

  1. 克隆你的 Robot 库
  2. 打开文件夹并找到 __init__.py,其中会初始化带有 hybrid core 或 dynamic core 的 Library 类。 (示例)
    from robotlibcore import DynamicCore
    class LibraryName(DynamicCore):
      def __init__(self):
         ...
    
  3. 将以下函数添加到类中
    def to_mcp(self):
        from mcp.server.fastmcp import FastMCP
        mcp = FastMCP(self.__class__.__name__)
        for kw in self.keywords.values():
            mcp.add_tool(kw)
        return mcp

你可以在任意 MCP 客户端中使用它。

  1. 按下 ctrl shift p 并输入 MCP: Open Workspace Folder Configuration。(如果不存在,请点击创建)
  2. 添加以下几行
{
        "servers": {
            "LibName": {
                "type": "stdio",
                "command": "uv",
                "args": [
                    "--directory",
                    "C:\\somefolder\\ABS Path to The library Root",
                    "run",
                    "test.py"] # the new py file name where you run the server
            }
        }
}

你可以在库根目录的 py 文件中运行以下代码:

from src.LibraryName import LibraryName
if __name__ == "__main__":
    LibraryName().to_mcp().run(transport="stdio")

或者

image

就这样。

然后,你可以按下 ctrl shift p 并在以下位置查看: MCP: List Servers

Demo

I will be documenting a demo using MailClientLibrary

from src.MailClientLibrary import MailClientLibrary 
a = MailClientLibrary(Username="user", Password="pass", MailServerAddress="127.0.0.1", ImapPorts=[993,143], Pop3Ports=[995,110], SmtpPorts=[465,25]).to_mcp()
a.run(transport='stdio')
print(a)

CODEX

under project root folder add .cortex/config.toml file with the following input

[mcp_servers.mail-client]
command = "uv"
args = [
  "--directory",
  "C:\\Repos\\RobotFramework-MailClientLibrary",
  "run",
  "mail_mcp_server.py",
]
cwd = "C:\\Repos\\RobotFramework-MailClientLibrary"

open a new session and ask: ist all mcp servers you can access

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。