mcp-testrail-sync
v0.1.0-beta.1MCP server for TestRail: create and read test cases, sections and labels from prompts in Claude, OpenCode, Codex or Copilot.
TestRail MCP server for Claude, OpenCode, Codex and Copilot Create and read test cases from a plain prompt A TestRail MCP server that lets Claude Code, Claude Desktop, OpenCode, Codex, GitHub Copilot and other AI clients read and create TestRail test cases from a plain prompt. Your MCP client runs this same command for you, see Quick start.
Summary extracted from the README.
A TestRail MCP server that lets Claude Code, Claude Desktop, OpenCode, Codex, GitHub Copilot and other AI clients read and create TestRail test cases from a plain prompt.
npm: https://www.npmjs.com/package/mcp-testrail-sync
Run it (test build):
npx -y mcp-testrail-sync@beta --help
Your MCP client runs this same command for you, see Quick start.
Works with: Claude Code · Claude Desktop · OpenCode · Codex · VS Code Copilot · any MCP client.
"Use mcp-testrail-sync to create test cases in section "User registration" from
test_registration.md"
Ask your AI things like
- "Create test cases in TestRail from
test_registration.md" - "Sync these QA test cases with our TestRail project"
- "List the sections in our TestRail suite"
- "Find TestRail test cases about login"
- "Import these manual test cases into the section User registration"
Safe by design (v1 PoC):
- One project and one suite only. Both are set in the config. Every read is filtered to that suite, and every write is checked against it.
- No update or delete. The code simply has no update/delete API calls. The only writes are create test case and create section.
Quick start
- Nothing to install: the client starts the server with
npx -y mcp-testrail-sync. While this is a test build, usemcp-testrail-sync@beta. - Get your TestRail API key: TestRail → My Settings → API Keys → Add key. The API must be enabled: Admin → Site Settings → API.
- Add the server to your MCP client. Example for OpenCode (
opencode.json):
Claude Code, in one command:{ "$schema": "https://opencode.ai/config.json", "mcp": { "mcp-testrail-sync": { "type": "local", "command": ["npx", "-y", "mcp-testrail-sync@beta", "--project", "demo-name"], "enabled": true, "environment": { "TESTRAIL_URL": "https://your-instance.testrail.io", "TESTRAIL_USERNAME": "your-email@example.com", "TESTRAIL_API_KEY": "your-api-key", "TESTRAIL_SUITE": "test1" } } } }
Configs for Claude Desktop, Codex and VS Code Copilot are in docs/CLIENTS.md.claude mcp add mcp-testrail-sync \ -e TESTRAIL_URL=https://your-instance.testrail.io \ -e TESTRAIL_USERNAME=your-email@example.com \ -e TESTRAIL_API_KEY=your-api-key \ -e TESTRAIL_SUITE=test1 \ -- npx -y mcp-testrail-sync@beta --project demo-name - Restart the client and ask: "Run system_ping from mcp-testrail-sync". You should see your project and suite.
See it in action (OpenCode)
1. Add the server to opencode.json (inside .opencode/ or the project root):
2. Ask in plain language. A read-only prompt to try first:
Use the testrail MCP server.
1. Run system_ping and show me the locked project
2. Show the section tree of the suite.
3. List 3 test cases from the suite - subsection `Suite Test`. For each one show the id, title, section path and priority.
Replace
Suite Testwith a section name from your own suite.
3. Get the answer from TestRail. The client calls system_ping, suites_list and tests_list for you and shows the result:
Configuration
Everything lives in the MCP client config: no .env files.
| Setting | Where | Example |
|---|---|---|
--project |
command arg | demo-name or 12 (name or id) |
TESTRAIL_URL |
env | https://your-instance.testrail.io |
TESTRAIL_USERNAME |
env | your-email@example.com |
TESTRAIL_API_KEY |
env | API key (not your password) |
TESTRAIL_SUITE |
env (or --suite arg) |
test1 or 34 (name or id) |
TESTRAIL_DEBUG |
env, optional | true logs each API call to stderr |
If something is missing or wrong, the server stops at startup and lists every problem, e.g. TESTRAIL_API_KEY is required (TestRail > My Settings > API Keys), or Suite "test2" not found in project "demo-name". Available: "test1" (id 34), ....
Tools
| Tool | What it does |
|---|---|
system_ping |
Checks the connection and shows the locked project/suite, steps format, required fields, and available tools |
tests_list |
Lists cases in the suite, filtered by section, title text, priority, type or label; paged |
tests_get |
Gets one case with full steps (123 or C123) |
tests_search |
Searches cases by title (shortcut for tests_list + search_text) |
tests_create |
Creates 1–50 cases in one call, in sections of the suite |
sections_list |
Shows the suite's sections/subsections as a tree, with Parent > Child paths |
sections_create |
Creates a section, or a subsection when you pass parent_id |
suites_list |
Shows the configured suite as a tree, optionally with case counts |
suites_get |
Gets details of the configured suite |
suites_search |
Finds sections in the suite by name and returns their paths |
labels_list |
Lists project labels (TestRail 10.5+) |
labels_get |
Gets a label by id or title |
runs_list |
The reporting tool. All runs of the suite (standalone and inside plans) with counts per status, plus totals. Filter by from/to date window, state (open / completed / all), milestone, name; group_by: "milestone" gives a progress table |
runs_get |
One run with its tests: by default the failed / blocked / retest ones, with latest comment and defects (123 or R123) |
milestones_list |
Lists milestones with state and dates; filter by state, date window, name |
Paging: tests_list, runs_list, runs_get and milestones_list all use the same shape: count, offset, limit, has_more, next_offset. For runs_list the totals always cover every matched run, not only the page. The response also has a scan block (what was read) and warnings if anything was cut short.
Progress reports are read-only and stay inside the configured suite. Runs of other suites (also inside plans) are ignored. from/to match runs that were active at any time in the window (created before to, and still open or completed after from). Every summary has total, passed, failed, blocked, retest, untested, custom (e.g. "Skipped"), executed_pct, pass_rate_pct (passed / total) and pass_rate_of_executed_pct.
How steps are sent: at startup the server checks the project's templates.
- If the project has the Test Case (Steps) template, steps go in as separated steps (one row per step, each with its expected result).
- Otherwise they go in as numbered text.
Fields the project marks as required are shown by system_ping. Pass them through custom_fields in tests_create.
Example prompts
See examples/prompts.md and the sample examples/test_registration.md.
Development
npm install
npm run build # compile TypeScript to dist/
npm test # unit + tool tests against an in-memory fake TestRail
npm run inspect # open MCP Inspector (set the TESTRAIL_* env vars first, then add --project in the UI)
New to MCP? Read docs/HOW_MCP_WORKS.md. It walks through this codebase and shows how to add a tool.
Roadmap (v2+)
Update/delete with confirmation, test runs/plans/results, creating suites, a read-only mode, a duplicate-title check before create, attachments, shared steps, HTTP transport.
License
MIT