@shortcut/mcp 0.17.0 → 0.18.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
CHANGED
|
@@ -148,6 +148,10 @@ Or you can edit the local JSON file directly:
|
|
|
148
148
|
- **stories-set-external-links** - Replace all external links on a story with a new set of links
|
|
149
149
|
- **stories-get-by-external-link** - Find all stories that contain a specific external link
|
|
150
150
|
|
|
151
|
+
### Labels
|
|
152
|
+
- **labels-list** - List all labels in the Shortcut workspace.
|
|
153
|
+
- **labels-create** - Create a new label in Shortcut.
|
|
154
|
+
|
|
151
155
|
### Epics
|
|
152
156
|
|
|
153
157
|
- **epics-get-by-id** - Get a Shortcut epic by ID
|
|
@@ -227,6 +231,7 @@ The following values are accepted in addition to the full tool names listed abov
|
|
|
227
231
|
- `stories`
|
|
228
232
|
- `epics`
|
|
229
233
|
- `iterations`
|
|
234
|
+
- `labels`
|
|
230
235
|
- `objectives`
|
|
231
236
|
- `teams`
|
|
232
237
|
- `workflows`
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,51 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { CustomMcpServer, DocumentTools, EpicTools, IterationTools, ObjectiveTools, ShortcutClientWrapper, StoryTools, TeamTools, UserTools, WorkflowTools } from "./workflows-
|
|
2
|
+
import { BaseTools, CustomMcpServer, DocumentTools, EpicTools, IterationTools, ObjectiveTools, ShortcutClientWrapper, StoryTools, TeamTools, UserTools, WorkflowTools } from "./workflows-Dko3ibgz.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { ShortcutClient } from "@shortcut/client";
|
|
5
|
+
import { z } from "zod";
|
|
5
6
|
|
|
7
|
+
//#region src/tools/labels.ts
|
|
8
|
+
/**
|
|
9
|
+
* Tools for managing Shortcut labels.
|
|
10
|
+
*/
|
|
11
|
+
var LabelTools = class LabelTools extends BaseTools {
|
|
12
|
+
static create(client$1, server$1) {
|
|
13
|
+
const tools = new LabelTools(client$1);
|
|
14
|
+
server$1.addToolWithReadAccess("labels-list", "List all labels in the Shortcut workspace.", { includeArchived: z.boolean().optional().describe("Whether to include archived labels in the list.").default(false) }, async (params) => await tools.listLabels(params));
|
|
15
|
+
server$1.addToolWithWriteAccess("labels-create", "Create a new label in Shortcut.", {
|
|
16
|
+
name: z.string().min(1).max(128).describe("The name of the new label. Required."),
|
|
17
|
+
color: z.string().regex(/^#[a-fA-F0-9]{6}$/).optional().describe("The hex color to be displayed with the label (e.g., \"#ff0000\")."),
|
|
18
|
+
description: z.string().max(1024).optional().describe("A description of the label.")
|
|
19
|
+
}, async (params) => await tools.createLabel(params));
|
|
20
|
+
return tools;
|
|
21
|
+
}
|
|
22
|
+
formatLabel(label, { includeDescription = false, includeArchived = false } = {}) {
|
|
23
|
+
return {
|
|
24
|
+
id: label.id,
|
|
25
|
+
name: label.name,
|
|
26
|
+
app_url: label.app_url,
|
|
27
|
+
...includeDescription ? { description: label.description ?? null } : {},
|
|
28
|
+
...includeArchived ? { archived: label.archived } : {},
|
|
29
|
+
stats: Object.fromEntries(Object.entries(label.stats || {}).filter(([key, value]) => !key.match(/(unestimated|total)$/) && !!value))
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
async listLabels({ includeArchived = false }) {
|
|
33
|
+
const labels = await this.client.listLabels({ includeArchived });
|
|
34
|
+
if (!labels.length) return this.toResult("Result: No labels found.");
|
|
35
|
+
const formattedLabels = labels.map((label) => this.formatLabel(label, { includeArchived }));
|
|
36
|
+
return this.toResult(`Result (${labels.length} labels found):`, { labels: formattedLabels });
|
|
37
|
+
}
|
|
38
|
+
async createLabel({ name, color, description }) {
|
|
39
|
+
const label = await this.client.createLabel({
|
|
40
|
+
name,
|
|
41
|
+
color,
|
|
42
|
+
description
|
|
43
|
+
});
|
|
44
|
+
return this.toResult(`Label created with ID: ${label.id}.`, { label: this.formatLabel(label, { includeDescription: true }) });
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
6
49
|
//#region src/server.ts
|
|
7
50
|
let apiToken = process.env.SHORTCUT_API_TOKEN;
|
|
8
51
|
let isReadonly = process.env.SHORTCUT_READONLY === "true";
|
|
@@ -29,6 +72,7 @@ ObjectiveTools.create(client, server);
|
|
|
29
72
|
TeamTools.create(client, server);
|
|
30
73
|
WorkflowTools.create(client, server);
|
|
31
74
|
DocumentTools.create(client, server);
|
|
75
|
+
LabelTools.create(client, server);
|
|
32
76
|
async function startServer() {
|
|
33
77
|
try {
|
|
34
78
|
const transport = new StdioServerTransport();
|
package/dist/server-http.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CustomMcpServer, DocumentTools, EpicTools, IterationTools, ObjectiveTools, ShortcutClientWrapper, StoryTools, TeamTools, UserTools, WorkflowTools } from "./workflows-
|
|
1
|
+
import { CustomMcpServer, DocumentTools, EpicTools, IterationTools, ObjectiveTools, ShortcutClientWrapper, StoryTools, TeamTools, UserTools, WorkflowTools } from "./workflows-Dko3ibgz.js";
|
|
2
2
|
import { ShortcutClient } from "@shortcut/client";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
@@ -476,12 +476,24 @@ var ShortcutClientWrapper = class {
|
|
|
476
476
|
await this.loadCustomFields();
|
|
477
477
|
return Array.from(this.customFieldCache.values());
|
|
478
478
|
}
|
|
479
|
+
async listLabels({ includeArchived = false }) {
|
|
480
|
+
const response = await this.client.listLabels({ slim: false });
|
|
481
|
+
const allLabels = response?.data ?? [];
|
|
482
|
+
if (includeArchived) return allLabels;
|
|
483
|
+
return allLabels.filter((label) => !label.archived);
|
|
484
|
+
}
|
|
485
|
+
async createLabel(params) {
|
|
486
|
+
const response = await this.client.createLabel(params);
|
|
487
|
+
const label = response?.data ?? null;
|
|
488
|
+
if (!label) throw new Error(`Failed to create the label: ${response.status}`);
|
|
489
|
+
return label;
|
|
490
|
+
}
|
|
479
491
|
};
|
|
480
492
|
|
|
481
493
|
//#endregion
|
|
482
494
|
//#region package.json
|
|
483
495
|
var name = "@shortcut/mcp";
|
|
484
|
-
var version = "0.
|
|
496
|
+
var version = "0.18.0";
|
|
485
497
|
|
|
486
498
|
//#endregion
|
|
487
499
|
//#region src/mcp/CustomMcpServer.ts
|
|
@@ -1688,4 +1700,4 @@ var WorkflowTools = class WorkflowTools extends BaseTools {
|
|
|
1688
1700
|
};
|
|
1689
1701
|
|
|
1690
1702
|
//#endregion
|
|
1691
|
-
export { CustomMcpServer, DocumentTools, EpicTools, IterationTools, ObjectiveTools, ShortcutClientWrapper, StoryTools, TeamTools, UserTools, WorkflowTools };
|
|
1703
|
+
export { BaseTools, CustomMcpServer, DocumentTools, EpicTools, IterationTools, ObjectiveTools, ShortcutClientWrapper, StoryTools, TeamTools, UserTools, WorkflowTools };
|