testrail-mcp
Enables uploading and managing test cases in TestRail: checking credentials and configured defaults, listing projects, suites, sections (as a tree, with text search), and existing cases, inspecting custom case fields and their required dropdown options, and creating cases with titles, preconditions, references, step-by-step actions and expected results. Also supports uploading saved case-pack JSON files with embedded base64 images attached to steps, with dry-run previews before anything is created.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@testrail-mcp add test cases for CSV export with steps to the Reports > Export section"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
testrail-mcp
An MCP server that lets Claude upload test cases to TestRail.
You describe the feature to Claude in a chat; Claude writes the test cases there. This server's only job is to talk to TestRail: find the right section, check required fields, and create the cases (with step-by-step actions and expected results). No user-story form, no screenshot area, no AI key — the chat is the interface.
Python, one dependency (
mcp); HTTP calls use the standard library.Your TestRail URL, email and API key are read only from environment variables set in your MCP client's config. Nothing personal is stored in this repository.
Tools
Tool | What it does |
| Confirms the credentials work and shows the configured defaults |
| Active projects |
| Suites in a project |
| Sections as a tree ( |
| Existing cases in a section, to avoid duplicates |
| Custom case fields for your template, with dropdown options and which are required |
| Creates cases: title, preconditions, refs, steps ( |
| Uploads a saved |
testrail_add_cases and testrail_upload_case_file accept dry_run: true to preview exactly what
would be sent without creating anything. Dropdown fields accept the option label
(e.g. "Not Automated") or its numeric id.
Related MCP server: QA Studio MCP Server
Install
Requires Python 3.10+ and uv (or plain pip).
git clone https://github.com/<your-github-user>/testrail-mcp.git
cd testrail-mcp
uv sync # or: pip install -e .Connect it to Claude Desktop
Open Settings → Developer → Edit Config in Claude Desktop and add a server entry
(full example: examples/claude_desktop_config.json):
{
"mcpServers": {
"testrail": {
"command": "uv",
"args": ["--directory", "C:\\path\\to\\testrail-mcp", "run", "testrail-mcp"],
"env": {
"TESTRAIL_URL": "https://yourcompany.testrail.io",
"TESTRAIL_USER": "you@company.com",
"TESTRAIL_API_KEY": "your-api-key",
"TESTRAIL_PROJECT_ID": "1"
}
}
}
}Restart Claude Desktop. The tools then appear in your chats.
The config file lives only on your computer, so your key never goes into git. Use a TestRail API key (TestRail → My Settings → API Keys), not your password, so you can revoke it any time.
Settings
Variable | Required | Meaning |
| yes | e.g. |
| yes | Email you sign in to TestRail with |
| yes | TestRail → My Settings → API Keys |
| recommended | Default project |
| no | Default suite (multi-suite projects) |
| no | Default section for new cases |
| no | Case template, default |
| no | JSON of custom field values applied to every new case, e.g. |
| no | Default |
| no | Default |
If TestRail says a field "is a required field", ask Claude to run testrail_get_fields and then either
pass the value per upload or put it in TESTRAIL_DEFAULT_FIELDS.
Using it
Example prompts:
Write test cases for the CSV export story below, then add them to the "Reports > Export" section with refs PROJ-123.
Upload
C:\Users\me\Downloads\export-cases.jsonto section 42.
Claude will look up the section, check required fields, show you the cases, and create them. Each result links to the new case in TestRail.
Case-pack file format
testrail_upload_case_file reads this JSON shape (images are optional and embedded as base64):
{
"format": "testrail-case-pack",
"version": 1,
"refs": "PROJ-123",
"section_id": null,
"fields": {"custom_automation_type": "Not Automated"},
"image_placement": "expected",
"notes": ["anything to double-check before uploading"],
"cases": [
{
"title": "Verify CSV export downloads a file",
"preconditions": "User is signed in",
"steps": [
{"content": "Open Reports and click Export CSV", "expected": "A .csv file downloads", "images": ["img1"]}
]
}
],
"images": {"img1": {"name": "export.png", "mime": "image/png", "data": "<base64>"}}
}section_id and fields in the call override the file; the file overrides the environment defaults.
Development
uv sync --extra dev
uv run pytestTests run against an in-memory fake TestRail (tests/fake_testrail.py), so they never touch a real
instance.
License
MIT
Available Tools
8 toolstestrail_add_casesA
Create test cases in a TestRail section.
cases: [{"title": "Verify ...", "preconditions": "...", "refs": "optional per-case refs", "steps": [{"content": "one action", "expected": "one expected result"}]}] section_id: defaults to TESTRAIL_SECTION_ID. refs: references applied to every case (e.g. a story key), unless a case sets its own. fields: custom field values for every case, e.g. {"custom_automation_type": "Not Automated"}. Dropdowns accept the option id or its label. Merged over TESTRAIL_DEFAULT_FIELDS. dry_run: return the payloads that would be sent, without creating anything.
Inputs: cases (required), refs, fields, dry_run, +2 more.
testrail_check_connectionA
Check the TestRail credentials work and show the configured defaults (project, suite, section, fields).
Inputs: no named parameters.
testrail_get_fieldsC
Custom case fields for the configured template: name, label, type, required, and dropdown options.
Inputs: project_id, required_only. Returns: result
testrail_list_casesA
List existing cases (id, title, refs) in a section, e.g. to avoid creating duplicates.
Inputs: section_id (required), suite_id, project_id. Returns: result
testrail_list_projectsA
List active TestRail projects (id, name, suite_mode).
Inputs: no named parameters. Returns: result
testrail_list_sectionsA
List sections as a tree with full paths ("Parent > Child"). search filters by text in the path.
project_id / suite_id default to TESTRAIL_PROJECT_ID / TESTRAIL_SUITE_ID.
Inputs: search, suite_id, project_id. Returns: result
testrail_list_suitesA
List the test suites in a project. project_id defaults to TESTRAIL_PROJECT_ID.
Inputs: project_id. Returns: result
testrail_upload_case_fileB
Upload a saved testrail-case-pack .json file from this computer (full path). Embedded images in the file are attached to their steps. section_id overrides the file's section_id, which overrides TESTRAIL_SECTION_ID.
Inputs: path (required), fields, dry_run, project_id, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Tools mostly target distinct resources and actions (list sections, list cases, get fields, add cases, etc.). The only mild overlap is between testrail_add_cases and testrail_upload_case_file, both of which create cases, but their descriptions clearly differentiate structured input from file upload.
All tools use the consistent testrail_ prefix followed by a verb_noun pattern (testrail_list_sections, testrail_add_cases, testrail_get_fields), written uniformly in snake_case.
Eight tools are well-scoped for a TestRail case-authoring integration, covering listing hierarchy, checking connectivity, inspecting fields, and adding cases without unnecessary bloat.
The surface covers listing and creating test cases, but lacks update and delete operations and single-case retrieval, which are notable gaps for typical TestRail case management workflows.
Maintenance
Related MCP Connectors
Create and manage test cases, test runs and results in Testiny from your AI assistant.
Direct access to Cypress tests results and accessibility reports in your AI workflow.
Run UX research from Claude — create card sort studies, list studies, pull headline stats.
Writes adversarial test suites for AI-built code. Your agent's test engineer.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI assistants to interact with TestRail test management systems through comprehensive API integration. Supports retrieving and updating test cases, projects, suites, runs, and results, plus adding attachments and managing test data through natural language commands.1840 npmMIT
- AlicenseBqualityBmaintenanceEnables interaction with QA Studio test management platform directly from Claude, allowing users to manage projects, create test runs, view test results, create test cases, and submit manual test results through natural language.716 npmAGPL 3.0
- AlicenseBqualityDmaintenanceEnables AI assistants to interact directly with TestRail instances for managing test projects, suites, cases, runs, results, plans, milestones, and attachments through the TestRail API with secure authentication.7761 npm1MIT
- AlicenseBqualityDmaintenanceEnables AI assistants to interact with TestRail test management system, supporting full CRUD operations on projects, suites, sections, test cases, runs, results, plans, and milestones.35276 npm1MIT