How uarlouski/testrail-mcp-server works
TestRail MCP Server exposes TestRail API v2 operations to AI assistants over MCP stdio, with a CLI alternative for shell and CI use. The main workflow routes a client request through server registration to a domain tool, which calls the shared TestRail API client and returns structured results. Domain capabilities include project and test-structure discovery, case management and export, run/result execution, reference data, attachments, and shared steps. The excerpts establish MCP dispatch, CLI dispatch, and several tool-to-client calls; other domain links are supported by the README or registry references, not inspection of every handler.
Main entry points: testrail.ts TestRail API client · registry.ts Tool registry · export_cases_for_rag.ts RAG case export · cli.ts Tool CLI
Components 23
Entry points
- MCP server
src/index.ts - Tool CLI
src/cli.ts - CLI argument parser
src/adapters/cli_parser.ts - Tool registry
src/tools/registry.ts
Test organization
- Projects
src/tools/projects/query_project.ts - Test suites
src/tools/suites - Sections
src/tools/sections/query_section.ts
Cases and execution
- Case management
src/tools/cases - Case fields
src/tools/cases/fields.ts - RAG case export
src/tools/cases/export_cases_for_rag.ts - Test runs
src/tools/runs/query_run.ts - Test results
src/tools/results - Test execution
src/tools/tests
Shared capabilities
- Attachments
src/tools/attachments/query_attachment.ts - Reference data
src/tools/commons - Shared steps
src/tools/shared_steps
API and shaping
- TestRail API client
src/client/testrail.ts - Query dispatcher
src/utils/query_handler.ts - Case value mapper
src/utils/mapper.ts - Output sanitizer
src/utils/sanitizer.ts
Other components
- AI assistant
- Shell / CI
- TestRail instance
Connections 39
- AI assistant → MCP server: sends MCP requests
- MCP server → Tool registry: selects tools
src/index.ts - MCP server → TestRail API client: creates client
src/index.ts - MCP server → Output sanitizer: sanitizes output
src/index.ts - Shell / CI → Tool CLI: runs commands
- Tool CLI → CLI argument parser: parses arguments
src/cli.ts - Tool CLI → Tool registry: looks up tools
src/cli.ts - Tool CLI → TestRail API client: creates client
src/cli.ts - Tool CLI → Output sanitizer: sanitizes output
src/cli.ts - Tool registry → Projects: registers tools
src/tools/registry.ts - Tool registry → Test suites: registers tools
src/tools/registry.ts - Tool registry → Sections: registers tools
src/tools/registry.ts - Tool registry → Case management: registers tools
src/tools/registry.ts - Tool registry → Test runs: registers tools
src/tools/registry.ts - Tool registry → Test results: registers tools
src/tools/registry.ts - Tool registry → Test execution: registers tools
src/tools/registry.ts - Tool registry → Attachments: registers tools
src/tools/registry.ts - Tool registry → Reference data: registers tools
src/tools/registry.ts - Tool registry → Shared steps: conditionally registers
src/tools/registry.ts - Projects → TestRail API client: queries API
src/tools/projects/query_project.ts - Test suites → TestRail API client: uses API
src/tools/suites/query_suite.ts - Sections → Query dispatcher: dispatches query
src/tools/sections/query_section.ts - Sections → TestRail API client: queries sections
src/tools/sections/query_section.ts - Case management → TestRail API client: manages cases
src/tools/cases/export_cases_for_rag.ts - Case management → Case fields: uses field definitions
src/tools/cases/types.ts - RAG case export → TestRail API client: fetches case data
src/tools/cases/export_cases_for_rag.ts - RAG case export → Case management: fetches filtered cases
src/tools/cases/export_cases_for_rag.ts - RAG case export → Case fields: resolves field types
src/tools/cases/export_cases_for_rag.ts - RAG case export → Case value mapper: maps custom values
src/tools/cases/export_cases_for_rag.ts - RAG case export → Sections: resolves section paths
src/tools/cases/export_cases_for_rag.ts - Test runs → Query dispatcher: dispatches query
src/tools/runs/query_run.ts - Test runs → TestRail API client: queries runs
src/tools/runs/query_run.ts - Test results → TestRail API client: uses API
src/tools/results/add_results_for_cases.ts - Test execution → TestRail API client: uses API
- Attachments → Query dispatcher: dispatches query
src/tools/attachments/query_attachment.ts - Attachments → TestRail API client: downloads and lists
src/tools/attachments/query_attachment.ts - Reference data → TestRail API client: uses API
src/tools/commons/get_users.ts - Shared steps → TestRail API client: uses API
src/tools/shared_steps/update_shared_step.ts - TestRail API client → TestRail instance: calls API v2