@id3-clarity/mcp-server 1.5.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/EXAMPLES.md +64 -0
- package/LICENSE +21 -0
- package/README.md +538 -0
- package/dist/client/clarity-api-client.d.ts +19 -0
- package/dist/client/clarity-api-client.js +34 -0
- package/dist/client/clarity-api-client.js.map +1 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.js +17 -0
- package/dist/config.js.map +1 -0
- package/dist/i18n/en.d.ts +5 -0
- package/dist/i18n/en.js +4 -0
- package/dist/i18n/en.js.map +1 -0
- package/dist/i18n/tr.d.ts +5 -0
- package/dist/i18n/tr.js +4 -0
- package/dist/i18n/tr.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.js +69 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/index.d.ts +9 -0
- package/dist/tools/index.js +1120 -0
- package/dist/tools/index.js.map +1 -0
- package/package.json +28 -0
package/EXAMPLES.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
Sample prompts you can give to Claude Desktop / Cursor / Cline / Windsurf once `@id3-clarity/mcp-server` is connected. The AI picks the right tool — you don't have to call them by name.
|
|
4
|
+
|
|
5
|
+
## 1. List your projects
|
|
6
|
+
|
|
7
|
+
**Prompt:** "Show me my CLARITY projects."
|
|
8
|
+
|
|
9
|
+
The AI calls `list_projects` and returns project names + IDs you can reference in later prompts.
|
|
10
|
+
|
|
11
|
+
## 2. Generate test cases from a requirement
|
|
12
|
+
|
|
13
|
+
**Prompt:** "Read this requirement and create 10 test cases in the `Auth/Backend` folder of project `E-commerce`:
|
|
14
|
+
> *As a user, I want to log in with email and password so I can access my account. Validation: rate-limited at 5 attempts/min, password must be 8+ chars, lockout after 10 failed attempts.*"
|
|
15
|
+
|
|
16
|
+
The AI drafts JSON internally (canonical CLARITY schema or the `suggestions[]` alias), then calls `import_test_cases_json` with `folderStrategy: "find-or-create"` and `duplicateStrategy: "skip"`.
|
|
17
|
+
|
|
18
|
+
## 3. View failing tests
|
|
19
|
+
|
|
20
|
+
**Prompt:** "Which test cases failed most often this month in project `E-commerce`?"
|
|
21
|
+
|
|
22
|
+
The AI calls `get_failing_cases({ projectId, days: 30, limit: 10 })` and lists the top offenders.
|
|
23
|
+
|
|
24
|
+
## 4. Check run progress
|
|
25
|
+
|
|
26
|
+
**Prompt:** "How is the `Sprint-42 Smoke` run going?"
|
|
27
|
+
|
|
28
|
+
The AI calls `list_runs` to find the run id, then `get_run_progress({ runId })` and reports pass/fail/skip/blocked counts.
|
|
29
|
+
|
|
30
|
+
## 5. Mark an execution as failed
|
|
31
|
+
|
|
32
|
+
**Prompt:** "Mark the case `User can checkout with VISA` in the `Sprint-42 Smoke` run as FAIL with comment: `payment-service returned 502 — see incident #4521`."
|
|
33
|
+
|
|
34
|
+
The AI resolves IDs via `search_test_cases` + `list_runs`, then calls `update_execution_result({ projectId, runId, caseId, status: "FAIL", comment: "..." })`.
|
|
35
|
+
|
|
36
|
+
## 6. Delete a folder safely
|
|
37
|
+
|
|
38
|
+
**Prompt:** "Delete the `legacy-api` folder from project `E-commerce`."
|
|
39
|
+
|
|
40
|
+
The AI calls `delete_folder({ projectId, folderId })`. The first call returns `requiresConfirmation: true` plus a `confirmationToken` and a preview of what will be deleted. The AI shows you the preview, asks "are you sure?", and only then issues the second call with `confirmationToken` to actually perform the soft-delete.
|
|
41
|
+
|
|
42
|
+
## 7. Search by title
|
|
43
|
+
|
|
44
|
+
**Prompt:** "Find all test cases that mention `2FA` in project `E-commerce`."
|
|
45
|
+
|
|
46
|
+
The AI calls `search_test_cases({ projectId, query: "2FA" })` and returns the matches.
|
|
47
|
+
|
|
48
|
+
## 8. Update test case priority
|
|
49
|
+
|
|
50
|
+
**Prompt:** "Bump priority of every test case tagged `payment` to `CRITICAL` in project `E-commerce`."
|
|
51
|
+
|
|
52
|
+
The AI calls `list_test_cases({ projectId, tag: "payment" })`, then iterates with `update_test_case({ caseId, priority: "CRITICAL" })` for each result.
|
|
53
|
+
|
|
54
|
+
## 9. Inspect your token
|
|
55
|
+
|
|
56
|
+
**Prompt:** "What scopes does my CLARITY token have?"
|
|
57
|
+
|
|
58
|
+
The AI calls `get_my_quota` and shows scopes, accessible projects, and current rate limit usage.
|
|
59
|
+
|
|
60
|
+
## 10. Discover tool schemas
|
|
61
|
+
|
|
62
|
+
**Prompt:** "What parameters does `import_test_cases_json` take?"
|
|
63
|
+
|
|
64
|
+
The AI calls `get_schema({ toolName: "import_test_cases_json" })` and explains the fields, defaults, and enums.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CLARITY Test Management
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
# @id3-clarity/mcp-server
|
|
2
|
+
|
|
3
|
+
> **CLARITY Test Management — Model Context Protocol server.**
|
|
4
|
+
> Connect Claude Desktop, Cursor, Cline, or Windsurf to your CLARITY instance and manage test cases, suites, runs, and projects entirely through natural language.
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/@id3-clarity/mcp-server)
|
|
7
|
+
[](https://nodejs.org)
|
|
8
|
+
[](./LICENSE)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
`@id3-clarity/mcp-server` (v1.5.0) exposes **68 tools** from the CLARITY REST API as an [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server. Once connected, your AI client can:
|
|
15
|
+
|
|
16
|
+
- **Create and update** test cases, folders, suites, runs, requirements, and releases without leaving your editor
|
|
17
|
+
- **Search and inspect** existing tests, execution history, and failure patterns
|
|
18
|
+
- **Import test cases from JSON** or from AI-generated suggestions
|
|
19
|
+
- **Track run progress** and mark individual executions as pass/fail/blocked/skipped
|
|
20
|
+
- **Sync requirements with Jira** bidirectionally (push, link, pull-sync, conflict detection)
|
|
21
|
+
- **Manage releases** with readiness scoring, requirement scope, and test run links
|
|
22
|
+
- **Schedule recurring runs**, attach evidence, comment with @-mentions, and read dashboard metrics
|
|
23
|
+
- **Safely delete** resources with a 2-step confirmation + 30-day Trash recovery
|
|
24
|
+
|
|
25
|
+
All operations are tenant-isolated, fully audit-logged, and rate-limited on the CLARITY backend. The server itself is a lightweight stdio process — no extra ports, no background daemons.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Quick Start (2 minutes)
|
|
30
|
+
|
|
31
|
+
### 1. Get your API token
|
|
32
|
+
|
|
33
|
+
In CLARITY, go to: **Settings → API Access → MCP Tokens → + New Token**
|
|
34
|
+
|
|
35
|
+
- **Name**: e.g. `Claude Desktop - <your name>`
|
|
36
|
+
- **Scopes**: `read` + `write` (add `delete` only if needed)
|
|
37
|
+
- **Projects**: select the projects you'll work on (leave blank for org-wide access)
|
|
38
|
+
- Click **Create**, copy the `clr_...` token — it is shown **only once**
|
|
39
|
+
|
|
40
|
+
### 2. Add to your AI client
|
|
41
|
+
|
|
42
|
+
Pick your client and paste the configuration. Replace only the `clr_...` token; all other values are pre-filled.
|
|
43
|
+
|
|
44
|
+
#### Claude Desktop
|
|
45
|
+
|
|
46
|
+
Config file:
|
|
47
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
48
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
49
|
+
|
|
50
|
+
**Test environment** (clarity-test.id3.com.tr):
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"mcpServers": {
|
|
54
|
+
"clarity": {
|
|
55
|
+
"command": "npx",
|
|
56
|
+
"args": ["-y", "@id3-clarity/mcp-server"],
|
|
57
|
+
"env": {
|
|
58
|
+
"CLARITY_API_URL": "https://clarity-test-api.id3.com.tr",
|
|
59
|
+
"CLARITY_API_TOKEN": "clr_PASTE_YOUR_TOKEN_HERE",
|
|
60
|
+
"CLARITY_LANG": "tr"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Production** (clarity.id3.com.tr):
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"mcpServers": {
|
|
71
|
+
"clarity": {
|
|
72
|
+
"command": "npx",
|
|
73
|
+
"args": ["-y", "@id3-clarity/mcp-server"],
|
|
74
|
+
"env": {
|
|
75
|
+
"CLARITY_API_URL": "https://clarity-api.id3.com.tr",
|
|
76
|
+
"CLARITY_API_TOKEN": "clr_PASTE_YOUR_TOKEN_HERE",
|
|
77
|
+
"CLARITY_LANG": "tr"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
#### Cursor
|
|
85
|
+
|
|
86
|
+
Config file: `~/.cursor/mcp.json` — same JSON structure as Claude Desktop above.
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"mcpServers": {
|
|
91
|
+
"clarity": {
|
|
92
|
+
"command": "npx",
|
|
93
|
+
"args": ["-y", "@id3-clarity/mcp-server"],
|
|
94
|
+
"env": {
|
|
95
|
+
"CLARITY_API_URL": "https://clarity-api.id3.com.tr",
|
|
96
|
+
"CLARITY_API_TOKEN": "clr_PASTE_YOUR_TOKEN_HERE",
|
|
97
|
+
"CLARITY_LANG": "en"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### Cline (VSCode)
|
|
105
|
+
|
|
106
|
+
VSCode → Cline extension → Settings → MCP Servers → "Edit in JSON" → paste the same config as above.
|
|
107
|
+
|
|
108
|
+
#### Windsurf
|
|
109
|
+
|
|
110
|
+
Config file: `~/.windsurf/mcp.json` — same structure.
|
|
111
|
+
|
|
112
|
+
### 3. Restart your AI client
|
|
113
|
+
|
|
114
|
+
Quit and reopen Claude Desktop / Cursor / Cline / Windsurf. The status bar should show **"clarity (68 tools)"** or similar.
|
|
115
|
+
|
|
116
|
+
### 4. Test the connection
|
|
117
|
+
|
|
118
|
+
Try: **"List my CLARITY projects"**
|
|
119
|
+
|
|
120
|
+
The AI calls `list_projects` and returns your accessible projects with IDs you can use in follow-up prompts.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Prerequisites
|
|
125
|
+
|
|
126
|
+
- **Node.js 18+** (used by `npx` to fetch and run the server)
|
|
127
|
+
- **A CLARITY API token** — create one at **CLARITY → Settings → API Access → MCP Tokens → New Token**
|
|
128
|
+
|
|
129
|
+
Tokens look like `clr_<32 alphanumeric characters>`.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Installation
|
|
134
|
+
|
|
135
|
+
The recommended way is `npx` (no global install needed). The snippet in the Quick Start section is all you need.
|
|
136
|
+
|
|
137
|
+
If you prefer a global install:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
npm install -g @id3-clarity/mcp-server
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Then replace `"command": "npx", "args": ["-y", "@id3-clarity/mcp-server"]` with `"command": "clarity-mcp-server"` in your config.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Authentication
|
|
148
|
+
|
|
149
|
+
### Creating a token
|
|
150
|
+
|
|
151
|
+
1. Log in to CLARITY and open **Settings → API Access → MCP Tokens**
|
|
152
|
+
2. Click **+ New Token**
|
|
153
|
+
3. Fill in:
|
|
154
|
+
- **Name** — a human-readable label (e.g. `Cursor - kaan`)
|
|
155
|
+
- **Scopes** — `read`, `write`, and/or `delete` (grant only what you need)
|
|
156
|
+
- **Project access** — specific projects, or leave blank for all accessible projects
|
|
157
|
+
- **Expiry** — optional; recommended for shared/CI tokens
|
|
158
|
+
4. Click **Create** and copy the token immediately — it will not be shown again
|
|
159
|
+
|
|
160
|
+
### Token format
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
clr_<32 alphanumeric characters>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Rotating a token
|
|
167
|
+
|
|
168
|
+
Go to **Settings → API Access → MCP Tokens**, find the token, click **Revoke**, and create a new one. Update the `CLARITY_API_TOKEN` env var in your AI client config and restart.
|
|
169
|
+
|
|
170
|
+
### Minimum required scopes
|
|
171
|
+
|
|
172
|
+
| Task | Required scopes |
|
|
173
|
+
|------|----------------|
|
|
174
|
+
| Read projects, folders, test cases, runs | `read` |
|
|
175
|
+
| Create / update test cases, suites, runs | `read` + `write` |
|
|
176
|
+
| Delete test cases / folders / suites | `read` + `write` + `delete` |
|
|
177
|
+
| Admin operations | `admin` |
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Environment Variables
|
|
182
|
+
|
|
183
|
+
| Variable | Required | Default | Description |
|
|
184
|
+
|---|---|---|---|
|
|
185
|
+
| `CLARITY_API_URL` | Yes | — | API base URL, e.g. `https://clarity-api.id3.com.tr` |
|
|
186
|
+
| `CLARITY_API_TOKEN` | Yes | — | Token in `clr_<32 alphanumeric>` format |
|
|
187
|
+
| `CLARITY_LANG` | No | `en` | `tr` or `en` — switches tool description language shown to the AI |
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Available Tools (68)
|
|
192
|
+
|
|
193
|
+
> Generated from `src/tools/index.ts` (v1.5.0). Scopes follow the pattern: read tools need `read`, mutating tools need `write`, destructive tools need `delete`.
|
|
194
|
+
|
|
195
|
+
### Projects (5)
|
|
196
|
+
|
|
197
|
+
| Tool | Description | Required scope |
|
|
198
|
+
|---|---|---|
|
|
199
|
+
| `list_projects` | Lists CLARITY projects accessible to your token | read |
|
|
200
|
+
| `get_project` | Returns details of a specific project | read |
|
|
201
|
+
| `get_project_stats` | Project statistics (case count, last 30 days success rate) | read |
|
|
202
|
+
| `create_project` | Creates a new project | write |
|
|
203
|
+
| `update_project` | Updates project info | write |
|
|
204
|
+
|
|
205
|
+
### Folders (4)
|
|
206
|
+
|
|
207
|
+
| Tool | Description | Required scope |
|
|
208
|
+
|---|---|---|
|
|
209
|
+
| `list_folders` | Lists folders in a project (flat) | read |
|
|
210
|
+
| `get_folder_tree` | Returns folder hierarchy as a tree | read |
|
|
211
|
+
| `create_folder` | Creates a folder; use `parentId` for nested | write |
|
|
212
|
+
| `update_folder` | Updates folder name/parent | write |
|
|
213
|
+
|
|
214
|
+
### Test Cases (7)
|
|
215
|
+
|
|
216
|
+
| Tool | Description | Required scope |
|
|
217
|
+
|---|---|---|
|
|
218
|
+
| `list_test_cases` | Lists test cases (paginated) with `folderId`/`type`/`priority`/`status`/`tag`/`search` filters | read |
|
|
219
|
+
| `get_test_case` | Returns test case detail (steps + metadata + relations) | read |
|
|
220
|
+
| `search_test_cases` | Full-text search by title in test cases | read |
|
|
221
|
+
| `create_test_case` | Creates a test case; non-MANUAL/AUTOMATED types auto-coerce to MANUAL + `testTypes` | write |
|
|
222
|
+
| `update_test_case` | Updates test case fields | write |
|
|
223
|
+
| `bulk_create_test_cases` | Bulk create test cases (max 50); for more use `import_test_cases_json` | write |
|
|
224
|
+
| `import_test_cases_json` | Bulk import via CLARITY JSON schema with `folderStrategy` / `duplicateStrategy` | write |
|
|
225
|
+
|
|
226
|
+
### Suites (4)
|
|
227
|
+
|
|
228
|
+
| Tool | Description | Required scope |
|
|
229
|
+
|---|---|---|
|
|
230
|
+
| `list_suites` | Lists test suites | read |
|
|
231
|
+
| `get_suite` | Returns suite detail with included cases | read |
|
|
232
|
+
| `create_suite` | Creates a new test suite | write |
|
|
233
|
+
| `update_suite` | Updates a suite; `addCaseIds`/`removeCaseIds` for case management | write |
|
|
234
|
+
|
|
235
|
+
### Runs (5)
|
|
236
|
+
|
|
237
|
+
| Tool | Description | Required scope |
|
|
238
|
+
|---|---|---|
|
|
239
|
+
| `list_runs` | Lists test runs; supports status filter | read |
|
|
240
|
+
| `get_run` | Returns run detail with execution results | read |
|
|
241
|
+
| `get_run_progress` | Run progress statistics (pass/fail/skip/blocked/pending counts) | read |
|
|
242
|
+
| `create_run` | Creates a test run; either `testSuiteId` OR `testCaseIds[]` required | write |
|
|
243
|
+
| `update_execution_result` | Updates execution result for a case within a run (PASS/FAIL/SKIP/BLOCKED) | write |
|
|
244
|
+
|
|
245
|
+
### Requirements (9)
|
|
246
|
+
|
|
247
|
+
| Tool | Description | Required scope |
|
|
248
|
+
|---|---|---|
|
|
249
|
+
| `list_requirements` | Lists requirements with type/status/priority/assignee/source/syncStatus/testable/search filters | read |
|
|
250
|
+
| `get_requirement` | Returns full requirement detail incl. attachments and Jira/Azure sync status | read |
|
|
251
|
+
| `create_requirement` | Creates a requirement; accepts legacy `type`/`status` keys or `typeId`/`statusId` UUIDs | write |
|
|
252
|
+
| `update_requirement` | Updates requirement fields; linked items auto-flip `syncStatus` to `pending` | write |
|
|
253
|
+
| `link_requirement_to_test_case` | Links a requirement to up to 100 test cases per call (idempotent) | write |
|
|
254
|
+
| `unlink_requirement_from_test_case` | Removes a requirement ↔ test case link (idempotent no-op if absent) | write |
|
|
255
|
+
| `get_requirement_traceability` | Requirement → test case → last execution traceability matrix with coverage % | read |
|
|
256
|
+
| `list_requirement_types` | Lists requirement types (system defaults + project overrides) | read |
|
|
257
|
+
| `list_requirement_statuses` | Lists requirement statuses (system defaults + project overrides) | read |
|
|
258
|
+
|
|
259
|
+
### Jira Sync (4)
|
|
260
|
+
|
|
261
|
+
| Tool | Description | Required scope |
|
|
262
|
+
|---|---|---|
|
|
263
|
+
| `push_requirement_to_jira` | Pushes a manually-created requirement to Jira as a new issue | write |
|
|
264
|
+
| `link_requirement_to_jira` | Links a requirement to an existing Jira issue (fields overwritten from Jira) | write |
|
|
265
|
+
| `sync_requirement` | One-way pull-sync from Jira/Azure DevOps to local; reports conflicts | write |
|
|
266
|
+
| `push_requirement_update_to_jira` | Pushes CLARITY changes up to the linked Jira issue (last-write-wins + conflict detection) | write |
|
|
267
|
+
|
|
268
|
+
### Releases (9)
|
|
269
|
+
|
|
270
|
+
| Tool | Description | Required scope |
|
|
271
|
+
|---|---|---|
|
|
272
|
+
| `list_releases` | Lists releases; auto-computed `coveragePercent` / `overallPassRate` / `readinessScore` | read |
|
|
273
|
+
| `get_release` | Release detail — merged test runs (direct + inherited via requirements) | read |
|
|
274
|
+
| `create_release` | Creates a release; optional Jira fixVersion/sprint scope binding | write |
|
|
275
|
+
| `update_release` | Partial update; `status="released"` auto-sets `actualDate` | write |
|
|
276
|
+
| `add_requirement_to_release` | Links a requirement to a release; related runs auto-inherited | write |
|
|
277
|
+
| `remove_requirement_from_release` | Unlinks a requirement from a release (idempotent) | write |
|
|
278
|
+
| `bulk_remove_requirements_from_release` | Bulk-unlink up to 500 requirements from a release | write |
|
|
279
|
+
| `add_test_run_to_release` | Directly attaches a test run with a `runType` classification | write |
|
|
280
|
+
| `get_release_readiness` | Readiness score (60% pass rate + 40% coverage), gates and blockers | read |
|
|
281
|
+
|
|
282
|
+
### Users (2)
|
|
283
|
+
|
|
284
|
+
| Tool | Description | Required scope |
|
|
285
|
+
|---|---|---|
|
|
286
|
+
| `list_users` | Lists users assigned to a project (id, email, name, role) | read |
|
|
287
|
+
| `get_user` | Returns user details — role, department, last login, membership count | read |
|
|
288
|
+
|
|
289
|
+
### Tags (1)
|
|
290
|
+
|
|
291
|
+
| Tool | Description | Required scope |
|
|
292
|
+
|---|---|---|
|
|
293
|
+
| `list_tags` | Lists all unique tags used in a project's test cases, alphabetically | read |
|
|
294
|
+
|
|
295
|
+
### Custom Fields (1)
|
|
296
|
+
|
|
297
|
+
| Tool | Description | Required scope |
|
|
298
|
+
|---|---|---|
|
|
299
|
+
| `list_custom_fields` | Lists tenant-scoped custom field definitions | read |
|
|
300
|
+
|
|
301
|
+
### Webhooks (1)
|
|
302
|
+
|
|
303
|
+
| Tool | Description | Required scope |
|
|
304
|
+
|---|---|---|
|
|
305
|
+
| `list_webhooks` | Lists webhooks scoped to the project or tenant-wide | read |
|
|
306
|
+
|
|
307
|
+
### Pipelines (1)
|
|
308
|
+
|
|
309
|
+
| Tool | Description | Required scope |
|
|
310
|
+
|---|---|---|
|
|
311
|
+
| `list_pipelines` | Lists CI/CD pipelines with their most recent run status | read |
|
|
312
|
+
|
|
313
|
+
### Dashboard (1)
|
|
314
|
+
|
|
315
|
+
| Tool | Description | Required scope |
|
|
316
|
+
|---|---|---|
|
|
317
|
+
| `get_dashboard_metrics` | Analytics digest (cases, runs, pass rate, recent failures, flaky, avg execution time) | read |
|
|
318
|
+
|
|
319
|
+
### Attachments (1)
|
|
320
|
+
|
|
321
|
+
| Tool | Description | Required scope |
|
|
322
|
+
|---|---|---|
|
|
323
|
+
| `add_test_case_attachment` | Attaches external evidence to a test case via URL (no file upload) | write |
|
|
324
|
+
|
|
325
|
+
### Comments (1)
|
|
326
|
+
|
|
327
|
+
| Tool | Description | Required scope |
|
|
328
|
+
|---|---|---|
|
|
329
|
+
| `add_test_case_comment` | Adds a markdown comment; `mentions[]` triggers @-mention notifications | write |
|
|
330
|
+
|
|
331
|
+
### Scheduled Runs (3)
|
|
332
|
+
|
|
333
|
+
| Tool | Description | Required scope |
|
|
334
|
+
|---|---|---|
|
|
335
|
+
| `list_scheduled_runs` | Lists scheduled test runs; status filter (active/paused/completed/failed) | read |
|
|
336
|
+
| `create_scheduled_run` | Creates a scheduled run for a suite (cron or interval schedule) | write |
|
|
337
|
+
| `pause_scheduled_run` | Pauses an active scheduled run (status=paused) | write |
|
|
338
|
+
|
|
339
|
+
### Reports & Insights (2)
|
|
340
|
+
|
|
341
|
+
| Tool | Description | Required scope |
|
|
342
|
+
|---|---|---|
|
|
343
|
+
| `get_failing_cases` | Top failing test cases in the last N days | read |
|
|
344
|
+
| `get_test_type_info` | Test type enum values and descriptions (MANUAL/API/AUTOMATED etc.) | read |
|
|
345
|
+
|
|
346
|
+
### Meta (2)
|
|
347
|
+
|
|
348
|
+
| Tool | Description | Required scope |
|
|
349
|
+
|---|---|---|
|
|
350
|
+
| `get_my_quota` | Shows your token's scopes, accessible projects, and rate limits | read |
|
|
351
|
+
| `get_schema` | Returns list of all tools or schema of a specific tool | read |
|
|
352
|
+
|
|
353
|
+
### Delete (5)
|
|
354
|
+
|
|
355
|
+
| Tool | Description | Required scope |
|
|
356
|
+
|---|---|---|
|
|
357
|
+
| `delete_test_case` | Soft-deletes a test case (restorable for 30 days), 2-step confirmation | delete |
|
|
358
|
+
| `delete_folder` | Soft-deletes a folder + cases inside, 2-step confirmation | delete |
|
|
359
|
+
| `delete_suite` | Deletes a suite (cases remain), 2-step confirmation | delete |
|
|
360
|
+
| `delete_requirement` | Soft-deletes a requirement (test case links removed), 2-step confirmation | delete |
|
|
361
|
+
| `delete_release` | Soft-deletes a release (linked runs/requirements intact), 2-step confirmation | delete |
|
|
362
|
+
|
|
363
|
+
> **Delete tools** (`delete_test_case`, `delete_folder`, `delete_suite`, `delete_requirement`, `delete_release`) require a 2-step confirmation flow: the first call returns `requiresConfirmation: true` with a `confirmationToken` and a preview of what will be deleted; the second call passes the token to confirm. The confirmation window expires after 60 seconds.
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
## Examples
|
|
368
|
+
|
|
369
|
+
Here are prompts you can paste directly into your AI client. The AI picks the correct tool(s) automatically.
|
|
370
|
+
|
|
371
|
+
### 1. List your projects
|
|
372
|
+
```
|
|
373
|
+
Show me my CLARITY projects.
|
|
374
|
+
```
|
|
375
|
+
Calls `list_projects`.
|
|
376
|
+
|
|
377
|
+
### 2. Generate test cases from a requirement
|
|
378
|
+
```
|
|
379
|
+
Read this requirement and create 10 test cases in the "Auth/Login" folder of project "E-commerce":
|
|
380
|
+
> Users must log in with email and password. Rate-limited to 5 attempts per minute.
|
|
381
|
+
> Lockout after 10 failed attempts. Password minimum 8 characters.
|
|
382
|
+
```
|
|
383
|
+
Calls `import_test_cases_json` with `folderStrategy: "find-or-create"` and `duplicateStrategy: "skip"`.
|
|
384
|
+
|
|
385
|
+
### 3. Find failing tests
|
|
386
|
+
```
|
|
387
|
+
Which test cases failed most often this month in project "E-commerce"?
|
|
388
|
+
```
|
|
389
|
+
Calls `get_failing_cases({ projectId, days: 30, limit: 10 })`.
|
|
390
|
+
|
|
391
|
+
### 4. Check run progress
|
|
392
|
+
```
|
|
393
|
+
How is the "Sprint-42 Smoke" run going?
|
|
394
|
+
```
|
|
395
|
+
Calls `list_runs` to resolve the run ID, then `get_run_progress`.
|
|
396
|
+
|
|
397
|
+
### 5. Mark an execution as failed
|
|
398
|
+
```
|
|
399
|
+
Mark the case "User can checkout with VISA" in the "Sprint-42 Smoke" run as FAIL
|
|
400
|
+
with comment: "payment-service returned 502 — see incident #4521"
|
|
401
|
+
```
|
|
402
|
+
Calls `search_test_cases` + `list_runs` to resolve IDs, then `update_execution_result`.
|
|
403
|
+
|
|
404
|
+
### 6. Bulk-create test cases
|
|
405
|
+
```
|
|
406
|
+
Create 5 test cases for the password-reset flow in the "Auth" folder of project "E-commerce".
|
|
407
|
+
Cover: request email, invalid email, expired link, successful reset, and password reuse rule.
|
|
408
|
+
```
|
|
409
|
+
Calls `bulk_create_test_cases` with up to 50 cases in a single request.
|
|
410
|
+
|
|
411
|
+
### 7. Safe folder deletion
|
|
412
|
+
```
|
|
413
|
+
Delete the "legacy-api" folder from project "E-commerce".
|
|
414
|
+
```
|
|
415
|
+
First call returns a preview and a `confirmationToken`. The AI shows you the preview and asks for confirmation before proceeding with the second call.
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## Troubleshooting
|
|
420
|
+
|
|
421
|
+
### "Connected to clarity (0 tools)" or no tools listed
|
|
422
|
+
|
|
423
|
+
- Check `CLARITY_API_URL` — must include the scheme and no trailing slash (e.g. `https://clarity-api.id3.com.tr`)
|
|
424
|
+
- Verify `CLARITY_API_TOKEN` starts with `clr_`
|
|
425
|
+
- Restart the AI client after editing the config file
|
|
426
|
+
|
|
427
|
+
### `INVALID_TOKEN`
|
|
428
|
+
|
|
429
|
+
The token has been revoked or never existed. Create a new one at **CLARITY → Settings → API Access → MCP Tokens → New Token**.
|
|
430
|
+
|
|
431
|
+
### `INSUFFICIENT_SCOPE`
|
|
432
|
+
|
|
433
|
+
The token lacks the scope the tool needs. Edit the token at **Settings → API Access → MCP Tokens** and enable the required scope (`read`, `write`, or `delete`).
|
|
434
|
+
|
|
435
|
+
### `PROJECT_NOT_ACCESSIBLE`
|
|
436
|
+
|
|
437
|
+
The token is scoped to specific projects and the requested project is not in its allowlist. Either expand the token's project access or use a different token.
|
|
438
|
+
|
|
439
|
+
### `RATE_LIMIT_EXCEEDED`
|
|
440
|
+
|
|
441
|
+
CLARITY enforces 60 requests/minute per token by default. Wait a few seconds and retry. For bulk operations, use `bulk_create_test_cases` instead of looping over `create_test_case`.
|
|
442
|
+
|
|
443
|
+
### `CONFIRMATION_EXPIRED`
|
|
444
|
+
|
|
445
|
+
The 60-second confirmation window for a destructive operation expired. Retry the delete call to receive a fresh `confirmationToken`.
|
|
446
|
+
|
|
447
|
+
### `TENANT_CONTEXT_MISSING`
|
|
448
|
+
|
|
449
|
+
The API token has no tenant association. This usually means the token was created before a tenant was configured. Create a new token after verifying your CLARITY workspace is fully set up.
|
|
450
|
+
|
|
451
|
+
### The server starts but the AI can't find a project
|
|
452
|
+
|
|
453
|
+
Use `list_projects` first to confirm the project ID. Project names are case-sensitive in search filters; use `projectId` (UUID) in tool calls for reliability.
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
## Privacy & Security
|
|
458
|
+
|
|
459
|
+
### Tenant isolation
|
|
460
|
+
|
|
461
|
+
Every API call is executed under the tenant associated with your token. The server cannot access data from other tenants, even if you supply a cross-tenant ID. This isolation is enforced at the CLARITY backend, not only in the MCP layer.
|
|
462
|
+
|
|
463
|
+
### Audit logging
|
|
464
|
+
|
|
465
|
+
Every tool call — including the initiating token ID, source IP, tool name, parameters, and result — is written to CLARITY's immutable audit log. Administrators can review this log at **Settings → Audit Log**.
|
|
466
|
+
|
|
467
|
+
### Least-privilege tokens
|
|
468
|
+
|
|
469
|
+
Grant only the scopes your workflow actually needs:
|
|
470
|
+
|
|
471
|
+
- **Read-only monitoring / dashboards** → `read` scope only
|
|
472
|
+
- **Content creation (AI-generated tests)** → `read` + `write`
|
|
473
|
+
- **Cleanup / migrations** → `read` + `write` + `delete`
|
|
474
|
+
|
|
475
|
+
### IP allowlist
|
|
476
|
+
|
|
477
|
+
For production tokens, navigate to **Settings → API Access → MCP Tokens → [token] → IP Allowlist** and restrict the token to specific CIDR ranges.
|
|
478
|
+
|
|
479
|
+
### Token soft-lock
|
|
480
|
+
|
|
481
|
+
If a token triggers more than 5 destructive operations within 60 seconds, it is automatically soft-locked for 1 hour as a safety net against runaway automation. An administrator can unlock it at **Settings → API Access → MCP Tokens**.
|
|
482
|
+
|
|
483
|
+
### Treat tokens like passwords
|
|
484
|
+
|
|
485
|
+
- Never paste a token into a chat, issue, or screenshot
|
|
486
|
+
- Never commit tokens to source control
|
|
487
|
+
- Rotate tokens whenever a team member leaves or a device is compromised
|
|
488
|
+
- Use short-lived tokens (set an expiry) for CI pipelines
|
|
489
|
+
|
|
490
|
+
### Key rotation procedure
|
|
491
|
+
|
|
492
|
+
1. Create a new token at **Settings → API Access → MCP Tokens → New Token**
|
|
493
|
+
2. Update `CLARITY_API_TOKEN` in your AI client config
|
|
494
|
+
3. Restart the AI client
|
|
495
|
+
4. Revoke the old token at **Settings → API Access → MCP Tokens → [old token] → Revoke**
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
## Development
|
|
500
|
+
|
|
501
|
+
```bash
|
|
502
|
+
git clone <repo>
|
|
503
|
+
cd packages/clarity-mcp-server
|
|
504
|
+
npm install
|
|
505
|
+
npm run build
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
### Local linking (test before publish)
|
|
509
|
+
|
|
510
|
+
```bash
|
|
511
|
+
npm link
|
|
512
|
+
# In your AI client config replace:
|
|
513
|
+
# "command": "npx", "args": ["-y", "@id3-clarity/mcp-server"]
|
|
514
|
+
# with:
|
|
515
|
+
# "command": "clarity-mcp-server"
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
### Manual smoke test
|
|
519
|
+
|
|
520
|
+
```bash
|
|
521
|
+
CLARITY_API_URL=https://clarity-api.id3.com.tr \
|
|
522
|
+
CLARITY_API_TOKEN=clr_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
|
|
523
|
+
CLARITY_LANG=en \
|
|
524
|
+
node dist/index.js
|
|
525
|
+
# Expect on stderr: "@id3-clarity/mcp-server ready (lang=en)"
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
### Running unit tests
|
|
529
|
+
|
|
530
|
+
```bash
|
|
531
|
+
npm test
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
---
|
|
535
|
+
|
|
536
|
+
## License
|
|
537
|
+
|
|
538
|
+
MIT — see [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ServerConfig } from '../config';
|
|
2
|
+
export interface ToolResult {
|
|
3
|
+
success: boolean;
|
|
4
|
+
data?: unknown;
|
|
5
|
+
requiresConfirmation?: boolean;
|
|
6
|
+
confirmationToken?: string;
|
|
7
|
+
preview?: unknown;
|
|
8
|
+
replayedFromCache?: boolean;
|
|
9
|
+
meta?: Record<string, unknown>;
|
|
10
|
+
error?: {
|
|
11
|
+
code: string;
|
|
12
|
+
message: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare class ClarityApiClient {
|
|
16
|
+
private readonly http;
|
|
17
|
+
constructor(config: ServerConfig);
|
|
18
|
+
invokeTool(toolName: string, params: Record<string, unknown>): Promise<ToolResult>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ClarityApiClient = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
class ClarityApiClient {
|
|
9
|
+
http;
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.http = axios_1.default.create({
|
|
12
|
+
baseURL: config.apiUrl,
|
|
13
|
+
timeout: 30000,
|
|
14
|
+
headers: {
|
|
15
|
+
Authorization: `Bearer ${config.apiToken}`,
|
|
16
|
+
'Accept-Language': config.lang,
|
|
17
|
+
'User-Agent': '@id3-clarity/mcp-server/1.5.0',
|
|
18
|
+
},
|
|
19
|
+
validateStatus: (s) => s < 500,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
async invokeTool(toolName, params) {
|
|
23
|
+
try {
|
|
24
|
+
const res = await this.http.post(`/api/mcp/tools/${toolName}`, params);
|
|
25
|
+
return res.data;
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
const e = err;
|
|
29
|
+
throw new Error(`MCP API error: ${e.message ?? 'unknown'}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.ClarityApiClient = ClarityApiClient;
|
|
34
|
+
//# sourceMappingURL=clarity-api-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clarity-api-client.js","sourceRoot":"","sources":["../../src/client/clarity-api-client.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA6C;AAc7C,MAAa,gBAAgB;IACV,IAAI,CAAgB;IAErC,YAAY,MAAoB;QAC9B,IAAI,CAAC,IAAI,GAAG,eAAK,CAAC,MAAM,CAAC;YACvB,OAAO,EAAE,MAAM,CAAC,MAAM;YACtB,OAAO,EAAE,KAAK;YACd,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,MAAM,CAAC,QAAQ,EAAE;gBAC1C,iBAAiB,EAAE,MAAM,CAAC,IAAI;gBAC9B,YAAY,EAAE,+BAA+B;aAC9C;YACD,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG;SAC/B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,QAAgB,EAAE,MAA+B;QAChE,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;YACvE,OAAO,GAAG,CAAC,IAAkB,CAAC;QAChC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,GAAG,GAA2B,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC,OAAO,IAAI,SAAS,EAAE,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;CACF;AAzBD,4CAyBC"}
|