@fabricorg/sdk-mcp 0.1.16 → 0.1.17

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/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("./src-DhrJfSKo.cjs");
2
+ const require_src = require("./src-D_BrE5ow.cjs");
3
3
  exports.FABRIC_BRAND = require_src.FABRIC_BRAND;
4
4
  exports.FABRIC_MARK_DATA_URI = require_src.FABRIC_MARK_DATA_URI;
5
5
  exports.FABRIC_MCP_APP_RESOURCES = require_src.FABRIC_MCP_APP_RESOURCES;
package/dist/index.d.cts CHANGED
@@ -113,6 +113,48 @@ export type FabricLike = {
113
113
  }>>;
114
114
  [slug: string]: unknown;
115
115
  };
116
+ auth?: {
117
+ whoami(): Promise<{
118
+ user?: {
119
+ id: string;
120
+ name?: string | null;
121
+ email?: string | null;
122
+ };
123
+ id?: string;
124
+ name?: string | null;
125
+ email?: string | null;
126
+ organizations?: Array<{
127
+ id: string;
128
+ name: string;
129
+ slug?: string;
130
+ role?: string;
131
+ }>;
132
+ [key: string]: unknown;
133
+ }>;
134
+ };
135
+ projects?: {
136
+ list(options?: Record<string, unknown>): Promise<Array<{
137
+ id: string;
138
+ name: string;
139
+ slug?: string;
140
+ status?: string;
141
+ description?: string | null;
142
+ [key: string]: unknown;
143
+ }>>;
144
+ get(id: string, options?: Record<string, unknown>): Promise<Record<string, unknown>>;
145
+ listFeatures(projectId: string, options?: Record<string, unknown>): Promise<Array<Record<string, unknown>>>;
146
+ getFeature?(projectId: string, featureId: string, options?: Record<string, unknown>): Promise<Record<string, unknown>>;
147
+ listDocuments?(projectId: string, options?: Record<string, unknown>): Promise<Array<Record<string, unknown>>>;
148
+ getDocument?(documentId: string, options?: Record<string, unknown>): Promise<Record<string, unknown>>;
149
+ };
150
+ frames?: {
151
+ list(options?: Record<string, unknown>): Promise<Array<Record<string, unknown>>>;
152
+ get(id: string, options?: Record<string, unknown>): Promise<Record<string, unknown>>;
153
+ };
154
+ workspaces?: {
155
+ list(options?: Record<string, unknown>): Promise<Array<Record<string, unknown>>>;
156
+ get(id: string, options?: Record<string, unknown>): Promise<Record<string, unknown>>;
157
+ };
116
158
  };
117
159
  export interface CreateFabricMcpServerOptions {
118
160
  /** A configured FabricClient (createFabric) instance. Required. */
package/dist/index.d.ts CHANGED
@@ -113,6 +113,48 @@ export type FabricLike = {
113
113
  }>>;
114
114
  [slug: string]: unknown;
115
115
  };
116
+ auth?: {
117
+ whoami(): Promise<{
118
+ user?: {
119
+ id: string;
120
+ name?: string | null;
121
+ email?: string | null;
122
+ };
123
+ id?: string;
124
+ name?: string | null;
125
+ email?: string | null;
126
+ organizations?: Array<{
127
+ id: string;
128
+ name: string;
129
+ slug?: string;
130
+ role?: string;
131
+ }>;
132
+ [key: string]: unknown;
133
+ }>;
134
+ };
135
+ projects?: {
136
+ list(options?: Record<string, unknown>): Promise<Array<{
137
+ id: string;
138
+ name: string;
139
+ slug?: string;
140
+ status?: string;
141
+ description?: string | null;
142
+ [key: string]: unknown;
143
+ }>>;
144
+ get(id: string, options?: Record<string, unknown>): Promise<Record<string, unknown>>;
145
+ listFeatures(projectId: string, options?: Record<string, unknown>): Promise<Array<Record<string, unknown>>>;
146
+ getFeature?(projectId: string, featureId: string, options?: Record<string, unknown>): Promise<Record<string, unknown>>;
147
+ listDocuments?(projectId: string, options?: Record<string, unknown>): Promise<Array<Record<string, unknown>>>;
148
+ getDocument?(documentId: string, options?: Record<string, unknown>): Promise<Record<string, unknown>>;
149
+ };
150
+ frames?: {
151
+ list(options?: Record<string, unknown>): Promise<Array<Record<string, unknown>>>;
152
+ get(id: string, options?: Record<string, unknown>): Promise<Record<string, unknown>>;
153
+ };
154
+ workspaces?: {
155
+ list(options?: Record<string, unknown>): Promise<Array<Record<string, unknown>>>;
156
+ get(id: string, options?: Record<string, unknown>): Promise<Record<string, unknown>>;
157
+ };
116
158
  };
117
159
  export interface CreateFabricMcpServerOptions {
118
160
  /** A configured FabricClient (createFabric) instance. Required. */
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as FABRIC_BRAND, i as withFabricApp, n as FABRIC_MCP_APP_RESOURCES, o as FABRIC_MARK_DATA_URI, r as readFabricMcpAppResource, s as buildFabricVisualizePayload, t as createFabricMcpServer } from "./src-DGnJhMpQ.js";
1
+ import { a as FABRIC_BRAND, i as withFabricApp, n as FABRIC_MCP_APP_RESOURCES, o as FABRIC_MARK_DATA_URI, r as readFabricMcpAppResource, s as buildFabricVisualizePayload, t as createFabricMcpServer } from "./src-c4qJ8sp9.js";
2
2
  export { FABRIC_BRAND, FABRIC_MARK_DATA_URI, FABRIC_MCP_APP_RESOURCES, buildFabricVisualizePayload, createFabricMcpServer, readFabricMcpAppResource, withFabricApp };
@@ -2613,22 +2613,83 @@ function buildFabricMcpViewScript(options) {
2613
2613
  function extractItems(v) {
2614
2614
  if (!v) return [];
2615
2615
  if (Array.isArray(v)) return v;
2616
- var keys = ["projects", "features", "workflows", "executions", "documents", "results", "chunks", "matches", "integrations", "servers", "frames", "items", "harnesses", "operations"];
2616
+ var keys = ["projects", "features", "tickets", "frames", "artifacts", "workspaces", "workflows", "executions", "documents", "contexts", "results", "chunks", "matches", "integrations", "servers", "items", "itemIds", "harnesses", "operations", "organizations"];
2617
2617
  for (var i = 0; i < keys.length; i++) {
2618
2618
  if (Array.isArray(v[keys[i]])) return v[keys[i]];
2619
2619
  }
2620
2620
  return [];
2621
2621
  }
2622
2622
 
2623
+ function isArtifactPayload(v) {
2624
+ if (!v || typeof v !== "object") return false;
2625
+ return Array.isArray(v.frames) || Array.isArray(v.artifacts) || Array.isArray(v.workspaces) || Boolean(v.frameId || v.blocks || v.surface === "artifact" || v.surface === "workspace");
2626
+ }
2627
+
2628
+ function isTicketPayload(v) {
2629
+ if (!v || typeof v !== "object") return false;
2630
+ return Array.isArray(v.features) || Array.isArray(v.tickets) || Array.isArray(v.itemIds) || Array.isArray(v.items) || Boolean(v.feature || v.identifier || v.draftingStage || v.acceptanceCriteria);
2631
+ }
2632
+
2623
2633
  function drawProjectCard(v) {
2634
+ if (isArtifactPayload(v)) {
2635
+ var artItems = extractItems(v);
2636
+ var singleArt = (!artItems.length && v && (v.title || v.frameId || v.id)) ? v : null;
2637
+ var list = artItems.length ? artItems : (singleArt ? [singleArt] : []);
2638
+ var artTitle = (v && v.title) || (list.length ? list.length + " Fabric Artifacts & Workspaces" : "Fabric Artifacts & Workspaces");
2639
+ var artSub = (v && v.description) || "Interactive frames, project artifacts, slideshows, and organization workspaces accessible with your Fabric credentials.";
2640
+ var artCard = K.card({
2641
+ mark: CFG.mark,
2642
+ eyebrow: "FABRIC ARTIFACTS & WORKSPACES",
2643
+ eyebrowMeta: "Authenticated Tenant Access",
2644
+ title: String(artTitle),
2645
+ sub: String(artSub),
2646
+ tools: [K.expandButton()],
2647
+ label: String(artTitle)
2648
+ });
2649
+
2650
+ var workspaceCount = list.filter(function (x) { return x && x.surface === "workspace"; }).length;
2651
+ var artifactCount = list.length - workspaceCount;
2652
+ add(artCard.body, K.grid([
2653
+ K.stat({ label: "Total Artifacts", value: String(list.length || "0"), meta: "Frames & pages" }),
2654
+ K.stat({ label: "Project Artifacts", value: String(artifactCount), meta: "Surface: artifact" }),
2655
+ K.stat({ label: "Org Workspaces", value: String(workspaceCount || (v && Array.isArray(v.workspaces) ? v.workspaces.length : 0)), meta: "Shared canvases" })
2656
+ ], 140));
2657
+
2658
+ if (list.length) {
2659
+ var artRows = list.slice(0, 10).map(function (it) {
2660
+ var kindStr = (it.surface ? it.surface : "artifact") + (it.kind ? " · " + it.kind : "");
2661
+ var detailStr = it.shareScope || (it.updatedAt ? String(it.updatedAt).slice(0, 10) : (it.description || "Accessible"));
2662
+ return [
2663
+ String(it.title || it.name || it.id || "Artifact"),
2664
+ String(kindStr),
2665
+ String(detailStr).slice(0, 56)
2666
+ ];
2667
+ });
2668
+ add(artCard.body, K.table(["Artifact / Workspace", "Surface & Kind", "Sharing / Updated"], artRows));
2669
+ }
2670
+
2671
+ var firstUrl = (singleArt && singleArt.url) || (list[0] && list[0].url) || null;
2672
+ var artActions = [];
2673
+ if (firstUrl) {
2674
+ artActions.push(K.button("Open Artifact in Portal", function () { K.openLink(String(firstUrl)); }, { variant: "primary", arrow: "↗" }));
2675
+ }
2676
+ artActions.push(
2677
+ K.button("Open in Fabric Desktop", function () { K.openLink("fabricagents://action/new-chat"); }, { variant: firstUrl ? "outline" : "primary", arrow: "↗" }),
2678
+ K.button("List All Artifacts", function () { callServerTool("fabric_list_artifacts", {}); }, { variant: "quiet", arrow: "→" })
2679
+ );
2680
+ add(artCard.body, K.actions(artActions));
2681
+ return artCard;
2682
+ }
2683
+
2624
2684
  var p = (v && (v.project || v)) || {};
2625
2685
  var items = extractItems(v);
2626
2686
  var projName = p.name || p.title || (items.length ? items.length + " Fabric Projects" : CFG.title);
2627
- var projSlug = p.slug || p.id || "fabric-workspace";
2687
+ var projSlug = p.slug || p.id || (items[0] && (items[0].slug || items[0].id)) || "fabric-workspace";
2688
+ var projId = p.id || (items[0] && items[0].id) || "";
2628
2689
  var desc = p.description || p.summary || CFG.subtitle;
2629
2690
  var card = K.card({
2630
2691
  mark: CFG.mark,
2631
- eyebrow: "FABRIC WORKSPACE",
2692
+ eyebrow: "FABRIC PROJECTS",
2632
2693
  eyebrowMeta: CFG.badge,
2633
2694
  title: String(projName),
2634
2695
  sub: String(desc),
@@ -2636,30 +2697,38 @@ function buildFabricMcpViewScript(options) {
2636
2697
  label: String(projName)
2637
2698
  });
2638
2699
 
2700
+ var totalFeatures = p.featureCount != null ? p.featureCount : (p._count && p._count.features != null ? p._count.features : items.reduce(function (acc, it) { return acc + (Number(it.featureCount || (it._count && it._count.features) || 0)); }, 0));
2701
+ var totalDocs = p.contextCount != null ? p.contextCount : (p.documentCount != null ? p.documentCount : items.reduce(function (acc, it) { return acc + (Number(it.documentCount || it.contextCount || 0)); }, 0));
2702
+
2639
2703
  var stats = K.grid([
2640
- K.stat({ label: "Projects / Items", value: String(items.length || (p.id ? 1 : "Ready")), meta: p.status || "Active tenant" }),
2641
- K.stat({ label: "Features", value: String(p.featureCount != null ? p.featureCount : "Synced"), meta: "Backlog & specs" }),
2642
- K.stat({ label: "Living Memory", value: String(p.contextCount != null ? p.contextCount : "Active"), meta: "RAG & instructions" })
2704
+ K.stat({ label: "Projects", value: String(items.length || (p.id ? 1 : "Ready")), meta: p.status || "Active tenant" }),
2705
+ K.stat({ label: "Tickets & Features", value: String(totalFeatures || "Synced"), meta: "Backlog & specs" }),
2706
+ K.stat({ label: "Docs & Artifacts", value: String(totalDocs || "Active"), meta: "Living memory & frames" })
2643
2707
  ], 140);
2644
2708
  add(card.body, stats);
2645
2709
 
2646
2710
  if (items.length) {
2647
- var rows = items.slice(0, 8).map(function (it) {
2711
+ var rows = items.slice(0, 10).map(function (it) {
2712
+ var statusBadge = String(it.status || it.state || it.role || "ACTIVE");
2713
+ var detail = it.description || it.repositoryUrl || (it.updatedAt ? "Updated " + String(it.updatedAt).slice(0, 10) : "—");
2648
2714
  return [
2649
- String(it.name || it.title || it.slug || it.id || "Item"),
2650
- String(it.status || it.state || it.kind || "active"),
2651
- String(it.updatedAt ? String(it.updatedAt).slice(0, 10) : (it.description || "—")).slice(0, 60)
2715
+ String(it.name || it.title || it.slug || it.id || "Project"),
2716
+ statusBadge,
2717
+ String(detail).slice(0, 60)
2652
2718
  ];
2653
2719
  });
2654
- add(card.body, K.table(["Name", "Status", "Detail"], rows));
2720
+ add(card.body, K.table(["Project", "Status", "Description / Repository"], rows));
2655
2721
  }
2656
2722
 
2657
2723
  var deepLink = "fabricagents://action/new-chat?workspace=" + encodeURIComponent(String(projSlug));
2658
2724
  add(card.body, K.actions([
2659
2725
  K.button("Open in Fabric Desktop", function () { K.openLink(deepLink); }, { variant: "primary", arrow: "↗" }),
2660
- K.button("Delegate to Remote Server", function () {
2661
- ask("Delegate the next coding task for project \"" + projName + "\" to the Remote Fabric Agents Server.");
2662
- }, { variant: "outline", arrow: "→" })
2726
+ K.button("My Assigned Tickets", function () {
2727
+ callServerTool("fabric_list_tickets", projId ? { projectId: String(projId), assignedToMe: true } : { assignedToMe: true });
2728
+ }, { variant: "outline", arrow: "→" }),
2729
+ K.button("View Artifacts", function () {
2730
+ callServerTool("fabric_list_artifacts", projId ? { projectId: String(projId) } : {});
2731
+ }, { variant: "quiet", arrow: "→" })
2663
2732
  ]));
2664
2733
  return card;
2665
2734
  }
@@ -2672,6 +2741,83 @@ function buildFabricMcpViewScript(options) {
2672
2741
  draw();
2673
2742
  }, "Execution target");
2674
2743
 
2744
+ if (isTicketPayload(v)) {
2745
+ var singleTicket = (!items.length && v && (v.id || v.identifier || v.title)) ? v : (v && v.feature ? v.feature : null);
2746
+ var ticketList = items.length ? items : (singleTicket ? [singleTicket] : []);
2747
+ var totalTickets = (v && v.total != null) ? v.total : ticketList.length;
2748
+ var assignedCount = ticketList.filter(function (t) { return t && (t.assigneeId || t.assignedToMe || t.draftingStage === "PUBLISHED"); }).length || ticketList.length;
2749
+ var totalTasks = ticketList.reduce(function (acc, t) { return acc + Number(t && (t.taskCount != null ? t.taskCount : (Array.isArray(t.tasks) ? t.tasks.length : 0))); }, 0);
2750
+ var doneTasks = ticketList.reduce(function (acc, t) { return acc + Number(t && (t.completedTaskCount != null ? t.completedTaskCount : (Array.isArray(t.tasks) ? t.tasks.filter(function (x) { return x.isCompleted || x.completed; }).length : 0))); }, 0);
2751
+
2752
+ var ticketHeading = singleTicket
2753
+ ? ((singleTicket.identifier ? singleTicket.identifier + " · " : "") + (singleTicket.title || "Ticket Detail"))
2754
+ : (v && v.assignedToMe ? (totalTickets + " Tickets Assigned to You") : (totalTickets + " Project Tickets & Features"));
2755
+
2756
+ var ticketCard = K.card({
2757
+ mark: CFG.mark,
2758
+ eyebrow: "FABRIC TICKETS & BACKLOG",
2759
+ eyebrowMeta: v && v.assignedToMe ? "Assigned to You" : "Features, Bugs & Tasks",
2760
+ title: String(ticketHeading),
2761
+ sub: singleTicket && singleTicket.description ? String(singleTicket.description).slice(0, 180) : "Live tickets, bugs, and stories from your Fabric projects. Select any item to delegate to Fabric Desktop or Remote Fabric Agents Server.",
2762
+ tools: [seg, K.expandButton()],
2763
+ label: String(ticketHeading)
2764
+ });
2765
+
2766
+ add(ticketCard.body, K.grid([
2767
+ K.stat({ label: "Tickets / Stories", value: String(totalTickets), meta: v && v.assignedToMe ? "Assigned to you" : "Active backlog" }),
2768
+ K.stat({ label: "Ready / Assigned", value: String(assignedCount), meta: "Spec & ownership" }),
2769
+ K.stat({ label: "Tasks Completed", value: totalTasks ? (doneTasks + " / " + totalTasks) : "Synced", meta: "Implementation tasks" })
2770
+ ], 140));
2771
+
2772
+ if (ticketList.length) {
2773
+ var ticketRows = ticketList.slice(0, 10).map(function (t, idx) {
2774
+ if (typeof t === "number" || typeof t === "string") {
2775
+ return ["#" + String(t), "ADO Assigned Work Item", "Assigned", "Snapshot ready"];
2776
+ }
2777
+ var keyStr = String(t.identifier || t.key || (t.id ? String(t.id).slice(0, 8) : ("#" + (idx + 1))));
2778
+ var kindPrefix = t.kind === "BUG" ? "[BUG] " : (t.kind === "FEATURE" ? "[FEAT] " : "");
2779
+ var statusStr = (t.status && t.status.name) ? t.status.name : String(t.status || t.state || t.draftingStage || "Open");
2780
+ var prioStr = String(t.priority || "P2").replace("_", " ");
2781
+ var taskInfo = t.taskCount != null ? (" · " + (t.completedTaskCount || 0) + "/" + t.taskCount + " tasks") : "";
2782
+ return [
2783
+ keyStr,
2784
+ kindPrefix + String(t.title || t.name || "Untitled Ticket").slice(0, 52),
2785
+ statusStr,
2786
+ prioStr + taskInfo
2787
+ ];
2788
+ });
2789
+ add(ticketCard.body, K.table(["Key", "Ticket / Feature", "Status", "Priority & Tasks"], ticketRows));
2790
+ } else {
2791
+ add(ticketCard.body, K.callout({
2792
+ tone: "ok",
2793
+ title: "No Open Tickets Matched",
2794
+ text: "You have no matching open tickets for this filter, or all assigned items are completed."
2795
+ }));
2796
+ }
2797
+
2798
+ var firstTicket = ticketList[0] && typeof ticketList[0] === "object" ? ticketList[0] : null;
2799
+ var ticketPrompt = firstTicket
2800
+ ? ("Implement ticket " + (firstTicket.identifier || firstTicket.id || "") + ": " + (firstTicket.title || ""))
2801
+ : "Implement my highest-priority assigned Fabric ticket.";
2802
+ var ticketDeepLink = "fabricagents://action/new-chat?harness=" + encodeURIComponent(S.harness) + "&input=" + encodeURIComponent(ticketPrompt) + "&send=true";
2803
+
2804
+ add(ticketCard.body, K.actions([
2805
+ K.button(
2806
+ S.mode === 1 ? "Start Ticket in Fabric Desktop" : "Delegate Ticket to Remote Server",
2807
+ function () {
2808
+ if (S.mode === 1) {
2809
+ K.openLink(ticketDeepLink);
2810
+ } else {
2811
+ ask("Delegate \"" + ticketPrompt + "\" to the Remote Fabric Agents Server using " + S.harness + ".");
2812
+ }
2813
+ },
2814
+ { variant: "primary", arrow: S.mode === 1 ? "↗" : "→" }
2815
+ ),
2816
+ K.button("Open in Fabric Desktop", function () { K.openLink(ticketDeepLink); }, { variant: "outline", arrow: "↗" })
2817
+ ]));
2818
+ return ticketCard;
2819
+ }
2820
+
2675
2821
  var titleText = (v && (v.projectName || v.title)) || (items.length ? items.length + " Workspace Items Ready" : CFG.title);
2676
2822
  var card = K.card({
2677
2823
  mark: CFG.mark,
@@ -2960,7 +3106,7 @@ function createFabricMcpServer(options) {
2960
3106
  const fabric = options.fabric;
2961
3107
  const server = new _modelcontextprotocol_sdk_server_mcp_js.McpServer({
2962
3108
  name: (_options$name = options.name) !== null && _options$name !== void 0 ? _options$name : "fabric",
2963
- version: (_options$version = options.version) !== null && _options$version !== void 0 ? _options$version : "0.1.16"
3109
+ version: (_options$version = options.version) !== null && _options$version !== void 0 ? _options$version : "0.1.17"
2964
3110
  });
2965
3111
  for (const appResource of FABRIC_MCP_APP_RESOURCES) server.registerResource(appResource.name, appResource.uri, {
2966
3112
  title: appResource.name,
@@ -3251,6 +3397,288 @@ function createFabricMcpServer(options) {
3251
3397
  return _ref6.apply(this, arguments);
3252
3398
  };
3253
3399
  }());
3400
+ server.registerTool("fabric_get_identity", {
3401
+ title: "Get Authenticated Fabric Identity & Organizations",
3402
+ description: "Return the currently signed-in Fabric user identity, active credential scopes, and organization memberships.",
3403
+ inputSchema: {},
3404
+ _meta: withFabricApp("ui://fabric/project-dashboard")
3405
+ }, _asyncToGenerator(function* () {
3406
+ var _fabric$auth;
3407
+ if (!((_fabric$auth = fabric.auth) === null || _fabric$auth === void 0 ? void 0 : _fabric$auth.whoami)) return {
3408
+ content: [{
3409
+ type: "text",
3410
+ text: "Identity lookup requires an authenticated FabricClient (`fabric login`)."
3411
+ }],
3412
+ isError: true
3413
+ };
3414
+ const whoami = yield fabric.auth.whoami();
3415
+ return {
3416
+ structuredContent: _objectSpread2({ title: "Authenticated Fabric Identity" }, whoami),
3417
+ content: [{
3418
+ type: "text",
3419
+ text: JSON.stringify(whoami, null, 2)
3420
+ }],
3421
+ _meta: withFabricApp("ui://fabric/project-dashboard")
3422
+ };
3423
+ }));
3424
+ server.registerTool("fabric_list_projects", {
3425
+ title: "List Fabric Projects",
3426
+ description: "List all Fabric projects accessible to the signed-in user in the active organization. Renders an interactive Fabric Projects MCP App card with 1-click Open in Fabric Desktop and ticket/artifact actions.",
3427
+ inputSchema: {
3428
+ status: zod.z.enum([
3429
+ "DRAFT",
3430
+ "ACTIVE",
3431
+ "COMPLETED",
3432
+ "ARCHIVED"
3433
+ ]).optional().describe("Optional project status filter."),
3434
+ search: zod.z.string().optional().describe("Optional search query by project name or description."),
3435
+ limit: zod.z.number().int().min(1).max(100).optional().describe("Maximum projects to return (default 50).")
3436
+ },
3437
+ _meta: withFabricApp("ui://fabric/project-dashboard")
3438
+ }, function() {
3439
+ var _ref7 = _asyncToGenerator(function* ({ status, search, limit }) {
3440
+ var _fabric$projects;
3441
+ if (!((_fabric$projects = fabric.projects) === null || _fabric$projects === void 0 ? void 0 : _fabric$projects.list)) return {
3442
+ content: [{
3443
+ type: "text",
3444
+ text: "Listing projects requires an authenticated FabricClient (`fabric login`)."
3445
+ }],
3446
+ isError: true
3447
+ };
3448
+ const projects = yield fabric.projects.list({
3449
+ status,
3450
+ search,
3451
+ limit: limit !== null && limit !== void 0 ? limit : 50
3452
+ });
3453
+ const payload = {
3454
+ title: "Your Fabric Projects",
3455
+ projects,
3456
+ total: projects.length
3457
+ };
3458
+ return {
3459
+ structuredContent: payload,
3460
+ content: [{
3461
+ type: "text",
3462
+ text: JSON.stringify(payload, null, 2)
3463
+ }],
3464
+ _meta: withFabricApp("ui://fabric/project-dashboard")
3465
+ };
3466
+ });
3467
+ return function(_x7) {
3468
+ return _ref7.apply(this, arguments);
3469
+ };
3470
+ }());
3471
+ server.registerTool("fabric_get_project", {
3472
+ title: "Get Fabric Project Details",
3473
+ description: "Get detailed metadata, feature/bug counts, and document summary for a specific Fabric project.",
3474
+ inputSchema: { projectId: zod.z.string().describe("Project ID from `fabric_list_projects`.") },
3475
+ _meta: withFabricApp("ui://fabric/project-dashboard")
3476
+ }, function() {
3477
+ var _ref8 = _asyncToGenerator(function* ({ projectId }) {
3478
+ var _fabric$projects2;
3479
+ if (!((_fabric$projects2 = fabric.projects) === null || _fabric$projects2 === void 0 ? void 0 : _fabric$projects2.get)) return {
3480
+ content: [{
3481
+ type: "text",
3482
+ text: "Project lookup requires an authenticated FabricClient (`fabric login`)."
3483
+ }],
3484
+ isError: true
3485
+ };
3486
+ const project = yield fabric.projects.get(projectId);
3487
+ return {
3488
+ structuredContent: project,
3489
+ content: [{
3490
+ type: "text",
3491
+ text: JSON.stringify(project, null, 2)
3492
+ }],
3493
+ _meta: withFabricApp("ui://fabric/project-dashboard")
3494
+ };
3495
+ });
3496
+ return function(_x8) {
3497
+ return _ref8.apply(this, arguments);
3498
+ };
3499
+ }());
3500
+ server.registerTool("fabric_list_artifacts", {
3501
+ title: "List Fabric Artifacts, Frames, Workspaces & Documents",
3502
+ description: "List all Fabric artifacts (interactive HTML frames, workspaces, and project documents/specs) accessible to the signed-in user. Renders an interactive Fabric Artifacts & Workspaces MCP App card.",
3503
+ inputSchema: {
3504
+ projectId: zod.z.string().optional().describe("Optional project ID to filter artifacts and include project documents (PRDs, specs, architecture docs)."),
3505
+ surface: zod.z.enum([
3506
+ "all",
3507
+ "artifact",
3508
+ "workspace",
3509
+ "document"
3510
+ ]).optional().describe("Filter by artifact surface: 'artifact' (frames), 'workspace', 'document', or 'all' (default)."),
3511
+ search: zod.z.string().optional().describe("Optional search query by title.")
3512
+ },
3513
+ _meta: withFabricApp("ui://fabric/project-dashboard")
3514
+ }, function() {
3515
+ var _ref10 = _asyncToGenerator(function* ({ projectId, surface, search }) {
3516
+ var _fabric$frames, _fabric$workspaces, _fabric$projects3;
3517
+ const effectiveSurface = surface !== null && surface !== void 0 ? surface : "all";
3518
+ const artifacts = [];
3519
+ if ((effectiveSurface === "all" || effectiveSurface === "artifact" || effectiveSurface === "workspace") && ((_fabric$frames = fabric.frames) === null || _fabric$frames === void 0 ? void 0 : _fabric$frames.list)) try {
3520
+ const frames = yield fabric.frames.list(search ? { search } : {});
3521
+ for (const f of frames) {
3522
+ if (projectId && f.projectId && f.projectId !== projectId) continue;
3523
+ const frameSurface = typeof f.surface === "string" ? f.surface : f.projectId ? "artifact" : "workspace";
3524
+ if (effectiveSurface !== "all" && frameSurface !== effectiveSurface) continue;
3525
+ artifacts.push(_objectSpread2(_objectSpread2({}, f), {}, { surface: frameSurface }));
3526
+ }
3527
+ } catch (_unused2) {}
3528
+ if ((effectiveSurface === "all" || effectiveSurface === "workspace") && ((_fabric$workspaces = fabric.workspaces) === null || _fabric$workspaces === void 0 ? void 0 : _fabric$workspaces.list)) try {
3529
+ const workspaces = yield fabric.workspaces.list();
3530
+ for (const w of workspaces) {
3531
+ var _w$kind;
3532
+ artifacts.push(_objectSpread2(_objectSpread2({}, w), {}, {
3533
+ surface: "workspace",
3534
+ kind: (_w$kind = w.kind) !== null && _w$kind !== void 0 ? _w$kind : "WORKSPACE"
3535
+ }));
3536
+ }
3537
+ } catch (_unused3) {}
3538
+ if (projectId && (effectiveSurface === "all" || effectiveSurface === "document") && ((_fabric$projects3 = fabric.projects) === null || _fabric$projects3 === void 0 ? void 0 : _fabric$projects3.listDocuments)) try {
3539
+ const docs = yield fabric.projects.listDocuments(projectId);
3540
+ for (const d of docs) {
3541
+ var _d$type;
3542
+ artifacts.push(_objectSpread2(_objectSpread2({}, d), {}, {
3543
+ projectId,
3544
+ surface: "artifact",
3545
+ kind: (_d$type = d.type) !== null && _d$type !== void 0 ? _d$type : "DOCUMENT"
3546
+ }));
3547
+ }
3548
+ } catch (_unused4) {}
3549
+ const filtered = search ? artifacts.filter((a) => {
3550
+ var _ref9, _a$title;
3551
+ return String((_ref9 = (_a$title = a.title) !== null && _a$title !== void 0 ? _a$title : a.name) !== null && _ref9 !== void 0 ? _ref9 : "").toLowerCase().includes(search.toLowerCase());
3552
+ }) : artifacts;
3553
+ const payload = {
3554
+ title: "Fabric Artifacts & Workspaces",
3555
+ frames: filtered,
3556
+ total: filtered.length
3557
+ };
3558
+ return {
3559
+ structuredContent: payload,
3560
+ content: [{
3561
+ type: "text",
3562
+ text: JSON.stringify(payload, null, 2)
3563
+ }],
3564
+ _meta: withFabricApp("ui://fabric/project-dashboard")
3565
+ };
3566
+ });
3567
+ return function(_x9) {
3568
+ return _ref10.apply(this, arguments);
3569
+ };
3570
+ }());
3571
+ server.registerTool("fabric_get_artifact", {
3572
+ title: "Get Fabric Artifact, Frame, or Document Content",
3573
+ description: "Fetch the full content and metadata of a Fabric artifact (interactive HTML frame, workspace, or project document) by ID.",
3574
+ inputSchema: {
3575
+ artifactId: zod.z.string().describe("ID of the frame, workspace, or document."),
3576
+ kind: zod.z.enum([
3577
+ "frame",
3578
+ "workspace",
3579
+ "document"
3580
+ ]).optional().describe("Artifact kind hint ('frame' default, 'workspace', or 'document').")
3581
+ },
3582
+ _meta: withFabricApp("ui://fabric/project-dashboard")
3583
+ }, function() {
3584
+ var _ref12 = _asyncToGenerator(function* ({ artifactId, kind }) {
3585
+ var _fabric$projects4, _fabric$workspaces2, _fabric$frames2, _ref11, _record$title, _record$surface;
3586
+ const effectiveKind = kind !== null && kind !== void 0 ? kind : "frame";
3587
+ let record = null;
3588
+ if (effectiveKind === "document" && ((_fabric$projects4 = fabric.projects) === null || _fabric$projects4 === void 0 ? void 0 : _fabric$projects4.getDocument)) record = yield fabric.projects.getDocument(artifactId);
3589
+ else if (effectiveKind === "workspace" && ((_fabric$workspaces2 = fabric.workspaces) === null || _fabric$workspaces2 === void 0 ? void 0 : _fabric$workspaces2.get)) record = yield fabric.workspaces.get(artifactId);
3590
+ else if ((_fabric$frames2 = fabric.frames) === null || _fabric$frames2 === void 0 ? void 0 : _fabric$frames2.get) record = yield fabric.frames.get(artifactId);
3591
+ if (!record) return {
3592
+ content: [{
3593
+ type: "text",
3594
+ text: `Artifact "${artifactId}" could not be loaded.`
3595
+ }],
3596
+ isError: true
3597
+ };
3598
+ return {
3599
+ structuredContent: {
3600
+ title: String((_ref11 = (_record$title = record.title) !== null && _record$title !== void 0 ? _record$title : record.name) !== null && _ref11 !== void 0 ? _ref11 : artifactId),
3601
+ frames: [_objectSpread2(_objectSpread2({}, record), {}, { surface: (_record$surface = record.surface) !== null && _record$surface !== void 0 ? _record$surface : effectiveKind === "workspace" ? "workspace" : "artifact" })],
3602
+ artifact: record
3603
+ },
3604
+ content: [{
3605
+ type: "text",
3606
+ text: JSON.stringify(record, null, 2)
3607
+ }],
3608
+ _meta: withFabricApp("ui://fabric/project-dashboard")
3609
+ };
3610
+ });
3611
+ return function(_x10) {
3612
+ return _ref12.apply(this, arguments);
3613
+ };
3614
+ }());
3615
+ server.registerTool("fabric_list_tickets", {
3616
+ title: "List Fabric Tickets, Features & Bugs (Including Assigned to Me)",
3617
+ description: "List tickets (features and bugs) for a project or across all accessible projects, with optional `assignedToMe: true` filtering for tickets assigned to the signed-in user. Renders an interactive Fabric Tickets & Backlog MCP App card with 1-click Start in Fabric Desktop and Remote Agent Delegation.",
3618
+ inputSchema: {
3619
+ projectId: zod.z.string().optional().describe("Optional project ID. When omitted, aggregates tickets across your active projects."),
3620
+ assignedToMe: zod.z.boolean().optional().describe("When true, filters to tickets assigned to the currently authenticated Fabric user."),
3621
+ assigneeId: zod.z.string().optional().describe("Optional explicit assignee user ID filter."),
3622
+ priority: zod.z.enum([
3623
+ "P0_CRITICAL",
3624
+ "P1_HIGH",
3625
+ "P2_MEDIUM",
3626
+ "P3_LOW"
3627
+ ]).optional().describe("Optional priority filter."),
3628
+ kind: zod.z.enum(["FEATURE", "BUG"]).optional().describe("Optional ticket kind filter ('FEATURE' or 'BUG').")
3629
+ },
3630
+ _meta: withFabricApp("ui://fabric/agent-delegation")
3631
+ }, function() {
3632
+ var _ref13 = _asyncToGenerator(function* ({ projectId, assignedToMe, assigneeId, priority, kind }) {
3633
+ var _fabric$projects5, _fabric$projects6, _fabric$auth2;
3634
+ if (!((_fabric$projects5 = fabric.projects) === null || _fabric$projects5 === void 0 ? void 0 : _fabric$projects5.listFeatures) || !((_fabric$projects6 = fabric.projects) === null || _fabric$projects6 === void 0 ? void 0 : _fabric$projects6.list)) return {
3635
+ content: [{
3636
+ type: "text",
3637
+ text: "Listing tickets requires an authenticated FabricClient (`fabric login`)."
3638
+ }],
3639
+ isError: true
3640
+ };
3641
+ let effectiveAssigneeId = assigneeId;
3642
+ if (assignedToMe && !effectiveAssigneeId && ((_fabric$auth2 = fabric.auth) === null || _fabric$auth2 === void 0 ? void 0 : _fabric$auth2.whoami)) try {
3643
+ var _me$user$id, _me$user;
3644
+ const me = yield fabric.auth.whoami();
3645
+ effectiveAssigneeId = (_me$user$id = (_me$user = me.user) === null || _me$user === void 0 ? void 0 : _me$user.id) !== null && _me$user$id !== void 0 ? _me$user$id : me.id;
3646
+ } catch (_unused5) {}
3647
+ const targetProjectIds = [];
3648
+ if (projectId) targetProjectIds.push(projectId);
3649
+ else {
3650
+ const projects = yield fabric.projects.list({ limit: 10 });
3651
+ for (const p of projects) if (p.id) targetProjectIds.push(p.id);
3652
+ }
3653
+ const allTickets = [];
3654
+ for (const pid of targetProjectIds) try {
3655
+ const items = yield fabric.projects.listFeatures(pid, _objectSpread2(_objectSpread2({}, priority ? { priority } : {}), effectiveAssigneeId ? { assigneeId: effectiveAssigneeId } : {}));
3656
+ for (const item of items) {
3657
+ var _item$projectId;
3658
+ if (kind && item.kind && item.kind !== kind) continue;
3659
+ if (effectiveAssigneeId && item.assigneeId && item.assigneeId !== effectiveAssigneeId) continue;
3660
+ allTickets.push(_objectSpread2(_objectSpread2({}, item), {}, { projectId: (_item$projectId = item.projectId) !== null && _item$projectId !== void 0 ? _item$projectId : pid }));
3661
+ }
3662
+ } catch (_unused6) {}
3663
+ const payload = {
3664
+ title: assignedToMe ? "Tickets Assigned to You" : "Fabric Tickets & Backlog",
3665
+ features: allTickets,
3666
+ total: allTickets.length,
3667
+ assignedToMe: Boolean(assignedToMe)
3668
+ };
3669
+ return {
3670
+ structuredContent: payload,
3671
+ content: [{
3672
+ type: "text",
3673
+ text: JSON.stringify(payload, null, 2)
3674
+ }],
3675
+ _meta: withFabricApp("ui://fabric/agent-delegation")
3676
+ };
3677
+ });
3678
+ return function(_x11) {
3679
+ return _ref13.apply(this, arguments);
3680
+ };
3681
+ }());
3254
3682
  return server;
3255
3683
  }
3256
3684
  //#endregion
@@ -3303,4 +3731,4 @@ Object.defineProperty(exports, "withFabricApp", {
3303
3731
  }
3304
3732
  });
3305
3733
 
3306
- //# sourceMappingURL=src-DhrJfSKo.cjs.map
3734
+ //# sourceMappingURL=src-D_BrE5ow.cjs.map