使用说明
TestRail MCP服务器
一种MCP(模型上下文协议)服务器,为人工智能助手提供对TestRail API的访问,以进行测试管理操作。
特性
此服务器提供以下工具与TestRail交互:
- get_test_run -获取特定测试运行的信息
- get_test_results -获取测试运行的测试结果
- get_test_case -获取特定测试用例的详细信息
- list_项目 -列出所有可用的TestRail项目
- 用户名 -获取TestRail用户列表
- get_tests_for_run -获取特定测试运行中的所有测试
安装
- 安装依赖项:
npm install
- 创建一个
.env文件基于.env.example:
cp .env.example .env
- 在中配置您的TestRail凭据
.env:
TESTRAIL_URL=https://argosapps.testrail.net
TESTRAIL_USERNAME=your-email@sainsburys.co.uk
TESTRAIL_API_KEY=your-api-key-here
- 构建服务器:
npm run build
用法
命令行界面(推荐)
使用TestRail MCP服务器的最简单方法是通过CLI包装器:
# Get tests for a run
node cli.js get-tests <run_id>
# Get test run details
node cli.js get-run <run_id>
# Get test results for a run
node cli.js get-results <run_id>
# Get a specific test case
node cli.js get-case <case_id>
# List all projects
node cli.js list-projects
# Get all users
node cli.js get-users
示例:
node cli.js get-tests 20560
node cli.js get-run 18889
node cli.js list-projects
使用克劳德桌面
添加到您的Claude Desktop配置(claude_desktop_config.json):
{
"mcpServers": {
"testrail": {
"command": "node",
"args": [
"C:\\Users\\Marc.Reynolds\\testrail-mcp-server\\build\\index.js"
]
}
}
}
使用VS代码
添加到VS Code工作区设置(.vscode/settings.json):
{
"github.copilot.chat.codeGeneration.mcp": {
"enabled": true,
"servers": {
"testrail": {
"command": "node",
"args": [
"c:\\Users\\Marc.Reynolds\\testrail-mcp-server\\build\\index.js"
]
}
}
}
}
发展
在开发过程中以监视模式运行:
npm run watch
TestRail API文档
此服务器使用TestRail API v2。更多信息:
许可证
麻省理工学院