Skip to main content
Glama
sker65

TestRail MCP Server

by sker65

TestRail MCP 服务器

铁匠徽章

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

特征

  • 使用 TestRail API 进行身份验证

  • 访问 TestRail 实体:

    • 项目

    • 案例

    • 运行

    • 结果

    • 数据集

  • 全面支持模型上下文协议

  • 与任何 MCP 客户端兼容(Claude Desktop、Cursor、Windsurf 等)

Related MCP server: JMeter MCP Server

与 Octomind MCP 一起查看实际运行情况

视频标题

安装

通过 Smithery 安装

要通过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 ://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 Inspector 进行测试

为了进行测试和调试,您可以使用 MCP Inspector:

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

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

发展

该服务器使用以下方式构建:

  • FastMCP - 用于构建 MCP 服务器的 Python 框架

  • 请求- 用于与 TestRail API 进行 HTTP 通信

  • python-dotenv - 用于环境变量管理

执照

麻省理工学院

Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

Resources

Looking for Admin?

Admins can modify the Dockerfile, update the server description, and track usage metrics. If you are the server author, to access the admin panel.

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/sker65/testrail-mcp'

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