@openfairygui/mcp 0.2.0-alpha.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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-eqd_tVeJ.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
@@ -1,22 +1,14 @@
1
1
  import { connectOpenFairyGuiMcpStdio } from "./stdio.cjs";
2
2
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
- import { BackendRuntime } from "@openfairygui/backend";
4
3
  import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
4
+ import { BackendRuntime } from "@openfairygui/backend";
5
5
  import { z } from "zod";
6
6
 
7
- //#region src/server.d.ts
8
- interface CreateOpenFairyGuiMcpServerOptions {
9
- runtime?: BackendRuntime;
10
- name?: string;
11
- version?: string;
12
- }
13
- declare function createOpenFairyGuiMcpServer(options?: CreateOpenFairyGuiMcpServerOptions): McpServer;
14
- //#endregion
15
7
  //#region src/tool-definitions.d.ts
16
8
  declare const OPENFAIRYGUI_BACKEND_TOOL_PREFIX = "openfairygui_backend_";
17
- 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_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"];
18
10
  type OpenFairyGuiBackendToolName = typeof OPENFAIRYGUI_BACKEND_TOOL_NAMES[number];
19
- type BackendMethodName = 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'applyTransaction' | 'saveSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache';
11
+ type BackendMethodName = 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'applyTransaction' | 'saveSession' | 'materializeSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache';
20
12
  interface OpenFairyGuiBackendToolDefinition {
21
13
  name: OpenFairyGuiBackendToolName;
22
14
  backendMethod: BackendMethodName;
@@ -157,6 +149,33 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
157
149
  sessionId: z.ZodString;
158
150
  expectedRevision: z.ZodOptional<z.ZodNumber>;
159
151
  targetPath: z.ZodOptional<z.ZodString>;
152
+ force: z.ZodOptional<z.ZodBoolean>;
153
+ mode: z.ZodOptional<z.ZodLiteral<"materializeCleanSession">>;
154
+ }, z.core.$strip>;
155
+ readonly outputSchema: z.ZodObject<{
156
+ backendResult: z.ZodObject<{
157
+ ok: z.ZodBoolean;
158
+ data: z.ZodOptional<z.ZodUnknown>;
159
+ error: z.ZodOptional<z.ZodUnknown>;
160
+ meta: z.ZodOptional<z.ZodUnknown>;
161
+ }, z.core.$loose>;
162
+ }, z.core.$strip>;
163
+ readonly annotations: {
164
+ readonly readOnlyHint: false;
165
+ readonly destructiveHint: true;
166
+ readonly idempotentHint: false;
167
+ readonly openWorldHint: false;
168
+ };
169
+ }, {
170
+ readonly name: "openfairygui_backend_materialize_session";
171
+ readonly backendMethod: "materializeSession";
172
+ readonly title: "Materialize Backend Session";
173
+ readonly description: "Force materialize the current backend session project through the configured project storage without requiring a dirty edit revision.";
174
+ readonly inputSchema: z.ZodObject<{
175
+ sessionId: z.ZodString;
176
+ expectedRevision: z.ZodOptional<z.ZodNumber>;
177
+ mode: z.ZodOptional<z.ZodLiteral<"fullProject">>;
178
+ reason: z.ZodOptional<z.ZodString>;
160
179
  }, z.core.$strip>;
161
180
  readonly outputSchema: z.ZodObject<{
162
181
  backendResult: z.ZodObject<{
@@ -176,7 +195,7 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
176
195
  readonly name: "openfairygui_backend_close_session";
177
196
  readonly backendMethod: "closeSession";
178
197
  readonly title: "Close Backend Session";
179
- readonly description: "Close a backend session and release its backend-local advisory lock.";
198
+ readonly description: "Close a backend session and release its backend-local session lock.";
180
199
  readonly inputSchema: z.ZodObject<{
181
200
  sessionId: z.ZodString;
182
201
  }, z.core.$strip>;
@@ -342,7 +361,16 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
342
361
  }];
343
362
  //#endregion
344
363
  //#region src/tool-handler.d.ts
345
- declare function callOpenFairyGuiBackendTool(runtime: BackendRuntime, name: OpenFairyGuiBackendToolName, input: Record<string, unknown>): Promise<CallToolResult>;
364
+ type OpenFairyGuiBackendRuntime = Pick<BackendRuntime, 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'applyTransaction' | 'saveSession' | 'materializeSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache'>;
365
+ declare function callOpenFairyGuiBackendTool(runtime: OpenFairyGuiBackendRuntime, name: OpenFairyGuiBackendToolName, input: Record<string, unknown>): Promise<CallToolResult>;
366
+ //#endregion
367
+ //#region src/server.d.ts
368
+ interface CreateOpenFairyGuiMcpServerOptions {
369
+ runtime?: OpenFairyGuiBackendRuntime;
370
+ name?: string;
371
+ version?: string;
372
+ }
373
+ declare function createOpenFairyGuiMcpServer(options?: CreateOpenFairyGuiMcpServerOptions): McpServer;
346
374
  //#endregion
347
375
  //#region src/prompt-definitions.d.ts
348
376
  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"];
@@ -378,4 +406,4 @@ declare const OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS: readonly [{
378
406
  declare const OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI = "openfairygui://backend/capabilities";
379
407
  declare const OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES: readonly ["openfairygui://backend/session/{sessionId}", "openfairygui://backend/cache/{sessionId}", "openfairygui://backend/job/{sessionId}/{jobId}"];
380
408
  //#endregion
381
- 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 OpenFairyGuiBackendToolDefinition, type OpenFairyGuiBackendToolName, callOpenFairyGuiBackendTool, connectOpenFairyGuiMcpStdio, createOpenFairyGuiMcpServer };
409
+ 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
@@ -1,22 +1,14 @@
1
1
  import { connectOpenFairyGuiMcpStdio } from "./stdio.mjs";
2
2
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { z } from "zod";
4
- import { BackendRuntime } from "@openfairygui/backend";
5
4
  import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
5
+ import { BackendRuntime } from "@openfairygui/backend";
6
6
 
7
- //#region src/server.d.ts
8
- interface CreateOpenFairyGuiMcpServerOptions {
9
- runtime?: BackendRuntime;
10
- name?: string;
11
- version?: string;
12
- }
13
- declare function createOpenFairyGuiMcpServer(options?: CreateOpenFairyGuiMcpServerOptions): McpServer;
14
- //#endregion
15
7
  //#region src/tool-definitions.d.ts
16
8
  declare const OPENFAIRYGUI_BACKEND_TOOL_PREFIX = "openfairygui_backend_";
17
- 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_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"];
18
10
  type OpenFairyGuiBackendToolName = typeof OPENFAIRYGUI_BACKEND_TOOL_NAMES[number];
19
- type BackendMethodName = 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'applyTransaction' | 'saveSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache';
11
+ type BackendMethodName = 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'applyTransaction' | 'saveSession' | 'materializeSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache';
20
12
  interface OpenFairyGuiBackendToolDefinition {
21
13
  name: OpenFairyGuiBackendToolName;
22
14
  backendMethod: BackendMethodName;
@@ -157,6 +149,33 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
157
149
  sessionId: z.ZodString;
158
150
  expectedRevision: z.ZodOptional<z.ZodNumber>;
159
151
  targetPath: z.ZodOptional<z.ZodString>;
152
+ force: z.ZodOptional<z.ZodBoolean>;
153
+ mode: z.ZodOptional<z.ZodLiteral<"materializeCleanSession">>;
154
+ }, z.core.$strip>;
155
+ readonly outputSchema: z.ZodObject<{
156
+ backendResult: z.ZodObject<{
157
+ ok: z.ZodBoolean;
158
+ data: z.ZodOptional<z.ZodUnknown>;
159
+ error: z.ZodOptional<z.ZodUnknown>;
160
+ meta: z.ZodOptional<z.ZodUnknown>;
161
+ }, z.core.$loose>;
162
+ }, z.core.$strip>;
163
+ readonly annotations: {
164
+ readonly readOnlyHint: false;
165
+ readonly destructiveHint: true;
166
+ readonly idempotentHint: false;
167
+ readonly openWorldHint: false;
168
+ };
169
+ }, {
170
+ readonly name: "openfairygui_backend_materialize_session";
171
+ readonly backendMethod: "materializeSession";
172
+ readonly title: "Materialize Backend Session";
173
+ readonly description: "Force materialize the current backend session project through the configured project storage without requiring a dirty edit revision.";
174
+ readonly inputSchema: z.ZodObject<{
175
+ sessionId: z.ZodString;
176
+ expectedRevision: z.ZodOptional<z.ZodNumber>;
177
+ mode: z.ZodOptional<z.ZodLiteral<"fullProject">>;
178
+ reason: z.ZodOptional<z.ZodString>;
160
179
  }, z.core.$strip>;
161
180
  readonly outputSchema: z.ZodObject<{
162
181
  backendResult: z.ZodObject<{
@@ -176,7 +195,7 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
176
195
  readonly name: "openfairygui_backend_close_session";
177
196
  readonly backendMethod: "closeSession";
178
197
  readonly title: "Close Backend Session";
179
- readonly description: "Close a backend session and release its backend-local advisory lock.";
198
+ readonly description: "Close a backend session and release its backend-local session lock.";
180
199
  readonly inputSchema: z.ZodObject<{
181
200
  sessionId: z.ZodString;
182
201
  }, z.core.$strip>;
@@ -342,7 +361,16 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
342
361
  }];
343
362
  //#endregion
344
363
  //#region src/tool-handler.d.ts
345
- declare function callOpenFairyGuiBackendTool(runtime: BackendRuntime, name: OpenFairyGuiBackendToolName, input: Record<string, unknown>): Promise<CallToolResult>;
364
+ type OpenFairyGuiBackendRuntime = Pick<BackendRuntime, 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'applyTransaction' | 'saveSession' | 'materializeSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache'>;
365
+ declare function callOpenFairyGuiBackendTool(runtime: OpenFairyGuiBackendRuntime, name: OpenFairyGuiBackendToolName, input: Record<string, unknown>): Promise<CallToolResult>;
366
+ //#endregion
367
+ //#region src/server.d.ts
368
+ interface CreateOpenFairyGuiMcpServerOptions {
369
+ runtime?: OpenFairyGuiBackendRuntime;
370
+ name?: string;
371
+ version?: string;
372
+ }
373
+ declare function createOpenFairyGuiMcpServer(options?: CreateOpenFairyGuiMcpServerOptions): McpServer;
346
374
  //#endregion
347
375
  //#region src/prompt-definitions.d.ts
348
376
  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"];
@@ -378,4 +406,4 @@ declare const OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS: readonly [{
378
406
  declare const OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI = "openfairygui://backend/capabilities";
379
407
  declare const OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES: readonly ["openfairygui://backend/session/{sessionId}", "openfairygui://backend/cache/{sessionId}", "openfairygui://backend/job/{sessionId}/{jobId}"];
380
408
  //#endregion
381
- 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 OpenFairyGuiBackendToolDefinition, type OpenFairyGuiBackendToolName, callOpenFairyGuiBackendTool, connectOpenFairyGuiMcpStdio, createOpenFairyGuiMcpServer };
409
+ 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-AonL7fG4.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,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";
@@ -170,7 +171,17 @@ async function callOpenFairyGuiBackendTool(runtime, name, input) {
170
171
  result = await runtime.saveSession({
171
172
  sessionId: String(input.sessionId),
172
173
  expectedRevision: input.expectedRevision === void 0 ? void 0 : Number(input.expectedRevision),
173
- targetPath: input.targetPath === void 0 ? void 0 : String(input.targetPath)
174
+ targetPath: input.targetPath === void 0 ? void 0 : String(input.targetPath),
175
+ force: input.force === void 0 ? void 0 : Boolean(input.force),
176
+ mode: input.mode
177
+ });
178
+ break;
179
+ case "openfairygui_backend_materialize_session":
180
+ result = await runtime.materializeSession({
181
+ sessionId: String(input.sessionId),
182
+ expectedRevision: input.expectedRevision === void 0 ? void 0 : Number(input.expectedRevision),
183
+ mode: input.mode,
184
+ reason: input.reason === void 0 ? void 0 : String(input.reason)
174
185
  });
175
186
  break;
176
187
  case "openfairygui_backend_close_session":
@@ -226,6 +237,7 @@ const OPENFAIRYGUI_BACKEND_TOOL_NAMES = [
226
237
  "openfairygui_backend_get_session",
227
238
  "openfairygui_backend_apply_transaction",
228
239
  "openfairygui_backend_save_session",
240
+ "openfairygui_backend_materialize_session",
229
241
  "openfairygui_backend_close_session",
230
242
  "openfairygui_backend_get_events",
231
243
  "openfairygui_backend_get_job",
@@ -328,7 +340,28 @@ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
328
340
  inputSchema: z.object({
329
341
  sessionId,
330
342
  expectedRevision: expectedRevision.optional(),
331
- targetPath: z.string().min(1).optional()
343
+ targetPath: z.string().min(1).optional(),
344
+ force: z.boolean().optional(),
345
+ mode: z.literal("materializeCleanSession").optional()
346
+ }),
347
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
348
+ annotations: {
349
+ readOnlyHint: false,
350
+ destructiveHint: true,
351
+ idempotentHint: false,
352
+ openWorldHint: false
353
+ }
354
+ },
355
+ {
356
+ name: "openfairygui_backend_materialize_session",
357
+ backendMethod: "materializeSession",
358
+ title: "Materialize Backend Session",
359
+ description: "Force materialize the current backend session project through the configured project storage without requiring a dirty edit revision.",
360
+ inputSchema: z.object({
361
+ sessionId,
362
+ expectedRevision: expectedRevision.optional(),
363
+ mode: z.literal("fullProject").optional(),
364
+ reason: z.string().min(1).optional()
332
365
  }),
333
366
  outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
334
367
  annotations: {
@@ -342,7 +375,7 @@ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
342
375
  name: "openfairygui_backend_close_session",
343
376
  backendMethod: "closeSession",
344
377
  title: "Close Backend Session",
345
- description: "Close a backend session and release its backend-local advisory lock.",
378
+ description: "Close a backend session and release its backend-local session lock.",
346
379
  inputSchema: z.object({ sessionId }),
347
380
  outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
348
381
  annotations: {
@@ -462,7 +495,21 @@ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
462
495
  ];
463
496
  //#endregion
464
497
  //#region src/server.ts
465
- const PACKAGE_VERSION = process.env.npm_package_version ?? "0.2.0-alpha.0";
498
+ const require = createRequire(import.meta.url);
499
+ function getInjectedPackageVersion() {
500
+ const version = "0.2.0";
501
+ return typeof version === "string" && true ? version : null;
502
+ }
503
+ function readPackageVersion() {
504
+ const injectedVersion = getInjectedPackageVersion();
505
+ if (injectedVersion) return injectedVersion;
506
+ try {
507
+ const pkg = require("../package.json");
508
+ if (typeof pkg.version === "string" && pkg.version.length > 0) return pkg.version;
509
+ } catch {}
510
+ return "0.0.0-dev";
511
+ }
512
+ const PACKAGE_VERSION = readPackageVersion();
466
513
  function createOpenFairyGuiMcpServer(options = {}) {
467
514
  const runtime = options.runtime ?? createNodeBackendRuntime();
468
515
  const server = new McpServer({
@@ -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");
@@ -170,7 +171,17 @@ async function callOpenFairyGuiBackendTool(runtime, name, input) {
170
171
  result = await runtime.saveSession({
171
172
  sessionId: String(input.sessionId),
172
173
  expectedRevision: input.expectedRevision === void 0 ? void 0 : Number(input.expectedRevision),
173
- targetPath: input.targetPath === void 0 ? void 0 : String(input.targetPath)
174
+ targetPath: input.targetPath === void 0 ? void 0 : String(input.targetPath),
175
+ force: input.force === void 0 ? void 0 : Boolean(input.force),
176
+ mode: input.mode
177
+ });
178
+ break;
179
+ case "openfairygui_backend_materialize_session":
180
+ result = await runtime.materializeSession({
181
+ sessionId: String(input.sessionId),
182
+ expectedRevision: input.expectedRevision === void 0 ? void 0 : Number(input.expectedRevision),
183
+ mode: input.mode,
184
+ reason: input.reason === void 0 ? void 0 : String(input.reason)
174
185
  });
175
186
  break;
176
187
  case "openfairygui_backend_close_session":
@@ -226,6 +237,7 @@ const OPENFAIRYGUI_BACKEND_TOOL_NAMES = [
226
237
  "openfairygui_backend_get_session",
227
238
  "openfairygui_backend_apply_transaction",
228
239
  "openfairygui_backend_save_session",
240
+ "openfairygui_backend_materialize_session",
229
241
  "openfairygui_backend_close_session",
230
242
  "openfairygui_backend_get_events",
231
243
  "openfairygui_backend_get_job",
@@ -328,7 +340,28 @@ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
328
340
  inputSchema: zod.z.object({
329
341
  sessionId,
330
342
  expectedRevision: expectedRevision.optional(),
331
- targetPath: zod.z.string().min(1).optional()
343
+ targetPath: zod.z.string().min(1).optional(),
344
+ force: zod.z.boolean().optional(),
345
+ mode: zod.z.literal("materializeCleanSession").optional()
346
+ }),
347
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
348
+ annotations: {
349
+ readOnlyHint: false,
350
+ destructiveHint: true,
351
+ idempotentHint: false,
352
+ openWorldHint: false
353
+ }
354
+ },
355
+ {
356
+ name: "openfairygui_backend_materialize_session",
357
+ backendMethod: "materializeSession",
358
+ title: "Materialize Backend Session",
359
+ description: "Force materialize the current backend session project through the configured project storage without requiring a dirty edit revision.",
360
+ inputSchema: zod.z.object({
361
+ sessionId,
362
+ expectedRevision: expectedRevision.optional(),
363
+ mode: zod.z.literal("fullProject").optional(),
364
+ reason: zod.z.string().min(1).optional()
332
365
  }),
333
366
  outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
334
367
  annotations: {
@@ -342,7 +375,7 @@ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
342
375
  name: "openfairygui_backend_close_session",
343
376
  backendMethod: "closeSession",
344
377
  title: "Close Backend Session",
345
- description: "Close a backend session and release its backend-local advisory lock.",
378
+ description: "Close a backend session and release its backend-local session lock.",
346
379
  inputSchema: zod.z.object({ sessionId }),
347
380
  outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
348
381
  annotations: {
@@ -462,7 +495,21 @@ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
462
495
  ];
463
496
  //#endregion
464
497
  //#region src/server.ts
465
- const PACKAGE_VERSION = process.env.npm_package_version ?? "0.2.0-alpha.0";
498
+ const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
499
+ function getInjectedPackageVersion() {
500
+ const version = "0.2.0";
501
+ return typeof version === "string" && true ? version : null;
502
+ }
503
+ function readPackageVersion() {
504
+ const injectedVersion = getInjectedPackageVersion();
505
+ if (injectedVersion) return injectedVersion;
506
+ try {
507
+ const pkg = require$1("../package.json");
508
+ if (typeof pkg.version === "string" && pkg.version.length > 0) return pkg.version;
509
+ } catch {}
510
+ return "0.0.0-dev";
511
+ }
512
+ const PACKAGE_VERSION = readPackageVersion();
466
513
  function createOpenFairyGuiMcpServer(options = {}) {
467
514
  const runtime = options.runtime ?? (0, _openfairygui_backend_node.createNodeBackendRuntime)();
468
515
  const server = new _modelcontextprotocol_sdk_server_mcp_js.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-eqd_tVeJ.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-AonL7fG4.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.2",
3
+ "version": "0.2.0",
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.2"
61
+ "@openfairygui/backend": "0.2.0"
62
62
  },
63
63
  "devDependencies": {
64
64
  "ava": "^7.0.0",
65
65
  "tsx": "^4.0.0",
66
- "@openfairygui/core": "0.2.0-alpha.2"
66
+ "@openfairygui/test-utils": "0.2.0-alpha.10",
67
+ "@openfairygui/core": "0.2.0"
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
  }
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@ export {
7
7
  } from './stdio.js';
8
8
  export {
9
9
  callOpenFairyGuiBackendTool,
10
+ type OpenFairyGuiBackendRuntime,
10
11
  } from './tool-handler.js';
11
12
  export {
12
13
  OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS,
@@ -1,6 +1,6 @@
1
1
  import { ResourceTemplate, type McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import type { ReadResourceResult } from '@modelcontextprotocol/sdk/types.js';
3
- import type { BackendRuntime } from '@openfairygui/backend';
3
+ import type { OpenFairyGuiBackendRuntime } from './tool-handler.js';
4
4
 
5
5
  const JSON_MIME_TYPE = 'application/json';
6
6
 
@@ -28,7 +28,7 @@ export const OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES = [
28
28
  'openfairygui://backend/job/{sessionId}/{jobId}',
29
29
  ] as const;
30
30
 
31
- export function registerOpenFairyGuiBackendResources(server: McpServer, runtime: BackendRuntime): void {
31
+ export function registerOpenFairyGuiBackendResources(server: McpServer, runtime: OpenFairyGuiBackendRuntime): void {
32
32
  server.registerResource(
33
33
  'openfairygui_backend_capabilities',
34
34
  OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI,
package/src/server.ts CHANGED
@@ -1,18 +1,40 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import type { BackendRuntime } from '@openfairygui/backend';
3
2
  import { createNodeBackendRuntime } from '@openfairygui/backend/node';
3
+ import { createRequire } from 'node:module';
4
4
  import { registerOpenFairyGuiBackendPrompts } from './prompt-definitions.js';
5
5
  import { registerOpenFairyGuiBackendResources } from './resource-definitions.js';
6
- import { callOpenFairyGuiBackendTool } from './tool-handler.js';
6
+ import { callOpenFairyGuiBackendTool, type OpenFairyGuiBackendRuntime } from './tool-handler.js';
7
7
  import {
8
8
  OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS,
9
9
  type OpenFairyGuiBackendToolName,
10
10
  } from './tool-definitions.js';
11
11
 
12
- 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();
13
35
 
14
36
  export interface CreateOpenFairyGuiMcpServerOptions {
15
- runtime?: BackendRuntime;
37
+ runtime?: OpenFairyGuiBackendRuntime;
16
38
  name?: string;
17
39
  version?: string;
18
40
  }
@@ -9,6 +9,7 @@ export const OPENFAIRYGUI_BACKEND_TOOL_NAMES = [
9
9
  'openfairygui_backend_get_session',
10
10
  'openfairygui_backend_apply_transaction',
11
11
  'openfairygui_backend_save_session',
12
+ 'openfairygui_backend_materialize_session',
12
13
  'openfairygui_backend_close_session',
13
14
  'openfairygui_backend_get_events',
14
15
  'openfairygui_backend_get_job',
@@ -27,6 +28,7 @@ export type BackendMethodName =
27
28
  | 'getSession'
28
29
  | 'applyTransaction'
29
30
  | 'saveSession'
31
+ | 'materializeSession'
30
32
  | 'closeSession'
31
33
  | 'getEvents'
32
34
  | 'getJob'
@@ -130,6 +132,22 @@ export const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
130
132
  sessionId,
131
133
  expectedRevision: expectedRevision.optional(),
132
134
  targetPath: z.string().min(1).optional(),
135
+ force: z.boolean().optional(),
136
+ mode: z.literal('materializeCleanSession').optional(),
137
+ }),
138
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
139
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
140
+ },
141
+ {
142
+ name: 'openfairygui_backend_materialize_session',
143
+ backendMethod: 'materializeSession',
144
+ title: 'Materialize Backend Session',
145
+ description: 'Force materialize the current backend session project through the configured project storage without requiring a dirty edit revision.',
146
+ inputSchema: z.object({
147
+ sessionId,
148
+ expectedRevision: expectedRevision.optional(),
149
+ mode: z.literal('fullProject').optional(),
150
+ reason: z.string().min(1).optional(),
133
151
  }),
134
152
  outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
135
153
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
@@ -138,7 +156,7 @@ export const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
138
156
  name: 'openfairygui_backend_close_session',
139
157
  backendMethod: 'closeSession',
140
158
  title: 'Close Backend Session',
141
- description: 'Close a backend session and release its backend-local advisory lock.',
159
+ description: 'Close a backend session and release its backend-local session lock.',
142
160
  inputSchema: z.object({ sessionId }),
143
161
  outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
144
162
  annotations: { readOnlyHint: false, idempotentHint: false, openWorldHint: false },
@@ -2,6 +2,24 @@ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
2
2
  import type { BackendRuntime } from '@openfairygui/backend';
3
3
  import type { OpenFairyGuiBackendToolName } from './tool-definitions.js';
4
4
 
5
+ export type OpenFairyGuiBackendRuntime = Pick<
6
+ BackendRuntime,
7
+ | 'getCapabilities'
8
+ | 'openSession'
9
+ | 'openProjectSession'
10
+ | 'getSession'
11
+ | 'applyTransaction'
12
+ | 'saveSession'
13
+ | 'materializeSession'
14
+ | 'closeSession'
15
+ | 'getEvents'
16
+ | 'getJob'
17
+ | 'listJobs'
18
+ | 'cancelJob'
19
+ | 'getCacheSnapshot'
20
+ | 'refreshCache'
21
+ >;
22
+
5
23
  function jsonResult(payload: unknown, isError = false): CallToolResult {
6
24
  return {
7
25
  content: [
@@ -25,7 +43,7 @@ function isBackendFailure(value: unknown): boolean {
25
43
  }
26
44
 
27
45
  export async function callOpenFairyGuiBackendTool(
28
- runtime: BackendRuntime,
46
+ runtime: OpenFairyGuiBackendRuntime,
29
47
  name: OpenFairyGuiBackendToolName,
30
48
  input: Record<string, unknown>,
31
49
  ): Promise<CallToolResult> {
@@ -64,6 +82,16 @@ export async function callOpenFairyGuiBackendTool(
64
82
  sessionId: String(input.sessionId),
65
83
  expectedRevision: input.expectedRevision === undefined ? undefined : Number(input.expectedRevision),
66
84
  targetPath: input.targetPath === undefined ? undefined : String(input.targetPath),
85
+ force: input.force === undefined ? undefined : Boolean(input.force),
86
+ mode: input.mode as Parameters<BackendRuntime['saveSession']>[0]['mode'],
87
+ });
88
+ break;
89
+ case 'openfairygui_backend_materialize_session':
90
+ result = await runtime.materializeSession({
91
+ sessionId: String(input.sessionId),
92
+ expectedRevision: input.expectedRevision === undefined ? undefined : Number(input.expectedRevision),
93
+ mode: input.mode as Parameters<BackendRuntime['materializeSession']>[0]['mode'],
94
+ reason: input.reason === undefined ? undefined : String(input.reason),
67
95
  });
68
96
  break;
69
97
  case 'openfairygui_backend_close_session':