mX射线
](https://www.npmjs.com/package/mxray-mcp-server)  ](https://nodejs.org/)
一 MCP(模型上下文协议) 将AI驱动的IDE连接到的服务器 Jira Cloud的X射线测试管理。它在stdio上公开了28个测试管理工具,让你的AI助手创建和管理测试、测试执行、测试计划、测试集和导入/导出测试结果——所有这些都不需要离开你的编辑器。
⚠️ 仅限X射线云。 此服务器的目标是Xray Cloud REST和GraphQL API。X射线服务器/数据中心使用不同的API,不受支持。
快速开始
# Run directly with npx — no installation needed
JIRA_BASE_URL=https://yourcompany.atlassian.net \
JIRA_EMAIL=you@company.com \
JIRA_API_TOKEN=your-token \
npx mxray-mcp-server有关IDE集成,请参阅 用法 下面的部分。
先决条件
- Node.js ≥ 20.6
- A. 吉拉云 帐户与 Jira的X光片 已安装应用程序
- A. Jira API代币 --生成一个 Atlassian帐户设置
- _(可选)_ X射线云API凭据 (客户端ID+机密)——X射线特定工具所需,如获取测试步骤、更新测试运行和导入/导出结果。在X射线中生成它们→ 设置→ API密钥.
没有X射线凭据,9 Jira专用工具仍然可以完全工作。其余18个特定于X射线的工具在调用时将返回明确的错误消息。
安装
# 1. Clone the repository
git clone https://github.com/Timorek/mXray.git
cd mXray
# 2. Install dependencies
npm install
# 3. Configure environment variables
cp .env.example .env
# Edit .env with your credentials (see Configuration below)
# 4. Build
npm run build配置
编辑 .env 上面创建的文件:
# Required
JIRA_BASE_URL=https://yourcompany.atlassian.net
JIRA_EMAIL=your-email@company.com
JIRA_API_TOKEN=your-jira-api-token
# Optional — enables Xray-specific tools (GraphQL, import/export)
XRAY_CLIENT_ID=your-xray-client-id
XRAY_CLIENT_SECRET=your-xray-client-secret服务器在启动时使用严格的Zod模式验证所有变量,如果缺少任何内容或格式错误,则退出并显示描述性错误。
用法
服务器通过以下方式进行通信 标准 并且必须在您的MCP兼容IDE中注册。所有启动日志都将写入 stderr 保持stdio通道干净。
GitHub Copilot命令行界面
添加 ~/.copilot/mcp-config.json (全球)或 .copilot/mcp-config.json (项目本地):
选项A——通过带有内联凭据的npx(无需安装):
{
"mcpServers": {
"mxray": {
"command": "npx",
"args": ["-y", "mxray-mcp-server"],
"env": {
"JIRA_BASE_URL": "https://yourcompany.atlassian.net",
"JIRA_EMAIL": "your-email@company.com",
"JIRA_API_TOKEN": "your-jira-api-token",
"XRAY_CLIENT_ID": "your-xray-client-id",
"XRAY_CLIENT_SECRET": "your-xray-client-secret"
}
}
}
}选项B——通过npx加载 .env 文件(推荐):
创建一个 .env 使用您的凭据文件(请参阅 配置),然后设置 cwd 到 目录 包含 .env 文件(不是文件本身):
{
"mcpServers": {
"mxray": {
"command": "npx",
"args": ["-y", "mxray-mcp-server"],
"cwd": "/absolute/path/to/mXray"
}
}
}选项C——来自本地构建的内联凭据:
{
"mcpServers": {
"mxray": {
"command": "node",
"args": ["/absolute/path/to/mXray/dist/index.js"],
"env": {
"JIRA_BASE_URL": "https://yourcompany.atlassian.net",
"JIRA_EMAIL": "your-email@company.com",
"JIRA_API_TOKEN": "your-jira-api-token",
"XRAY_CLIENT_ID": "your-xray-client-id",
"XRAY_CLIENT_SECRET": "your-xray-client-secret"
}
}
}
}选项D——从本地构建,从加载 .env 文件(推荐):
{
"mcpServers": {
"mxray": {
"command": "node",
"args": ["--env-file=/absolute/path/to/mXray/.env", "/absolute/path/to/mXray/dist/index.js"]
}
}
}克劳德代码
添加 ~/.claude/mcp_settings.json:
选项A——通过带有内联凭据的npx(无需安装):
{
"mcpServers": {
"mxray": {
"command": "npx",
"args": ["-y", "mxray-mcp-server"],
"env": {
"JIRA_BASE_URL": "https://yourcompany.atlassian.net",
"JIRA_EMAIL": "your-email@company.com",
"JIRA_API_TOKEN": "your-jira-api-token",
"XRAY_CLIENT_ID": "your-xray-client-id",
"XRAY_CLIENT_SECRET": "your-xray-client-secret"
}
}
}
}选项B——通过npx加载 .env 文件(推荐):
创建一个 .env 使用您的凭据文件(请参阅 配置),然后设置 cwd 到 目录 包含 .env 文件(不是文件本身):
{
"mcpServers": {
"mxray": {
"command": "npx",
"args": ["-y", "mxray-mcp-server"],
"cwd": "/absolute/path/to/mXray"
}
}
}选项C——来自本地构建的内联凭据:
{
"mcpServers": {
"mxray": {
"command": "node",
"args": ["/absolute/path/to/mXray/dist/index.js"],
"env": {
"JIRA_BASE_URL": "https://yourcompany.atlassian.net",
"JIRA_EMAIL": "your-email@company.com",
"JIRA_API_TOKEN": "your-jira-api-token",
"XRAY_CLIENT_ID": "your-xray-client-id",
"XRAY_CLIENT_SECRET": "your-xray-client-secret"
}
}
}
}选项D——从本地构建,从加载 .env 文件(推荐):
{
"mcpServers": {
"mxray": {
"command": "node",
"args": ["--env-file=/absolute/path/to/mXray/.env", "/absolute/path/to/mXray/dist/index.js"]
}
}
}可用工具
标记有的工具 *(X射线)* 需要 XRAY_CLIENT_ID 和 XRAY_CLIENT_SECRET.
测试
| 工具 | 说明 |
|---|---|
list_tests | 列出项目中的测试;按标签或组件过滤 |
get_test | 获取特定测试的详细信息 |
get_test_with_steps | 获取测试详细信息,包括手动步骤 *(X射线)* |
create_test | 创建测试(手动/黄瓜/通用) |
update_test | 更新测试字段(摘要、描述、标签、优先级) |
update_test_type | 更改X射线检测类型 *(X射线)* |
update_gherkin_test_definition | 在Cucumber测试中更新Gherkin场景 *(X射线)* |
测试执行
| 工具 | 说明 |
|---|---|
list_test_executions | 列出项目中的测试执行 |
get_test_execution | 获取执行细节和测试运行 |
create_test_execution | 创建新的测试执行 |
update_test_run | 更新测试运行状态和注释 *(X射线)* |
测试计划
| 工具 | 说明 |
|---|---|
list_test_plans | 列出项目中的测试计划 |
get_test_plan | 获取计划详细信息和相关测试 |
create_test_plan | 创建新的测试计划 |
add_tests_to_test_plan | 将测试添加到计划中 *(X射线)* |
测试集
| 工具 | 说明 |
|---|---|
list_test_sets | 列出项目中的测试集 |
get_test_set | 获取设置详细信息和相关测试 |
create_test_set | 创建新的测试集 |
add_tests_to_test_set | 将测试添加到集合中 *(X射线)* |
导入
所有导入工具都需要X射线凭据。
| 工具 | 说明 |
|---|---|
import_execution_results | 以Xray JSON格式导入结果 |
import_cucumber_results | 以Cucumber JSON格式导入结果 |
import_junit_results | 以JUnitXML格式导入结果 |
import_testng_results | 以TestNG XML格式导入结果 |
import_nunit_results | 以NUnit XML格式导入结果 |
import_robot_results | 以Robot Framework XML格式导入结果 |
import_behave_results | 以Behave JSON格式导入结果 |
import_feature_file | 导入小黄瓜 .feature 创建/更新测试的文件 |
出口
| 工具 | 说明 |
|---|---|
export_cucumber_features | 将Cucumber功能文件导出为base64编码的ZIP *(X射线)* |
用于测试导入工具的示例测试报告文件位于 samples/.
发展
npm run dev # Run with tsx — no build step needed
npm run build # Compile TypeScript → dist/
npm run typecheck # Type-check without emitting files
npm test # Run tests with Vitest
npm run test:watch # Run tests in watch mode要在MCP配置中使用开发服务器,请替换 node dist/index.js 随着 npx tsx src/index.ts.
项目结构
mXray/
├── src/
│ ├── index.ts # Entry point: config, clients, tool registration
│ ├── types.ts # Zod config schema + TypeScript interfaces
│ ├── utils/errors.ts # Centralized API error formatting
│ ├── services/
│ │ └── XrayCloudService.ts # Xray JWT auth, GraphQL queries, REST imports
│ └── tools/
│ ├── tests/ # 7 test management tools
│ ├── test-executions/ # 4 test execution tools
│ ├── test-plans/ # 4 test plan tools
│ ├── test-sets/ # 4 test set tools
│ ├── import/ # 8 result import tools
│ └── export/ # 1 export tool
├── samples/ # Example test report files
├── .env.example # Environment variable template
├── package.json
└── tsconfig.json许可证
麻省理工学院 © 2026 阿卡迪乌斯·克洛斯
