Testrail Mcp Server

io.github.uarlouski由 GitHub 帳號 uarlouski 發布v3.3.1更新於 Oct 28, 2026

Connect AI assistants to TestRail: manage test cases, suites, runs, results, and attachments.

已驗證STDIO僅桌面知識與記憶開發者工具

概覽

AI 產生的概覽

本機 MCP 伺服器,將 AI 助理接入 TestRail,可瀏覽專案、管理測試案例、啟動測試執行、記錄結果並上傳附件。

可以做什麼
  • 瀏覽專案、測試套件、區段與使用者,建立 QA 結構對應
  • 取得、建立、更新與批次編輯測試案例,並查看案例欄位、歷史及選用的 RAG 匯出
  • 建立與查詢測試執行,列出測試與結果,依測試或案例 ID 提交結果
  • 上傳與查詢附件,管理共用步驟
  • 查詢狀態、優先順序、範本、標籤與組態
  • 在明確開啟刪除後刪除實體
適用情境
適合 QA 工程師與測試自動化情境:希望助理直接在對話中讀寫 TestRail,而不必複製貼上,例如草擬測試案例、啟動測試執行、標記結果或將案例匯出至知識庫。內附的命令列工具也適用於不想使用大型語言模型的 CI/CD 流程。
執行需求
透過 npx 在本機以 stdio 執行,需要 Node.js 18 以上版本。需要 TESTRAIL_INSTANCE_URL、TESTRAIL_USERNAME 與 TESTRAIL_API_KEY,以及已啟用執行個體層級 API 的 TestRail 訂閱。選用開關可控制讀取、寫入、刪除權限、停用工具與功能工具。
安裝前請注意
API 金鑰屬於憑證,應避免寫入共用的設定檔。寫入操作預設開啟,助理可建立與修改案例、執行與結果;若要唯讀,可將 TESTRAIL_ALLOW_WRITE_OPERATIONS 設為 false 或依名稱停用工具。刪除預設關閉,除非將 TESTRAIL_ALLOW_DELETE_OPERATIONS 設為 true。RAG 匯出工具標示為實驗性。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Testrail Mcp Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

🚀 TestRail MCP Server

Connect Claude, Cursor, Windsurf, and VS Code to TestRail — an open-source Model Context Protocol (MCP) server for AI-assisted test management.

Manage TestRail projects, search and create test cases, kick off test runs, record results, and attach files through natural-language conversation with your AI assistant — or from CI/CD with the bundled testrail-cli. Built for QA engineers and AI-assisted test automation.

[npm version] [npm downloads] [CI Status] [License] [TypeScript] [GitHub stars] [Score Badge] [M8ven Score] [M8ven Verified] [Smithery badge]

Compatible with: [Claude Desktop] [Cursor] [Windsurf] [VS Code]

📚 Documentation · Getting Started · Tool Reference · FAQ


What is the TestRail MCP Server?

The TestRail MCP Server is a free, open-source Model Context Protocol server that gives AI assistants direct, structured access to a TestRail instance through the TestRail API v2. Once configured, an assistant such as Claude Desktop, Cursor, Windsurf, or GitHub Copilot in VS Code can search test cases, draft new ones, start test runs, record results, and upload attachments on your behalf — without you leaving the chat window.

It exposes 35 tools, runs locally on Node.js 18+ over the MCP stdio transport, and is licensed under Apache 2.0. There is nothing to host or deploy: your MCP client launches it on demand with npx.

No context switching. No tedious copy-pasting. Just ask your AI.

[!NOTE] Compatibility baseline: tested and validated against TestRail 10.6.2 (API v2). Older TestRail instances (including pre-7.x pagination) are also supported via built-in backward compatibility. TestRail Cloud and self-hosted TestRail Server both work.

Table of contents

✨ Key Features & Capabilities

CapabilityDescription
🔍 Intelligent DiscoveryBrowse projects, test suites, and sections to automatically map your QA organization.
📋 Full Case ManagementFetch, create, update, and bulk-edit test cases with comprehensive custom field support.
▶️ Actionable ExecutionCreate test runs, update results by test_id or case_id, attach files, and track statuses.
🧠 Context-Aware AIDynamically exposes templates, fields, priorities, and statuses so LLMs generate valid, structured data.
🖥️ CLI & CI/CD NativeRun every tool from bash, GitHub Actions, GitLab CI, or Jenkins with zero LLM overhead.
🔐 Least-Privilege ControlsPer-mode permissions plus per-tool allowlisting; destructive deletes are off by default.

🚀 Quick Start Guide

1. Obtain your TestRail API key

Navigate to My Settings → API Keys in TestRail and generate a new key. Copy it immediately — TestRail shows it only once. The API must also be enabled instance-wide under Administration → Site Settings → API.

2. Configure your MCP client

Add the server to your MCP client configuration. The Claude Desktop example is shown below; Cursor, Windsurf, and VS Code use the same pattern (see the collapsible sections).

🤖 Claude Desktop

Add this to your claude_desktop_config.json:

json
{  "mcpServers": {    "testrail": {      "command": "npx",      "args": ["-y", "@uarlouski/testrail-mcp-server@latest"],      "env": {        "TESTRAIL_INSTANCE_URL": "https://your-instance.testrail.io",        "TESTRAIL_USERNAME": "[email protected]",        "TESTRAIL_API_KEY": "your-api-key",        "TESTRAIL_ENABLE_SHARED_STEPS": "true"      }    }  }}
⌨️ Cursor

Open Settings → MCP → Add new MCP server, or edit .cursor/mcp.json in your project (~/.cursor/mcp.json for all projects):

json
{  "mcpServers": {    "testrail": {      "command": "npx",      "args": ["-y", "@uarlouski/testrail-mcp-server@latest"],      "env": {        "TESTRAIL_INSTANCE_URL": "https://your-instance.testrail.io",        "TESTRAIL_USERNAME": "[email protected]",        "TESTRAIL_API_KEY": "your-api-key"      }    }  }}
🌊 Windsurf

Edit ~/.codeium/windsurf/mcp_config.json:

json
{  "mcpServers": {    "testrail": {      "command": "npx",      "args": ["-y", "@uarlouski/testrail-mcp-server@latest"],      "env": {        "TESTRAIL_INSTANCE_URL": "https://your-instance.testrail.io",        "TESTRAIL_USERNAME": "[email protected]",        "TESTRAIL_API_KEY": "your-api-key"      }    }  }}
💻 VS Code

Add to .vscode/mcp.json. The inputs block keeps your API key out of the file:

json
{  "inputs": [    {      "id": "testrail-api-key",      "type": "promptString",      "description": "TestRail API key",      "password": true    }  ],  "servers": {    "testrail": {      "command": "npx",      "args": ["-y", "@uarlouski/testrail-mcp-server@latest"],      "env": {        "TESTRAIL_INSTANCE_URL": "https://your-instance.testrail.io",        "TESTRAIL_USERNAME": "[email protected]",        "TESTRAIL_API_KEY": "${input:testrail-api-key}"      }    }  }}
🌐 Other MCP Clients

Any MCP-compliant client can use this server, because it speaks the standard MCP stdio transport. Point your client at the npx command with the required environment variables — no port, URL, or transport configuration needed.

3. See it in action

Restart your client completely, then turbo-charge your QA workflow by asking your AI assistant:

  • "List all projects in TestRail to find the latest active project."
  • "Show me all active users in the project to find the right assignee."
  • "Show me all test cases in section 5 of project 3."
  • "Create a comprehensive test case for 'Login Validation' with detailed steps."
  • "Start a new test run containing cases from section 5."
  • "Mark test case C1042 as passed with the comment 'verified on staging'."

Full per-client setup instructions, including troubleshooting, are in the Getting Started guide.


🖥️ Command Line Interface (CLI) & CI/CD Automation

In addition to interacting via AI assistants, you can invoke any TestRail tool directly from shell scripts, terminal environments, and automated CI/CD pipelines (GitHub Actions, GitLab CI, Jenkins) using testrail-cli or npx — with zero LLM overhead.

  • Deterministic Execution: Returns standard Unix exit codes (0 on success, 1 on error).
  • Pipeline-Native Output: Emits clean JSON to stdout for piping into tools like jq, while diagnostics and errors go to stderr.
  • Zero Duplication: Reuses the exact same API client, retry logic, and validation schemas as the MCP server.

Invocation methods

bash
# Method 1: Direct npx subcommand (Recommended)npx @uarlouski/testrail-mcp-server cli <command> [flags]
# Method 2: Global or local binarytestrail-cli <command> [flags]
# Method 3: Via package runnernpx -p @uarlouski/testrail-mcp-server testrail-cli <command> [flags]

Examples

Query projects (query_project)
bash
# List all active projectsnpx @uarlouski/testrail-mcp-server cli query_project --action many
# Query a single project by IDnpx @uarlouski/testrail-mcp-server cli query_project --action one --project_id 1
Report automated test results (add_results_for_cases)
bash
# Submit results by case_id — what your test framework already knowsnpx @uarlouski/testrail-mcp-server cli add_results_for_cases \  --run_id 88 \  --results '[{"case_id":1042,"status_id":1,"comment":"Passed in CI"}]'
Export cases for knowledge base / RAG (export_cases_for_rag)
bash
# Export all cases for a project into Markdown & metadata sidecarsnpx @uarlouski/testrail-mcp-server cli export_cases_for_rag \  --project_id 1 \  --output_dir ./rag_exports
# Export specific cases by ID (comma-separated list)npx @uarlouski/testrail-mcp-server cli export_cases_for_rag \  --case_ids C101,C102,103 \  --output_dir ./rag_exports
Command discovery & flag documentation
bash
# List all available commandsnpx @uarlouski/testrail-mcp-server cli --help
# Show parameter options for a specific toolnpx @uarlouski/testrail-mcp-server cli query_project --help

See the CLI & CI/CD guide for complete GitHub Actions, GitLab CI, and Jenkins workflows.


⚙️ Environment Variables & Security Controls

VariableDescriptionRequiredDefault
TESTRAIL_INSTANCE_URLYour TestRail instance URL (e.g., https://example.testrail.io)✅
TESTRAIL_USERNAMEYour TestRail user email address✅
TESTRAIL_API_KEYYour TestRail API key (Guide)✅
TESTRAIL_ENABLE_SHARED_STEPSSet to true to enable Shared Steps management toolsfalse
TESTRAIL_ENABLE_CASE_HISTORYSet to true to enable Case History and revision tracking toolsfalse
TESTRAIL_ENABLE_RAG_TOOLSSet to true to enable experimental Knowledge Base / RAG export tools (export_cases_for_rag). Subject to breaking API changes.false
TESTRAIL_ALLOW_WRITE_OPERATIONSAllow write operations (e.g. adding/updating test cases, test runs, sections)true
TESTRAIL_ALLOW_READ_OPERATIONSAllow read operations (e.g. retrieving projects, test cases, templates)true
TESTRAIL_ALLOW_DELETE_OPERATIONSAllow delete operations (e.g. deleting cases or shared steps). Enabled strictly via true.false
TESTRAIL_ENABLE_DEPRECATED_TOOLSPreserved for backward compatibility with existing host configurations.true
TESTRAIL_DISABLED_TOOLSComma-separated list of specific tool names to disable (e.g., mutate_suite,delete_entity). Fails if invalid tool names are specified.-

With only the three required credentials, 27 of the 35 tools are registered. Ready-made read-only and least-privilege configurations are in the Configuration guide.


🧰 Available Tools

All 35 tools, grouped by area. Each declares a read, write, or delete mode, which the server surfaces to clients as MCP annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint).

AreaToolsReference
Discovery & Navigationquery_project, query_suite, mutate_suite, query_section, mutate_section, get_usersDocs
Test Case Managementget_case, get_cases, add_case, update_case, update_cases, get_case_fields, resolve_case_field, get_case_history, export_cases_for_ragDocs
Execution & Trackingquery_run, mutate_run, query_test, get_tests, get_results, add_results, add_results_for_casesDocs
Attachments & Mediaadd_attachment, query_attachmentDocs
Shared Stepsget_shared_step, get_shared_steps, get_shared_step_history, add_shared_step, update_shared_stepDocs
System Metadataget_statuses, get_priorities, get_case_fields, get_templates, get_labels, get_configurationsDocs
Deletiondelete_entityDocs

❓ Frequently Asked Questions

Which AI assistants and MCP clients are supported?

Any MCP-compliant client, because the server uses the standard MCP stdio transport. Setup is verified with Claude Desktop, Cursor, Windsurf, and VS Code. Other clients follow the same pattern: run npx -y @uarlouski/testrail-mcp-server@latest with three environment variables.

Which TestRail versions are supported?

The server targets TestRail API v2 and is tested against TestRail 10.6.2. Older instances work too — the client detects whether an endpoint returns a modern paginated response or a legacy bare array, so pre-7.x instances need no configuration. Both TestRail Cloud and self-hosted TestRail Server are supported.

Is it safe to give an AI assistant write access to TestRail?

Access is layered rather than all-or-nothing. Every tool declares a read, write, or delete mode; deletes are disabled unless you explicitly set TESTRAIL_ALLOW_DELETE_OPERATIONS=true. You can disable all writes with TESTRAIL_ALLOW_WRITE_OPERATIONS=false, or block individual tools by name with TESTRAIL_DISABLED_TOOLS. The server runs locally and talks only to your TestRail instance — there is no telemetry and no third-party service in the middle.

Is it free?

Yes — Apache 2.0 licensed, with no paid tier, licence key, or usage limit. You need your own TestRail subscription, and whatever your AI assistant costs. The CLI has no LLM cost at all.

Can I use it in CI/CD without an AI assistant?

Yes. The package ships a testrail-cli binary exposing every tool as a subcommand, reusing the same API client, retry logic, and validation schemas. JSON on stdout, diagnostics on stderr, exit code 0 or 1 — see the CLI guide.

How do I stop the AI from inventing custom fields that don't exist?

It can't. Before add_case or update_case sends anything, the server validates every field key against your instance's real schema (fetched via get_case_fields) and rejects unknown keys. Templates, priorities, statuses, and configurations are all exposed as tools too, so the model looks up correct IDs instead of guessing them.

How do I handle thousands of test cases without blowing the context window?

Pass output_file to get_cases (or output_dir to export_cases_for_rag). The server paginates the full result set, writes raw JSON to disk, and returns only a short summary to the model.

More answers in the full FAQ.


📚 Documentation & Complete Tool Reference

For a comprehensive guide, detailed configuration options, and a complete breakdown of all available tools, visit the official documentation site:

👉 TestRail MCP Server Documentation


🤝 Contributing

Open-source contributions are actively welcomed! Please feel free to open an issue for feature requests or submit a pull request for improvements.

📜 License

This project is licensed under the Apache License 2.0.


TestRail MCP Server · Engineered with the Model Context Protocol

來源:README.md,提交 eeadcf5

工具

0
SourceWeft 曾在隔離沙箱中以無憑證方式啟動該軟體包一次,以列出其工具,但未能完成:伺服器未能啟動。

版本歷史

6
  1. v3.3.1最新Oct 26, 2026
  2. v3.3.0Oct 20, 2026
  3. v3.2.0Oct 5, 2026
  4. v3.1.0Sep 25, 2026
  5. v3.0.0Sep 22, 2026
  6. v2.10.0Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分