@openfairygui/mcp 0.2.0-alpha.0 → 0.2.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/dist/index.cjs +1 -1
- package/dist/index.d.cts +26 -2
- package/dist/index.d.mts +27 -3
- package/dist/index.mjs +1 -1
- package/dist/{stdio-BDHxauin.cjs → stdio-Ckmxm29z.cjs} +29 -2
- package/dist/{stdio-ByGWerIG.mjs → stdio-DT1cUPJ3.mjs} +29 -2
- package/dist/stdio.cjs +1 -1
- package/dist/stdio.mjs +1 -1
- package/package.json +1 -1
- package/src/server.ts +3 -2
- package/src/tool-definitions.ts +16 -0
- package/src/tool-handler.ts +8 -0
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_stdio = require("./stdio-
|
|
2
|
+
const require_stdio = require("./stdio-Ckmxm29z.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
|
@@ -14,9 +14,9 @@ declare function createOpenFairyGuiMcpServer(options?: CreateOpenFairyGuiMcpServ
|
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/tool-definitions.d.ts
|
|
16
16
|
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_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"];
|
|
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"];
|
|
18
18
|
type OpenFairyGuiBackendToolName = typeof OPENFAIRYGUI_BACKEND_TOOL_NAMES[number];
|
|
19
|
-
type BackendMethodName = 'getCapabilities' | 'openSession' | 'getSession' | 'applyTransaction' | 'saveSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache';
|
|
19
|
+
type BackendMethodName = 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'applyTransaction' | 'saveSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache';
|
|
20
20
|
interface OpenFairyGuiBackendToolDefinition {
|
|
21
21
|
name: OpenFairyGuiBackendToolName;
|
|
22
22
|
backendMethod: BackendMethodName;
|
|
@@ -79,6 +79,30 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
|
|
|
79
79
|
readonly idempotentHint: false;
|
|
80
80
|
readonly openWorldHint: false;
|
|
81
81
|
};
|
|
82
|
+
}, {
|
|
83
|
+
readonly name: "openfairygui_backend_open_project_session";
|
|
84
|
+
readonly backendMethod: "openProjectSession";
|
|
85
|
+
readonly title: "Open Project Session";
|
|
86
|
+
readonly description: "Open a browser-safe backend session from an already loaded UAM project without filesystem access.";
|
|
87
|
+
readonly inputSchema: z.ZodObject<{
|
|
88
|
+
project: z.ZodUnknown;
|
|
89
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
90
|
+
canonicalProjectPath: z.ZodOptional<z.ZodString>;
|
|
91
|
+
canonicalPathKey: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
readonly outputSchema: z.ZodObject<{
|
|
94
|
+
backendResult: z.ZodObject<{
|
|
95
|
+
ok: z.ZodBoolean;
|
|
96
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
97
|
+
error: z.ZodOptional<z.ZodUnknown>;
|
|
98
|
+
meta: z.ZodOptional<z.ZodUnknown>;
|
|
99
|
+
}, z.core.$loose>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
readonly annotations: {
|
|
102
|
+
readonly readOnlyHint: false;
|
|
103
|
+
readonly idempotentHint: false;
|
|
104
|
+
readonly openWorldHint: false;
|
|
105
|
+
};
|
|
82
106
|
}, {
|
|
83
107
|
readonly name: "openfairygui_backend_get_session";
|
|
84
108
|
readonly backendMethod: "getSession";
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { connectOpenFairyGuiMcpStdio } from "./stdio.mjs";
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
-
import { BackendRuntime } from "@openfairygui/backend";
|
|
4
3
|
import { z } from "zod";
|
|
4
|
+
import { BackendRuntime } from "@openfairygui/backend";
|
|
5
5
|
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
6
6
|
|
|
7
7
|
//#region src/server.d.ts
|
|
@@ -14,9 +14,9 @@ declare function createOpenFairyGuiMcpServer(options?: CreateOpenFairyGuiMcpServ
|
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/tool-definitions.d.ts
|
|
16
16
|
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_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"];
|
|
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"];
|
|
18
18
|
type OpenFairyGuiBackendToolName = typeof OPENFAIRYGUI_BACKEND_TOOL_NAMES[number];
|
|
19
|
-
type BackendMethodName = 'getCapabilities' | 'openSession' | 'getSession' | 'applyTransaction' | 'saveSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache';
|
|
19
|
+
type BackendMethodName = 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'applyTransaction' | 'saveSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache';
|
|
20
20
|
interface OpenFairyGuiBackendToolDefinition {
|
|
21
21
|
name: OpenFairyGuiBackendToolName;
|
|
22
22
|
backendMethod: BackendMethodName;
|
|
@@ -79,6 +79,30 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
|
|
|
79
79
|
readonly idempotentHint: false;
|
|
80
80
|
readonly openWorldHint: false;
|
|
81
81
|
};
|
|
82
|
+
}, {
|
|
83
|
+
readonly name: "openfairygui_backend_open_project_session";
|
|
84
|
+
readonly backendMethod: "openProjectSession";
|
|
85
|
+
readonly title: "Open Project Session";
|
|
86
|
+
readonly description: "Open a browser-safe backend session from an already loaded UAM project without filesystem access.";
|
|
87
|
+
readonly inputSchema: z.ZodObject<{
|
|
88
|
+
project: z.ZodUnknown;
|
|
89
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
90
|
+
canonicalProjectPath: z.ZodOptional<z.ZodString>;
|
|
91
|
+
canonicalPathKey: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
readonly outputSchema: z.ZodObject<{
|
|
94
|
+
backendResult: z.ZodObject<{
|
|
95
|
+
ok: z.ZodBoolean;
|
|
96
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
97
|
+
error: z.ZodOptional<z.ZodUnknown>;
|
|
98
|
+
meta: z.ZodOptional<z.ZodUnknown>;
|
|
99
|
+
}, z.core.$loose>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
readonly annotations: {
|
|
102
|
+
readonly readOnlyHint: false;
|
|
103
|
+
readonly idempotentHint: false;
|
|
104
|
+
readonly openWorldHint: false;
|
|
105
|
+
};
|
|
82
106
|
}, {
|
|
83
107
|
readonly name: "openfairygui_backend_get_session";
|
|
84
108
|
readonly backendMethod: "getSession";
|
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-
|
|
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";
|
|
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,5 @@
|
|
|
1
1
|
let _modelcontextprotocol_sdk_server_mcp_js = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
2
|
-
let
|
|
2
|
+
let _openfairygui_backend_node = require("@openfairygui/backend/node");
|
|
3
3
|
let zod = require("zod");
|
|
4
4
|
let _modelcontextprotocol_sdk_server_stdio_js = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
5
5
|
let node_url = require("node:url");
|
|
@@ -148,6 +148,14 @@ async function callOpenFairyGuiBackendTool(runtime, name, input) {
|
|
|
148
148
|
case "openfairygui_backend_open_session":
|
|
149
149
|
result = await runtime.openSession({ projectPath: String(input.projectPath) });
|
|
150
150
|
break;
|
|
151
|
+
case "openfairygui_backend_open_project_session":
|
|
152
|
+
result = runtime.openProjectSession({
|
|
153
|
+
project: input.project,
|
|
154
|
+
sessionId: input.sessionId === void 0 ? void 0 : String(input.sessionId),
|
|
155
|
+
canonicalProjectPath: input.canonicalProjectPath === void 0 ? void 0 : String(input.canonicalProjectPath),
|
|
156
|
+
canonicalPathKey: input.canonicalPathKey === void 0 ? void 0 : String(input.canonicalPathKey)
|
|
157
|
+
});
|
|
158
|
+
break;
|
|
151
159
|
case "openfairygui_backend_get_session":
|
|
152
160
|
result = runtime.getSession({ sessionId: String(input.sessionId) });
|
|
153
161
|
break;
|
|
@@ -214,6 +222,7 @@ const OPENFAIRYGUI_BACKEND_TOOL_PREFIX = "openfairygui_backend_";
|
|
|
214
222
|
const OPENFAIRYGUI_BACKEND_TOOL_NAMES = [
|
|
215
223
|
"openfairygui_backend_get_capabilities",
|
|
216
224
|
"openfairygui_backend_open_session",
|
|
225
|
+
"openfairygui_backend_open_project_session",
|
|
217
226
|
"openfairygui_backend_get_session",
|
|
218
227
|
"openfairygui_backend_apply_transaction",
|
|
219
228
|
"openfairygui_backend_save_session",
|
|
@@ -262,6 +271,24 @@ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
|
|
|
262
271
|
openWorldHint: false
|
|
263
272
|
}
|
|
264
273
|
},
|
|
274
|
+
{
|
|
275
|
+
name: "openfairygui_backend_open_project_session",
|
|
276
|
+
backendMethod: "openProjectSession",
|
|
277
|
+
title: "Open Project Session",
|
|
278
|
+
description: "Open a browser-safe backend session from an already loaded UAM project without filesystem access.",
|
|
279
|
+
inputSchema: zod.z.object({
|
|
280
|
+
project: zod.z.unknown(),
|
|
281
|
+
sessionId: zod.z.string().min(1).optional(),
|
|
282
|
+
canonicalProjectPath: zod.z.string().min(1).optional(),
|
|
283
|
+
canonicalPathKey: zod.z.string().min(1).optional()
|
|
284
|
+
}),
|
|
285
|
+
outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
|
|
286
|
+
annotations: {
|
|
287
|
+
readOnlyHint: false,
|
|
288
|
+
idempotentHint: false,
|
|
289
|
+
openWorldHint: false
|
|
290
|
+
}
|
|
291
|
+
},
|
|
265
292
|
{
|
|
266
293
|
name: "openfairygui_backend_get_session",
|
|
267
294
|
backendMethod: "getSession",
|
|
@@ -437,7 +464,7 @@ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
|
|
|
437
464
|
//#region src/server.ts
|
|
438
465
|
const PACKAGE_VERSION = process.env.npm_package_version ?? "0.2.0-alpha.0";
|
|
439
466
|
function createOpenFairyGuiMcpServer(options = {}) {
|
|
440
|
-
const runtime = options.runtime ??
|
|
467
|
+
const runtime = options.runtime ?? (0, _openfairygui_backend_node.createNodeBackendRuntime)();
|
|
441
468
|
const server = new _modelcontextprotocol_sdk_server_mcp_js.McpServer({
|
|
442
469
|
name: options.name ?? "openfairygui-mcp",
|
|
443
470
|
version: options.version ?? PACKAGE_VERSION
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import {
|
|
2
|
+
import { createNodeBackendRuntime } from "@openfairygui/backend/node";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
@@ -148,6 +148,14 @@ async function callOpenFairyGuiBackendTool(runtime, name, input) {
|
|
|
148
148
|
case "openfairygui_backend_open_session":
|
|
149
149
|
result = await runtime.openSession({ projectPath: String(input.projectPath) });
|
|
150
150
|
break;
|
|
151
|
+
case "openfairygui_backend_open_project_session":
|
|
152
|
+
result = runtime.openProjectSession({
|
|
153
|
+
project: input.project,
|
|
154
|
+
sessionId: input.sessionId === void 0 ? void 0 : String(input.sessionId),
|
|
155
|
+
canonicalProjectPath: input.canonicalProjectPath === void 0 ? void 0 : String(input.canonicalProjectPath),
|
|
156
|
+
canonicalPathKey: input.canonicalPathKey === void 0 ? void 0 : String(input.canonicalPathKey)
|
|
157
|
+
});
|
|
158
|
+
break;
|
|
151
159
|
case "openfairygui_backend_get_session":
|
|
152
160
|
result = runtime.getSession({ sessionId: String(input.sessionId) });
|
|
153
161
|
break;
|
|
@@ -214,6 +222,7 @@ const OPENFAIRYGUI_BACKEND_TOOL_PREFIX = "openfairygui_backend_";
|
|
|
214
222
|
const OPENFAIRYGUI_BACKEND_TOOL_NAMES = [
|
|
215
223
|
"openfairygui_backend_get_capabilities",
|
|
216
224
|
"openfairygui_backend_open_session",
|
|
225
|
+
"openfairygui_backend_open_project_session",
|
|
217
226
|
"openfairygui_backend_get_session",
|
|
218
227
|
"openfairygui_backend_apply_transaction",
|
|
219
228
|
"openfairygui_backend_save_session",
|
|
@@ -262,6 +271,24 @@ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
|
|
|
262
271
|
openWorldHint: false
|
|
263
272
|
}
|
|
264
273
|
},
|
|
274
|
+
{
|
|
275
|
+
name: "openfairygui_backend_open_project_session",
|
|
276
|
+
backendMethod: "openProjectSession",
|
|
277
|
+
title: "Open Project Session",
|
|
278
|
+
description: "Open a browser-safe backend session from an already loaded UAM project without filesystem access.",
|
|
279
|
+
inputSchema: z.object({
|
|
280
|
+
project: z.unknown(),
|
|
281
|
+
sessionId: z.string().min(1).optional(),
|
|
282
|
+
canonicalProjectPath: z.string().min(1).optional(),
|
|
283
|
+
canonicalPathKey: z.string().min(1).optional()
|
|
284
|
+
}),
|
|
285
|
+
outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
|
|
286
|
+
annotations: {
|
|
287
|
+
readOnlyHint: false,
|
|
288
|
+
idempotentHint: false,
|
|
289
|
+
openWorldHint: false
|
|
290
|
+
}
|
|
291
|
+
},
|
|
265
292
|
{
|
|
266
293
|
name: "openfairygui_backend_get_session",
|
|
267
294
|
backendMethod: "getSession",
|
|
@@ -437,7 +464,7 @@ const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
|
|
|
437
464
|
//#region src/server.ts
|
|
438
465
|
const PACKAGE_VERSION = process.env.npm_package_version ?? "0.2.0-alpha.0";
|
|
439
466
|
function createOpenFairyGuiMcpServer(options = {}) {
|
|
440
|
-
const runtime = options.runtime ??
|
|
467
|
+
const runtime = options.runtime ?? createNodeBackendRuntime();
|
|
441
468
|
const server = new McpServer({
|
|
442
469
|
name: options.name ?? "openfairygui-mcp",
|
|
443
470
|
version: options.version ?? PACKAGE_VERSION
|
package/dist/stdio.cjs
CHANGED
package/dist/stdio.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as connectOpenFairyGuiMcpStdio } from "./stdio-
|
|
1
|
+
import { t as connectOpenFairyGuiMcpStdio } from "./stdio-DT1cUPJ3.mjs";
|
|
2
2
|
export { connectOpenFairyGuiMcpStdio };
|
package/package.json
CHANGED
package/src/server.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import { BackendRuntime } from '@openfairygui/backend';
|
|
2
|
+
import type { BackendRuntime } from '@openfairygui/backend';
|
|
3
|
+
import { createNodeBackendRuntime } from '@openfairygui/backend/node';
|
|
3
4
|
import { registerOpenFairyGuiBackendPrompts } from './prompt-definitions.js';
|
|
4
5
|
import { registerOpenFairyGuiBackendResources } from './resource-definitions.js';
|
|
5
6
|
import { callOpenFairyGuiBackendTool } from './tool-handler.js';
|
|
@@ -17,7 +18,7 @@ export interface CreateOpenFairyGuiMcpServerOptions {
|
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export function createOpenFairyGuiMcpServer(options: CreateOpenFairyGuiMcpServerOptions = {}): McpServer {
|
|
20
|
-
const runtime = options.runtime ??
|
|
21
|
+
const runtime = options.runtime ?? createNodeBackendRuntime();
|
|
21
22
|
const server = new McpServer({
|
|
22
23
|
name: options.name ?? 'openfairygui-mcp',
|
|
23
24
|
version: options.version ?? PACKAGE_VERSION,
|
package/src/tool-definitions.ts
CHANGED
|
@@ -5,6 +5,7 @@ export const OPENFAIRYGUI_BACKEND_TOOL_PREFIX = 'openfairygui_backend_';
|
|
|
5
5
|
export const OPENFAIRYGUI_BACKEND_TOOL_NAMES = [
|
|
6
6
|
'openfairygui_backend_get_capabilities',
|
|
7
7
|
'openfairygui_backend_open_session',
|
|
8
|
+
'openfairygui_backend_open_project_session',
|
|
8
9
|
'openfairygui_backend_get_session',
|
|
9
10
|
'openfairygui_backend_apply_transaction',
|
|
10
11
|
'openfairygui_backend_save_session',
|
|
@@ -22,6 +23,7 @@ export type OpenFairyGuiBackendToolName = typeof OPENFAIRYGUI_BACKEND_TOOL_NAMES
|
|
|
22
23
|
export type BackendMethodName =
|
|
23
24
|
| 'getCapabilities'
|
|
24
25
|
| 'openSession'
|
|
26
|
+
| 'openProjectSession'
|
|
25
27
|
| 'getSession'
|
|
26
28
|
| 'applyTransaction'
|
|
27
29
|
| 'saveSession'
|
|
@@ -83,6 +85,20 @@ export const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS = [
|
|
|
83
85
|
outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
|
|
84
86
|
annotations: { readOnlyHint: false, idempotentHint: false, openWorldHint: false },
|
|
85
87
|
},
|
|
88
|
+
{
|
|
89
|
+
name: 'openfairygui_backend_open_project_session',
|
|
90
|
+
backendMethod: 'openProjectSession',
|
|
91
|
+
title: 'Open Project Session',
|
|
92
|
+
description: 'Open a browser-safe backend session from an already loaded UAM project without filesystem access.',
|
|
93
|
+
inputSchema: z.object({
|
|
94
|
+
project: z.unknown(),
|
|
95
|
+
sessionId: z.string().min(1).optional(),
|
|
96
|
+
canonicalProjectPath: z.string().min(1).optional(),
|
|
97
|
+
canonicalPathKey: z.string().min(1).optional(),
|
|
98
|
+
}),
|
|
99
|
+
outputSchema: OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA,
|
|
100
|
+
annotations: { readOnlyHint: false, idempotentHint: false, openWorldHint: false },
|
|
101
|
+
},
|
|
86
102
|
{
|
|
87
103
|
name: 'openfairygui_backend_get_session',
|
|
88
104
|
backendMethod: 'getSession',
|
package/src/tool-handler.ts
CHANGED
|
@@ -39,6 +39,14 @@ export async function callOpenFairyGuiBackendTool(
|
|
|
39
39
|
projectPath: String(input.projectPath),
|
|
40
40
|
});
|
|
41
41
|
break;
|
|
42
|
+
case 'openfairygui_backend_open_project_session':
|
|
43
|
+
result = runtime.openProjectSession({
|
|
44
|
+
project: input.project as Parameters<BackendRuntime['openProjectSession']>[0]['project'],
|
|
45
|
+
sessionId: input.sessionId === undefined ? undefined : String(input.sessionId),
|
|
46
|
+
canonicalProjectPath: input.canonicalProjectPath === undefined ? undefined : String(input.canonicalProjectPath),
|
|
47
|
+
canonicalPathKey: input.canonicalPathKey === undefined ? undefined : String(input.canonicalPathKey),
|
|
48
|
+
});
|
|
49
|
+
break;
|
|
42
50
|
case 'openfairygui_backend_get_session':
|
|
43
51
|
result = runtime.getSession({
|
|
44
52
|
sessionId: String(input.sessionId),
|