@openfairygui/mcp 0.2.0-alpha.3 → 0.3.0-alpha.1

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
@@ -10,9 +10,12 @@ It maps the backend P2 runtime surface into MCP tools:
10
10
 
11
11
  - `getCapabilities`
12
12
  - `openSession`
13
+ - `openProjectSession`
13
14
  - `getSession`
15
+ - `getProjectOutline`
14
16
  - `applyTransaction`
15
17
  - `saveSession`
18
+ - `materializeSession`
16
19
  - `closeSession`
17
20
  - `getEvents`
18
21
  - `getJob`
@@ -33,11 +36,13 @@ P1 also registers MCP-native ergonomics around the same backend surface:
33
36
  - read-only resources for identity snapshots:
34
37
  - `openfairygui://backend/capabilities`
35
38
  - `openfairygui://backend/session/{sessionId}`
39
+ - `openfairygui://backend/session/{sessionId}/outline`
36
40
  - `openfairygui://backend/cache/{sessionId}`
37
41
  - `openfairygui://backend/job/{sessionId}/{jobId}`
38
- - prompts for capability inspection, session open/inspect, revision-checked transactions, save, and runtime polling
42
+ - prompts for capability inspection, session open/inspect, project-outline inspection, revision-checked transactions, save, and runtime polling
39
43
 
40
44
  Resources return `application/json` text containing the unchanged backend result envelope. Parameterized polling remains tool-based: `getEvents` and `listJobs` are not exposed as resource URI query grammars.
45
+ The project outline is revision-bound and exposes package, resource, folder, display-node, controller-page, and transition identities for transaction planning. It intentionally omits source bytes and full property payloads.
41
46
 
42
47
  It does **not** redefine transaction selectors, transaction operations, path policy, session semantics, job semantics, cache semantics, or backend error envelopes. Those remain owned by `@openfairygui/backend`, `@openfairygui/functions`, and `@openfairygui/core`.
43
48
 
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_stdio = require("./stdio-Ckmxm29z.cjs");
2
+ const require_stdio = require("./stdio-BqoMZ4QC.cjs");
3
3
  exports.OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI = require_stdio.OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI;
4
4
  exports.OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS = require_stdio.OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS;
5
5
  exports.OPENFAIRYGUI_BACKEND_PROMPT_NAMES = require_stdio.OPENFAIRYGUI_BACKEND_PROMPT_NAMES;
package/dist/index.d.cts CHANGED
@@ -6,9 +6,9 @@ import { z } from "zod";
6
6
 
7
7
  //#region src/tool-definitions.d.ts
8
8
  declare const OPENFAIRYGUI_BACKEND_TOOL_PREFIX = "openfairygui_backend_";
9
- declare const OPENFAIRYGUI_BACKEND_TOOL_NAMES: readonly ["openfairygui_backend_get_capabilities", "openfairygui_backend_open_session", "openfairygui_backend_open_project_session", "openfairygui_backend_get_session", "openfairygui_backend_apply_transaction", "openfairygui_backend_save_session", "openfairygui_backend_close_session", "openfairygui_backend_get_events", "openfairygui_backend_get_job", "openfairygui_backend_list_jobs", "openfairygui_backend_cancel_job", "openfairygui_backend_get_cache_snapshot", "openfairygui_backend_refresh_cache"];
9
+ declare const OPENFAIRYGUI_BACKEND_TOOL_NAMES: readonly ["openfairygui_backend_get_capabilities", "openfairygui_backend_open_session", "openfairygui_backend_open_project_session", "openfairygui_backend_get_session", "openfairygui_backend_get_project_outline", "openfairygui_backend_apply_transaction", "openfairygui_backend_save_session", "openfairygui_backend_materialize_session", "openfairygui_backend_close_session", "openfairygui_backend_get_events", "openfairygui_backend_get_job", "openfairygui_backend_list_jobs", "openfairygui_backend_cancel_job", "openfairygui_backend_get_cache_snapshot", "openfairygui_backend_refresh_cache"];
10
10
  type OpenFairyGuiBackendToolName = typeof OPENFAIRYGUI_BACKEND_TOOL_NAMES[number];
11
- type BackendMethodName = 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'applyTransaction' | 'saveSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache';
11
+ type BackendMethodName = 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'getProjectOutline' | 'applyTransaction' | 'saveSession' | 'materializeSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache';
12
12
  interface OpenFairyGuiBackendToolDefinition {
13
13
  name: OpenFairyGuiBackendToolName;
14
14
  backendMethod: BackendMethodName;
@@ -116,6 +116,27 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
116
116
  readonly idempotentHint: true;
117
117
  readonly openWorldHint: false;
118
118
  };
119
+ }, {
120
+ readonly name: "openfairygui_backend_get_project_outline";
121
+ readonly backendMethod: "getProjectOutline";
122
+ readonly title: "Get Project Outline";
123
+ readonly description: "Return a revision-bound project/package/resource/component identity outline without source bytes or full property payloads.";
124
+ readonly inputSchema: z.ZodObject<{
125
+ sessionId: z.ZodString;
126
+ }, z.core.$strip>;
127
+ readonly outputSchema: z.ZodObject<{
128
+ backendResult: z.ZodObject<{
129
+ ok: z.ZodBoolean;
130
+ data: z.ZodOptional<z.ZodUnknown>;
131
+ error: z.ZodOptional<z.ZodUnknown>;
132
+ meta: z.ZodOptional<z.ZodUnknown>;
133
+ }, z.core.$loose>;
134
+ }, z.core.$strip>;
135
+ readonly annotations: {
136
+ readonly readOnlyHint: true;
137
+ readonly idempotentHint: true;
138
+ readonly openWorldHint: false;
139
+ };
119
140
  }, {
120
141
  readonly name: "openfairygui_backend_apply_transaction";
121
142
  readonly backendMethod: "applyTransaction";
@@ -149,6 +170,33 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
149
170
  sessionId: z.ZodString;
150
171
  expectedRevision: z.ZodOptional<z.ZodNumber>;
151
172
  targetPath: z.ZodOptional<z.ZodString>;
173
+ force: z.ZodOptional<z.ZodBoolean>;
174
+ mode: z.ZodOptional<z.ZodLiteral<"materializeCleanSession">>;
175
+ }, z.core.$strip>;
176
+ readonly outputSchema: z.ZodObject<{
177
+ backendResult: z.ZodObject<{
178
+ ok: z.ZodBoolean;
179
+ data: z.ZodOptional<z.ZodUnknown>;
180
+ error: z.ZodOptional<z.ZodUnknown>;
181
+ meta: z.ZodOptional<z.ZodUnknown>;
182
+ }, z.core.$loose>;
183
+ }, z.core.$strip>;
184
+ readonly annotations: {
185
+ readonly readOnlyHint: false;
186
+ readonly destructiveHint: true;
187
+ readonly idempotentHint: false;
188
+ readonly openWorldHint: false;
189
+ };
190
+ }, {
191
+ readonly name: "openfairygui_backend_materialize_session";
192
+ readonly backendMethod: "materializeSession";
193
+ readonly title: "Materialize Backend Session";
194
+ readonly description: "Force materialize the current backend session project through the configured project storage without requiring a dirty edit revision.";
195
+ readonly inputSchema: z.ZodObject<{
196
+ sessionId: z.ZodString;
197
+ expectedRevision: z.ZodOptional<z.ZodNumber>;
198
+ mode: z.ZodOptional<z.ZodLiteral<"fullProject">>;
199
+ reason: z.ZodOptional<z.ZodString>;
152
200
  }, z.core.$strip>;
153
201
  readonly outputSchema: z.ZodObject<{
154
202
  backendResult: z.ZodObject<{
@@ -168,7 +216,7 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
168
216
  readonly name: "openfairygui_backend_close_session";
169
217
  readonly backendMethod: "closeSession";
170
218
  readonly title: "Close Backend Session";
171
- readonly description: "Close a backend session and release its backend-local advisory lock.";
219
+ readonly description: "Close a backend session and release its backend-local session lock.";
172
220
  readonly inputSchema: z.ZodObject<{
173
221
  sessionId: z.ZodString;
174
222
  }, z.core.$strip>;
@@ -334,7 +382,7 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
334
382
  }];
335
383
  //#endregion
336
384
  //#region src/tool-handler.d.ts
337
- type OpenFairyGuiBackendRuntime = Pick<BackendRuntime, 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'applyTransaction' | 'saveSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache'>;
385
+ type OpenFairyGuiBackendRuntime = Pick<BackendRuntime, 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'getProjectOutline' | 'applyTransaction' | 'saveSession' | 'materializeSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache'>;
338
386
  declare function callOpenFairyGuiBackendTool(runtime: OpenFairyGuiBackendRuntime, name: OpenFairyGuiBackendToolName, input: Record<string, unknown>): Promise<CallToolResult>;
339
387
  //#endregion
340
388
  //#region src/server.d.ts
@@ -346,7 +394,7 @@ interface CreateOpenFairyGuiMcpServerOptions {
346
394
  declare function createOpenFairyGuiMcpServer(options?: CreateOpenFairyGuiMcpServerOptions): McpServer;
347
395
  //#endregion
348
396
  //#region src/prompt-definitions.d.ts
349
- declare const OPENFAIRYGUI_BACKEND_PROMPT_NAMES: readonly ["openfairygui_inspect_capabilities", "openfairygui_open_and_inspect_session", "openfairygui_plan_revision_checked_transaction", "openfairygui_save_session", "openfairygui_poll_runtime_state"];
397
+ declare const OPENFAIRYGUI_BACKEND_PROMPT_NAMES: readonly ["openfairygui_inspect_capabilities", "openfairygui_open_and_inspect_session", "openfairygui_inspect_project_outline", "openfairygui_plan_revision_checked_transaction", "openfairygui_save_session", "openfairygui_poll_runtime_state"];
350
398
  type OpenFairyGuiBackendPromptName = typeof OPENFAIRYGUI_BACKEND_PROMPT_NAMES[number];
351
399
  declare const OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS: readonly [{
352
400
  readonly name: "openfairygui_inspect_capabilities";
@@ -358,6 +406,11 @@ declare const OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS: readonly [{
358
406
  readonly title: "Open and Inspect an OpenFairyGUI Session";
359
407
  readonly description: "Guide a client through opening and reading a backend session.";
360
408
  readonly text: string;
409
+ }, {
410
+ readonly name: "openfairygui_inspect_project_outline";
411
+ readonly title: "Inspect an OpenFairyGUI Project Outline";
412
+ readonly description: "Guide a client through selector discovery before a revision-checked transaction.";
413
+ readonly text: string;
361
414
  }, {
362
415
  readonly name: "openfairygui_plan_revision_checked_transaction";
363
416
  readonly title: "Plan a Revision-Checked OpenFairyGUI Transaction";
@@ -377,6 +430,6 @@ declare const OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS: readonly [{
377
430
  //#endregion
378
431
  //#region src/resource-definitions.d.ts
379
432
  declare const OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI = "openfairygui://backend/capabilities";
380
- declare const OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES: readonly ["openfairygui://backend/session/{sessionId}", "openfairygui://backend/cache/{sessionId}", "openfairygui://backend/job/{sessionId}/{jobId}"];
433
+ declare const OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES: readonly ["openfairygui://backend/session/{sessionId}", "openfairygui://backend/session/{sessionId}/outline", "openfairygui://backend/cache/{sessionId}", "openfairygui://backend/job/{sessionId}/{jobId}"];
381
434
  //#endregion
382
435
  export { type BackendMethodName, type CreateOpenFairyGuiMcpServerOptions, OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI, OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS, OPENFAIRYGUI_BACKEND_PROMPT_NAMES, OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES, OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS, OPENFAIRYGUI_BACKEND_TOOL_NAMES, OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA, OPENFAIRYGUI_BACKEND_TOOL_PREFIX, type OpenFairyGuiBackendPromptName, type OpenFairyGuiBackendRuntime, type OpenFairyGuiBackendToolDefinition, type OpenFairyGuiBackendToolName, callOpenFairyGuiBackendTool, connectOpenFairyGuiMcpStdio, createOpenFairyGuiMcpServer };
package/dist/index.d.mts CHANGED
@@ -6,9 +6,9 @@ import { BackendRuntime } from "@openfairygui/backend";
6
6
 
7
7
  //#region src/tool-definitions.d.ts
8
8
  declare const OPENFAIRYGUI_BACKEND_TOOL_PREFIX = "openfairygui_backend_";
9
- declare const OPENFAIRYGUI_BACKEND_TOOL_NAMES: readonly ["openfairygui_backend_get_capabilities", "openfairygui_backend_open_session", "openfairygui_backend_open_project_session", "openfairygui_backend_get_session", "openfairygui_backend_apply_transaction", "openfairygui_backend_save_session", "openfairygui_backend_close_session", "openfairygui_backend_get_events", "openfairygui_backend_get_job", "openfairygui_backend_list_jobs", "openfairygui_backend_cancel_job", "openfairygui_backend_get_cache_snapshot", "openfairygui_backend_refresh_cache"];
9
+ declare const OPENFAIRYGUI_BACKEND_TOOL_NAMES: readonly ["openfairygui_backend_get_capabilities", "openfairygui_backend_open_session", "openfairygui_backend_open_project_session", "openfairygui_backend_get_session", "openfairygui_backend_get_project_outline", "openfairygui_backend_apply_transaction", "openfairygui_backend_save_session", "openfairygui_backend_materialize_session", "openfairygui_backend_close_session", "openfairygui_backend_get_events", "openfairygui_backend_get_job", "openfairygui_backend_list_jobs", "openfairygui_backend_cancel_job", "openfairygui_backend_get_cache_snapshot", "openfairygui_backend_refresh_cache"];
10
10
  type OpenFairyGuiBackendToolName = typeof OPENFAIRYGUI_BACKEND_TOOL_NAMES[number];
11
- type BackendMethodName = 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'applyTransaction' | 'saveSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache';
11
+ type BackendMethodName = 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'getProjectOutline' | 'applyTransaction' | 'saveSession' | 'materializeSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache';
12
12
  interface OpenFairyGuiBackendToolDefinition {
13
13
  name: OpenFairyGuiBackendToolName;
14
14
  backendMethod: BackendMethodName;
@@ -116,6 +116,27 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
116
116
  readonly idempotentHint: true;
117
117
  readonly openWorldHint: false;
118
118
  };
119
+ }, {
120
+ readonly name: "openfairygui_backend_get_project_outline";
121
+ readonly backendMethod: "getProjectOutline";
122
+ readonly title: "Get Project Outline";
123
+ readonly description: "Return a revision-bound project/package/resource/component identity outline without source bytes or full property payloads.";
124
+ readonly inputSchema: z.ZodObject<{
125
+ sessionId: z.ZodString;
126
+ }, z.core.$strip>;
127
+ readonly outputSchema: z.ZodObject<{
128
+ backendResult: z.ZodObject<{
129
+ ok: z.ZodBoolean;
130
+ data: z.ZodOptional<z.ZodUnknown>;
131
+ error: z.ZodOptional<z.ZodUnknown>;
132
+ meta: z.ZodOptional<z.ZodUnknown>;
133
+ }, z.core.$loose>;
134
+ }, z.core.$strip>;
135
+ readonly annotations: {
136
+ readonly readOnlyHint: true;
137
+ readonly idempotentHint: true;
138
+ readonly openWorldHint: false;
139
+ };
119
140
  }, {
120
141
  readonly name: "openfairygui_backend_apply_transaction";
121
142
  readonly backendMethod: "applyTransaction";
@@ -149,6 +170,33 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
149
170
  sessionId: z.ZodString;
150
171
  expectedRevision: z.ZodOptional<z.ZodNumber>;
151
172
  targetPath: z.ZodOptional<z.ZodString>;
173
+ force: z.ZodOptional<z.ZodBoolean>;
174
+ mode: z.ZodOptional<z.ZodLiteral<"materializeCleanSession">>;
175
+ }, z.core.$strip>;
176
+ readonly outputSchema: z.ZodObject<{
177
+ backendResult: z.ZodObject<{
178
+ ok: z.ZodBoolean;
179
+ data: z.ZodOptional<z.ZodUnknown>;
180
+ error: z.ZodOptional<z.ZodUnknown>;
181
+ meta: z.ZodOptional<z.ZodUnknown>;
182
+ }, z.core.$loose>;
183
+ }, z.core.$strip>;
184
+ readonly annotations: {
185
+ readonly readOnlyHint: false;
186
+ readonly destructiveHint: true;
187
+ readonly idempotentHint: false;
188
+ readonly openWorldHint: false;
189
+ };
190
+ }, {
191
+ readonly name: "openfairygui_backend_materialize_session";
192
+ readonly backendMethod: "materializeSession";
193
+ readonly title: "Materialize Backend Session";
194
+ readonly description: "Force materialize the current backend session project through the configured project storage without requiring a dirty edit revision.";
195
+ readonly inputSchema: z.ZodObject<{
196
+ sessionId: z.ZodString;
197
+ expectedRevision: z.ZodOptional<z.ZodNumber>;
198
+ mode: z.ZodOptional<z.ZodLiteral<"fullProject">>;
199
+ reason: z.ZodOptional<z.ZodString>;
152
200
  }, z.core.$strip>;
153
201
  readonly outputSchema: z.ZodObject<{
154
202
  backendResult: z.ZodObject<{
@@ -168,7 +216,7 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
168
216
  readonly name: "openfairygui_backend_close_session";
169
217
  readonly backendMethod: "closeSession";
170
218
  readonly title: "Close Backend Session";
171
- readonly description: "Close a backend session and release its backend-local advisory lock.";
219
+ readonly description: "Close a backend session and release its backend-local session lock.";
172
220
  readonly inputSchema: z.ZodObject<{
173
221
  sessionId: z.ZodString;
174
222
  }, z.core.$strip>;
@@ -334,7 +382,7 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
334
382
  }];
335
383
  //#endregion
336
384
  //#region src/tool-handler.d.ts
337
- type OpenFairyGuiBackendRuntime = Pick<BackendRuntime, 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'applyTransaction' | 'saveSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache'>;
385
+ type OpenFairyGuiBackendRuntime = Pick<BackendRuntime, 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'getProjectOutline' | 'applyTransaction' | 'saveSession' | 'materializeSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache'>;
338
386
  declare function callOpenFairyGuiBackendTool(runtime: OpenFairyGuiBackendRuntime, name: OpenFairyGuiBackendToolName, input: Record<string, unknown>): Promise<CallToolResult>;
339
387
  //#endregion
340
388
  //#region src/server.d.ts
@@ -346,7 +394,7 @@ interface CreateOpenFairyGuiMcpServerOptions {
346
394
  declare function createOpenFairyGuiMcpServer(options?: CreateOpenFairyGuiMcpServerOptions): McpServer;
347
395
  //#endregion
348
396
  //#region src/prompt-definitions.d.ts
349
- declare const OPENFAIRYGUI_BACKEND_PROMPT_NAMES: readonly ["openfairygui_inspect_capabilities", "openfairygui_open_and_inspect_session", "openfairygui_plan_revision_checked_transaction", "openfairygui_save_session", "openfairygui_poll_runtime_state"];
397
+ declare const OPENFAIRYGUI_BACKEND_PROMPT_NAMES: readonly ["openfairygui_inspect_capabilities", "openfairygui_open_and_inspect_session", "openfairygui_inspect_project_outline", "openfairygui_plan_revision_checked_transaction", "openfairygui_save_session", "openfairygui_poll_runtime_state"];
350
398
  type OpenFairyGuiBackendPromptName = typeof OPENFAIRYGUI_BACKEND_PROMPT_NAMES[number];
351
399
  declare const OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS: readonly [{
352
400
  readonly name: "openfairygui_inspect_capabilities";
@@ -358,6 +406,11 @@ declare const OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS: readonly [{
358
406
  readonly title: "Open and Inspect an OpenFairyGUI Session";
359
407
  readonly description: "Guide a client through opening and reading a backend session.";
360
408
  readonly text: string;
409
+ }, {
410
+ readonly name: "openfairygui_inspect_project_outline";
411
+ readonly title: "Inspect an OpenFairyGUI Project Outline";
412
+ readonly description: "Guide a client through selector discovery before a revision-checked transaction.";
413
+ readonly text: string;
361
414
  }, {
362
415
  readonly name: "openfairygui_plan_revision_checked_transaction";
363
416
  readonly title: "Plan a Revision-Checked OpenFairyGUI Transaction";
@@ -377,6 +430,6 @@ declare const OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS: readonly [{
377
430
  //#endregion
378
431
  //#region src/resource-definitions.d.ts
379
432
  declare const OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI = "openfairygui://backend/capabilities";
380
- declare const OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES: readonly ["openfairygui://backend/session/{sessionId}", "openfairygui://backend/cache/{sessionId}", "openfairygui://backend/job/{sessionId}/{jobId}"];
433
+ declare const OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES: readonly ["openfairygui://backend/session/{sessionId}", "openfairygui://backend/session/{sessionId}/outline", "openfairygui://backend/cache/{sessionId}", "openfairygui://backend/job/{sessionId}/{jobId}"];
381
434
  //#endregion
382
435
  export { type BackendMethodName, type CreateOpenFairyGuiMcpServerOptions, OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI, OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS, OPENFAIRYGUI_BACKEND_PROMPT_NAMES, OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES, OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS, OPENFAIRYGUI_BACKEND_TOOL_NAMES, OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA, OPENFAIRYGUI_BACKEND_TOOL_PREFIX, type OpenFairyGuiBackendPromptName, type OpenFairyGuiBackendRuntime, type OpenFairyGuiBackendToolDefinition, type OpenFairyGuiBackendToolName, callOpenFairyGuiBackendTool, connectOpenFairyGuiMcpStdio, createOpenFairyGuiMcpServer };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA, c as OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI, d as OPENFAIRYGUI_BACKEND_PROMPT_NAMES, i as OPENFAIRYGUI_BACKEND_TOOL_NAMES, l as OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES, n as createOpenFairyGuiMcpServer, o as OPENFAIRYGUI_BACKEND_TOOL_PREFIX, r as OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS, s as callOpenFairyGuiBackendTool, t as connectOpenFairyGuiMcpStdio, u as OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS } from "./stdio-DT1cUPJ3.mjs";
1
+ import { a as OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA, c as OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI, d as OPENFAIRYGUI_BACKEND_PROMPT_NAMES, i as OPENFAIRYGUI_BACKEND_TOOL_NAMES, l as OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES, n as createOpenFairyGuiMcpServer, o as OPENFAIRYGUI_BACKEND_TOOL_PREFIX, r as OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS, s as callOpenFairyGuiBackendTool, t as connectOpenFairyGuiMcpStdio, u as OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS } from "./stdio-C69hamhI.mjs";
2
2
  export { OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI, OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS, OPENFAIRYGUI_BACKEND_PROMPT_NAMES, OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES, OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS, OPENFAIRYGUI_BACKEND_TOOL_NAMES, OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA, OPENFAIRYGUI_BACKEND_TOOL_PREFIX, callOpenFairyGuiBackendTool, connectOpenFairyGuiMcpStdio, createOpenFairyGuiMcpServer };
@@ -1,5 +1,6 @@
1
1
  let _modelcontextprotocol_sdk_server_mcp_js = require("@modelcontextprotocol/sdk/server/mcp.js");
2
2
  let _openfairygui_backend_node = require("@openfairygui/backend/node");
3
+ let node_module = require("node:module");
3
4
  let zod = require("zod");
4
5
  let _modelcontextprotocol_sdk_server_stdio_js = require("@modelcontextprotocol/sdk/server/stdio.js");
5
6
  let node_url = require("node:url");
@@ -7,6 +8,7 @@ let node_url = require("node:url");
7
8
  const OPENFAIRYGUI_BACKEND_PROMPT_NAMES = [
8
9
  "openfairygui_inspect_capabilities",
9
10
  "openfairygui_open_and_inspect_session",
11
+ "openfairygui_inspect_project_outline",
10
12
  "openfairygui_plan_revision_checked_transaction",
11
13
  "openfairygui_save_session",
12
14
  "openfairygui_poll_runtime_state"
@@ -32,6 +34,17 @@ const OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS = [
32
34
  "Close the session with openfairygui_backend_close_session when finished."
33
35
  ].join("\n")
34
36
  },
37
+ {
38
+ name: "openfairygui_inspect_project_outline",
39
+ title: "Inspect an OpenFairyGUI Project Outline",
40
+ description: "Guide a client through selector discovery before a revision-checked transaction.",
41
+ text: [
42
+ "Use openfairygui_backend_get_project_outline with the active sessionId before planning mutations.",
43
+ "Use package, resource, folder, display node, controller page, and transition identities from the returned outline.",
44
+ "Pass the returned revision as expectedRevision when calling openfairygui_backend_apply_transaction.",
45
+ "Read a new outline if the backend reports a stale revision; the outline intentionally excludes source bytes and full property payloads."
46
+ ].join("\n")
47
+ },
35
48
  {
36
49
  name: "openfairygui_plan_revision_checked_transaction",
37
50
  title: "Plan a Revision-Checked OpenFairyGUI Transaction",
@@ -96,6 +109,7 @@ function jsonResource(uri, backendResult) {
96
109
  const OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI = "openfairygui://backend/capabilities";
97
110
  const OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES = [
98
111
  "openfairygui://backend/session/{sessionId}",
112
+ "openfairygui://backend/session/{sessionId}/outline",
99
113
  "openfairygui://backend/cache/{sessionId}",
100
114
  "openfairygui://backend/job/{sessionId}/{jobId}"
101
115
  ];
@@ -110,6 +124,11 @@ function registerOpenFairyGuiBackendResources(server, runtime) {
110
124
  description: "Read a backend session envelope by backend-local session id.",
111
125
  mimeType: JSON_MIME_TYPE
112
126
  }, (uri, variables) => jsonResource(uri, runtime.getSession({ sessionId: firstVariable(variables.sessionId) })));
127
+ server.registerResource("openfairygui_backend_project_outline", new _modelcontextprotocol_sdk_server_mcp_js.ResourceTemplate("openfairygui://backend/session/{sessionId}/outline", { list: void 0 }), {
128
+ title: "OpenFairyGUI Project Outline",
129
+ description: "Read a revision-bound project identity outline without source bytes or full property payloads.",
130
+ mimeType: JSON_MIME_TYPE
131
+ }, (uri, variables) => jsonResource(uri, runtime.getProjectOutline({ sessionId: firstVariable(variables.sessionId) })));
113
132
  server.registerResource("openfairygui_backend_cache", new _modelcontextprotocol_sdk_server_mcp_js.ResourceTemplate("openfairygui://backend/cache/{sessionId}", { list: void 0 }), {
114
133
  title: "OpenFairyGUI Backend Cache Snapshot",
115
134
  description: "Read a derived backend cache envelope by backend-local session id.",
@@ -159,6 +178,9 @@ async function callOpenFairyGuiBackendTool(runtime, name, input) {
159
178
  case "openfairygui_backend_get_session":
160
179
  result = runtime.getSession({ sessionId: String(input.sessionId) });
161
180
  break;
181
+ case "openfairygui_backend_get_project_outline":
182
+ result = runtime.getProjectOutline({ sessionId: String(input.sessionId) });
183
+ break;
162
184
  case "openfairygui_backend_apply_transaction":
163
185
  result = await runtime.applyTransaction({
164
186
  sessionId: String(input.sessionId),
@@ -170,7 +192,17 @@ async function callOpenFairyGuiBackendTool(runtime, name, input) {
170
192
  result = await runtime.saveSession({
171
193
  sessionId: String(input.sessionId),
172
194
  expectedRevision: input.expectedRevision === void 0 ? void 0 : Number(input.expectedRevision),
173
- targetPath: input.targetPath === void 0 ? void 0 : String(input.targetPath)
195
+ targetPath: input.targetPath === void 0 ? void 0 : String(input.targetPath),
196
+ force: input.force === void 0 ? void 0 : Boolean(input.force),
197
+ mode: input.mode
198
+ });
199
+ break;
200
+ case "openfairygui_backend_materialize_session":
201
+ result = await runtime.materializeSession({
202
+ sessionId: String(input.sessionId),
203
+ expectedRevision: input.expectedRevision === void 0 ? void 0 : Number(input.expectedRevision),
204
+ mode: input.mode,
205
+ reason: input.reason === void 0 ? void 0 : String(input.reason)
174
206
  });
175
207
  break;
176
208
  case "openfairygui_backend_close_session":
@@ -224,8 +256,10 @@ const OPENFAIRYGUI_BACKEND_TOOL_NAMES = [
224
256
  "openfairygui_backend_open_session",
225
257
  "openfairygui_backend_open_project_session",
226
258
  "openfairygui_backend_get_session",
259
+ "openfairygui_backend_get_project_outline",
227
260
  "openfairygui_backend_apply_transaction",
228
261
  "openfairygui_backend_save_session",
262
+ "openfairygui_backend_materialize_session",
229
263
  "openfairygui_backend_close_session",
230
264
  "openfairygui_backend_get_events",
231
265
  "openfairygui_backend_get_job",
@@ -302,6 +336,19 @@ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
302
336
  openWorldHint: false
303
337
  }
304
338
  },
339
+ {
340
+ name: "openfairygui_backend_get_project_outline",
341
+ backendMethod: "getProjectOutline",
342
+ title: "Get Project Outline",
343
+ description: "Return a revision-bound project/package/resource/component identity outline without source bytes or full property payloads.",
344
+ inputSchema: zod.z.object({ sessionId }),
345
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
346
+ annotations: {
347
+ readOnlyHint: true,
348
+ idempotentHint: true,
349
+ openWorldHint: false
350
+ }
351
+ },
305
352
  {
306
353
  name: "openfairygui_backend_apply_transaction",
307
354
  backendMethod: "applyTransaction",
@@ -328,7 +375,28 @@ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
328
375
  inputSchema: zod.z.object({
329
376
  sessionId,
330
377
  expectedRevision: expectedRevision.optional(),
331
- targetPath: zod.z.string().min(1).optional()
378
+ targetPath: zod.z.string().min(1).optional(),
379
+ force: zod.z.boolean().optional(),
380
+ mode: zod.z.literal("materializeCleanSession").optional()
381
+ }),
382
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
383
+ annotations: {
384
+ readOnlyHint: false,
385
+ destructiveHint: true,
386
+ idempotentHint: false,
387
+ openWorldHint: false
388
+ }
389
+ },
390
+ {
391
+ name: "openfairygui_backend_materialize_session",
392
+ backendMethod: "materializeSession",
393
+ title: "Materialize Backend Session",
394
+ description: "Force materialize the current backend session project through the configured project storage without requiring a dirty edit revision.",
395
+ inputSchema: zod.z.object({
396
+ sessionId,
397
+ expectedRevision: expectedRevision.optional(),
398
+ mode: zod.z.literal("fullProject").optional(),
399
+ reason: zod.z.string().min(1).optional()
332
400
  }),
333
401
  outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
334
402
  annotations: {
@@ -342,7 +410,7 @@ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
342
410
  name: "openfairygui_backend_close_session",
343
411
  backendMethod: "closeSession",
344
412
  title: "Close Backend Session",
345
- description: "Close a backend session and release its backend-local advisory lock.",
413
+ description: "Close a backend session and release its backend-local session lock.",
346
414
  inputSchema: zod.z.object({ sessionId }),
347
415
  outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
348
416
  annotations: {
@@ -462,7 +530,21 @@ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
462
530
  ];
463
531
  //#endregion
464
532
  //#region src/server.ts
465
- const PACKAGE_VERSION = process.env.npm_package_version ?? "0.2.0-alpha.0";
533
+ const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
534
+ function getInjectedPackageVersion() {
535
+ const version = "0.3.0-alpha.1";
536
+ return typeof version === "string" && true ? version : null;
537
+ }
538
+ function readPackageVersion() {
539
+ const injectedVersion = getInjectedPackageVersion();
540
+ if (injectedVersion) return injectedVersion;
541
+ try {
542
+ const pkg = require$1("../package.json");
543
+ if (typeof pkg.version === "string" && pkg.version.length > 0) return pkg.version;
544
+ } catch {}
545
+ return "0.0.0-dev";
546
+ }
547
+ const PACKAGE_VERSION = readPackageVersion();
466
548
  function createOpenFairyGuiMcpServer(options = {}) {
467
549
  const runtime = options.runtime ?? (0, _openfairygui_backend_node.createNodeBackendRuntime)();
468
550
  const server = new _modelcontextprotocol_sdk_server_mcp_js.McpServer({
@@ -1,3 +1,4 @@
1
+ import { createRequire } from "node:module";
1
2
  import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
2
3
  import { createNodeBackendRuntime } from "@openfairygui/backend/node";
3
4
  import { z } from "zod";
@@ -7,6 +8,7 @@ import { pathToFileURL } from "node:url";
7
8
  const OPENFAIRYGUI_BACKEND_PROMPT_NAMES = [
8
9
  "openfairygui_inspect_capabilities",
9
10
  "openfairygui_open_and_inspect_session",
11
+ "openfairygui_inspect_project_outline",
10
12
  "openfairygui_plan_revision_checked_transaction",
11
13
  "openfairygui_save_session",
12
14
  "openfairygui_poll_runtime_state"
@@ -32,6 +34,17 @@ const OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS = [
32
34
  "Close the session with openfairygui_backend_close_session when finished."
33
35
  ].join("\n")
34
36
  },
37
+ {
38
+ name: "openfairygui_inspect_project_outline",
39
+ title: "Inspect an OpenFairyGUI Project Outline",
40
+ description: "Guide a client through selector discovery before a revision-checked transaction.",
41
+ text: [
42
+ "Use openfairygui_backend_get_project_outline with the active sessionId before planning mutations.",
43
+ "Use package, resource, folder, display node, controller page, and transition identities from the returned outline.",
44
+ "Pass the returned revision as expectedRevision when calling openfairygui_backend_apply_transaction.",
45
+ "Read a new outline if the backend reports a stale revision; the outline intentionally excludes source bytes and full property payloads."
46
+ ].join("\n")
47
+ },
35
48
  {
36
49
  name: "openfairygui_plan_revision_checked_transaction",
37
50
  title: "Plan a Revision-Checked OpenFairyGUI Transaction",
@@ -96,6 +109,7 @@ function jsonResource(uri, backendResult) {
96
109
  const OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI = "openfairygui://backend/capabilities";
97
110
  const OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES = [
98
111
  "openfairygui://backend/session/{sessionId}",
112
+ "openfairygui://backend/session/{sessionId}/outline",
99
113
  "openfairygui://backend/cache/{sessionId}",
100
114
  "openfairygui://backend/job/{sessionId}/{jobId}"
101
115
  ];
@@ -110,6 +124,11 @@ function registerOpenFairyGuiBackendResources(server, runtime) {
110
124
  description: "Read a backend session envelope by backend-local session id.",
111
125
  mimeType: JSON_MIME_TYPE
112
126
  }, (uri, variables) => jsonResource(uri, runtime.getSession({ sessionId: firstVariable(variables.sessionId) })));
127
+ server.registerResource("openfairygui_backend_project_outline", new ResourceTemplate("openfairygui://backend/session/{sessionId}/outline", { list: void 0 }), {
128
+ title: "OpenFairyGUI Project Outline",
129
+ description: "Read a revision-bound project identity outline without source bytes or full property payloads.",
130
+ mimeType: JSON_MIME_TYPE
131
+ }, (uri, variables) => jsonResource(uri, runtime.getProjectOutline({ sessionId: firstVariable(variables.sessionId) })));
113
132
  server.registerResource("openfairygui_backend_cache", new ResourceTemplate("openfairygui://backend/cache/{sessionId}", { list: void 0 }), {
114
133
  title: "OpenFairyGUI Backend Cache Snapshot",
115
134
  description: "Read a derived backend cache envelope by backend-local session id.",
@@ -159,6 +178,9 @@ async function callOpenFairyGuiBackendTool(runtime, name, input) {
159
178
  case "openfairygui_backend_get_session":
160
179
  result = runtime.getSession({ sessionId: String(input.sessionId) });
161
180
  break;
181
+ case "openfairygui_backend_get_project_outline":
182
+ result = runtime.getProjectOutline({ sessionId: String(input.sessionId) });
183
+ break;
162
184
  case "openfairygui_backend_apply_transaction":
163
185
  result = await runtime.applyTransaction({
164
186
  sessionId: String(input.sessionId),
@@ -170,7 +192,17 @@ async function callOpenFairyGuiBackendTool(runtime, name, input) {
170
192
  result = await runtime.saveSession({
171
193
  sessionId: String(input.sessionId),
172
194
  expectedRevision: input.expectedRevision === void 0 ? void 0 : Number(input.expectedRevision),
173
- targetPath: input.targetPath === void 0 ? void 0 : String(input.targetPath)
195
+ targetPath: input.targetPath === void 0 ? void 0 : String(input.targetPath),
196
+ force: input.force === void 0 ? void 0 : Boolean(input.force),
197
+ mode: input.mode
198
+ });
199
+ break;
200
+ case "openfairygui_backend_materialize_session":
201
+ result = await runtime.materializeSession({
202
+ sessionId: String(input.sessionId),
203
+ expectedRevision: input.expectedRevision === void 0 ? void 0 : Number(input.expectedRevision),
204
+ mode: input.mode,
205
+ reason: input.reason === void 0 ? void 0 : String(input.reason)
174
206
  });
175
207
  break;
176
208
  case "openfairygui_backend_close_session":
@@ -224,8 +256,10 @@ const OPENFAIRYGUI_BACKEND_TOOL_NAMES = [
224
256
  "openfairygui_backend_open_session",
225
257
  "openfairygui_backend_open_project_session",
226
258
  "openfairygui_backend_get_session",
259
+ "openfairygui_backend_get_project_outline",
227
260
  "openfairygui_backend_apply_transaction",
228
261
  "openfairygui_backend_save_session",
262
+ "openfairygui_backend_materialize_session",
229
263
  "openfairygui_backend_close_session",
230
264
  "openfairygui_backend_get_events",
231
265
  "openfairygui_backend_get_job",
@@ -302,6 +336,19 @@ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
302
336
  openWorldHint: false
303
337
  }
304
338
  },
339
+ {
340
+ name: "openfairygui_backend_get_project_outline",
341
+ backendMethod: "getProjectOutline",
342
+ title: "Get Project Outline",
343
+ description: "Return a revision-bound project/package/resource/component identity outline without source bytes or full property payloads.",
344
+ inputSchema: z.object({ sessionId }),
345
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
346
+ annotations: {
347
+ readOnlyHint: true,
348
+ idempotentHint: true,
349
+ openWorldHint: false
350
+ }
351
+ },
305
352
  {
306
353
  name: "openfairygui_backend_apply_transaction",
307
354
  backendMethod: "applyTransaction",
@@ -328,7 +375,28 @@ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
328
375
  inputSchema: z.object({
329
376
  sessionId,
330
377
  expectedRevision: expectedRevision.optional(),
331
- targetPath: z.string().min(1).optional()
378
+ targetPath: z.string().min(1).optional(),
379
+ force: z.boolean().optional(),
380
+ mode: z.literal("materializeCleanSession").optional()
381
+ }),
382
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
383
+ annotations: {
384
+ readOnlyHint: false,
385
+ destructiveHint: true,
386
+ idempotentHint: false,
387
+ openWorldHint: false
388
+ }
389
+ },
390
+ {
391
+ name: "openfairygui_backend_materialize_session",
392
+ backendMethod: "materializeSession",
393
+ title: "Materialize Backend Session",
394
+ description: "Force materialize the current backend session project through the configured project storage without requiring a dirty edit revision.",
395
+ inputSchema: z.object({
396
+ sessionId,
397
+ expectedRevision: expectedRevision.optional(),
398
+ mode: z.literal("fullProject").optional(),
399
+ reason: z.string().min(1).optional()
332
400
  }),
333
401
  outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
334
402
  annotations: {
@@ -342,7 +410,7 @@ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
342
410
  name: "openfairygui_backend_close_session",
343
411
  backendMethod: "closeSession",
344
412
  title: "Close Backend Session",
345
- description: "Close a backend session and release its backend-local advisory lock.",
413
+ description: "Close a backend session and release its backend-local session lock.",
346
414
  inputSchema: z.object({ sessionId }),
347
415
  outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
348
416
  annotations: {
@@ -462,7 +530,21 @@ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
462
530
  ];
463
531
  //#endregion
464
532
  //#region src/server.ts
465
- const PACKAGE_VERSION = process.env.npm_package_version ?? "0.2.0-alpha.0";
533
+ const require = createRequire(import.meta.url);
534
+ function getInjectedPackageVersion() {
535
+ const version = "0.3.0-alpha.1";
536
+ return typeof version === "string" && true ? version : null;
537
+ }
538
+ function readPackageVersion() {
539
+ const injectedVersion = getInjectedPackageVersion();
540
+ if (injectedVersion) return injectedVersion;
541
+ try {
542
+ const pkg = require("../package.json");
543
+ if (typeof pkg.version === "string" && pkg.version.length > 0) return pkg.version;
544
+ } catch {}
545
+ return "0.0.0-dev";
546
+ }
547
+ const PACKAGE_VERSION = readPackageVersion();
466
548
  function createOpenFairyGuiMcpServer(options = {}) {
467
549
  const runtime = options.runtime ?? createNodeBackendRuntime();
468
550
  const server = new McpServer({
package/dist/stdio.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_stdio = require("./stdio-Ckmxm29z.cjs");
2
+ const require_stdio = require("./stdio-BqoMZ4QC.cjs");
3
3
  exports.connectOpenFairyGuiMcpStdio = require_stdio.connectOpenFairyGuiMcpStdio;
package/dist/stdio.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as connectOpenFairyGuiMcpStdio } from "./stdio-DT1cUPJ3.mjs";
1
+ import { t as connectOpenFairyGuiMcpStdio } from "./stdio-C69hamhI.mjs";
2
2
  export { connectOpenFairyGuiMcpStdio };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfairygui/mcp",
3
- "version": "0.2.0-alpha.3",
3
+ "version": "0.3.0-alpha.1",
4
4
  "description": "FairyGUI Headless Authoring SDK - MCP server adapter for the backend runtime.",
5
5
  "author": "OpenFairyGUI Contributors",
6
6
  "license": "MIT",
@@ -58,12 +58,13 @@
58
58
  "dependencies": {
59
59
  "@modelcontextprotocol/sdk": "^1.29.0",
60
60
  "zod": "^4.3.6",
61
- "@openfairygui/backend": "0.2.0-alpha.3"
61
+ "@openfairygui/backend": "0.3.0-alpha.1"
62
62
  },
63
63
  "devDependencies": {
64
64
  "ava": "^7.0.0",
65
65
  "tsx": "^4.0.0",
66
- "@openfairygui/core": "0.2.0-alpha.3"
66
+ "@openfairygui/test-utils": "0.2.0-alpha.10",
67
+ "@openfairygui/core": "0.3.0-alpha.1"
67
68
  },
68
69
  "ava": {
69
70
  "extensions": {
@@ -78,8 +79,8 @@
78
79
  ]
79
80
  },
80
81
  "scripts": {
81
- "build": "tsdown src/index.ts src/stdio.ts --format esm,cjs --platform node --external node:fs --external node:path --external node:fs/promises --env.PACKAGE_VERSION=$npm_package_version",
82
- "build:watch": "tsdown src/index.ts src/stdio.ts --watch --format esm,cjs --platform node --env.PACKAGE_VERSION=$npm_package_version",
82
+ "build": "tsdown src/index.ts src/stdio.ts --format esm,cjs --platform node --external node:fs --external node:path --external node:fs/promises",
83
+ "build:watch": "tsdown src/index.ts src/stdio.ts --watch --format esm,cjs --platform node",
83
84
  "test": "ava test/**/*.test.ts --no-worker-threads"
84
85
  }
85
86
  }
@@ -3,6 +3,7 @@ import type { GetPromptResult } from '@modelcontextprotocol/sdk/types.js';
3
3
  export const OPENFAIRYGUI_BACKEND_PROMPT_NAMES = [
4
4
  'openfairygui_inspect_capabilities',
5
5
  'openfairygui_open_and_inspect_session',
6
+ 'openfairygui_inspect_project_outline',
6
7
  'openfairygui_plan_revision_checked_transaction',
7
8
  'openfairygui_save_session',
8
9
  'openfairygui_poll_runtime_state',
@@ -38,6 +39,17 @@ export const OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS = [
38
39
  'Close the session with openfairygui_backend_close_session when finished.',
39
40
  ].join('\n'),
40
41
  },
42
+ {
43
+ name: 'openfairygui_inspect_project_outline',
44
+ title: 'Inspect an OpenFairyGUI Project Outline',
45
+ description: 'Guide a client through selector discovery before a revision-checked transaction.',
46
+ text: [
47
+ 'Use openfairygui_backend_get_project_outline with the active sessionId before planning mutations.',
48
+ 'Use package, resource, folder, display node, controller page, and transition identities from the returned outline.',
49
+ 'Pass the returned revision as expectedRevision when calling openfairygui_backend_apply_transaction.',
50
+ 'Read a new outline if the backend reports a stale revision; the outline intentionally excludes source bytes and full property payloads.',
51
+ ].join('\n'),
52
+ },
41
53
  {
42
54
  name: 'openfairygui_plan_revision_checked_transaction',
43
55
  title: 'Plan a Revision-Checked OpenFairyGUI Transaction',
@@ -24,6 +24,7 @@ export const OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI = 'openfairygui://ba
24
24
 
25
25
  export const OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES = [
26
26
  'openfairygui://backend/session/{sessionId}',
27
+ 'openfairygui://backend/session/{sessionId}/outline',
27
28
  'openfairygui://backend/cache/{sessionId}',
28
29
  'openfairygui://backend/job/{sessionId}/{jobId}',
29
30
  ] as const;
@@ -53,6 +54,19 @@ export function registerOpenFairyGuiBackendResources(server: McpServer, runtime:
53
54
  })),
54
55
  );
55
56
 
57
+ server.registerResource(
58
+ 'openfairygui_backend_project_outline',
59
+ new ResourceTemplate('openfairygui://backend/session/{sessionId}/outline', { list: undefined }),
60
+ {
61
+ title: 'OpenFairyGUI Project Outline',
62
+ description: 'Read a revision-bound project identity outline without source bytes or full property payloads.',
63
+ mimeType: JSON_MIME_TYPE,
64
+ },
65
+ (uri: URL, variables) => jsonResource(uri, runtime.getProjectOutline({
66
+ sessionId: firstVariable(variables.sessionId),
67
+ })),
68
+ );
69
+
56
70
  server.registerResource(
57
71
  'openfairygui_backend_cache',
58
72
  new ResourceTemplate('openfairygui://backend/cache/{sessionId}', { list: undefined }),
package/src/server.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import { createNodeBackendRuntime } from '@openfairygui/backend/node';
3
+ import { createRequire } from 'node:module';
3
4
  import { registerOpenFairyGuiBackendPrompts } from './prompt-definitions.js';
4
5
  import { registerOpenFairyGuiBackendResources } from './resource-definitions.js';
5
6
  import { callOpenFairyGuiBackendTool, type OpenFairyGuiBackendRuntime } from './tool-handler.js';
@@ -8,7 +9,29 @@ import {
8
9
  type OpenFairyGuiBackendToolName,
9
10
  } from './tool-definitions.js';
10
11
 
11
- const PACKAGE_VERSION = process.env.npm_package_version ?? '0.2.0-alpha.0';
12
+ const require = createRequire(import.meta.url);
13
+ declare const __OPENFAIRYGUI_PACKAGE_VERSION__: string | undefined;
14
+
15
+ function getInjectedPackageVersion(): string | null {
16
+ const version = typeof __OPENFAIRYGUI_PACKAGE_VERSION__ === 'string' ? __OPENFAIRYGUI_PACKAGE_VERSION__ : null;
17
+ return typeof version === 'string' && version.length > 0 ? version : null;
18
+ }
19
+
20
+ function readPackageVersion(): string {
21
+ const injectedVersion = getInjectedPackageVersion();
22
+ if (injectedVersion) return injectedVersion;
23
+ try {
24
+ const pkg = require('../package.json') as { version?: unknown };
25
+ if (typeof pkg.version === 'string' && pkg.version.length > 0) {
26
+ return pkg.version;
27
+ }
28
+ } catch {
29
+ // Keep the MCP server usable when executed from a bundled artifact missing package.json.
30
+ }
31
+ return '0.0.0-dev';
32
+ }
33
+
34
+ const PACKAGE_VERSION = readPackageVersion();
12
35
 
13
36
  export interface CreateOpenFairyGuiMcpServerOptions {
14
37
  runtime?: OpenFairyGuiBackendRuntime;
@@ -7,8 +7,10 @@ export const OPENFAIRYGUI_BACKEND_TOOL_NAMES = [
7
7
  'openfairygui_backend_open_session',
8
8
  'openfairygui_backend_open_project_session',
9
9
  'openfairygui_backend_get_session',
10
+ 'openfairygui_backend_get_project_outline',
10
11
  'openfairygui_backend_apply_transaction',
11
12
  'openfairygui_backend_save_session',
13
+ 'openfairygui_backend_materialize_session',
12
14
  'openfairygui_backend_close_session',
13
15
  'openfairygui_backend_get_events',
14
16
  'openfairygui_backend_get_job',
@@ -25,8 +27,10 @@ export type BackendMethodName =
25
27
  | 'openSession'
26
28
  | 'openProjectSession'
27
29
  | 'getSession'
30
+ | 'getProjectOutline'
28
31
  | 'applyTransaction'
29
32
  | 'saveSession'
33
+ | 'materializeSession'
30
34
  | 'closeSession'
31
35
  | 'getEvents'
32
36
  | 'getJob'
@@ -108,6 +112,15 @@ export const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
108
112
  outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
109
113
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
110
114
  },
115
+ {
116
+ name: 'openfairygui_backend_get_project_outline',
117
+ backendMethod: 'getProjectOutline',
118
+ title: 'Get Project Outline',
119
+ description: 'Return a revision-bound project/package/resource/component identity outline without source bytes or full property payloads.',
120
+ inputSchema: z.object({ sessionId }),
121
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
122
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
123
+ },
111
124
  {
112
125
  name: 'openfairygui_backend_apply_transaction',
113
126
  backendMethod: 'applyTransaction',
@@ -130,6 +143,22 @@ export const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
130
143
  sessionId,
131
144
  expectedRevision: expectedRevision.optional(),
132
145
  targetPath: z.string().min(1).optional(),
146
+ force: z.boolean().optional(),
147
+ mode: z.literal('materializeCleanSession').optional(),
148
+ }),
149
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
150
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
151
+ },
152
+ {
153
+ name: 'openfairygui_backend_materialize_session',
154
+ backendMethod: 'materializeSession',
155
+ title: 'Materialize Backend Session',
156
+ description: 'Force materialize the current backend session project through the configured project storage without requiring a dirty edit revision.',
157
+ inputSchema: z.object({
158
+ sessionId,
159
+ expectedRevision: expectedRevision.optional(),
160
+ mode: z.literal('fullProject').optional(),
161
+ reason: z.string().min(1).optional(),
133
162
  }),
134
163
  outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
135
164
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
@@ -138,7 +167,7 @@ export const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
138
167
  name: 'openfairygui_backend_close_session',
139
168
  backendMethod: 'closeSession',
140
169
  title: 'Close Backend Session',
141
- description: 'Close a backend session and release its backend-local advisory lock.',
170
+ description: 'Close a backend session and release its backend-local session lock.',
142
171
  inputSchema: z.object({ sessionId }),
143
172
  outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
144
173
  annotations: { readOnlyHint: false, idempotentHint: false, openWorldHint: false },
@@ -8,8 +8,10 @@ export type OpenFairyGuiBackendRuntime = Pick<
8
8
  | 'openSession'
9
9
  | 'openProjectSession'
10
10
  | 'getSession'
11
+ | 'getProjectOutline'
11
12
  | 'applyTransaction'
12
13
  | 'saveSession'
14
+ | 'materializeSession'
13
15
  | 'closeSession'
14
16
  | 'getEvents'
15
17
  | 'getJob'
@@ -69,6 +71,11 @@ export async function callOpenFairyGuiBackendTool(
69
71
  sessionId: String(input.sessionId),
70
72
  });
71
73
  break;
74
+ case 'openfairygui_backend_get_project_outline':
75
+ result = runtime.getProjectOutline({
76
+ sessionId: String(input.sessionId),
77
+ });
78
+ break;
72
79
  case 'openfairygui_backend_apply_transaction':
73
80
  result = await runtime.applyTransaction({
74
81
  sessionId: String(input.sessionId),
@@ -81,6 +88,16 @@ export async function callOpenFairyGuiBackendTool(
81
88
  sessionId: String(input.sessionId),
82
89
  expectedRevision: input.expectedRevision === undefined ? undefined : Number(input.expectedRevision),
83
90
  targetPath: input.targetPath === undefined ? undefined : String(input.targetPath),
91
+ force: input.force === undefined ? undefined : Boolean(input.force),
92
+ mode: input.mode as Parameters<BackendRuntime['saveSession']>[0]['mode'],
93
+ });
94
+ break;
95
+ case 'openfairygui_backend_materialize_session':
96
+ result = await runtime.materializeSession({
97
+ sessionId: String(input.sessionId),
98
+ expectedRevision: input.expectedRevision === undefined ? undefined : Number(input.expectedRevision),
99
+ mode: input.mode as Parameters<BackendRuntime['materializeSession']>[0]['mode'],
100
+ reason: input.reason === undefined ? undefined : String(input.reason),
84
101
  });
85
102
  break;
86
103
  case 'openfairygui_backend_close_session':