@qcentriq/mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +175 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +781 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# @qcentriq/mcp
|
|
2
|
+
|
|
3
|
+
Official [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server for **QCentriq** automated test discovery, error diagnostics, self-healing, and cloud execution.
|
|
4
|
+
|
|
5
|
+
Connect your favorite AI coding assistant (**Cursor**, **Claude Desktop**, **VS Code Cline / Roo Code**, **Windsurf**, or **Zed**) directly to your QCentriq QA projects.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🚀 Quick Start (npx)
|
|
10
|
+
|
|
11
|
+
You do not need to install anything globally. You can launch the server instantly using `npx`:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx -y @qcentriq/mcp --api-key "qc_your_api_key_here"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or set environment variables:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
export QCENTRIQ_API_KEY="qc_your_api_key_here"
|
|
21
|
+
export QCENTRIQ_BASE_URL="https://api.qcentriq.com" # optional, defaults to production
|
|
22
|
+
|
|
23
|
+
npx -y @qcentriq/mcp
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## ⚙️ Configuration Guides
|
|
29
|
+
|
|
30
|
+
### 1. Claude Desktop
|
|
31
|
+
|
|
32
|
+
Add QCentriq to your `claude_desktop_config.json`:
|
|
33
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
34
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
35
|
+
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"mcpServers": {
|
|
40
|
+
"qcentriq": {
|
|
41
|
+
"command": "npx",
|
|
42
|
+
"args": ["-y", "@qcentriq/mcp"],
|
|
43
|
+
"env": {
|
|
44
|
+
"QCENTRIQ_API_KEY": "qc_your_api_key_here",
|
|
45
|
+
"QCENTRIQ_BASE_URL": "https://api.qcentriq.com",
|
|
46
|
+
"QCENTRIQ_PROJECT_ID": "optional-default-project-uuid"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
### 2. Cursor IDE
|
|
56
|
+
|
|
57
|
+
In Cursor, open **Settings** $\to$ **Features** $\to$ **MCP Servers** $\to$ **Add New MCP Server**, or edit `~/.cursor/mcp.json` (or `.cursor/mcp.json` in your repository root):
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"mcpServers": {
|
|
62
|
+
"qcentriq": {
|
|
63
|
+
"command": "npx",
|
|
64
|
+
"args": ["-y", "@qcentriq/mcp"],
|
|
65
|
+
"env": {
|
|
66
|
+
"QCENTRIQ_API_KEY": "qc_your_api_key_here",
|
|
67
|
+
"QCENTRIQ_BASE_URL": "https://api.qcentriq.com"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
### 3. VS Code (Cline / Roo Code)
|
|
77
|
+
|
|
78
|
+
In VS Code with the Cline or Roo Code extension, open `cline_mcp_settings.json`:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"mcpServers": {
|
|
83
|
+
"qcentriq": {
|
|
84
|
+
"command": "npx",
|
|
85
|
+
"args": ["-y", "@qcentriq/mcp"],
|
|
86
|
+
"env": {
|
|
87
|
+
"QCENTRIQ_API_KEY": "qc_your_api_key_here"
|
|
88
|
+
},
|
|
89
|
+
"disabled": false,
|
|
90
|
+
"autoApprove": [
|
|
91
|
+
"qcentriq_list_tests",
|
|
92
|
+
"qcentriq_get_test",
|
|
93
|
+
"qcentriq_get_test_groups",
|
|
94
|
+
"qcentriq_get_test_run_logs"
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### 4. Windsurf
|
|
104
|
+
|
|
105
|
+
In `~/.codeium/windsurf/mcp_config.json`:
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"mcpServers": {
|
|
110
|
+
"qcentriq": {
|
|
111
|
+
"command": "npx",
|
|
112
|
+
"args": ["-y", "@qcentriq/mcp"],
|
|
113
|
+
"env": {
|
|
114
|
+
"QCENTRIQ_API_KEY": "qc_your_api_key_here"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 🛠️ Available MCP Tools
|
|
124
|
+
|
|
125
|
+
The QCentriq MCP Server cleanly separates **remote cloud discovery/diagnostics** (connected exclusively to `api/v1/mcp/sse`) and **local client operations** (executed purely inside your machine's environment):
|
|
126
|
+
|
|
127
|
+
### 🌐 Remote Discovery & Diagnostics (via `/api/v1/mcp/sse`)
|
|
128
|
+
| Tool Name | Description | Key Arguments |
|
|
129
|
+
| :--- | :--- | :--- |
|
|
130
|
+
| `qcentriq_list_tests` | Discover test cases, groups, status, priority, and update timestamps. | `project_id`, `group_id`, `priority`, `test_type`, `limit`, `offset` |
|
|
131
|
+
| `qcentriq_get_test` | Fetch full test case details, step definitions, preconditions, and latest execution failure diagnostics. | `test_case_id`, `project_id` |
|
|
132
|
+
| `qcentriq_get_test_groups` | Discover and inspect test groups, member cases, and whether an automation script exists. | `project_id`, `group_id`, `limit`, `offset` |
|
|
133
|
+
| `qcentriq_download_script` | Download Playwright Python test script and accompanying fixtures (`conftest.py`) from storage. | `group_id`, `project_id`, `include_fixtures` |
|
|
134
|
+
| `qcentriq_get_environment` | Retrieve target environment configuration, base URL (`BASE_URL`), and variables for local execution. | `project_id`, `environment_id`, `environment_name`, `include_secrets` |
|
|
135
|
+
| `qcentriq_get_test_run_logs` | Fetch execution history, logs, stdout/stderr, and stack traces across single-case, suite, and group runs. | `test_case_id`, `project_id`, `run_id`, `status`, `latest_only`, `from_date`, `to_date` |
|
|
136
|
+
|
|
137
|
+
### 💻 Client-Focused Local Tools (Executed Locally on Your Machine)
|
|
138
|
+
| Tool Name | Description | Key Arguments |
|
|
139
|
+
| :--- | :--- | :--- |
|
|
140
|
+
| `qcentriq_save_script` | Save downloaded test scripts and fixtures directly to your local workspace disk (`tests/` folder). | `file_name`, `content`, `conftest_content`, `destination_dir` |
|
|
141
|
+
| `qcentriq_run_local_test` | Run the test locally in your environment via `pytest`. Captures stdout, stderr, exit code, and test duration without triggering cloud runners. | `file_path`, `test_name`, `headless`, `browser`, `base_url`, `env_vars`, `extra_args`, `timeout_seconds` |
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 🔒 Security & Privacy
|
|
146
|
+
|
|
147
|
+
- **Safe Network Boundary**: The client MCP server connects **exclusively** to `${baseUrl}/api/v1/mcp/sse`. It does not trigger remote cloud runs or invoke unwanted cloud integration endpoints.
|
|
148
|
+
- **Client-Focused Execution**: Test runs and file saves are executed locally on your machine, giving you full control and privacy.
|
|
149
|
+
- **Zero-Leak Redaction**: The MCP server filters all outgoing tool payloads, masking API keys (`qc_...`), bearer tokens, and URL credentials (`https://user:pass@...`) to prevent accidental leaks to LLM contexts.
|
|
150
|
+
- **Strict Stdio Isolation**: Diagnostic logging is strictly directed to `stderr`, leaving standard output (`stdout`) pristine for JSON-RPC 2.0 protocol frames.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 💻 Local Development
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# Clone and install dependencies
|
|
158
|
+
cd packages/qcentriq-mcp
|
|
159
|
+
npm install
|
|
160
|
+
|
|
161
|
+
# Run tests
|
|
162
|
+
npm test
|
|
163
|
+
|
|
164
|
+
# Build production bundle
|
|
165
|
+
npm run build
|
|
166
|
+
|
|
167
|
+
# Run in development mode
|
|
168
|
+
QCENTRIQ_API_KEY="qc_..." QCENTRIQ_BASE_URL="http://localhost:8787" npm run dev
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 📄 License
|
|
174
|
+
|
|
175
|
+
Apache-2.0 © QCentriq
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,781 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
|
+
|
|
7
|
+
// src/config.ts
|
|
8
|
+
import { Command } from "commander";
|
|
9
|
+
|
|
10
|
+
// src/utils/logger.ts
|
|
11
|
+
var isDebugEnabled = Boolean(process.env.DEBUG || process.env.QCENTRIQ_DEBUG);
|
|
12
|
+
function setDebugLogging(enabled) {
|
|
13
|
+
isDebugEnabled = enabled;
|
|
14
|
+
}
|
|
15
|
+
function formatMessage(level, message, ...args) {
|
|
16
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
17
|
+
const extra = args.length > 0 ? " " + args.map((a) => typeof a === "object" ? JSON.stringify(a) : String(a)).join(" ") : "";
|
|
18
|
+
return `[${timestamp}] [QCentriq MCP] [${level}] ${message}${extra}
|
|
19
|
+
`;
|
|
20
|
+
}
|
|
21
|
+
var logger = {
|
|
22
|
+
info(message, ...args) {
|
|
23
|
+
process.stderr.write(formatMessage("INFO", message, ...args));
|
|
24
|
+
},
|
|
25
|
+
warn(message, ...args) {
|
|
26
|
+
process.stderr.write(formatMessage("WARN", message, ...args));
|
|
27
|
+
},
|
|
28
|
+
error(message, ...args) {
|
|
29
|
+
process.stderr.write(formatMessage("ERROR", message, ...args));
|
|
30
|
+
},
|
|
31
|
+
debug(message, ...args) {
|
|
32
|
+
if (isDebugEnabled) {
|
|
33
|
+
process.stderr.write(formatMessage("DEBUG", message, ...args));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/config.ts
|
|
39
|
+
var DEFAULT_BASE_URL = "https://api.qcentriq.com";
|
|
40
|
+
function loadConfig(argv = process.argv) {
|
|
41
|
+
const program = new Command();
|
|
42
|
+
program.name("qcentriq-mcp").description("QCentriq Model Context Protocol (MCP) Server for automated test discovery and execution").option("-k, --api-key <key>", "QCentriq API key (or QCENTRIQ_API_KEY env var)").option("-u, --base-url <url>", "QCentriq API base URL (or QCENTRIQ_BASE_URL env var)").option("-p, --project-id <id>", "Default QCentriq project UUID (or QCENTRIQ_PROJECT_ID env var)").option("-d, --debug", "Enable debug logging to stderr (or DEBUG/QCENTRIQ_DEBUG env var)").allowUnknownOption(true).parse(argv);
|
|
43
|
+
const opts = program.opts();
|
|
44
|
+
const apiKey = opts.apiKey || process.env.QCENTRIQ_API_KEY || "";
|
|
45
|
+
const rawBaseUrl = opts.baseUrl || process.env.QCENTRIQ_BASE_URL || DEFAULT_BASE_URL;
|
|
46
|
+
const baseUrl = rawBaseUrl.replace(/\/+$/, "");
|
|
47
|
+
const defaultProjectId = opts.projectId || process.env.QCENTRIQ_PROJECT_ID;
|
|
48
|
+
const debug = Boolean(opts.debug || process.env.DEBUG || process.env.QCENTRIQ_DEBUG);
|
|
49
|
+
if (debug) {
|
|
50
|
+
setDebugLogging(true);
|
|
51
|
+
}
|
|
52
|
+
if (!apiKey) {
|
|
53
|
+
logger.error("Missing QCentriq API key!");
|
|
54
|
+
logger.error("Provide it via --api-key <key> or set the QCENTRIQ_API_KEY environment variable.");
|
|
55
|
+
logger.error("Example: QCENTRIQ_API_KEY=qc_xxxxxxxxxxxx npx -y @qcentriq/mcp");
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
apiKey,
|
|
60
|
+
baseUrl,
|
|
61
|
+
defaultProjectId,
|
|
62
|
+
debug
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/client/api.ts
|
|
67
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
68
|
+
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
69
|
+
|
|
70
|
+
// src/utils/sanitizer.ts
|
|
71
|
+
var QCENTRIQ_KEY_REGEX = /qc_[0-9a-fA-F]{30,45}/g;
|
|
72
|
+
var BEARER_TOKEN_REGEX = /Bearer\s+ey[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+/=]*/g;
|
|
73
|
+
var URL_CREDENTIALS_REGEX = /([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)[^/\s:@]+:[^/\s:@]+@/g;
|
|
74
|
+
function sanitizeText(text) {
|
|
75
|
+
if (!text) return text;
|
|
76
|
+
return text.replace(QCENTRIQ_KEY_REGEX, "[REDACTED_API_KEY]").replace(BEARER_TOKEN_REGEX, "Bearer [REDACTED_TOKEN]").replace(URL_CREDENTIALS_REGEX, "$1[REDACTED_USERINFO]@");
|
|
77
|
+
}
|
|
78
|
+
function sanitizePayload(value) {
|
|
79
|
+
if (value === null || value === void 0) {
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
if (typeof value === "string") {
|
|
83
|
+
return sanitizeText(value);
|
|
84
|
+
}
|
|
85
|
+
if (Array.isArray(value)) {
|
|
86
|
+
return value.map((item) => sanitizePayload(item));
|
|
87
|
+
}
|
|
88
|
+
if (typeof value === "object") {
|
|
89
|
+
const copy = {};
|
|
90
|
+
for (const [k, v] of Object.entries(value)) {
|
|
91
|
+
if (/password|secret|token|api_?key|auth/i.test(k) && typeof v === "string" && v.length > 0) {
|
|
92
|
+
copy[k] = "[REDACTED]";
|
|
93
|
+
} else {
|
|
94
|
+
copy[k] = sanitizePayload(v);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return copy;
|
|
98
|
+
}
|
|
99
|
+
return value;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// src/client/api.ts
|
|
103
|
+
var QCentriqApiClient = class {
|
|
104
|
+
config;
|
|
105
|
+
mcpClient = null;
|
|
106
|
+
mcpTransport = null;
|
|
107
|
+
isConnecting = false;
|
|
108
|
+
connectPromise = null;
|
|
109
|
+
constructor(config) {
|
|
110
|
+
this.config = config;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Connect to QCentriq's remote FastMCP SSE endpoint (/api/v1/mcp/sse).
|
|
114
|
+
* All QCentriq backend operations are handled via this single SSE connection.
|
|
115
|
+
*/
|
|
116
|
+
async ensureMcpConnected() {
|
|
117
|
+
if (this.mcpClient) {
|
|
118
|
+
return this.mcpClient;
|
|
119
|
+
}
|
|
120
|
+
if (this.isConnecting && this.connectPromise) {
|
|
121
|
+
await this.connectPromise;
|
|
122
|
+
if (this.mcpClient) return this.mcpClient;
|
|
123
|
+
}
|
|
124
|
+
this.isConnecting = true;
|
|
125
|
+
this.connectPromise = (async () => {
|
|
126
|
+
try {
|
|
127
|
+
const sseUrl = new URL(`${this.config.baseUrl}/api/v1/mcp/sse`);
|
|
128
|
+
sseUrl.searchParams.set("token", this.config.apiKey);
|
|
129
|
+
logger.debug(`Connecting via SSEClientTransport to: ${sseUrl.toString()}`);
|
|
130
|
+
this.mcpTransport = new SSEClientTransport(sseUrl, {
|
|
131
|
+
requestInit: {
|
|
132
|
+
headers: {
|
|
133
|
+
Authorization: `Bearer ${this.config.apiKey}`
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
this.mcpClient = new Client(
|
|
138
|
+
{
|
|
139
|
+
name: "qcentriq-mcp-cli",
|
|
140
|
+
version: "1.0.0"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
capabilities: {}
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
await this.mcpClient.connect(this.mcpTransport);
|
|
147
|
+
logger.info("Connected to QCentriq backend /api/v1/mcp/sse successfully.");
|
|
148
|
+
} catch (err) {
|
|
149
|
+
logger.error(`Failed to connect to QCentriq MCP SSE: ${err.message}`);
|
|
150
|
+
this.mcpClient = null;
|
|
151
|
+
this.mcpTransport = null;
|
|
152
|
+
throw new Error(`Could not connect to QCentriq MCP endpoint: ${err.message}`);
|
|
153
|
+
} finally {
|
|
154
|
+
this.isConnecting = false;
|
|
155
|
+
}
|
|
156
|
+
})();
|
|
157
|
+
await this.connectPromise;
|
|
158
|
+
if (!this.mcpClient) {
|
|
159
|
+
throw new Error("Failed to initialize MCP client.");
|
|
160
|
+
}
|
|
161
|
+
return this.mcpClient;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Retrieve list of tools exposed by QCentriq backend over /api/v1/mcp/sse.
|
|
165
|
+
*/
|
|
166
|
+
async listRemoteTools() {
|
|
167
|
+
const client = await this.ensureMcpConnected();
|
|
168
|
+
const result = await client.listTools();
|
|
169
|
+
return result.tools || [];
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Invoke a remote tool on the QCentriq backend via /api/v1/mcp/sse.
|
|
173
|
+
*/
|
|
174
|
+
async callRemoteTool(toolName, args) {
|
|
175
|
+
const client = await this.ensureMcpConnected();
|
|
176
|
+
logger.debug(`Invoking remote tool "${toolName}" with arguments:`, args);
|
|
177
|
+
try {
|
|
178
|
+
const response = await client.callTool({
|
|
179
|
+
name: toolName,
|
|
180
|
+
arguments: args
|
|
181
|
+
});
|
|
182
|
+
return sanitizePayload(response);
|
|
183
|
+
} catch (err) {
|
|
184
|
+
logger.error(`Error calling remote tool "${toolName}":`, err.message);
|
|
185
|
+
if (err.message?.includes("closed") || err.message?.includes("disconnect")) {
|
|
186
|
+
this.mcpClient = null;
|
|
187
|
+
this.mcpTransport = null;
|
|
188
|
+
}
|
|
189
|
+
throw err;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Close the SSE connection on shutdown.
|
|
194
|
+
*/
|
|
195
|
+
async close() {
|
|
196
|
+
if (this.mcpClient) {
|
|
197
|
+
try {
|
|
198
|
+
await this.mcpClient.close();
|
|
199
|
+
} catch {
|
|
200
|
+
}
|
|
201
|
+
this.mcpClient = null;
|
|
202
|
+
this.mcpTransport = null;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
// src/tools/list-tests.ts
|
|
208
|
+
import { z } from "zod";
|
|
209
|
+
function registerListTestsTool(server, client, config) {
|
|
210
|
+
server.tool(
|
|
211
|
+
"qcentriq_list_tests",
|
|
212
|
+
"Discover and list automated test cases and test groups for a project with status, priority, and update dates. Test group script availability is indicated in test_groups. Blocked test cases have no script.",
|
|
213
|
+
{
|
|
214
|
+
project_id: z.string().uuid().optional().describe("Optional project UUID (inferred from API key if omitted)."),
|
|
215
|
+
group_id: z.string().uuid().optional().describe("Optional test group UUID filter."),
|
|
216
|
+
priority: z.enum(["low", "medium", "high", "critical"]).optional().describe("Filter by priority."),
|
|
217
|
+
test_type: z.enum(["web", "api", "mobile"]).optional().describe("Filter by test type."),
|
|
218
|
+
limit: z.number().int().min(1).max(100).default(50).describe("Max number of test cases to return (default 50)."),
|
|
219
|
+
offset: z.number().int().min(0).default(0).describe("Pagination offset.")
|
|
220
|
+
},
|
|
221
|
+
async (args) => {
|
|
222
|
+
try {
|
|
223
|
+
const projectId = args.project_id || config.defaultProjectId;
|
|
224
|
+
const response = await client.callRemoteTool("qcentriq_list_tests", {
|
|
225
|
+
...args,
|
|
226
|
+
project_id: projectId
|
|
227
|
+
});
|
|
228
|
+
return response;
|
|
229
|
+
} catch (err) {
|
|
230
|
+
return {
|
|
231
|
+
isError: true,
|
|
232
|
+
content: [{ type: "text", text: `Error in qcentriq_list_tests: ${err.message}` }]
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// src/tools/get-test.ts
|
|
240
|
+
import { z as z2 } from "zod";
|
|
241
|
+
function registerGetTestTool(server, client, config) {
|
|
242
|
+
server.tool(
|
|
243
|
+
"qcentriq_get_test",
|
|
244
|
+
"Retrieve detailed test case information including step definitions, preconditions, latest execution diagnostics, error stack traces, and parent test group script metadata.",
|
|
245
|
+
{
|
|
246
|
+
test_case_id: z2.string().uuid().describe("UUID of the target test case."),
|
|
247
|
+
project_id: z2.string().uuid().optional().describe("Optional project UUID (inferred from API key if omitted).")
|
|
248
|
+
},
|
|
249
|
+
async (args) => {
|
|
250
|
+
try {
|
|
251
|
+
const projectId = args.project_id || config.defaultProjectId;
|
|
252
|
+
const response = await client.callRemoteTool("qcentriq_get_test", {
|
|
253
|
+
...args,
|
|
254
|
+
project_id: projectId
|
|
255
|
+
});
|
|
256
|
+
return response;
|
|
257
|
+
} catch (err) {
|
|
258
|
+
return {
|
|
259
|
+
isError: true,
|
|
260
|
+
content: [{ type: "text", text: `Error in qcentriq_get_test: ${err.message}` }]
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// src/tools/get-groups.ts
|
|
268
|
+
import { z as z3 } from "zod";
|
|
269
|
+
function registerGetTestGroupsTool(server, client, config) {
|
|
270
|
+
server.tool(
|
|
271
|
+
"qcentriq_get_test_groups",
|
|
272
|
+
"Discover and inspect test groups for a project. Returns what each group is about (title, description), total/active/blocked test case counts, and whether a test script exists. Provide group_id to inspect member test cases.",
|
|
273
|
+
{
|
|
274
|
+
project_id: z3.string().uuid().optional().describe("Optional project UUID (inferred from API key if omitted)."),
|
|
275
|
+
group_id: z3.string().uuid().optional().describe("Optional test group UUID filter to inspect a specific group."),
|
|
276
|
+
limit: z3.number().int().min(1).max(100).default(50).describe("Max test groups to return (default 50)."),
|
|
277
|
+
offset: z3.number().int().min(0).default(0).describe("Pagination offset.")
|
|
278
|
+
},
|
|
279
|
+
async (args) => {
|
|
280
|
+
try {
|
|
281
|
+
const projectId = args.project_id || config.defaultProjectId;
|
|
282
|
+
const response = await client.callRemoteTool("qcentriq_get_test_groups", {
|
|
283
|
+
...args,
|
|
284
|
+
project_id: projectId
|
|
285
|
+
});
|
|
286
|
+
return response;
|
|
287
|
+
} catch (err) {
|
|
288
|
+
return {
|
|
289
|
+
isError: true,
|
|
290
|
+
content: [{ type: "text", text: `Error in qcentriq_get_test_groups: ${err.message}` }]
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// src/tools/download-script.ts
|
|
298
|
+
import { z as z4 } from "zod";
|
|
299
|
+
import * as fs from "fs/promises";
|
|
300
|
+
import * as path from "path";
|
|
301
|
+
function registerDownloadScriptTool(server, client, config) {
|
|
302
|
+
server.tool(
|
|
303
|
+
"qcentriq_download_script",
|
|
304
|
+
"Download test group script and accompanying fixture files (e.g. conftest.py) for local test execution and editing. Optionally writes files directly to the local filesystem.",
|
|
305
|
+
{
|
|
306
|
+
group_id: z4.string().uuid().describe("UUID of the target test group."),
|
|
307
|
+
project_id: z4.string().uuid().optional().describe("Optional project UUID (inferred from API key if omitted)."),
|
|
308
|
+
include_fixtures: z4.boolean().default(true).describe("Whether to retrieve accompanying conftest.py / fixtures (default True)."),
|
|
309
|
+
save_to_disk: z4.boolean().default(false).describe("If true, saves the downloaded test script and fixtures directly to the local filesystem."),
|
|
310
|
+
destination_dir: z4.string().default("./tests").describe("Destination directory when save_to_disk is true (defaults to ./tests).")
|
|
311
|
+
},
|
|
312
|
+
async (args) => {
|
|
313
|
+
try {
|
|
314
|
+
const projectId = args.project_id || config.defaultProjectId;
|
|
315
|
+
const response = await client.callRemoteTool("qcentriq_download_script", {
|
|
316
|
+
group_id: args.group_id,
|
|
317
|
+
project_id: projectId,
|
|
318
|
+
include_fixtures: args.include_fixtures
|
|
319
|
+
});
|
|
320
|
+
if (args.save_to_disk && response && response.content) {
|
|
321
|
+
try {
|
|
322
|
+
const textItem = response.content.find((c) => c.type === "text");
|
|
323
|
+
if (textItem && textItem.text) {
|
|
324
|
+
const data = JSON.parse(textItem.text);
|
|
325
|
+
const targetDir = path.resolve(process.cwd(), args.destination_dir);
|
|
326
|
+
await fs.mkdir(targetDir, { recursive: true });
|
|
327
|
+
const savedFiles = [];
|
|
328
|
+
if (data.file_name && data.content) {
|
|
329
|
+
const safeFileName = path.basename(data.file_name);
|
|
330
|
+
if (!safeFileName || safeFileName === "." || safeFileName === "..") {
|
|
331
|
+
throw new Error(`Invalid file name returned: "${data.file_name}"`);
|
|
332
|
+
}
|
|
333
|
+
const scriptPath = path.join(targetDir, safeFileName);
|
|
334
|
+
if (!path.resolve(scriptPath).startsWith(targetDir)) {
|
|
335
|
+
throw new Error(`Path traversal detected in returned file name: "${data.file_name}"`);
|
|
336
|
+
}
|
|
337
|
+
await fs.writeFile(scriptPath, data.content, "utf-8");
|
|
338
|
+
savedFiles.push(scriptPath);
|
|
339
|
+
logger.info(`Saved test script to: ${scriptPath}`);
|
|
340
|
+
}
|
|
341
|
+
if (data.conftest_content) {
|
|
342
|
+
const conftestPath = path.join(targetDir, "conftest.py");
|
|
343
|
+
await fs.writeFile(conftestPath, data.conftest_content, "utf-8");
|
|
344
|
+
savedFiles.push(conftestPath);
|
|
345
|
+
logger.info(`Saved conftest.py to: ${conftestPath}`);
|
|
346
|
+
}
|
|
347
|
+
if (savedFiles.length > 0) {
|
|
348
|
+
data.saved_files = savedFiles;
|
|
349
|
+
textItem.text = JSON.stringify(data, null, 2);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
} catch (writeErr) {
|
|
353
|
+
logger.warn(`Failed to write downloaded script to disk: ${writeErr.message}`);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return response;
|
|
357
|
+
} catch (err) {
|
|
358
|
+
return {
|
|
359
|
+
isError: true,
|
|
360
|
+
content: [{ type: "text", text: `Error in qcentriq_download_script: ${err.message}` }]
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// src/tools/environment.ts
|
|
368
|
+
import { z as z5 } from "zod";
|
|
369
|
+
function registerEnvironmentTool(server, client, config) {
|
|
370
|
+
server.tool(
|
|
371
|
+
"qcentriq_get_environment",
|
|
372
|
+
"Retrieve target test environment configuration, base URL (BASE_URL), environment variables, and secrets for local test execution.",
|
|
373
|
+
{
|
|
374
|
+
project_id: z5.string().uuid().optional().describe("Optional project UUID (inferred from API key if omitted)."),
|
|
375
|
+
environment_id: z5.string().uuid().optional().describe("Optional specific environment UUID."),
|
|
376
|
+
environment_name: z5.string().optional().describe("Optional environment name filter (e.g. 'staging', 'dev', 'production')."),
|
|
377
|
+
include_secrets: z5.boolean().default(false).describe("Whether to include decrypted secret values for runtime injection (default False).")
|
|
378
|
+
},
|
|
379
|
+
async (args) => {
|
|
380
|
+
try {
|
|
381
|
+
const projectId = args.project_id || config.defaultProjectId;
|
|
382
|
+
const response = await client.callRemoteTool("qcentriq_get_environment", {
|
|
383
|
+
...args,
|
|
384
|
+
project_id: projectId
|
|
385
|
+
});
|
|
386
|
+
return response;
|
|
387
|
+
} catch (err) {
|
|
388
|
+
return {
|
|
389
|
+
isError: true,
|
|
390
|
+
content: [{ type: "text", text: `Error in qcentriq_get_environment: ${err.message}` }]
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// src/tools/run-logs.ts
|
|
398
|
+
import { z as z6 } from "zod";
|
|
399
|
+
function registerRunLogsTool(server, client, config) {
|
|
400
|
+
server.tool(
|
|
401
|
+
"qcentriq_get_test_run_logs",
|
|
402
|
+
"Retrieve execution history and logs for a test case: per-run status, timing, error message, stack trace, and raw output logs across runs.",
|
|
403
|
+
{
|
|
404
|
+
test_case_id: z6.string().uuid().describe("UUID of the target test case."),
|
|
405
|
+
project_id: z6.string().uuid().optional().describe("Optional project UUID (inferred from API key if omitted)."),
|
|
406
|
+
run_id: z6.string().uuid().optional().describe("Optional specific run UUID to fetch a single run's full log."),
|
|
407
|
+
status: z6.enum(["failed", "passed", "error"]).optional().describe("Filter by result status."),
|
|
408
|
+
latest_only: z6.boolean().default(false).describe("If True, returns only the most recent matching run."),
|
|
409
|
+
from_date: z6.string().optional().describe("Optional ISO-8601 start date filter."),
|
|
410
|
+
to_date: z6.string().optional().describe("Optional ISO-8601 end date filter."),
|
|
411
|
+
limit: z6.number().int().min(1).max(100).default(20).describe("Max runs to return."),
|
|
412
|
+
offset: z6.number().int().min(0).default(0).describe("Pagination offset.")
|
|
413
|
+
},
|
|
414
|
+
async (args) => {
|
|
415
|
+
try {
|
|
416
|
+
const projectId = args.project_id || config.defaultProjectId;
|
|
417
|
+
const response = await client.callRemoteTool("qcentriq_get_test_run_logs", {
|
|
418
|
+
...args,
|
|
419
|
+
project_id: projectId
|
|
420
|
+
});
|
|
421
|
+
return response;
|
|
422
|
+
} catch (err) {
|
|
423
|
+
return {
|
|
424
|
+
isError: true,
|
|
425
|
+
content: [{ type: "text", text: `Error in qcentriq_get_test_run_logs: ${err.message}` }]
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
// src/tools/local-run.ts
|
|
433
|
+
import { z as z7 } from "zod";
|
|
434
|
+
|
|
435
|
+
// src/local/runner.ts
|
|
436
|
+
import { spawn } from "child_process";
|
|
437
|
+
import * as path2 from "path";
|
|
438
|
+
function resolvePytestCommand() {
|
|
439
|
+
if (process.env.VIRTUAL_ENV) {
|
|
440
|
+
const venvPytest = path2.join(process.env.VIRTUAL_ENV, "bin", "pytest");
|
|
441
|
+
return { cmd: venvPytest, baseArgs: [] };
|
|
442
|
+
}
|
|
443
|
+
return { cmd: "pytest", baseArgs: [] };
|
|
444
|
+
}
|
|
445
|
+
function killProcessTree(child) {
|
|
446
|
+
if (child.pid) {
|
|
447
|
+
try {
|
|
448
|
+
if (process.platform !== "win32") {
|
|
449
|
+
process.kill(-child.pid, "SIGKILL");
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
} catch {
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
try {
|
|
456
|
+
child.kill("SIGKILL");
|
|
457
|
+
} catch {
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
async function runLocalPytest(params) {
|
|
461
|
+
const startTime = Date.now();
|
|
462
|
+
const cwd = params.workingDir ? path2.resolve(params.workingDir) : process.cwd();
|
|
463
|
+
const timeoutMs = (params.timeoutSeconds || 60) * 1e3;
|
|
464
|
+
const { cmd, baseArgs } = resolvePytestCommand();
|
|
465
|
+
const args = [...baseArgs, params.filePath];
|
|
466
|
+
if (params.testName) {
|
|
467
|
+
args.push("-k", params.testName);
|
|
468
|
+
}
|
|
469
|
+
if (params.extraArgs && params.extraArgs.length > 0) {
|
|
470
|
+
args.push(...params.extraArgs);
|
|
471
|
+
}
|
|
472
|
+
if (!args.includes("-v") && !args.includes("-vv")) {
|
|
473
|
+
args.push("-v");
|
|
474
|
+
}
|
|
475
|
+
const env = {
|
|
476
|
+
...process.env,
|
|
477
|
+
...params.envVars || {}
|
|
478
|
+
};
|
|
479
|
+
if (params.baseUrl) {
|
|
480
|
+
env.BASE_URL = params.baseUrl;
|
|
481
|
+
}
|
|
482
|
+
if (params.browser) {
|
|
483
|
+
env.BROWSER = params.browser;
|
|
484
|
+
}
|
|
485
|
+
if (params.headless !== void 0) {
|
|
486
|
+
env.HEADLESS = params.headless ? "true" : "false";
|
|
487
|
+
}
|
|
488
|
+
const fullCommand = `${cmd} ${args.join(" ")}`;
|
|
489
|
+
logger.info(`Running local test command: ${fullCommand} in ${cwd}`);
|
|
490
|
+
return new Promise((resolve4) => {
|
|
491
|
+
let stdout = "";
|
|
492
|
+
let stderr = "";
|
|
493
|
+
let finished = false;
|
|
494
|
+
const child = spawn(cmd, args, {
|
|
495
|
+
cwd,
|
|
496
|
+
env,
|
|
497
|
+
detached: process.platform !== "win32",
|
|
498
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
499
|
+
});
|
|
500
|
+
const timer = setTimeout(() => {
|
|
501
|
+
if (!finished) {
|
|
502
|
+
finished = true;
|
|
503
|
+
killProcessTree(child);
|
|
504
|
+
resolve4({
|
|
505
|
+
passed: false,
|
|
506
|
+
exitCode: -1,
|
|
507
|
+
stdout,
|
|
508
|
+
stderr: stderr + `
|
|
509
|
+
[TIMEOUT] Test execution timed out after ${params.timeoutSeconds || 60} seconds.`,
|
|
510
|
+
durationMs: Date.now() - startTime,
|
|
511
|
+
command: fullCommand
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
}, timeoutMs);
|
|
515
|
+
child.stdout.on("data", (chunk) => {
|
|
516
|
+
stdout += chunk.toString();
|
|
517
|
+
});
|
|
518
|
+
child.stderr.on("data", (chunk) => {
|
|
519
|
+
stderr += chunk.toString();
|
|
520
|
+
});
|
|
521
|
+
child.on("error", (err) => {
|
|
522
|
+
if (finished) return;
|
|
523
|
+
finished = true;
|
|
524
|
+
clearTimeout(timer);
|
|
525
|
+
if (err.code === "ENOENT" && cmd !== "python3") {
|
|
526
|
+
logger.warn("pytest binary not found directly, falling back to python3 -m pytest...");
|
|
527
|
+
const fallbackChild = spawn("python3", ["-m", "pytest", ...args], {
|
|
528
|
+
cwd,
|
|
529
|
+
env,
|
|
530
|
+
detached: process.platform !== "win32",
|
|
531
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
532
|
+
});
|
|
533
|
+
let fbStdout = "";
|
|
534
|
+
let fbStderr = "";
|
|
535
|
+
let fbFinished = false;
|
|
536
|
+
const fbTimer = setTimeout(() => {
|
|
537
|
+
if (!fbFinished) {
|
|
538
|
+
fbFinished = true;
|
|
539
|
+
killProcessTree(fallbackChild);
|
|
540
|
+
resolve4({
|
|
541
|
+
passed: false,
|
|
542
|
+
exitCode: -1,
|
|
543
|
+
stdout: fbStdout,
|
|
544
|
+
stderr: fbStderr + `
|
|
545
|
+
[TIMEOUT] Test execution timed out after ${params.timeoutSeconds || 60} seconds.`,
|
|
546
|
+
durationMs: Date.now() - startTime,
|
|
547
|
+
command: `python3 -m pytest ${args.join(" ")}`
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
}, timeoutMs);
|
|
551
|
+
fallbackChild.stdout.on("data", (c) => fbStdout += c.toString());
|
|
552
|
+
fallbackChild.stderr.on("data", (c) => fbStderr += c.toString());
|
|
553
|
+
fallbackChild.on("close", (code) => {
|
|
554
|
+
if (fbFinished) return;
|
|
555
|
+
fbFinished = true;
|
|
556
|
+
clearTimeout(fbTimer);
|
|
557
|
+
resolve4({
|
|
558
|
+
passed: code === 0,
|
|
559
|
+
exitCode: code ?? -1,
|
|
560
|
+
stdout: fbStdout,
|
|
561
|
+
stderr: fbStderr,
|
|
562
|
+
durationMs: Date.now() - startTime,
|
|
563
|
+
command: `python3 -m pytest ${args.join(" ")}`
|
|
564
|
+
});
|
|
565
|
+
});
|
|
566
|
+
fallbackChild.on("error", (fbErr) => {
|
|
567
|
+
if (fbFinished) return;
|
|
568
|
+
fbFinished = true;
|
|
569
|
+
clearTimeout(fbTimer);
|
|
570
|
+
resolve4({
|
|
571
|
+
passed: false,
|
|
572
|
+
exitCode: -1,
|
|
573
|
+
stdout: "",
|
|
574
|
+
stderr: `Failed to execute pytest or python3 -m pytest: ${fbErr.message}. Ensure pytest is installed in your Python environment.`,
|
|
575
|
+
durationMs: Date.now() - startTime,
|
|
576
|
+
command: fullCommand
|
|
577
|
+
});
|
|
578
|
+
});
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
resolve4({
|
|
582
|
+
passed: false,
|
|
583
|
+
exitCode: -1,
|
|
584
|
+
stdout,
|
|
585
|
+
stderr: `Failed to spawn process: ${err.message}. Ensure pytest is installed in your Python environment.`,
|
|
586
|
+
durationMs: Date.now() - startTime,
|
|
587
|
+
command: fullCommand
|
|
588
|
+
});
|
|
589
|
+
});
|
|
590
|
+
child.on("close", (code) => {
|
|
591
|
+
if (finished) return;
|
|
592
|
+
finished = true;
|
|
593
|
+
clearTimeout(timer);
|
|
594
|
+
const durationMs = Date.now() - startTime;
|
|
595
|
+
resolve4({
|
|
596
|
+
passed: code === 0,
|
|
597
|
+
exitCode: code ?? -1,
|
|
598
|
+
stdout,
|
|
599
|
+
stderr,
|
|
600
|
+
durationMs,
|
|
601
|
+
command: fullCommand
|
|
602
|
+
});
|
|
603
|
+
});
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// src/tools/local-run.ts
|
|
608
|
+
function registerLocalRunTool(server) {
|
|
609
|
+
server.tool(
|
|
610
|
+
"qcentriq_run_local_test",
|
|
611
|
+
"Execute a downloaded Playwright/pytest test script locally in the developer's environment. Runs pytest as a local subprocess and returns stdout, stderr, exit code, and test diagnostics without using QCentriq cloud runners.",
|
|
612
|
+
{
|
|
613
|
+
file_path: z7.string().describe("Path to the local test file to run (e.g. 'tests/test_login.py')."),
|
|
614
|
+
test_name: z7.string().optional().describe("Optional specific test function name or expression to run (passed to pytest -k)."),
|
|
615
|
+
headless: z7.boolean().default(true).describe("Whether to run the browser in headless mode (default True). Set False to watch the browser execution live."),
|
|
616
|
+
browser: z7.enum(["chromium", "firefox", "webkit"]).default("chromium").describe("Browser engine to execute against (default 'chromium')."),
|
|
617
|
+
base_url: z7.string().url().optional().describe("Target application base URL (e.g. from qcentriq_get_environment). Injected as BASE_URL env var."),
|
|
618
|
+
env_vars: z7.record(z7.string(), z7.string()).optional().describe("Environment variables to inject into the local test process."),
|
|
619
|
+
extra_args: z7.array(z7.string()).optional().describe("Additional CLI arguments to pass to pytest (e.g. ['-s', '--alluredir=allure-results'])."),
|
|
620
|
+
timeout_seconds: z7.number().int().min(5).max(300).default(60).describe("Timeout in seconds for test execution (default 60)."),
|
|
621
|
+
working_dir: z7.string().optional().describe("Working directory to run pytest in (defaults to current project directory).")
|
|
622
|
+
},
|
|
623
|
+
async (args) => {
|
|
624
|
+
try {
|
|
625
|
+
const result = await runLocalPytest({
|
|
626
|
+
filePath: args.file_path,
|
|
627
|
+
testName: args.test_name,
|
|
628
|
+
headless: args.headless,
|
|
629
|
+
browser: args.browser,
|
|
630
|
+
baseUrl: args.base_url,
|
|
631
|
+
envVars: args.env_vars,
|
|
632
|
+
extraArgs: args.extra_args,
|
|
633
|
+
timeoutSeconds: args.timeout_seconds,
|
|
634
|
+
workingDir: args.working_dir
|
|
635
|
+
});
|
|
636
|
+
const statusText = result.passed ? "PASSED" : "FAILED";
|
|
637
|
+
const summary = [
|
|
638
|
+
`Local Test Run Result: ${statusText} (exit code ${result.exitCode})`,
|
|
639
|
+
`Duration: ${(result.durationMs / 1e3).toFixed(2)}s`,
|
|
640
|
+
`Command: ${result.command}`,
|
|
641
|
+
"",
|
|
642
|
+
"--- STDOUT ---",
|
|
643
|
+
result.stdout || "(no stdout)",
|
|
644
|
+
"",
|
|
645
|
+
"--- STDERR ---",
|
|
646
|
+
result.stderr || "(no stderr)"
|
|
647
|
+
].join("\n");
|
|
648
|
+
return {
|
|
649
|
+
content: [
|
|
650
|
+
{
|
|
651
|
+
type: "text",
|
|
652
|
+
text: summary
|
|
653
|
+
}
|
|
654
|
+
],
|
|
655
|
+
isError: !result.passed
|
|
656
|
+
};
|
|
657
|
+
} catch (err) {
|
|
658
|
+
return {
|
|
659
|
+
isError: true,
|
|
660
|
+
content: [
|
|
661
|
+
{
|
|
662
|
+
type: "text",
|
|
663
|
+
text: `Error executing local test: ${err.message}`
|
|
664
|
+
}
|
|
665
|
+
]
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// src/tools/save-script.ts
|
|
673
|
+
import { z as z8 } from "zod";
|
|
674
|
+
import * as fs2 from "fs/promises";
|
|
675
|
+
import * as path3 from "path";
|
|
676
|
+
function registerSaveScriptTool(server) {
|
|
677
|
+
server.tool(
|
|
678
|
+
"qcentriq_save_script",
|
|
679
|
+
"Save downloaded Playwright Python test script and fixtures directly to the local workspace disk so they can be run or edited locally.",
|
|
680
|
+
{
|
|
681
|
+
file_name: z8.string().describe("Target filename (e.g. 'test_login.py')."),
|
|
682
|
+
content: z8.string().describe("Python test script source code."),
|
|
683
|
+
conftest_content: z8.string().optional().describe("Accompanying conftest.py source code if present."),
|
|
684
|
+
destination_dir: z8.string().default("./tests").describe("Destination directory in the local workspace (default './tests').")
|
|
685
|
+
},
|
|
686
|
+
async (args) => {
|
|
687
|
+
try {
|
|
688
|
+
const targetDir = path3.resolve(process.cwd(), args.destination_dir);
|
|
689
|
+
await fs2.mkdir(targetDir, { recursive: true });
|
|
690
|
+
const savedFiles = [];
|
|
691
|
+
const safeFileName = path3.basename(args.file_name);
|
|
692
|
+
if (!safeFileName || safeFileName === "." || safeFileName === "..") {
|
|
693
|
+
throw new Error(`Invalid file name: "${args.file_name}"`);
|
|
694
|
+
}
|
|
695
|
+
const scriptPath = path3.join(targetDir, safeFileName);
|
|
696
|
+
if (!path3.resolve(scriptPath).startsWith(targetDir)) {
|
|
697
|
+
throw new Error(`Path traversal detected for file name: "${args.file_name}"`);
|
|
698
|
+
}
|
|
699
|
+
await fs2.writeFile(scriptPath, args.content, "utf-8");
|
|
700
|
+
savedFiles.push(scriptPath);
|
|
701
|
+
logger.info(`Saved test script to: ${scriptPath}`);
|
|
702
|
+
if (args.conftest_content) {
|
|
703
|
+
const conftestPath = path3.join(targetDir, "conftest.py");
|
|
704
|
+
await fs2.writeFile(conftestPath, args.conftest_content, "utf-8");
|
|
705
|
+
savedFiles.push(conftestPath);
|
|
706
|
+
logger.info(`Saved conftest.py to: ${conftestPath}`);
|
|
707
|
+
}
|
|
708
|
+
return {
|
|
709
|
+
content: [
|
|
710
|
+
{
|
|
711
|
+
type: "text",
|
|
712
|
+
text: JSON.stringify(
|
|
713
|
+
{
|
|
714
|
+
status: "success",
|
|
715
|
+
message: `Successfully saved ${savedFiles.length} file(s) to ${targetDir}`,
|
|
716
|
+
saved_files: savedFiles
|
|
717
|
+
},
|
|
718
|
+
null,
|
|
719
|
+
2
|
|
720
|
+
)
|
|
721
|
+
}
|
|
722
|
+
]
|
|
723
|
+
};
|
|
724
|
+
} catch (err) {
|
|
725
|
+
return {
|
|
726
|
+
isError: true,
|
|
727
|
+
content: [
|
|
728
|
+
{
|
|
729
|
+
type: "text",
|
|
730
|
+
text: `Failed to save test script to disk: ${err.message}`
|
|
731
|
+
}
|
|
732
|
+
]
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
// src/tools/index.ts
|
|
740
|
+
function registerAllTools(server, client, config) {
|
|
741
|
+
logger.debug("Registering QCentriq MCP tools...");
|
|
742
|
+
registerListTestsTool(server, client, config);
|
|
743
|
+
registerGetTestTool(server, client, config);
|
|
744
|
+
registerGetTestGroupsTool(server, client, config);
|
|
745
|
+
registerDownloadScriptTool(server, client, config);
|
|
746
|
+
registerEnvironmentTool(server, client, config);
|
|
747
|
+
registerRunLogsTool(server, client, config);
|
|
748
|
+
registerSaveScriptTool(server);
|
|
749
|
+
registerLocalRunTool(server);
|
|
750
|
+
logger.info("Successfully registered 8 QCentriq MCP tools (6 remote discovery + 2 local client execution).");
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
// src/index.ts
|
|
754
|
+
async function main() {
|
|
755
|
+
try {
|
|
756
|
+
const config = loadConfig(process.argv);
|
|
757
|
+
logger.info(`Starting QCentriq MCP Server against: ${config.baseUrl}`);
|
|
758
|
+
const apiClient = new QCentriqApiClient(config);
|
|
759
|
+
const server = new McpServer({
|
|
760
|
+
name: "@qcentriq/mcp",
|
|
761
|
+
version: "1.0.0"
|
|
762
|
+
});
|
|
763
|
+
registerAllTools(server, apiClient, config);
|
|
764
|
+
const transport = new StdioServerTransport();
|
|
765
|
+
const cleanup = async () => {
|
|
766
|
+
logger.info("Shutting down QCentriq MCP Server...");
|
|
767
|
+
await apiClient.close();
|
|
768
|
+
await server.close();
|
|
769
|
+
process.exit(0);
|
|
770
|
+
};
|
|
771
|
+
process.on("SIGINT", cleanup);
|
|
772
|
+
process.on("SIGTERM", cleanup);
|
|
773
|
+
await server.connect(transport);
|
|
774
|
+
logger.info("QCentriq MCP Server is running on stdio.");
|
|
775
|
+
} catch (err) {
|
|
776
|
+
logger.error("Fatal error during QCentriq MCP Server startup:", err.message);
|
|
777
|
+
process.exit(1);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
main();
|
|
781
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/config.ts","../src/utils/logger.ts","../src/client/api.ts","../src/utils/sanitizer.ts","../src/tools/list-tests.ts","../src/tools/get-test.ts","../src/tools/get-groups.ts","../src/tools/download-script.ts","../src/tools/environment.ts","../src/tools/run-logs.ts","../src/tools/local-run.ts","../src/local/runner.ts","../src/tools/save-script.ts","../src/tools/index.ts"],"sourcesContent":["import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { loadConfig } from \"./config.js\";\nimport { QCentriqApiClient } from \"./client/api.js\";\nimport { registerAllTools } from \"./tools/index.js\";\nimport { logger } from \"./utils/logger.js\";\n\nasync function main() {\n try {\n const config = loadConfig(process.argv);\n logger.info(`Starting QCentriq MCP Server against: ${config.baseUrl}`);\n\n const apiClient = new QCentriqApiClient(config);\n\n const server = new McpServer({\n name: \"@qcentriq/mcp\",\n version: \"1.0.0\",\n });\n\n registerAllTools(server, apiClient, config);\n\n const transport = new StdioServerTransport();\n\n const cleanup = async () => {\n logger.info(\"Shutting down QCentriq MCP Server...\");\n await apiClient.close();\n await server.close();\n process.exit(0);\n };\n\n process.on(\"SIGINT\", cleanup);\n process.on(\"SIGTERM\", cleanup);\n\n await server.connect(transport);\n logger.info(\"QCentriq MCP Server is running on stdio.\");\n } catch (err: any) {\n logger.error(\"Fatal error during QCentriq MCP Server startup:\", err.message);\n process.exit(1);\n }\n}\n\nmain();\n","import { Command } from \"commander\";\nimport { QCentriqConfig } from \"./types.js\";\nimport { logger, setDebugLogging } from \"./utils/logger.js\";\n\nconst DEFAULT_BASE_URL = \"https://api.qcentriq.com\";\n\nexport function loadConfig(argv: string[] = process.argv): QCentriqConfig {\n const program = new Command();\n\n program\n .name(\"qcentriq-mcp\")\n .description(\"QCentriq Model Context Protocol (MCP) Server for automated test discovery and execution\")\n .option(\"-k, --api-key <key>\", \"QCentriq API key (or QCENTRIQ_API_KEY env var)\")\n .option(\"-u, --base-url <url>\", \"QCentriq API base URL (or QCENTRIQ_BASE_URL env var)\")\n .option(\"-p, --project-id <id>\", \"Default QCentriq project UUID (or QCENTRIQ_PROJECT_ID env var)\")\n .option(\"-d, --debug\", \"Enable debug logging to stderr (or DEBUG/QCENTRIQ_DEBUG env var)\")\n .allowUnknownOption(true)\n .parse(argv);\n\n const opts = program.opts();\n\n const apiKey = opts.apiKey || process.env.QCENTRIQ_API_KEY || \"\";\n const rawBaseUrl = opts.baseUrl || process.env.QCENTRIQ_BASE_URL || DEFAULT_BASE_URL;\n const baseUrl = rawBaseUrl.replace(/\\/+$/, \"\");\n const defaultProjectId = opts.projectId || process.env.QCENTRIQ_PROJECT_ID;\n const debug = Boolean(opts.debug || process.env.DEBUG || process.env.QCENTRIQ_DEBUG);\n\n if (debug) {\n setDebugLogging(true);\n }\n\n if (!apiKey) {\n logger.error(\"Missing QCentriq API key!\");\n logger.error(\"Provide it via --api-key <key> or set the QCENTRIQ_API_KEY environment variable.\");\n logger.error(\"Example: QCENTRIQ_API_KEY=qc_xxxxxxxxxxxx npx -y @qcentriq/mcp\");\n process.exit(1);\n }\n\n return {\n apiKey,\n baseUrl,\n defaultProjectId,\n debug,\n };\n}\n","/**\n * Logger for QCentriq MCP Server.\n *\n * CRITICAL: In MCP stdio servers, standard output (stdout) is reserved\n * exclusively for JSON-RPC messages. Any text printed to stdout will\n * corrupt the MCP protocol stream. All logging MUST go to standard error (stderr).\n */\n\nlet isDebugEnabled = Boolean(process.env.DEBUG || process.env.QCENTRIQ_DEBUG);\n\nexport function setDebugLogging(enabled: boolean): void {\n isDebugEnabled = enabled;\n}\n\nfunction formatMessage(level: string, message: string, ...args: any[]): string {\n const timestamp = new Date().toISOString();\n const extra = args.length > 0 ? \" \" + args.map((a) => (typeof a === \"object\" ? JSON.stringify(a) : String(a))).join(\" \") : \"\";\n return `[${timestamp}] [QCentriq MCP] [${level}] ${message}${extra}\\n`;\n}\n\nexport const logger = {\n info(message: string, ...args: any[]): void {\n process.stderr.write(formatMessage(\"INFO\", message, ...args));\n },\n warn(message: string, ...args: any[]): void {\n process.stderr.write(formatMessage(\"WARN\", message, ...args));\n },\n error(message: string, ...args: any[]): void {\n process.stderr.write(formatMessage(\"ERROR\", message, ...args));\n },\n debug(message: string, ...args: any[]): void {\n if (isDebugEnabled) {\n process.stderr.write(formatMessage(\"DEBUG\", message, ...args));\n }\n },\n};\n","import { Client } from \"@modelcontextprotocol/sdk/client/index.js\";\nimport { SSEClientTransport } from \"@modelcontextprotocol/sdk/client/sse.js\";\nimport { QCentriqConfig } from \"../types.js\";\nimport { logger } from \"../utils/logger.js\";\nimport { sanitizePayload } from \"../utils/sanitizer.js\";\n\nexport class QCentriqApiClient {\n private config: QCentriqConfig;\n private mcpClient: Client | null = null;\n private mcpTransport: SSEClientTransport | null = null;\n private isConnecting: boolean = false;\n private connectPromise: Promise<void> | null = null;\n\n constructor(config: QCentriqConfig) {\n this.config = config;\n }\n\n /**\n * Connect to QCentriq's remote FastMCP SSE endpoint (/api/v1/mcp/sse).\n * All QCentriq backend operations are handled via this single SSE connection.\n */\n async ensureMcpConnected(): Promise<Client> {\n if (this.mcpClient) {\n return this.mcpClient;\n }\n\n if (this.isConnecting && this.connectPromise) {\n await this.connectPromise;\n if (this.mcpClient) return this.mcpClient;\n }\n\n this.isConnecting = true;\n this.connectPromise = (async () => {\n try {\n const sseUrl = new URL(`${this.config.baseUrl}/api/v1/mcp/sse`);\n sseUrl.searchParams.set(\"token\", this.config.apiKey);\n\n logger.debug(`Connecting via SSEClientTransport to: ${sseUrl.toString()}`);\n\n this.mcpTransport = new SSEClientTransport(sseUrl, {\n requestInit: {\n headers: {\n Authorization: `Bearer ${this.config.apiKey}`,\n },\n },\n });\n\n this.mcpClient = new Client(\n {\n name: \"qcentriq-mcp-cli\",\n version: \"1.0.0\",\n },\n {\n capabilities: {},\n }\n );\n\n await this.mcpClient.connect(this.mcpTransport);\n logger.info(\"Connected to QCentriq backend /api/v1/mcp/sse successfully.\");\n } catch (err: any) {\n logger.error(`Failed to connect to QCentriq MCP SSE: ${err.message}`);\n this.mcpClient = null;\n this.mcpTransport = null;\n throw new Error(`Could not connect to QCentriq MCP endpoint: ${err.message}`);\n } finally {\n this.isConnecting = false;\n }\n })();\n\n await this.connectPromise;\n if (!this.mcpClient) {\n throw new Error(\"Failed to initialize MCP client.\");\n }\n return this.mcpClient;\n }\n\n /**\n * Retrieve list of tools exposed by QCentriq backend over /api/v1/mcp/sse.\n */\n async listRemoteTools(): Promise<any[]> {\n const client = await this.ensureMcpConnected();\n const result = await client.listTools();\n return result.tools || [];\n }\n\n /**\n * Invoke a remote tool on the QCentriq backend via /api/v1/mcp/sse.\n */\n async callRemoteTool(toolName: string, args: Record<string, any>): Promise<any> {\n const client = await this.ensureMcpConnected();\n logger.debug(`Invoking remote tool \"${toolName}\" with arguments:`, args);\n\n try {\n const response = await client.callTool({\n name: toolName,\n arguments: args,\n });\n return sanitizePayload(response);\n } catch (err: any) {\n logger.error(`Error calling remote tool \"${toolName}\":`, err.message);\n if (err.message?.includes(\"closed\") || err.message?.includes(\"disconnect\")) {\n this.mcpClient = null;\n this.mcpTransport = null;\n }\n throw err;\n }\n }\n\n /**\n * Close the SSE connection on shutdown.\n */\n async close(): Promise<void> {\n if (this.mcpClient) {\n try {\n await this.mcpClient.close();\n } catch {\n // ignore on shutdown\n }\n this.mcpClient = null;\n this.mcpTransport = null;\n }\n }\n}\n","/**\n * Zero-Leak Credential Redactor for QCentriq MCP Server.\n *\n * Ensures API keys, bearer tokens, passwords, and sensitive values\n * are redacted before tool payloads are returned to the LLM.\n */\n\n// Matches QCentriq API keys: qc_ followed by 40 hex chars\nconst QCENTRIQ_KEY_REGEX = /qc_[0-9a-fA-F]{30,45}/g;\n\n// Matches Bearer JWT tokens\nconst BEARER_TOKEN_REGEX = /Bearer\\s+ey[A-Za-z0-9-_=]+\\.[A-Za-z0-9-_=]+\\.?[A-Za-z0-9-_.+/=]*/g;\n\n// Matches embedded credentials in URLs: https://user:pass@example.com -> https://example.com\nconst URL_CREDENTIALS_REGEX = /([a-zA-Z][a-zA-Z0-9+.-]*:\\/\\/)[^/\\s:@]+:[^/\\s:@]+@/g;\n\nexport function sanitizeText(text: string): string {\n if (!text) return text;\n return text\n .replace(QCENTRIQ_KEY_REGEX, \"[REDACTED_API_KEY]\")\n .replace(BEARER_TOKEN_REGEX, \"Bearer [REDACTED_TOKEN]\")\n .replace(URL_CREDENTIALS_REGEX, \"$1[REDACTED_USERINFO]@\");\n}\n\nexport function sanitizePayload<T>(value: T): T {\n if (value === null || value === undefined) {\n return value;\n }\n if (typeof value === \"string\") {\n return sanitizeText(value) as unknown as T;\n }\n if (Array.isArray(value)) {\n return value.map((item) => sanitizePayload(item)) as unknown as T;\n }\n if (typeof value === \"object\") {\n const copy: Record<string, any> = {};\n for (const [k, v] of Object.entries(value)) {\n // If the field name looks like a secret/token/password and the value is string, mask it\n if (\n /password|secret|token|api_?key|auth/i.test(k) &&\n typeof v === \"string\" &&\n v.length > 0\n ) {\n copy[k] = \"[REDACTED]\";\n } else {\n copy[k] = sanitizePayload(v);\n }\n }\n return copy as T;\n }\n return value;\n}\n","import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod\";\nimport { QCentriqApiClient } from \"../client/api.js\";\nimport { QCentriqConfig } from \"../types.js\";\n\nexport function registerListTestsTool(server: McpServer, client: QCentriqApiClient, config: QCentriqConfig): void {\n server.tool(\n \"qcentriq_list_tests\",\n \"Discover and list automated test cases and test groups for a project with status, priority, and update dates. Test group script availability is indicated in test_groups. Blocked test cases have no script.\",\n {\n project_id: z.string().uuid().optional().describe(\"Optional project UUID (inferred from API key if omitted).\"),\n group_id: z.string().uuid().optional().describe(\"Optional test group UUID filter.\"),\n priority: z.enum([\"low\", \"medium\", \"high\", \"critical\"]).optional().describe(\"Filter by priority.\"),\n test_type: z.enum([\"web\", \"api\", \"mobile\"]).optional().describe(\"Filter by test type.\"),\n limit: z.number().int().min(1).max(100).default(50).describe(\"Max number of test cases to return (default 50).\"),\n offset: z.number().int().min(0).default(0).describe(\"Pagination offset.\"),\n },\n async (args) => {\n try {\n const projectId = args.project_id || config.defaultProjectId;\n const response = await client.callRemoteTool(\"qcentriq_list_tests\", {\n ...args,\n project_id: projectId,\n });\n\n // The remote MCP server returns standard CallToolResult\n return response;\n } catch (err: any) {\n return {\n isError: true,\n content: [{ type: \"text\", text: `Error in qcentriq_list_tests: ${err.message}` }],\n };\n }\n }\n );\n}\n","import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod\";\nimport { QCentriqApiClient } from \"../client/api.js\";\nimport { QCentriqConfig } from \"../types.js\";\n\nexport function registerGetTestTool(server: McpServer, client: QCentriqApiClient, config: QCentriqConfig): void {\n server.tool(\n \"qcentriq_get_test\",\n \"Retrieve detailed test case information including step definitions, preconditions, latest execution diagnostics, error stack traces, and parent test group script metadata.\",\n {\n test_case_id: z.string().uuid().describe(\"UUID of the target test case.\"),\n project_id: z.string().uuid().optional().describe(\"Optional project UUID (inferred from API key if omitted).\"),\n },\n async (args) => {\n try {\n const projectId = args.project_id || config.defaultProjectId;\n const response = await client.callRemoteTool(\"qcentriq_get_test\", {\n ...args,\n project_id: projectId,\n });\n return response;\n } catch (err: any) {\n return {\n isError: true,\n content: [{ type: \"text\", text: `Error in qcentriq_get_test: ${err.message}` }],\n };\n }\n }\n );\n}\n","import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod\";\nimport { QCentriqApiClient } from \"../client/api.js\";\nimport { QCentriqConfig } from \"../types.js\";\n\nexport function registerGetTestGroupsTool(server: McpServer, client: QCentriqApiClient, config: QCentriqConfig): void {\n server.tool(\n \"qcentriq_get_test_groups\",\n \"Discover and inspect test groups for a project. Returns what each group is about (title, description), total/active/blocked test case counts, and whether a test script exists. Provide group_id to inspect member test cases.\",\n {\n project_id: z.string().uuid().optional().describe(\"Optional project UUID (inferred from API key if omitted).\"),\n group_id: z.string().uuid().optional().describe(\"Optional test group UUID filter to inspect a specific group.\"),\n limit: z.number().int().min(1).max(100).default(50).describe(\"Max test groups to return (default 50).\"),\n offset: z.number().int().min(0).default(0).describe(\"Pagination offset.\"),\n },\n async (args) => {\n try {\n const projectId = args.project_id || config.defaultProjectId;\n const response = await client.callRemoteTool(\"qcentriq_get_test_groups\", {\n ...args,\n project_id: projectId,\n });\n return response;\n } catch (err: any) {\n return {\n isError: true,\n content: [{ type: \"text\", text: `Error in qcentriq_get_test_groups: ${err.message}` }],\n };\n }\n }\n );\n}\n","import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { QCentriqApiClient } from \"../client/api.js\";\nimport { QCentriqConfig } from \"../types.js\";\nimport { logger } from \"../utils/logger.js\";\n\nexport function registerDownloadScriptTool(server: McpServer, client: QCentriqApiClient, config: QCentriqConfig): void {\n server.tool(\n \"qcentriq_download_script\",\n \"Download test group script and accompanying fixture files (e.g. conftest.py) for local test execution and editing. Optionally writes files directly to the local filesystem.\",\n {\n group_id: z.string().uuid().describe(\"UUID of the target test group.\"),\n project_id: z.string().uuid().optional().describe(\"Optional project UUID (inferred from API key if omitted).\"),\n include_fixtures: z.boolean().default(true).describe(\"Whether to retrieve accompanying conftest.py / fixtures (default True).\"),\n save_to_disk: z.boolean().default(false).describe(\"If true, saves the downloaded test script and fixtures directly to the local filesystem.\"),\n destination_dir: z.string().default(\"./tests\").describe(\"Destination directory when save_to_disk is true (defaults to ./tests).\"),\n },\n async (args) => {\n try {\n const projectId = args.project_id || config.defaultProjectId;\n const response = await client.callRemoteTool(\"qcentriq_download_script\", {\n group_id: args.group_id,\n project_id: projectId,\n include_fixtures: args.include_fixtures,\n });\n\n // If save_to_disk was requested and files were returned in the content\n if (args.save_to_disk && response && response.content) {\n try {\n // Find JSON text in response content\n const textItem = response.content.find((c: any) => c.type === \"text\");\n if (textItem && textItem.text) {\n const data = JSON.parse(textItem.text);\n const targetDir = path.resolve(process.cwd(), args.destination_dir);\n await fs.mkdir(targetDir, { recursive: true });\n\n const savedFiles: string[] = [];\n\n if (data.file_name && data.content) {\n const safeFileName = path.basename(data.file_name);\n if (!safeFileName || safeFileName === \".\" || safeFileName === \"..\") {\n throw new Error(`Invalid file name returned: \"${data.file_name}\"`);\n }\n const scriptPath = path.join(targetDir, safeFileName);\n if (!path.resolve(scriptPath).startsWith(targetDir)) {\n throw new Error(`Path traversal detected in returned file name: \"${data.file_name}\"`);\n }\n await fs.writeFile(scriptPath, data.content, \"utf-8\");\n savedFiles.push(scriptPath);\n logger.info(`Saved test script to: ${scriptPath}`);\n }\n\n if (data.conftest_content) {\n const conftestPath = path.join(targetDir, \"conftest.py\");\n await fs.writeFile(conftestPath, data.conftest_content, \"utf-8\");\n savedFiles.push(conftestPath);\n logger.info(`Saved conftest.py to: ${conftestPath}`);\n }\n\n if (savedFiles.length > 0) {\n data.saved_files = savedFiles;\n textItem.text = JSON.stringify(data, null, 2);\n }\n }\n } catch (writeErr: any) {\n logger.warn(`Failed to write downloaded script to disk: ${writeErr.message}`);\n }\n }\n\n return response;\n } catch (err: any) {\n return {\n isError: true,\n content: [{ type: \"text\", text: `Error in qcentriq_download_script: ${err.message}` }],\n };\n }\n }\n );\n}\n","import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod\";\nimport { QCentriqApiClient } from \"../client/api.js\";\nimport { QCentriqConfig } from \"../types.js\";\n\nexport function registerEnvironmentTool(server: McpServer, client: QCentriqApiClient, config: QCentriqConfig): void {\n server.tool(\n \"qcentriq_get_environment\",\n \"Retrieve target test environment configuration, base URL (BASE_URL), environment variables, and secrets for local test execution.\",\n {\n project_id: z.string().uuid().optional().describe(\"Optional project UUID (inferred from API key if omitted).\"),\n environment_id: z.string().uuid().optional().describe(\"Optional specific environment UUID.\"),\n environment_name: z.string().optional().describe(\"Optional environment name filter (e.g. 'staging', 'dev', 'production').\"),\n include_secrets: z.boolean().default(false).describe(\"Whether to include decrypted secret values for runtime injection (default False).\"),\n },\n async (args) => {\n try {\n const projectId = args.project_id || config.defaultProjectId;\n const response = await client.callRemoteTool(\"qcentriq_get_environment\", {\n ...args,\n project_id: projectId,\n });\n return response;\n } catch (err: any) {\n return {\n isError: true,\n content: [{ type: \"text\", text: `Error in qcentriq_get_environment: ${err.message}` }],\n };\n }\n }\n );\n}\n","import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod\";\nimport { QCentriqApiClient } from \"../client/api.js\";\nimport { QCentriqConfig } from \"../types.js\";\n\nexport function registerRunLogsTool(server: McpServer, client: QCentriqApiClient, config: QCentriqConfig): void {\n server.tool(\n \"qcentriq_get_test_run_logs\",\n \"Retrieve execution history and logs for a test case: per-run status, timing, error message, stack trace, and raw output logs across runs.\",\n {\n test_case_id: z.string().uuid().describe(\"UUID of the target test case.\"),\n project_id: z.string().uuid().optional().describe(\"Optional project UUID (inferred from API key if omitted).\"),\n run_id: z.string().uuid().optional().describe(\"Optional specific run UUID to fetch a single run's full log.\"),\n status: z.enum([\"failed\", \"passed\", \"error\"]).optional().describe(\"Filter by result status.\"),\n latest_only: z.boolean().default(false).describe(\"If True, returns only the most recent matching run.\"),\n from_date: z.string().optional().describe(\"Optional ISO-8601 start date filter.\"),\n to_date: z.string().optional().describe(\"Optional ISO-8601 end date filter.\"),\n limit: z.number().int().min(1).max(100).default(20).describe(\"Max runs to return.\"),\n offset: z.number().int().min(0).default(0).describe(\"Pagination offset.\"),\n },\n async (args) => {\n try {\n const projectId = args.project_id || config.defaultProjectId;\n const response = await client.callRemoteTool(\"qcentriq_get_test_run_logs\", {\n ...args,\n project_id: projectId,\n });\n return response;\n } catch (err: any) {\n return {\n isError: true,\n content: [{ type: \"text\", text: `Error in qcentriq_get_test_run_logs: ${err.message}` }],\n };\n }\n }\n );\n}\n","import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod\";\nimport { runLocalPytest } from \"../local/runner.js\";\n\nexport function registerLocalRunTool(server: McpServer): void {\n server.tool(\n \"qcentriq_run_local_test\",\n \"Execute a downloaded Playwright/pytest test script locally in the developer's environment. Runs pytest as a local subprocess and returns stdout, stderr, exit code, and test diagnostics without using QCentriq cloud runners.\",\n {\n file_path: z.string().describe(\"Path to the local test file to run (e.g. 'tests/test_login.py').\"),\n test_name: z.string().optional().describe(\"Optional specific test function name or expression to run (passed to pytest -k).\"),\n headless: z.boolean().default(true).describe(\"Whether to run the browser in headless mode (default True). Set False to watch the browser execution live.\"),\n browser: z.enum([\"chromium\", \"firefox\", \"webkit\"]).default(\"chromium\").describe(\"Browser engine to execute against (default 'chromium').\"),\n base_url: z.string().url().optional().describe(\"Target application base URL (e.g. from qcentriq_get_environment). Injected as BASE_URL env var.\"),\n env_vars: z.record(z.string(), z.string()).optional().describe(\"Environment variables to inject into the local test process.\"),\n extra_args: z.array(z.string()).optional().describe(\"Additional CLI arguments to pass to pytest (e.g. ['-s', '--alluredir=allure-results']).\"),\n timeout_seconds: z.number().int().min(5).max(300).default(60).describe(\"Timeout in seconds for test execution (default 60).\"),\n working_dir: z.string().optional().describe(\"Working directory to run pytest in (defaults to current project directory).\"),\n },\n async (args) => {\n try {\n const result = await runLocalPytest({\n filePath: args.file_path,\n testName: args.test_name,\n headless: args.headless,\n browser: args.browser,\n baseUrl: args.base_url,\n envVars: args.env_vars,\n extraArgs: args.extra_args,\n timeoutSeconds: args.timeout_seconds,\n workingDir: args.working_dir,\n });\n\n const statusText = result.passed ? \"PASSED\" : \"FAILED\";\n const summary = [\n `Local Test Run Result: ${statusText} (exit code ${result.exitCode})`,\n `Duration: ${(result.durationMs / 1000).toFixed(2)}s`,\n `Command: ${result.command}`,\n \"\",\n \"--- STDOUT ---\",\n result.stdout || \"(no stdout)\",\n \"\",\n \"--- STDERR ---\",\n result.stderr || \"(no stderr)\",\n ].join(\"\\n\");\n\n return {\n content: [\n {\n type: \"text\",\n text: summary,\n },\n ],\n isError: !result.passed,\n };\n } catch (err: any) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: `Error executing local test: ${err.message}`,\n },\n ],\n };\n }\n }\n );\n}\n","import { spawn } from \"node:child_process\";\nimport * as path from \"node:path\";\nimport { logger } from \"../utils/logger.js\";\n\nexport interface LocalTestRunParams {\n filePath: string;\n testName?: string;\n headless?: boolean;\n browser?: \"chromium\" | \"firefox\" | \"webkit\";\n baseUrl?: string;\n envVars?: Record<string, string>;\n extraArgs?: string[];\n timeoutSeconds?: number;\n workingDir?: string;\n}\n\nexport interface LocalTestRunResult {\n passed: boolean;\n exitCode: number;\n stdout: string;\n stderr: string;\n durationMs: number;\n command: string;\n}\n\n/**\n * Determine the best command to invoke pytest in the user's environment.\n */\nfunction resolvePytestCommand(): { cmd: string; baseArgs: string[] } {\n // If a virtualenv is active, prefer its pytest\n if (process.env.VIRTUAL_ENV) {\n const venvPytest = path.join(process.env.VIRTUAL_ENV, \"bin\", \"pytest\");\n return { cmd: venvPytest, baseArgs: [] };\n }\n return { cmd: \"pytest\", baseArgs: [] };\n}\n\nfunction killProcessTree(child: { pid?: number; kill: (sig?: NodeJS.Signals | number) => boolean }): void {\n if (child.pid) {\n try {\n if (process.platform !== \"win32\") {\n process.kill(-child.pid, \"SIGKILL\");\n return;\n }\n } catch {\n // Process group kill may fail if group leader already died, fall back to killing child directly\n }\n }\n try {\n child.kill(\"SIGKILL\");\n } catch {\n // Process already terminated\n }\n}\n\n/**\n * Execute pytest locally in the user's environment.\n */\nexport async function runLocalPytest(params: LocalTestRunParams): Promise<LocalTestRunResult> {\n const startTime = Date.now();\n const cwd = params.workingDir ? path.resolve(params.workingDir) : process.cwd();\n const timeoutMs = (params.timeoutSeconds || 60) * 1000;\n\n const { cmd, baseArgs } = resolvePytestCommand();\n const args = [...baseArgs, params.filePath];\n\n if (params.testName) {\n args.push(\"-k\", params.testName);\n }\n\n if (params.extraArgs && params.extraArgs.length > 0) {\n args.push(...params.extraArgs);\n }\n\n // Always use verbose flag if not present\n if (!args.includes(\"-v\") && !args.includes(\"-vv\")) {\n args.push(\"-v\");\n }\n\n const env: NodeJS.ProcessEnv = {\n ...process.env,\n ...(params.envVars || {}),\n };\n\n if (params.baseUrl) {\n env.BASE_URL = params.baseUrl;\n }\n if (params.browser) {\n env.BROWSER = params.browser;\n }\n if (params.headless !== undefined) {\n env.HEADLESS = params.headless ? \"true\" : \"false\";\n }\n\n const fullCommand = `${cmd} ${args.join(\" \")}`;\n logger.info(`Running local test command: ${fullCommand} in ${cwd}`);\n\n return new Promise((resolve) => {\n let stdout = \"\";\n let stderr = \"\";\n let finished = false;\n\n // Spawn the test process with detached: true on POSIX so it becomes process group leader\n const child = spawn(cmd, args, {\n cwd,\n env,\n detached: process.platform !== \"win32\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n\n const timer = setTimeout(() => {\n if (!finished) {\n finished = true;\n killProcessTree(child);\n resolve({\n passed: false,\n exitCode: -1,\n stdout,\n stderr: stderr + `\\n[TIMEOUT] Test execution timed out after ${params.timeoutSeconds || 60} seconds.`,\n durationMs: Date.now() - startTime,\n command: fullCommand,\n });\n }\n }, timeoutMs);\n\n child.stdout.on(\"data\", (chunk) => {\n stdout += chunk.toString();\n });\n\n child.stderr.on(\"data\", (chunk) => {\n stderr += chunk.toString();\n });\n\n child.on(\"error\", (err: any) => {\n if (finished) return;\n finished = true;\n clearTimeout(timer);\n\n // If \"pytest\" wasn't found directly, try fallback to python3 -m pytest\n if (err.code === \"ENOENT\" && cmd !== \"python3\") {\n logger.warn(\"pytest binary not found directly, falling back to python3 -m pytest...\");\n const fallbackChild = spawn(\"python3\", [\"-m\", \"pytest\", ...args], {\n cwd,\n env,\n detached: process.platform !== \"win32\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n\n let fbStdout = \"\";\n let fbStderr = \"\";\n let fbFinished = false;\n\n const fbTimer = setTimeout(() => {\n if (!fbFinished) {\n fbFinished = true;\n killProcessTree(fallbackChild);\n resolve({\n passed: false,\n exitCode: -1,\n stdout: fbStdout,\n stderr: fbStderr + `\\n[TIMEOUT] Test execution timed out after ${params.timeoutSeconds || 60} seconds.`,\n durationMs: Date.now() - startTime,\n command: `python3 -m pytest ${args.join(\" \")}`,\n });\n }\n }, timeoutMs);\n\n fallbackChild.stdout.on(\"data\", (c) => (fbStdout += c.toString()));\n fallbackChild.stderr.on(\"data\", (c) => (fbStderr += c.toString()));\n\n fallbackChild.on(\"close\", (code) => {\n if (fbFinished) return;\n fbFinished = true;\n clearTimeout(fbTimer);\n resolve({\n passed: code === 0,\n exitCode: code ?? -1,\n stdout: fbStdout,\n stderr: fbStderr,\n durationMs: Date.now() - startTime,\n command: `python3 -m pytest ${args.join(\" \")}`,\n });\n });\n\n fallbackChild.on(\"error\", (fbErr) => {\n if (fbFinished) return;\n fbFinished = true;\n clearTimeout(fbTimer);\n resolve({\n passed: false,\n exitCode: -1,\n stdout: \"\",\n stderr: `Failed to execute pytest or python3 -m pytest: ${fbErr.message}. Ensure pytest is installed in your Python environment.`,\n durationMs: Date.now() - startTime,\n command: fullCommand,\n });\n });\n return;\n }\n\n resolve({\n passed: false,\n exitCode: -1,\n stdout,\n stderr: `Failed to spawn process: ${err.message}. Ensure pytest is installed in your Python environment.`,\n durationMs: Date.now() - startTime,\n command: fullCommand,\n });\n });\n\n child.on(\"close\", (code) => {\n if (finished) return;\n finished = true;\n clearTimeout(timer);\n\n const durationMs = Date.now() - startTime;\n resolve({\n passed: code === 0,\n exitCode: code ?? -1,\n stdout,\n stderr,\n durationMs,\n command: fullCommand,\n });\n });\n });\n}\n","import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { logger } from \"../utils/logger.js\";\n\nexport function registerSaveScriptTool(server: McpServer): void {\n server.tool(\n \"qcentriq_save_script\",\n \"Save downloaded Playwright Python test script and fixtures directly to the local workspace disk so they can be run or edited locally.\",\n {\n file_name: z.string().describe(\"Target filename (e.g. 'test_login.py').\"),\n content: z.string().describe(\"Python test script source code.\"),\n conftest_content: z.string().optional().describe(\"Accompanying conftest.py source code if present.\"),\n destination_dir: z.string().default(\"./tests\").describe(\"Destination directory in the local workspace (default './tests').\"),\n },\n async (args) => {\n try {\n const targetDir = path.resolve(process.cwd(), args.destination_dir);\n await fs.mkdir(targetDir, { recursive: true });\n\n const savedFiles: string[] = [];\n\n const safeFileName = path.basename(args.file_name);\n if (!safeFileName || safeFileName === \".\" || safeFileName === \"..\") {\n throw new Error(`Invalid file name: \"${args.file_name}\"`);\n }\n const scriptPath = path.join(targetDir, safeFileName);\n if (!path.resolve(scriptPath).startsWith(targetDir)) {\n throw new Error(`Path traversal detected for file name: \"${args.file_name}\"`);\n }\n\n await fs.writeFile(scriptPath, args.content, \"utf-8\");\n savedFiles.push(scriptPath);\n logger.info(`Saved test script to: ${scriptPath}`);\n\n if (args.conftest_content) {\n const conftestPath = path.join(targetDir, \"conftest.py\");\n await fs.writeFile(conftestPath, args.conftest_content, \"utf-8\");\n savedFiles.push(conftestPath);\n logger.info(`Saved conftest.py to: ${conftestPath}`);\n }\n\n return {\n content: [\n {\n type: \"text\",\n text: JSON.stringify(\n {\n status: \"success\",\n message: `Successfully saved ${savedFiles.length} file(s) to ${targetDir}`,\n saved_files: savedFiles,\n },\n null,\n 2\n ),\n },\n ],\n };\n } catch (err: any) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: `Failed to save test script to disk: ${err.message}`,\n },\n ],\n };\n }\n }\n );\n}\n","import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { QCentriqApiClient } from \"../client/api.js\";\nimport { QCentriqConfig } from \"../types.js\";\nimport { registerListTestsTool } from \"./list-tests.js\";\nimport { registerGetTestTool } from \"./get-test.js\";\nimport { registerGetTestGroupsTool } from \"./get-groups.js\";\nimport { registerDownloadScriptTool } from \"./download-script.js\";\nimport { registerEnvironmentTool } from \"./environment.js\";\nimport { registerRunLogsTool } from \"./run-logs.js\";\nimport { registerLocalRunTool } from \"./local-run.js\";\nimport { registerSaveScriptTool } from \"./save-script.js\";\nimport { logger } from \"../utils/logger.js\";\n\nexport function registerAllTools(server: McpServer, client: QCentriqApiClient, config: QCentriqConfig): void {\n logger.debug(\"Registering QCentriq MCP tools...\");\n\n // Remote discovery and diagnostics tools (proxying to backend /api/v1/mcp/sse)\n registerListTestsTool(server, client, config);\n registerGetTestTool(server, client, config);\n registerGetTestGroupsTool(server, client, config);\n registerDownloadScriptTool(server, client, config);\n registerEnvironmentTool(server, client, config);\n registerRunLogsTool(server, client, config);\n\n // Client-focused local execution tools (run strictly in developer environment)\n registerSaveScriptTool(server);\n registerLocalRunTool(server);\n\n logger.info(\"Successfully registered 8 QCentriq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AAO,KAAK,yCAAyC,OAAO,OAAO,EAAE;AAErE,UAAM,YAAY,IAAI,kBAAkB,MAAM;AAE9C,UAAM,SAAS,IAAI,UAAU;AAAA,MAC3B,MAAM;AAAA,MACN,SAAS;AAAA,IACX,CAAC;AAED,qBAAiB,QAAQ,WAAW,MAAM;AAE1C,UAAM,YAAY,IAAI,qBAAqB;AAE3C,UAAM,UAAU,YAAY;AAC1B,aAAO,KAAK,sCAAsC;AAClD,YAAM,UAAU,MAAM;AACtB,YAAM,OAAO,MAAM;AACnB,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,YAAQ,GAAG,UAAU,OAAO;AAC5B,YAAQ,GAAG,WAAW,OAAO;AAE7B,UAAM,OAAO,QAAQ,SAAS;AAC9B,WAAO,KAAK,0CAA0C;AAAA,EACxD,SAAS,KAAU;AACjB,WAAO,MAAM,mDAAmD,IAAI,OAAO;AAC3E,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAEA,KAAK;","names":["z","z","z","z","z","z","z","path","resolve","z","z","fs","path","z"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@qcentriq/mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Official Model Context Protocol (MCP) server for QCentriq automated test discovery, diagnostics, and execution.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"qcentriq-mcp": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsup",
|
|
15
|
+
"dev": "tsx src/index.ts",
|
|
16
|
+
"test": "vitest run",
|
|
17
|
+
"typecheck": "tsc --noEmit"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"mcp",
|
|
21
|
+
"model-context-protocol",
|
|
22
|
+
"qcentriq",
|
|
23
|
+
"playwright",
|
|
24
|
+
"testing",
|
|
25
|
+
"ai",
|
|
26
|
+
"automation",
|
|
27
|
+
"claude-desktop",
|
|
28
|
+
"cursor"
|
|
29
|
+
],
|
|
30
|
+
"author": "QCentriq",
|
|
31
|
+
"license": "Apache-2.0",
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
34
|
+
"commander": "^15.0.0",
|
|
35
|
+
"zod": "^4.5.4"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^26.5.0",
|
|
39
|
+
"tsup": "^8.4.0",
|
|
40
|
+
"tsx": "^4.19.3",
|
|
41
|
+
"typescript": "^5.8.2",
|
|
42
|
+
"vitest": "^5.0.0"
|
|
43
|
+
}
|
|
44
|
+
}
|