@shortcut/mcp 0.10.3 → 0.11.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.
Files changed (2) hide show
  1. package/dist/index.js +31 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -435,7 +435,7 @@ var ShortcutClientWrapper = class {
435
435
  //#endregion
436
436
  //#region package.json
437
437
  var name = "@shortcut/mcp";
438
- var version = "0.10.3";
438
+ var version = "0.11.0";
439
439
 
440
440
  //#endregion
441
441
  //#region src/tools/base.ts
@@ -548,14 +548,15 @@ var BaseTools = class {
548
548
  }
549
549
  getSimplifiedTeam(entity) {
550
550
  if (!entity) return null;
551
- const { archived, id, name: name$1, mention_name, member_ids, workflow_ids } = entity;
551
+ const { archived, id, name: name$1, mention_name, member_ids, workflow_ids, default_workflow_id } = entity;
552
552
  return {
553
553
  id,
554
554
  name: name$1,
555
555
  archived,
556
556
  mention_name,
557
557
  member_ids,
558
- workflow_ids
558
+ workflow_ids,
559
+ default_workflow_id: default_workflow_id ?? null
559
560
  };
560
561
  }
561
562
  getSimplifiedObjective(entity) {
@@ -699,10 +700,11 @@ var BaseTools = class {
699
700
  workflowsForEpic,
700
701
  workflowForStory ? { [workflowForStory.id]: workflowForStory } : {}
701
702
  ]);
703
+ const simplifiedStoryTeam = this.getSimplifiedTeam(teamForStory);
702
704
  const teams = this.mergeRelatedEntities([
703
705
  teamsForIteration,
704
706
  teamsForEpic,
705
- teamForStory ? { [teamForStory.id]: teamForStory } : {}
707
+ simplifiedStoryTeam ? { [simplifiedStoryTeam.id]: simplifiedStoryTeam } : {}
706
708
  ]);
707
709
  const epics = simplifiedEpic ? { [simplifiedEpic.id]: simplifiedEpic } : {};
708
710
  const iterations = simplifiedIteration ? { [simplifiedIteration.id]: simplifiedIteration } : {};
@@ -1430,6 +1432,7 @@ var UserTools = class UserTools extends BaseTools {
1430
1432
  static create(client$1, server$1) {
1431
1433
  const tools = new UserTools(client$1);
1432
1434
  server$1.tool("get-current-user", "Get the current user", async () => await tools.getCurrentUser());
1435
+ server$1.tool("get-current-user-teams", "Get a list of teams where the current user is a member", async () => await tools.getCurrentUserTeams());
1433
1436
  server$1.tool("list-members", "Get all members", async () => await tools.listMembers());
1434
1437
  return tools;
1435
1438
  }
@@ -1438,6 +1441,14 @@ var UserTools = class UserTools extends BaseTools {
1438
1441
  if (!user$1) throw new Error("Failed to retrieve current user.");
1439
1442
  return this.toResult(`Current user:`, user$1);
1440
1443
  }
1444
+ async getCurrentUserTeams() {
1445
+ const teams = await this.client.getTeams();
1446
+ const currentUser = await this.client.getCurrentUser();
1447
+ if (!currentUser) throw new Error("Failed to get current user.");
1448
+ const userTeams = teams.filter((team) => team.member_ids.includes(currentUser.id));
1449
+ if (!userTeams.length) return this.toResult(`Current user is not a member of any teams.`);
1450
+ return this.toResult(`Current user is a member of ${userTeams.length} teams:`, await this.entitiesWithRelatedEntities(userTeams, "teams"));
1451
+ }
1441
1452
  async listMembers() {
1442
1453
  const members = await this.client.listMembers();
1443
1454
  return this.toResult(`Found ${members.length} members:`, members);
@@ -1449,6 +1460,7 @@ var UserTools = class UserTools extends BaseTools {
1449
1460
  var WorkflowTools = class WorkflowTools extends BaseTools {
1450
1461
  static create(client$1, server$1) {
1451
1462
  const tools = new WorkflowTools(client$1);
1463
+ server$1.tool("get-default-workflow", "Get the default workflow for a specific team or the global default if no team is specified.", { teamPublicId: z.string().optional().describe("The public ID of the team to get the default workflow for.") }, async ({ teamPublicId }) => await tools.getDefaultWorkflow(teamPublicId));
1452
1464
  server$1.tool("get-workflow", "Get a Shortcut workflow by public ID", {
1453
1465
  workflowPublicId: z.number().positive().describe("The public ID of the workflow to get"),
1454
1466
  full: z.boolean().optional().default(false).describe("True to return all workflow fields from the API. False to return a slim version that excludes uncommon fields")
@@ -1456,6 +1468,21 @@ var WorkflowTools = class WorkflowTools extends BaseTools {
1456
1468
  server$1.tool("list-workflows", "List all Shortcut workflows", async () => await tools.listWorkflows());
1457
1469
  return tools;
1458
1470
  }
1471
+ async getDefaultWorkflow(teamPublicId) {
1472
+ if (teamPublicId) try {
1473
+ const teamDefaultWorkflowId = await this.client.getTeam(teamPublicId).then((t) => t?.default_workflow_id);
1474
+ if (teamDefaultWorkflowId) {
1475
+ const teamDefaultWorkflow = await this.client.getWorkflow(teamDefaultWorkflowId);
1476
+ if (teamDefaultWorkflow) return this.toResult(`Default workflow for team "${teamPublicId}" has id ${teamDefaultWorkflow.id}.`, await this.entityWithRelatedEntities(teamDefaultWorkflow, "workflow"));
1477
+ }
1478
+ } catch {}
1479
+ const currentUser = await this.client.getCurrentUser();
1480
+ if (!currentUser) throw new Error("Failed to retrieve current user.");
1481
+ const workspaceDefaultWorkflowId = currentUser.workspace2.default_workflow_id;
1482
+ const workspaceDefaultWorkflow = await this.client.getWorkflow(workspaceDefaultWorkflowId);
1483
+ if (workspaceDefaultWorkflow) return this.toResult(`${teamPublicId ? `No default workflow found for team with public ID "${teamPublicId}". The general default workflow has id ` : "Default workflow has id "}${workspaceDefaultWorkflow.id}.`, await this.entityWithRelatedEntities(workspaceDefaultWorkflow, "workflow"));
1484
+ return this.toResult("No default workflow found.");
1485
+ }
1459
1486
  async getWorkflow(workflowPublicId, full = false) {
1460
1487
  const workflow = await this.client.getWorkflow(workflowPublicId);
1461
1488
  if (!workflow) return this.toResult(`Workflow with public ID: ${workflowPublicId} not found.`);
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "modelcontextprotocol"
13
13
  ],
14
14
  "license": "MIT",
15
- "version": "0.10.3",
15
+ "version": "0.11.0",
16
16
  "type": "module",
17
17
  "main": "dist/index.js",
18
18
  "bin": {