TestRail协议服务器

TestRail MCP服务器是一个通过标准化协议与TestRail核心实体交互的服务,支持TestRail API认证和多种MCP客户端。

  • by Abhishek-Digha
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 abhishek-digha/testrail-mcp

使用说明

TestRail MCP服务器

TestRail的模型上下文协议(MCP)服务器,允许通过标准化协议与TestRail核心实体进行交互。

特性

  • 使用TestRail API进行身份验证
  • 访问TestRail实体:
    • 项目
    • 病例
    • 跑
    • 结果
    • 数据集
  • 完全支持模型上下文协议
  • 兼容任何MCP客户端(Claude Desktop、Cursor、Windsurf等)

与Octomind MCP一起观看它的运行

安装

通过Smithery安装

通过以下方式自动安装Claude Desktop的testrail mcp 史密瑟里:

npx -y @smithery/cli install @sker65/testrail-mcp --client claude

手动安装

  1. 克隆此存储库:

    git clone https://github.com/yourusername/testrail-mcp.git
    cd testrail-mcp
    
  2. 创建并激活虚拟环境:

    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    
  3. 安装依赖项:

    pip install -e .
    

配置

TestRail MCP服务器需要特定的环境变量才能与您的TestRail实例进行身份验证。这些必须在运行服务器之前设置。

  1. 创建一个 .env 项目根目录中的文件:

    TESTRAIL_URL=https://your-instance.testrail.io
    TESTRAIL_USERNAME=your-email@example.com
    TESTRAIL_API_KEY=your-api-key
    

    重要提示:

    • TESTRAIL_URL 应该是TestRail实例的完整URL(例如。, https://example.testrail.io)
    • TESTRAIL_USERNAME 您的TestRail电子邮件地址用于登录吗
    • TESTRAIL_API_KEY 是您的TestRail API密钥(不是您的密码)
      • 要生成API密钥,请登录TestRail,转到“我的设置”>“API密钥”并创建新密钥
  2. 验证配置是否正确加载:

    uvx testrail-mcp --config
    

    这将显示您的TestRail配置信息,包括您的URL、用户名和用于验证的API密钥的前几个字符。

如果您将此服务器与Claude Desktop或Cursor等客户端一起使用,请确保运行服务器的进程可以访问环境变量。您可能需要在系统环境中设置这些变量,或者确保它们是从 .env 文件。

用法

运行服务器

可以使用安装的脚本直接运行服务器:

uvx testrail-mcp

这将以stdio模式启动MCP服务器,该模式可用于支持stdio通信的MCP客户端。

与MCP客户端一起使用

克劳德桌面

在Claude Desktop中,添加一个具有以下配置的新服务器:

{
  "mcpServers": {
    "testrail": {
      "command": "uvx",
      "args": [
        "testrail-mcp"
      ],
      "env": {
        "TESTRAIL_URL": "https://your-instance.testrail.io",
        "TESTRAIL_USERNAME": "your-email@example.com",
        "TESTRAIL_API_KEY": "your-api-key"
      }
    }
  }
}

光标

在Cursor中,添加具有以下配置的新自定义工具:

{
  "name": "TestRail MCP",
  "command": "uvx",
  "args": [
    "testrail-mcp"
  ],
  "env": {
    "TESTRAIL_URL": "https://your-instance.testrail.io",
    "TESTRAIL_USERNAME": "your-email@example.com",
    "TESTRAIL_API_KEY": "your-api-key"
  }
}

帆板运动

在Windsurf中,添加一个具有以下配置的新工具:

{
  "name": "TestRail MCP",
  "command": "uvx",
  "args": [
    "testrail-mcp"
  ],
  "env": {
    "TESTRAIL_URL": "https://your-instance.testrail.io",
    "TESTRAIL_USERNAME": "your-email@example.com",
    "TESTRAIL_API_KEY": "your-api-key"
  }
}

MCP检验员测试

对于测试和调试,您可以使用MCP检查器:

npx @modelcontextprotocol/inspector \
  -e TESTRAIL_URL=<your-url> \
  -e TESTRAIL_USERNAME=<your-username> \
  -e TESTRAIL_API_KEY=<your-api-key> \
  uvx testrail-mcp

这将打开一个web界面,您可以在其中探索和测试所有可用的工具和资源。

发展

此服务器是使用以下方式构建的:

许可证

麻省理工学院