@openfairygui/mcp 0.2.0-alpha.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.
@@ -0,0 +1,470 @@
1
+ import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { BackendRuntime } from "@openfairygui/backend";
3
+ import { z } from "zod";
4
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
+ import { pathToFileURL } from "node:url";
6
+ //#region src/prompt-definitions.ts
7
+ const OPENFAIRYGUI_BACKEND_PROMPT_NAMES = [
8
+ "openfairygui_inspect_capabilities",
9
+ "openfairygui_open_and_inspect_session",
10
+ "openfairygui_plan_revision_checked_transaction",
11
+ "openfairygui_save_session",
12
+ "openfairygui_poll_runtime_state"
13
+ ];
14
+ const OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS = [
15
+ {
16
+ name: "openfairygui_inspect_capabilities",
17
+ title: "Inspect OpenFairyGUI Backend Capabilities",
18
+ description: "Guide a client through the capability and version discovery tool.",
19
+ text: [
20
+ "Use openfairygui_backend_get_capabilities first.",
21
+ "Read contractVersion, capabilitySchemaVersion, capability planes, methods, and runtime non-goals from the backend envelope.",
22
+ "Do not infer artifact publish/restore, subscriptions, persistent jobs, or cache source-of-truth support when the backend marks them unsupported."
23
+ ].join("\n")
24
+ },
25
+ {
26
+ name: "openfairygui_open_and_inspect_session",
27
+ title: "Open and Inspect an OpenFairyGUI Session",
28
+ description: "Guide a client through opening and reading a backend session.",
29
+ text: [
30
+ "Use openfairygui_backend_open_session with a projectPath, then use openfairygui_backend_get_session with the returned sessionId.",
31
+ "Backend path policy remains authoritative for project paths and save targets; MCP roots are only client context in this package.",
32
+ "Close the session with openfairygui_backend_close_session when finished."
33
+ ].join("\n")
34
+ },
35
+ {
36
+ name: "openfairygui_plan_revision_checked_transaction",
37
+ title: "Plan a Revision-Checked OpenFairyGUI Transaction",
38
+ description: "Guide a client through backend-owned revision checks without inventing operation grammar.",
39
+ text: [
40
+ "Use openfairygui_backend_get_session to read the current revision before mutation.",
41
+ "Call openfairygui_backend_apply_transaction with sessionId, expectedRevision, and backend/UAM-owned operations.",
42
+ "If the backend returns a stale revision error, refresh the session snapshot and re-plan against the new revision.",
43
+ "Do not invent selector grammar, transaction grammar, or operation payload semantics at the MCP layer."
44
+ ].join("\n")
45
+ },
46
+ {
47
+ name: "openfairygui_save_session",
48
+ title: "Save an OpenFairyGUI Backend Session",
49
+ description: "Guide a client through coordinated backend save semantics.",
50
+ text: [
51
+ "Use openfairygui_backend_save_session with sessionId and expectedRevision when available.",
52
+ "Backend path policy remains authoritative for targetPath; MCP does not canonicalize or authorize paths.",
53
+ "Handle stale revision and partial save failure envelopes from the backend without rewriting their error semantics."
54
+ ].join("\n")
55
+ },
56
+ {
57
+ name: "openfairygui_poll_runtime_state",
58
+ title: "Poll OpenFairyGUI Runtime State",
59
+ description: "Guide a client through event, job, and cache polling tools.",
60
+ text: [
61
+ "Use openfairygui_backend_get_events for polling events with the backend cursor contract.",
62
+ "Use openfairygui_backend_list_jobs and openfairygui_backend_get_job for in-memory job snapshots.",
63
+ "Use openfairygui_backend_get_cache_snapshot and openfairygui_backend_refresh_cache for derived read-only cache state.",
64
+ "Subscriptions, persistent jobs, artifact jobs, and cache-as-source-of-truth behavior are not supported by backend P2."
65
+ ].join("\n")
66
+ }
67
+ ];
68
+ function promptResult(text) {
69
+ return { messages: [{
70
+ role: "user",
71
+ content: {
72
+ type: "text",
73
+ text
74
+ }
75
+ }] };
76
+ }
77
+ function registerOpenFairyGuiBackendPrompts(server) {
78
+ for (const definition of OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS) server.registerPrompt(definition.name, {
79
+ title: definition.title,
80
+ description: definition.description
81
+ }, () => promptResult(definition.text));
82
+ }
83
+ //#endregion
84
+ //#region src/resource-definitions.ts
85
+ const JSON_MIME_TYPE = "application/json";
86
+ function firstVariable(value) {
87
+ return Array.isArray(value) ? value[0] ?? "" : value ?? "";
88
+ }
89
+ function jsonResource(uri, backendResult) {
90
+ return { contents: [{
91
+ uri: uri.toString(),
92
+ mimeType: JSON_MIME_TYPE,
93
+ text: JSON.stringify(backendResult, null, 2)
94
+ }] };
95
+ }
96
+ const OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI = "openfairygui://backend/capabilities";
97
+ const OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES = [
98
+ "openfairygui://backend/session/{sessionId}",
99
+ "openfairygui://backend/cache/{sessionId}",
100
+ "openfairygui://backend/job/{sessionId}/{jobId}"
101
+ ];
102
+ function registerOpenFairyGuiBackendResources(server, runtime) {
103
+ server.registerResource("openfairygui_backend_capabilities", OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI, {
104
+ title: "OpenFairyGUI Backend Capabilities",
105
+ description: "Read the backend capability and version envelope as JSON.",
106
+ mimeType: JSON_MIME_TYPE
107
+ }, (uri) => jsonResource(uri, runtime.getCapabilities()));
108
+ server.registerResource("openfairygui_backend_session", new ResourceTemplate("openfairygui://backend/session/{sessionId}", { list: void 0 }), {
109
+ title: "OpenFairyGUI Backend Session Snapshot",
110
+ description: "Read a backend session envelope by backend-local session id.",
111
+ mimeType: JSON_MIME_TYPE
112
+ }, (uri, variables) => jsonResource(uri, runtime.getSession({ sessionId: firstVariable(variables.sessionId) })));
113
+ server.registerResource("openfairygui_backend_cache", new ResourceTemplate("openfairygui://backend/cache/{sessionId}", { list: void 0 }), {
114
+ title: "OpenFairyGUI Backend Cache Snapshot",
115
+ description: "Read a derived backend cache envelope by backend-local session id.",
116
+ mimeType: JSON_MIME_TYPE
117
+ }, (uri, variables) => jsonResource(uri, runtime.getCacheSnapshot({ sessionId: firstVariable(variables.sessionId) })));
118
+ server.registerResource("openfairygui_backend_job", new ResourceTemplate("openfairygui://backend/job/{sessionId}/{jobId}", { list: void 0 }), {
119
+ title: "OpenFairyGUI Backend Job Snapshot",
120
+ description: "Read a backend runtime job envelope by session id and job id.",
121
+ mimeType: JSON_MIME_TYPE
122
+ }, (uri, variables) => jsonResource(uri, runtime.getJob({
123
+ sessionId: firstVariable(variables.sessionId),
124
+ jobId: firstVariable(variables.jobId)
125
+ })));
126
+ }
127
+ //#endregion
128
+ //#region src/tool-handler.ts
129
+ function jsonResult(payload, isError = false) {
130
+ return {
131
+ content: [{
132
+ type: "text",
133
+ text: JSON.stringify(payload, null, 2)
134
+ }],
135
+ structuredContent: { backendResult: payload },
136
+ isError
137
+ };
138
+ }
139
+ function isBackendFailure(value) {
140
+ return typeof value === "object" && value !== null && "ok" in value && value.ok === false;
141
+ }
142
+ async function callOpenFairyGuiBackendTool(runtime, name, input) {
143
+ let result;
144
+ switch (name) {
145
+ case "openfairygui_backend_get_capabilities":
146
+ result = runtime.getCapabilities();
147
+ break;
148
+ case "openfairygui_backend_open_session":
149
+ result = await runtime.openSession({ projectPath: String(input.projectPath) });
150
+ break;
151
+ case "openfairygui_backend_get_session":
152
+ result = runtime.getSession({ sessionId: String(input.sessionId) });
153
+ break;
154
+ case "openfairygui_backend_apply_transaction":
155
+ result = await runtime.applyTransaction({
156
+ sessionId: String(input.sessionId),
157
+ expectedRevision: Number(input.expectedRevision),
158
+ operations: input.operations
159
+ });
160
+ break;
161
+ case "openfairygui_backend_save_session":
162
+ result = await runtime.saveSession({
163
+ sessionId: String(input.sessionId),
164
+ expectedRevision: input.expectedRevision === void 0 ? void 0 : Number(input.expectedRevision),
165
+ targetPath: input.targetPath === void 0 ? void 0 : String(input.targetPath)
166
+ });
167
+ break;
168
+ case "openfairygui_backend_close_session":
169
+ result = await runtime.closeSession({ sessionId: String(input.sessionId) });
170
+ break;
171
+ case "openfairygui_backend_get_events":
172
+ result = runtime.getEvents({
173
+ sessionId: String(input.sessionId),
174
+ after: input.after === void 0 ? void 0 : String(input.after),
175
+ limit: input.limit === void 0 ? void 0 : Number(input.limit)
176
+ });
177
+ break;
178
+ case "openfairygui_backend_get_job":
179
+ result = runtime.getJob({
180
+ sessionId: String(input.sessionId),
181
+ jobId: String(input.jobId)
182
+ });
183
+ break;
184
+ case "openfairygui_backend_list_jobs":
185
+ result = runtime.listJobs({
186
+ sessionId: String(input.sessionId),
187
+ status: input.status,
188
+ kind: input.kind,
189
+ limit: input.limit === void 0 ? void 0 : Number(input.limit)
190
+ });
191
+ break;
192
+ case "openfairygui_backend_cancel_job":
193
+ result = runtime.cancelJob({
194
+ sessionId: String(input.sessionId),
195
+ jobId: String(input.jobId)
196
+ });
197
+ break;
198
+ case "openfairygui_backend_get_cache_snapshot":
199
+ result = runtime.getCacheSnapshot({ sessionId: String(input.sessionId) });
200
+ break;
201
+ case "openfairygui_backend_refresh_cache":
202
+ result = runtime.refreshCache({
203
+ sessionId: String(input.sessionId),
204
+ reason: input.reason
205
+ });
206
+ break;
207
+ default: throw new Error(`Unknown OpenFairyGUI backend MCP tool: ${name}`);
208
+ }
209
+ return jsonResult(result, isBackendFailure(result));
210
+ }
211
+ //#endregion
212
+ //#region src/tool-definitions.ts
213
+ const OPENFAIRYGUI_BACKEND_TOOL_PREFIX = "openfairygui_backend_";
214
+ const OPENFAIRYGUI_BACKEND_TOOL_NAMES = [
215
+ "openfairygui_backend_get_capabilities",
216
+ "openfairygui_backend_open_session",
217
+ "openfairygui_backend_get_session",
218
+ "openfairygui_backend_apply_transaction",
219
+ "openfairygui_backend_save_session",
220
+ "openfairygui_backend_close_session",
221
+ "openfairygui_backend_get_events",
222
+ "openfairygui_backend_get_job",
223
+ "openfairygui_backend_list_jobs",
224
+ "openfairygui_backend_cancel_job",
225
+ "openfairygui_backend_get_cache_snapshot",
226
+ "openfairygui_backend_refresh_cache"
227
+ ];
228
+ const sessionId = z.string().min(1);
229
+ const jobId = z.string().min(1);
230
+ const expectedRevision = z.number().int().nonnegative();
231
+ const limit = z.number().int().nonnegative().optional();
232
+ const OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA = z.object({ backendResult: z.object({
233
+ ok: z.boolean(),
234
+ data: z.unknown().optional(),
235
+ error: z.unknown().optional(),
236
+ meta: z.unknown().optional()
237
+ }).passthrough() });
238
+ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
239
+ {
240
+ name: "openfairygui_backend_get_capabilities",
241
+ backendMethod: "getCapabilities",
242
+ title: "Get Backend Capabilities",
243
+ description: "Return the OpenFairyGUI backend capability, version, and service-plane snapshot.",
244
+ inputSchema: z.object({}),
245
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
246
+ annotations: {
247
+ readOnlyHint: true,
248
+ idempotentHint: true,
249
+ openWorldHint: false
250
+ }
251
+ },
252
+ {
253
+ name: "openfairygui_backend_open_session",
254
+ backendMethod: "openSession",
255
+ title: "Open Backend Session",
256
+ description: "Open a FairyGUI project through BackendRuntime and acquire its backend-local session lock.",
257
+ inputSchema: z.object({ projectPath: z.string().min(1) }),
258
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
259
+ annotations: {
260
+ readOnlyHint: false,
261
+ idempotentHint: false,
262
+ openWorldHint: false
263
+ }
264
+ },
265
+ {
266
+ name: "openfairygui_backend_get_session",
267
+ backendMethod: "getSession",
268
+ title: "Get Backend Session",
269
+ description: "Return a backend session snapshot by session id.",
270
+ inputSchema: z.object({ sessionId }),
271
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
272
+ annotations: {
273
+ readOnlyHint: true,
274
+ idempotentHint: true,
275
+ openWorldHint: false
276
+ }
277
+ },
278
+ {
279
+ name: "openfairygui_backend_apply_transaction",
280
+ backendMethod: "applyTransaction",
281
+ title: "Apply UAM Transaction",
282
+ description: "Apply a backend revision-checked UAM operation batch without redefining selector or operation grammar.",
283
+ inputSchema: z.object({
284
+ sessionId,
285
+ expectedRevision,
286
+ operations: z.array(z.unknown())
287
+ }),
288
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
289
+ annotations: {
290
+ readOnlyHint: false,
291
+ destructiveHint: true,
292
+ idempotentHint: false,
293
+ openWorldHint: false
294
+ }
295
+ },
296
+ {
297
+ name: "openfairygui_backend_save_session",
298
+ backendMethod: "saveSession",
299
+ title: "Save Backend Session",
300
+ description: "Write the current backend session back through the backend coordinated non-atomic save path.",
301
+ inputSchema: z.object({
302
+ sessionId,
303
+ expectedRevision: expectedRevision.optional(),
304
+ targetPath: z.string().min(1).optional()
305
+ }),
306
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
307
+ annotations: {
308
+ readOnlyHint: false,
309
+ destructiveHint: true,
310
+ idempotentHint: false,
311
+ openWorldHint: false
312
+ }
313
+ },
314
+ {
315
+ name: "openfairygui_backend_close_session",
316
+ backendMethod: "closeSession",
317
+ title: "Close Backend Session",
318
+ description: "Close a backend session and release its backend-local advisory lock.",
319
+ inputSchema: z.object({ sessionId }),
320
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
321
+ annotations: {
322
+ readOnlyHint: false,
323
+ idempotentHint: false,
324
+ openWorldHint: false
325
+ }
326
+ },
327
+ {
328
+ name: "openfairygui_backend_get_events",
329
+ backendMethod: "getEvents",
330
+ title: "Get Runtime Events",
331
+ description: "Poll backend runtime events for a session using the backend P2 event cursor contract.",
332
+ inputSchema: z.object({
333
+ sessionId,
334
+ after: z.string().optional(),
335
+ limit
336
+ }),
337
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
338
+ annotations: {
339
+ readOnlyHint: true,
340
+ idempotentHint: true,
341
+ openWorldHint: false
342
+ }
343
+ },
344
+ {
345
+ name: "openfairygui_backend_get_job",
346
+ backendMethod: "getJob",
347
+ title: "Get Runtime Job",
348
+ description: "Return a backend runtime job snapshot by session and backend-local job id.",
349
+ inputSchema: z.object({
350
+ sessionId,
351
+ jobId
352
+ }),
353
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
354
+ annotations: {
355
+ readOnlyHint: true,
356
+ idempotentHint: true,
357
+ openWorldHint: false
358
+ }
359
+ },
360
+ {
361
+ name: "openfairygui_backend_list_jobs",
362
+ backendMethod: "listJobs",
363
+ title: "List Runtime Jobs",
364
+ description: "List backend runtime jobs for a session with backend P2 status/kind filters.",
365
+ inputSchema: z.object({
366
+ sessionId,
367
+ status: z.enum([
368
+ "queued",
369
+ "running",
370
+ "completed",
371
+ "failed",
372
+ "cancelled",
373
+ "active",
374
+ "terminal"
375
+ ]).optional(),
376
+ kind: z.literal("cache.refresh").optional(),
377
+ limit
378
+ }),
379
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
380
+ annotations: {
381
+ readOnlyHint: true,
382
+ idempotentHint: true,
383
+ openWorldHint: false
384
+ }
385
+ },
386
+ {
387
+ name: "openfairygui_backend_cancel_job",
388
+ backendMethod: "cancelJob",
389
+ title: "Cancel Runtime Job",
390
+ description: "Request cooperative cancellation for a backend runtime job.",
391
+ inputSchema: z.object({
392
+ sessionId,
393
+ jobId
394
+ }),
395
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
396
+ annotations: {
397
+ readOnlyHint: false,
398
+ idempotentHint: false,
399
+ openWorldHint: false
400
+ }
401
+ },
402
+ {
403
+ name: "openfairygui_backend_get_cache_snapshot",
404
+ backendMethod: "getCacheSnapshot",
405
+ title: "Get Cache Snapshot",
406
+ description: "Return the backend P2 derived read-only cache snapshot for a session.",
407
+ inputSchema: z.object({ sessionId }),
408
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
409
+ annotations: {
410
+ readOnlyHint: true,
411
+ idempotentHint: true,
412
+ openWorldHint: false
413
+ }
414
+ },
415
+ {
416
+ name: "openfairygui_backend_refresh_cache",
417
+ backendMethod: "refreshCache",
418
+ title: "Refresh Cache",
419
+ description: "Create a backend P2 cache.refresh job for the session cache snapshot.",
420
+ inputSchema: z.object({
421
+ sessionId,
422
+ reason: z.enum([
423
+ "manual",
424
+ "session_open",
425
+ "after_save"
426
+ ]).optional()
427
+ }),
428
+ outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
429
+ annotations: {
430
+ readOnlyHint: false,
431
+ idempotentHint: false,
432
+ openWorldHint: false
433
+ }
434
+ }
435
+ ];
436
+ //#endregion
437
+ //#region src/server.ts
438
+ const PACKAGE_VERSION = process.env.npm_package_version ?? "0.2.0-alpha.0";
439
+ function createOpenFairyGuiMcpServer(options = {}) {
440
+ const runtime = options.runtime ?? new BackendRuntime();
441
+ const server = new McpServer({
442
+ name: options.name ?? "openfairygui-mcp",
443
+ version: options.version ?? PACKAGE_VERSION
444
+ });
445
+ for (const definition of OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS) server.registerTool(definition.name, {
446
+ title: definition.title,
447
+ description: definition.description,
448
+ inputSchema: definition.inputSchema,
449
+ outputSchema: definition.outputSchema,
450
+ annotations: definition.annotations,
451
+ _meta: {
452
+ "openfairygui/backendMethod": definition.backendMethod,
453
+ "openfairygui/adapter": "thin-backend-p2"
454
+ }
455
+ }, async (args) => callOpenFairyGuiBackendTool(runtime, definition.name, args));
456
+ registerOpenFairyGuiBackendResources(server, runtime);
457
+ registerOpenFairyGuiBackendPrompts(server);
458
+ return server;
459
+ }
460
+ //#endregion
461
+ //#region src/stdio.ts
462
+ async function connectOpenFairyGuiMcpStdio() {
463
+ await createOpenFairyGuiMcpServer().connect(new StdioServerTransport());
464
+ }
465
+ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) connectOpenFairyGuiMcpStdio().catch((error) => {
466
+ console.error(error instanceof Error ? error.stack ?? error.message : String(error));
467
+ process.exitCode = 1;
468
+ });
469
+ //#endregion
470
+ export { OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA as a, OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI as c, OPENFAIRYGUI_BACKEND_PROMPT_NAMES as d, OPENFAIRYGUI_BACKEND_TOOL_NAMES as i, OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES as l, createOpenFairyGuiMcpServer as n, OPENFAIRYGUI_BACKEND_TOOL_PREFIX as o, OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS as r, callOpenFairyGuiBackendTool as s, connectOpenFairyGuiMcpStdio as t, OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS as u };
package/dist/stdio.cjs ADDED
@@ -0,0 +1,3 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_stdio = require("./stdio-BDHxauin.cjs");
3
+ exports.connectOpenFairyGuiMcpStdio = require_stdio.connectOpenFairyGuiMcpStdio;
@@ -0,0 +1,4 @@
1
+ //#region src/stdio.d.ts
2
+ declare function connectOpenFairyGuiMcpStdio(): Promise<void>;
3
+ //#endregion
4
+ export { connectOpenFairyGuiMcpStdio };
@@ -0,0 +1,4 @@
1
+ //#region src/stdio.d.ts
2
+ declare function connectOpenFairyGuiMcpStdio(): Promise<void>;
3
+ //#endregion
4
+ export { connectOpenFairyGuiMcpStdio };
package/dist/stdio.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { t as connectOpenFairyGuiMcpStdio } from "./stdio-ByGWerIG.mjs";
2
+ export { connectOpenFairyGuiMcpStdio };
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "@openfairygui/mcp",
3
+ "version": "0.2.0-alpha.0",
4
+ "description": "FairyGUI Headless Authoring SDK - MCP server adapter for the backend runtime.",
5
+ "author": "OpenFairyGUI Contributors",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/OpenFairyGUI/OpenFairyGUI.git",
10
+ "directory": "packages/mcp"
11
+ },
12
+ "homepage": "https://github.com/OpenFairyGUI/OpenFairyGUI#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/OpenFairyGUI/OpenFairyGUI/issues"
15
+ },
16
+ "type": "module",
17
+ "sideEffects": false,
18
+ "main": "./dist/index.cjs",
19
+ "module": "./dist/index.mjs",
20
+ "types": "./dist/index.d.mts",
21
+ "exports": {
22
+ ".": {
23
+ "require": {
24
+ "types": "./dist/index.d.cts",
25
+ "default": "./dist/index.cjs"
26
+ },
27
+ "default": {
28
+ "types": "./dist/index.d.mts",
29
+ "default": "./dist/index.mjs"
30
+ }
31
+ },
32
+ "./stdio": {
33
+ "require": {
34
+ "types": "./dist/stdio.d.cts",
35
+ "default": "./dist/stdio.cjs"
36
+ },
37
+ "default": {
38
+ "types": "./dist/stdio.d.mts",
39
+ "default": "./dist/stdio.mjs"
40
+ }
41
+ }
42
+ },
43
+ "bin": {
44
+ "ofgui-mcp": "bin/ofgui-mcp.cjs"
45
+ },
46
+ "scripts": {
47
+ "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",
48
+ "build:watch": "tsdown src/index.ts src/stdio.ts --watch --format esm,cjs --platform node --env.PACKAGE_VERSION=$npm_package_version",
49
+ "test": "ava test/**/*.test.ts --no-worker-threads"
50
+ },
51
+ "files": [
52
+ "dist/",
53
+ "bin/",
54
+ "src/"
55
+ ],
56
+ "keywords": [
57
+ "fairygui",
58
+ "mcp",
59
+ "model-context-protocol",
60
+ "backend",
61
+ "authoring"
62
+ ],
63
+ "dependencies": {
64
+ "@modelcontextprotocol/sdk": "^1.29.0",
65
+ "@openfairygui/backend": "workspace:*",
66
+ "zod": "^4.3.6"
67
+ },
68
+ "devDependencies": {
69
+ "@openfairygui/core": "workspace:*",
70
+ "ava": "^7.0.0",
71
+ "tsx": "^4.0.0"
72
+ },
73
+ "ava": {
74
+ "extensions": {
75
+ "ts": "module"
76
+ },
77
+ "nodeArguments": [
78
+ "--import",
79
+ "tsx/esm"
80
+ ],
81
+ "files": [
82
+ "test/**/*.test.ts"
83
+ ]
84
+ }
85
+ }
package/src/index.ts ADDED
@@ -0,0 +1,28 @@
1
+ export {
2
+ createOpenFairyGuiMcpServer,
3
+ type CreateOpenFairyGuiMcpServerOptions,
4
+ } from './server.js';
5
+ export {
6
+ connectOpenFairyGuiMcpStdio,
7
+ } from './stdio.js';
8
+ export {
9
+ callOpenFairyGuiBackendTool,
10
+ } from './tool-handler.js';
11
+ export {
12
+ OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS,
13
+ OPENFAIRYGUI_BACKEND_PROMPT_NAMES,
14
+ type OpenFairyGuiBackendPromptName,
15
+ } from './prompt-definitions.js';
16
+ export {
17
+ OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI,
18
+ OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES,
19
+ } from './resource-definitions.js';
20
+ export {
21
+ OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS,
22
+ OPENFAIRYGUI_BACKEND_TOOL_NAMES,
23
+ OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
24
+ OPENFAIRYGUI_BACKEND_TOOL_PREFIX,
25
+ type BackendMethodName,
26
+ type OpenFairyGuiBackendToolDefinition,
27
+ type OpenFairyGuiBackendToolName,
28
+ } from './tool-definitions.js';