@bun913/mcp-testrail

中文文档
0.19.9发布于 2026/06/09MITTypeScriptES Module构建来源已验证近 30 天下载 1.8万

原始使用文档
文档目录5 节
  1. Available Tools
  2. Usage
  3. Troubleshooting
  4. Contributing
  5. Acknowledgements

TestRail MCP Server

This Model Context Protocol (MCP) server provides tools for interacting with TestRail directly from Claude AI and other MCP-supported clients like Cursor. It allows you to manage test cases, projects, suites, runs, and more without leaving your conversation with the AI.

Available Tools

The TestRail MCP server provides the following tools:

CategoryTools
ProjectsgetProjects, getProject
SuitesgetSuites, getSuite, addSuite, updateSuite
CasesgetCase, getCases, addCase, updateCase, deleteCase, getCaseTypes, getCaseFields, copyToSection, moveToSection, getCaseHistory, updateCases, addBdd, getBdd
SectionsgetSection, getSections, addSection, moveSection, updateSection, deleteSection
RunsgetRuns, getRun, addRun, updateRun
TestsgetTests, getTest
ResultsgetResults, getResultsForCase, getResultsForRun, addResultForCase, addResultsForCases
PlansgetPlans
MilestonesgetMilestones
Shared StepsgetSharedSteps

Usage

You can connect this MCP server by setting like the below. This method uses npx to automatically download and run the latest version of the package, eliminating the need for local installation.

// Example configuration using npx
{
  "mcpServers": {
    "testrail": {
      "command": "npx",
      "args": ["@bun913/mcp-testrail@latest"],
      "env": {
        "TESTRAIL_URL": "https://your-instance.testrail.io", // Replace with your TestRail URL
        "TESTRAIL_USERNAME": "[email protected]", // Replace with your TestRail username
        "TESTRAIL_API_KEY": "YOUR_API_KEY" // Replace with your TestRail API key
      }
    }
  }
}

Troubleshooting

  • spawn npx ENOENT / spawn node ENOENT (commonly on macOS): your MCP host (Cursor, Claude Code, Claude Desktop, …) cannot find npx or node at process-spawn time. The chat UI usually surfaces this as a generic "MCP server doesn't work" with no useful detail; the per-server log is the diagnostic source of truth.

    Why it happens on macOS: GUI apps launched from the Dock, Spotlight, or Finder inherit launchd's minimal PATH (/usr/bin:/bin:/usr/sbin:/sbin). If you installed Node via a version manager (nvm, asdf, mise, fnm, Volta) or Apple Silicon Homebrew (/opt/homebrew/bin/), npx lives outside that PATH — only your shell startup file (~/.zshrc / ~/.bashrc) adds it. Your terminal works because the shell ran the startup file; the GUI-app process never did.

    Diagnose by checking the per-server log for spawn npx ENOENT:

    • Cursor: ~/Library/Application Support/Cursor/logs/<session>/window<N>/exthost/anysphere.cursor-mcp/MCP <server>.log
    • Claude Code / Claude Desktop: ~/Library/Logs/Claude/

    Fix by replacing "npx" in your MCP config with its absolute path. Run which npx in your normal terminal:

    /Users/you/.nvm/versions/node/v24.15.0/bin/npx   # nvm
    /opt/homebrew/bin/npx                            # Apple Silicon Homebrew
    /usr/local/bin/npx                               # Intel Homebrew / system Node
    

    Then update your MCP config:

    {
      "mcpServers": {
        "testrail": {
          "command": "/Users/you/.nvm/versions/node/v24.15.0/bin/npx",
          "args": ["@bun913/mcp-testrail@latest"],
          "env": {
            "TESTRAIL_URL": "https://your-instance.testrail.io",
            "TESTRAIL_USERNAME": "[email protected]",
            "TESTRAIL_API_KEY": "YOUR_API_KEY"
          }
        }
      }
    }
    

    Restart your MCP client after the change. The same fix applies to every npx-launched MCP server — if mcp-testrail is failing for this reason, your other npx-launched servers are likely failing too.

  • Authentication issues: Check your TestRail API credentials.

  • Your conversation is too long: Use limit and offset parameters for test cases and sections to paginate results.

  • HTTP 400 errors when creating/updating test cases: TestRail projects have different templates, custom fields, and required fields. This MCP server passes your parameters directly to the TestRail API — it does not validate or transform them. If you encounter 400 errors, define your project's rules in CLAUDE.md or AGENTS.md so the LLM sends the correct parameters. For example:

    # TestRail Rules for This Project
    - Project ID: 1
    - Always use template 2 (Separated Steps) when creating test cases
      - Use `customStepsSeparated` (array of step objects)
      - Do NOT send `customSteps` or `customExpected` with template 2
    - Required custom fields: custom_automation_type (default: 0)
    - Call `getCaseFields` at the start of a session to check available fields
    

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Acknowledgements

版本与发布记录

@bun913/mcp-testrail 共发布 33 个版本,首次发布于 2025/04/22;过去 12 个月发布了 15 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.19.9latest2026/06/094 个月前
0.19.82026/05/205 个月前
0.19.72026/05/096 个月前
0.19.62026/05/096 个月前
0.19.52026/04/186 个月前
0.19.42026/04/116 个月前

关于 @bun913/mcp-testrail 的常见问题

如何安装 @bun913/mcp-testrail?

在项目目录运行 npm install @bun913/mcp-testrail,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 mcp-testrail,可以用 npx mcp-testrail 直接运行。

@bun913/mcp-testrail 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@bun913/mcp-testrail 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@bun913/mcp-testrail 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.18.1。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@bun913/mcp-testrail 可以商用吗?

@bun913/mcp-testrail 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@bun913/mcp-testrail 的下载量有多少?

根据 npm 官方下载统计,@bun913/mcp-testrail 在 2026/10/09 – 2026/11/07 这 30 天内被下载 17,958 次,日均约 599 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bun913/mcp-testrail 还在维护吗?

最新版本 0.19.9 发布于 2026/06/09(4 个月前);至今共发布 33 个版本,其中过去 12 个月发布了 15 个;首次发布于 2025/04/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。