harness-mcp-v2 0.5.2 → 0.5.4
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 +24 -5
- package/build/client/pagination.d.ts.map +1 -1
- package/build/client/pagination.js +3 -1
- package/build/client/pagination.js.map +1 -1
- package/build/index.js +26 -2
- package/build/index.js.map +1 -1
- package/build/prompts/debug-pipeline.d.ts.map +1 -1
- package/build/prompts/debug-pipeline.js +19 -12
- package/build/prompts/debug-pipeline.js.map +1 -1
- package/build/registry/toolsets/logs.js +5 -5
- package/build/registry/toolsets/logs.js.map +1 -1
- package/build/tools/harness-create.d.ts.map +1 -1
- package/build/tools/harness-create.js +5 -2
- package/build/tools/harness-create.js.map +1 -1
- package/build/tools/harness-delete.d.ts.map +1 -1
- package/build/tools/harness-delete.js +4 -2
- package/build/tools/harness-delete.js.map +1 -1
- package/build/tools/harness-diagnose.d.ts +2 -1
- package/build/tools/harness-diagnose.d.ts.map +1 -1
- package/build/tools/harness-diagnose.js +290 -24
- package/build/tools/harness-diagnose.js.map +1 -1
- package/build/tools/harness-execute.d.ts.map +1 -1
- package/build/tools/harness-execute.js +49 -9
- package/build/tools/harness-execute.js.map +1 -1
- package/build/tools/harness-get.d.ts.map +1 -1
- package/build/tools/harness-get.js +15 -8
- package/build/tools/harness-get.js.map +1 -1
- package/build/tools/harness-list.d.ts.map +1 -1
- package/build/tools/harness-list.js +11 -5
- package/build/tools/harness-list.js.map +1 -1
- package/build/tools/harness-search.d.ts.map +1 -1
- package/build/tools/harness-search.js +5 -2
- package/build/tools/harness-search.js.map +1 -1
- package/build/tools/harness-status.d.ts.map +1 -1
- package/build/tools/harness-status.js +6 -3
- package/build/tools/harness-status.js.map +1 -1
- package/build/tools/harness-update.d.ts.map +1 -1
- package/build/tools/harness-update.js +4 -2
- package/build/tools/harness-update.js.map +1 -1
- package/build/tools/index.js +1 -1
- package/build/tools/index.js.map +1 -1
- package/build/utils/url-parser.d.ts +38 -0
- package/build/utils/url-parser.d.ts.map +1 -0
- package/build/utils/url-parser.js +165 -0
- package/build/utils/url-parser.js.map +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -418,6 +418,8 @@ The deployment runs 2 replicas with readiness/liveness probes, resource limits,
|
|
|
418
418
|
|
|
419
419
|
The server exposes 10 MCP tools. Every tool accepts `org_id` and `project_id` as optional overrides — if omitted, they fall back to `HARNESS_DEFAULT_ORG_ID` and `HARNESS_DEFAULT_PROJECT_ID`.
|
|
420
420
|
|
|
421
|
+
**URL support:** All tools accept a `url` parameter — paste any Harness UI URL and the server automatically extracts org, project, resource type, resource ID, pipeline ID, and execution ID. Explicit parameters always take precedence over URL-derived values.
|
|
422
|
+
|
|
421
423
|
| Tool | Description |
|
|
422
424
|
|------|-------------|
|
|
423
425
|
| `harness_describe` | Discover available resource types, operations, and fields. No API call — returns local registry metadata. |
|
|
@@ -428,7 +430,7 @@ The server exposes 10 MCP tools. Every tool accepts `org_id` and `project_id` as
|
|
|
428
430
|
| `harness_delete` | Delete a resource. Prompts for user confirmation via [elicitation](#elicitation). Destructive. |
|
|
429
431
|
| `harness_execute` | Execute an action on a resource (run pipeline, toggle flag, sync app). Prompts for user confirmation via [elicitation](#elicitation). |
|
|
430
432
|
| `harness_search` | Search across multiple resource types in parallel with a single query. |
|
|
431
|
-
| `harness_diagnose` |
|
|
433
|
+
| `harness_diagnose` | Analyze a pipeline execution — returns a structured report with stage breakdown, timing, bottlenecks, and failure info. Accepts an execution ID, pipeline ID (auto-fetches latest), or a Harness URL. Set `summary=false` for raw diagnostic data with pipeline YAML and logs. |
|
|
432
434
|
| `harness_status` | Get a real-time project health dashboard — recent executions, failure rates, and deep links. |
|
|
433
435
|
|
|
434
436
|
### Tool Examples
|
|
@@ -492,10 +494,22 @@ The server exposes 10 MCP tools. Every tool accepts `org_id` and `project_id` as
|
|
|
492
494
|
{ "query": "payment-service" }
|
|
493
495
|
```
|
|
494
496
|
|
|
495
|
-
**
|
|
497
|
+
**Get a structured execution report (summary mode, default):**
|
|
498
|
+
|
|
499
|
+
```json
|
|
500
|
+
{ "execution_id": "abc123XYZ" }
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
**Diagnose from a Harness URL (fetches YAML + logs automatically):**
|
|
504
|
+
|
|
505
|
+
```json
|
|
506
|
+
{ "url": "https://app.harness.io/ng/account/.../pipelines/myPipeline/executions/abc123XYZ/pipeline", "summary": false }
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
**Get the latest execution report for a pipeline:**
|
|
496
510
|
|
|
497
511
|
```json
|
|
498
|
-
{ "
|
|
512
|
+
{ "pipeline_id": "my-pipeline" }
|
|
499
513
|
```
|
|
500
514
|
|
|
501
515
|
**Get project health status:**
|
|
@@ -782,7 +796,7 @@ The server exposes 10 MCP tools. Every tool accepts `org_id` and `project_id` as
|
|
|
782
796
|
| Prompt | Description | Parameters |
|
|
783
797
|
|--------|-------------|------------|
|
|
784
798
|
| `build-deploy-app` | End-to-end CI/CD workflow: scan a git repo, generate CI pipeline (build & push Docker image), discover or generate K8s manifests, create CD pipeline, and deploy — with auto-retry on CI failures (up to 5 attempts) and CD failures (up to 3 attempts with user permission). On exhausted retries, provides Harness UI deep links to all created resources for manual investigation. | `repoUrl` (required), `imageName` (required), `projectId` (optional), `namespace` (optional) |
|
|
785
|
-
| `debug-pipeline-failure` | Analyze a failed execution:
|
|
799
|
+
| `debug-pipeline-failure` | Analyze a failed execution: accepts an execution ID, pipeline ID, or Harness URL. Gathers execution details, pipeline YAML, and logs via `harness_diagnose`, then provides root cause analysis and suggested fixes. | `executionId` (optional), `projectId` (optional) |
|
|
786
800
|
| `create-pipeline` | Generate a new pipeline YAML from natural language requirements, reviewing existing resources for context | `description` (required), `projectId` (optional) |
|
|
787
801
|
| `onboard-service` | Walk through onboarding a new service with environments and a deployment pipeline | `serviceName` (required), `projectId` (optional) |
|
|
788
802
|
| `dora-metrics-review` | Review DORA metrics (deployment frequency, change failure rate, MTTR, lead time) with Elite/High/Medium/Low classification and improvement recommendations | `teamRefId` (optional), `dateStart` (optional), `dateEnd` (optional) |
|
|
@@ -1076,6 +1090,7 @@ Write tools (`harness_create`, `harness_update`, `harness_delete`, `harness_exec
|
|
|
1076
1090
|
| Client | Elicitation Support |
|
|
1077
1091
|
|--------|-------------------|
|
|
1078
1092
|
| Cursor | Yes |
|
|
1093
|
+
| VS Code (Copilot) | Yes |
|
|
1079
1094
|
| Claude Desktop | Not yet |
|
|
1080
1095
|
| Windsurf | Not yet |
|
|
1081
1096
|
| MCP Inspector | Yes |
|
|
@@ -1086,8 +1101,12 @@ For clients that don't support elicitation, the server proceeds directly — the
|
|
|
1086
1101
|
|
|
1087
1102
|
- **Secrets are never exposed.** The `secret` resource type returns metadata only (name, type, scope) — secret values are never included in any response.
|
|
1088
1103
|
- **Write operations prompt for confirmation.** `harness_create`, `harness_update`, `harness_delete`, and `harness_execute` use MCP elicitation to get user approval before proceeding (see [Elicitation](#elicitation)).
|
|
1089
|
-
- **
|
|
1104
|
+
- **CORS restricted to same-origin.** The HTTP transport only allows same-origin requests, preventing CSRF attacks from malicious websites targeting the MCP server on localhost.
|
|
1105
|
+
- **HTTP rate limiting.** The HTTP transport enforces 60 requests per minute per IP to prevent request flooding.
|
|
1106
|
+
- **API rate limiting.** The Harness API client enforces a 10 requests/second limit to avoid hitting upstream rate limits.
|
|
1107
|
+
- **Pagination bounds enforced.** List queries are capped at 10,000 items total and 100 per page to prevent memory exhaustion.
|
|
1090
1108
|
- **Retries with backoff.** Transient failures (HTTP 429, 5xx) are retried with exponential backoff and jitter.
|
|
1109
|
+
- **Localhost binding.** The HTTP transport binds to `127.0.0.1` by default — not accessible from the network.
|
|
1091
1110
|
- **No stdout logging.** All logs go to stderr to avoid corrupting the stdio JSON-RPC transport.
|
|
1092
1111
|
|
|
1093
1112
|
## Troubleshooting & Common Pitfalls
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/client/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,UAAU,eAAe;IACvB,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/client/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,UAAU,eAAe;IACvB,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAmC/F"}
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* Handles both page-based (NG API) and offset-based patterns.
|
|
4
4
|
*/
|
|
5
5
|
export async function paginate(opts) {
|
|
6
|
-
const { client, request, maxItems = 100, pageSize = 20 } = opts;
|
|
6
|
+
const { client, request, maxItems: rawMax = 100, pageSize: rawSize = 20 } = opts;
|
|
7
|
+
const maxItems = Math.min(Math.max(rawMax, 1), 10_000);
|
|
8
|
+
const pageSize = Math.min(Math.max(rawSize, 1), 100);
|
|
7
9
|
const allItems = [];
|
|
8
10
|
let page = 0;
|
|
9
11
|
let total = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/client/pagination.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAI,IAAqB;IACrD,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,GAAG,EAAE,QAAQ,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/client/pagination.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAI,IAAqB;IACrD,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,GAAG,EAAE,QAAQ,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;IACjF,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACvD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACrD,MAAM,QAAQ,GAAQ,EAAE,CAAC;IACzB,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,OAAO,QAAQ,CAAC,MAAM,GAAG,QAAQ,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC5D,MAAM,MAAM,GAAG,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QAEjD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAKlC;YACD,GAAG,OAAO;YACV,MAAM,EAAE,MAA+D;SACxE,CAAC,CAAC;QAEH,kCAAkC;QAClC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE,OAAO,IAAI,QAAQ,CAAC,OAAO,IAAI,EAAE,CAAC;QACjE,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,aAAa,IAAI,QAAQ,CAAC,IAAI,EAAE,UAAU,IAAI,QAAQ,CAAC,aAAa,IAAI,QAAQ,CAAC,UAAU,IAAI,CAAC,CAAC;QAExH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM;QAEhC,QAAQ,CAAC,IAAI,CAAC,GAAI,OAAe,CAAC,CAAC;QACnC,IAAI,EAAE,CAAC;QAEP,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI;YAAE,MAAM,CAAC,YAAY;IAChD,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACpC,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -50,13 +50,37 @@ async function startHttp(config, port) {
|
|
|
50
50
|
// Override the default express.json() limit to match our config
|
|
51
51
|
const { json } = await import("express");
|
|
52
52
|
app.use(json({ limit: maxBodySize }));
|
|
53
|
-
//
|
|
53
|
+
// Block cross-origin requests — prevents CSRF from malicious websites
|
|
54
|
+
// targeting the MCP server on localhost. Only same-origin requests are allowed.
|
|
54
55
|
app.use((_req, res, next) => {
|
|
55
|
-
res.setHeader("Access-Control-Allow-Origin",
|
|
56
|
+
res.setHeader("Access-Control-Allow-Origin", `http://${host}:${port}`);
|
|
56
57
|
res.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
|
|
57
58
|
res.setHeader("Access-Control-Allow-Headers", "Content-Type, mcp-session-id");
|
|
58
59
|
next();
|
|
59
60
|
});
|
|
61
|
+
// Simple per-IP rate limiting: 60 requests per minute
|
|
62
|
+
const ipHits = new Map();
|
|
63
|
+
const RATE_WINDOW_MS = 60_000;
|
|
64
|
+
const RATE_LIMIT = 60;
|
|
65
|
+
app.use((req, res, next) => {
|
|
66
|
+
const ip = req.ip ?? "unknown";
|
|
67
|
+
const now = Date.now();
|
|
68
|
+
let entry = ipHits.get(ip);
|
|
69
|
+
if (!entry || now >= entry.resetAt) {
|
|
70
|
+
entry = { count: 0, resetAt: now + RATE_WINDOW_MS };
|
|
71
|
+
ipHits.set(ip, entry);
|
|
72
|
+
}
|
|
73
|
+
entry.count++;
|
|
74
|
+
if (entry.count > RATE_LIMIT) {
|
|
75
|
+
res.status(429).json({
|
|
76
|
+
jsonrpc: "2.0",
|
|
77
|
+
error: { code: -32000, message: "Too many requests. Try again later." },
|
|
78
|
+
id: null,
|
|
79
|
+
});
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
next();
|
|
83
|
+
});
|
|
60
84
|
// Health check
|
|
61
85
|
app.get("/health", (_req, res) => {
|
|
62
86
|
res.json({ status: "ok" });
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,UAAU,EAAe,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/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AM,CAAC,gBAAgB,IAAI,OAAO;KAC7C,CAAC,CAAC;IAEH,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC;QAC1B,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;SAAM,CAAC;QACN,MAAM,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAChC,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;IACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug-pipeline.d.ts","sourceRoot":"","sources":["../../src/prompts/debug-pipeline.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"debug-pipeline.d.ts","sourceRoot":"","sources":["../../src/prompts/debug-pipeline.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAmCnE"}
|
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
export function registerDebugPipelinePrompt(server) {
|
|
3
|
-
server.prompt("debug-pipeline-failure", "Analyze a failed pipeline execution and suggest fixes", {
|
|
4
|
-
executionId: z.string().describe("The failed execution ID"),
|
|
3
|
+
server.prompt("debug-pipeline-failure", "Analyze a failed pipeline execution and suggest fixes. Accepts an execution ID, pipeline ID, or Harness URL.", {
|
|
4
|
+
executionId: z.string().describe("The failed execution ID, pipeline ID, or a Harness URL").optional(),
|
|
5
5
|
projectId: z.string().describe("Project identifier").optional(),
|
|
6
|
-
}, async ({ executionId, projectId }) =>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
}, async ({ executionId, projectId }) => {
|
|
7
|
+
// Detect if the input looks like a URL
|
|
8
|
+
const isUrl = executionId?.startsWith("http");
|
|
9
|
+
const idParam = isUrl
|
|
10
|
+
? `url="${executionId}"`
|
|
11
|
+
: `execution_id="${executionId}"`;
|
|
12
|
+
return {
|
|
13
|
+
messages: [{
|
|
14
|
+
role: "user",
|
|
15
|
+
content: {
|
|
16
|
+
type: "text",
|
|
17
|
+
text: `Analyze this failed Harness pipeline execution and provide:
|
|
12
18
|
|
|
13
19
|
1. **Root cause** of the failure
|
|
14
20
|
2. **Which step failed** and why
|
|
15
21
|
3. **Suggested fix** with specific actions
|
|
16
22
|
4. **Similar patterns** — have we seen this failure type before?
|
|
17
23
|
|
|
18
|
-
Start by calling harness_diagnose with
|
|
24
|
+
Start by calling harness_diagnose with ${idParam}${projectId ? `, project_id="${projectId}"` : ""}, summary=false to gather all context (execution details, pipeline YAML, and logs) in one call.
|
|
19
25
|
|
|
20
26
|
Then analyze the diagnostic payload and provide actionable recommendations.`,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
},
|
|
28
|
+
}],
|
|
29
|
+
};
|
|
30
|
+
});
|
|
24
31
|
}
|
|
25
32
|
//# sourceMappingURL=debug-pipeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug-pipeline.js","sourceRoot":"","sources":["../../src/prompts/debug-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,MAAM,UAAU,2BAA2B,CAAC,MAAiB;IAC3D,MAAM,CAAC,MAAM,CACX,wBAAwB,EACxB,
|
|
1
|
+
{"version":3,"file":"debug-pipeline.js","sourceRoot":"","sources":["../../src/prompts/debug-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,MAAM,UAAU,2BAA2B,CAAC,MAAiB;IAC3D,MAAM,CAAC,MAAM,CACX,wBAAwB,EACxB,8GAA8G,EAC9G;QACE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wDAAwD,CAAC,CAAC,QAAQ,EAAE;QACrG,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC,QAAQ,EAAE;KAChE,EACD,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,EAAE;QACnC,uCAAuC;QACvC,MAAM,KAAK,GAAG,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QAC9C,MAAM,OAAO,GAAG,KAAK;YACnB,CAAC,CAAC,QAAQ,WAAW,GAAG;YACxB,CAAC,CAAC,iBAAiB,WAAW,GAAG,CAAC;QAEpC,OAAO;YACL,QAAQ,EAAE,CAAC;oBACT,IAAI,EAAE,MAAe;oBACrB,OAAO,EAAE;wBACP,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE;;;;;;;yCAOuB,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,iBAAiB,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE;;4EAErB;qBACjE;iBACF,CAAC;SACH,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -6,20 +6,20 @@ export const logsToolset = {
|
|
|
6
6
|
{
|
|
7
7
|
resourceType: "execution_log",
|
|
8
8
|
displayName: "Execution Log",
|
|
9
|
-
description: "Pipeline execution step logs.
|
|
9
|
+
description: "Pipeline execution step logs. Requires a 'prefix' query param in the format: {accountId}/pipeline/{pipelineId}/{runSequence}/-{executionId} (pipeline-level) or appended with /{stageId}/{stepId} (step-level).",
|
|
10
10
|
toolset: "logs",
|
|
11
11
|
scope: "project",
|
|
12
|
-
identifierFields: ["
|
|
13
|
-
listFilterFields: [
|
|
12
|
+
identifierFields: ["prefix"],
|
|
13
|
+
listFilterFields: [],
|
|
14
14
|
operations: {
|
|
15
15
|
get: {
|
|
16
16
|
method: "POST",
|
|
17
17
|
path: "/gateway/log-service/blob/download",
|
|
18
18
|
queryParams: {
|
|
19
|
-
|
|
19
|
+
prefix: "prefix",
|
|
20
20
|
},
|
|
21
21
|
responseExtractor: (raw) => raw,
|
|
22
|
-
description: "Download execution logs
|
|
22
|
+
description: "Download execution logs by prefix",
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../../src/registry/toolsets/logs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsB;IAC5C,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,kCAAkC;IAC/C,SAAS,EAAE;QACT;YACE,YAAY,EAAE,eAAe;YAC7B,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../../src/registry/toolsets/logs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsB;IAC5C,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,kCAAkC;IAC/C,SAAS,EAAE;QACT;YACE,YAAY,EAAE,eAAe;YAC7B,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,iNAAiN;YAC9N,OAAO,EAAE,MAAM;YACf,KAAK,EAAE,SAAS;YAChB,gBAAgB,EAAE,CAAC,QAAQ,CAAC;YAC5B,gBAAgB,EAAE,EAAE;YACpB,UAAU,EAAE;gBACV,GAAG,EAAE;oBACH,MAAM,EAAE,MAAM;oBACd,IAAI,EAAE,oCAAoC;oBAC1C,WAAW,EAAE;wBACX,MAAM,EAAE,QAAQ;qBACjB;oBACD,iBAAiB,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG;oBAC/B,WAAW,EAAE,mCAAmC;iBACjD;aACF;SACF;KACF;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness-create.d.ts","sourceRoot":"","sources":["../../src/tools/harness-create.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"harness-create.d.ts","sourceRoot":"","sources":["../../src/tools/harness-create.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAMjE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CA+BrG"}
|
|
@@ -2,14 +2,17 @@ import * as z from "zod/v4";
|
|
|
2
2
|
import { jsonResult, errorResult } from "../utils/response-formatter.js";
|
|
3
3
|
import { isUserError, toMcpError } from "../utils/errors.js";
|
|
4
4
|
import { confirmViaElicitation } from "../utils/elicitation.js";
|
|
5
|
+
import { applyUrlDefaults } from "../utils/url-parser.js";
|
|
5
6
|
export function registerCreateTool(server, registry, client) {
|
|
6
|
-
server.tool("harness_create", "Create a new Harness resource. For pipelines, templates, and triggers — read the schema resource first (e.g. schema:///pipeline) to understand the required body format.", {
|
|
7
|
+
server.tool("harness_create", "Create a new Harness resource. You can pass a Harness URL to auto-extract org and project scope. For pipelines, templates, and triggers — read the schema resource first (e.g. schema:///pipeline) to understand the required body format.", {
|
|
7
8
|
resource_type: z.string().describe("The type of resource to create (e.g. pipeline, service, environment, connector, trigger)"),
|
|
8
9
|
body: z.record(z.string(), z.unknown()).describe("The resource definition body (varies by resource type — typically the YAML or JSON spec)"),
|
|
10
|
+
url: z.string().describe("A Harness UI URL — org and project are extracted automatically").optional(),
|
|
9
11
|
org_id: z.string().describe("Organization identifier (overrides default)").optional(),
|
|
10
12
|
project_id: z.string().describe("Project identifier (overrides default)").optional(),
|
|
11
13
|
}, async (args) => {
|
|
12
14
|
try {
|
|
15
|
+
const input = applyUrlDefaults(args, args.url);
|
|
13
16
|
const elicit = await confirmViaElicitation({
|
|
14
17
|
server,
|
|
15
18
|
toolName: "harness_create",
|
|
@@ -18,7 +21,7 @@ export function registerCreateTool(server, registry, client) {
|
|
|
18
21
|
if (!elicit.proceed) {
|
|
19
22
|
return errorResult(`Operation ${elicit.reason} by user.`);
|
|
20
23
|
}
|
|
21
|
-
const result = await registry.dispatch(client, args.resource_type, "create",
|
|
24
|
+
const result = await registry.dispatch(client, args.resource_type, "create", input);
|
|
22
25
|
return jsonResult(result);
|
|
23
26
|
}
|
|
24
27
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness-create.js","sourceRoot":"","sources":["../../src/tools/harness-create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAI5B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"harness-create.js","sourceRoot":"","sources":["../../src/tools/harness-create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAI5B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AACzE,OA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aAAa,MAAM,CAAC,MAAM,WAAW,CAAC,CAAC;YAC5D,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YACpF,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,WAAW,CAAC,GAAG,CAAC;gBAAE,OAAO,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACtD,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness-delete.d.ts","sourceRoot":"","sources":["../../src/tools/harness-delete.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"harness-delete.d.ts","sourceRoot":"","sources":["../../src/tools/harness-delete.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAMjE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAsCrG"}
|
|
@@ -2,10 +2,12 @@ import * as z from "zod/v4";
|
|
|
2
2
|
import { jsonResult, errorResult } from "../utils/response-formatter.js";
|
|
3
3
|
import { isUserError, toMcpError } from "../utils/errors.js";
|
|
4
4
|
import { confirmViaElicitation } from "../utils/elicitation.js";
|
|
5
|
+
import { applyUrlDefaults } from "../utils/url-parser.js";
|
|
5
6
|
export function registerDeleteTool(server, registry, client) {
|
|
6
|
-
server.tool("harness_delete", "Delete a Harness resource. This is destructive and cannot be undone.", {
|
|
7
|
+
server.tool("harness_delete", "Delete a Harness resource. You can pass a Harness URL to auto-extract identifiers. This is destructive and cannot be undone.", {
|
|
7
8
|
resource_type: z.string().describe("The type of resource to delete (e.g. pipeline, trigger, connector)"),
|
|
8
9
|
resource_id: z.string().describe("The identifier of the resource to delete"),
|
|
10
|
+
url: z.string().describe("A Harness UI URL — org, project, resource type, and ID are extracted automatically").optional(),
|
|
9
11
|
org_id: z.string().describe("Organization identifier (overrides default)").optional(),
|
|
10
12
|
project_id: z.string().describe("Project identifier (overrides default)").optional(),
|
|
11
13
|
pipeline_id: z.string().describe("Pipeline ID (for trigger deletes)").optional(),
|
|
@@ -21,7 +23,7 @@ export function registerDeleteTool(server, registry, client) {
|
|
|
21
23
|
return errorResult(`Operation ${elicit.reason} by user.`);
|
|
22
24
|
}
|
|
23
25
|
const def = registry.getResource(args.resource_type);
|
|
24
|
-
const input =
|
|
26
|
+
const input = applyUrlDefaults(args, args.url);
|
|
25
27
|
if (def.identifierFields.length > 0 && args.resource_id) {
|
|
26
28
|
input[def.identifierFields[0]] = args.resource_id;
|
|
27
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness-delete.js","sourceRoot":"","sources":["../../src/tools/harness-delete.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAI5B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"harness-delete.js","source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McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import type { Registry } from "../registry/index.js";
|
|
3
3
|
import type { HarnessClient } from "../client/harness-client.js";
|
|
4
|
-
|
|
4
|
+
import type { Config } from "../config.js";
|
|
5
|
+
export declare function registerDiagnoseTool(server: McpServer, registry: Registry, client: HarnessClient, config: Config): void;
|
|
5
6
|
//# sourceMappingURL=harness-diagnose.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness-diagnose.d.ts","sourceRoot":"","sources":["../../src/tools/harness-diagnose.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"harness-diagnose.d.ts","sourceRoot":"","sources":["../../src/tools/harness-diagnose.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAsQ3C,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAiKvH"}
|