@openfairygui/mcp 0.2.0-alpha.2 → 0.2.0-alpha.3
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.d.cts +12 -11
- package/dist/index.d.mts +12 -11
- package/package.json +3 -3
- package/src/index.ts +1 -0
- package/src/resource-definitions.ts +2 -2
- package/src/server.ts +2 -3
- package/src/tool-handler.ts +18 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
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
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"];
|
|
@@ -342,7 +334,16 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
|
|
|
342
334
|
}];
|
|
343
335
|
//#endregion
|
|
344
336
|
//#region src/tool-handler.d.ts
|
|
345
|
-
|
|
337
|
+
type OpenFairyGuiBackendRuntime = Pick<BackendRuntime, 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'applyTransaction' | 'saveSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache'>;
|
|
338
|
+
declare function callOpenFairyGuiBackendTool(runtime: OpenFairyGuiBackendRuntime, name: OpenFairyGuiBackendToolName, input: Record<string, unknown>): Promise<CallToolResult>;
|
|
339
|
+
//#endregion
|
|
340
|
+
//#region src/server.d.ts
|
|
341
|
+
interface CreateOpenFairyGuiMcpServerOptions {
|
|
342
|
+
runtime?: OpenFairyGuiBackendRuntime;
|
|
343
|
+
name?: string;
|
|
344
|
+
version?: string;
|
|
345
|
+
}
|
|
346
|
+
declare function createOpenFairyGuiMcpServer(options?: CreateOpenFairyGuiMcpServerOptions): McpServer;
|
|
346
347
|
//#endregion
|
|
347
348
|
//#region src/prompt-definitions.d.ts
|
|
348
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"];
|
|
@@ -378,4 +379,4 @@ declare const OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS: readonly [{
|
|
|
378
379
|
declare const OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI = "openfairygui://backend/capabilities";
|
|
379
380
|
declare const OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES: readonly ["openfairygui://backend/session/{sessionId}", "openfairygui://backend/cache/{sessionId}", "openfairygui://backend/job/{sessionId}/{jobId}"];
|
|
380
381
|
//#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 };
|
|
382
|
+
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,17 +1,9 @@
|
|
|
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
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"];
|
|
@@ -342,7 +334,16 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
|
|
|
342
334
|
}];
|
|
343
335
|
//#endregion
|
|
344
336
|
//#region src/tool-handler.d.ts
|
|
345
|
-
|
|
337
|
+
type OpenFairyGuiBackendRuntime = Pick<BackendRuntime, 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'applyTransaction' | 'saveSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache'>;
|
|
338
|
+
declare function callOpenFairyGuiBackendTool(runtime: OpenFairyGuiBackendRuntime, name: OpenFairyGuiBackendToolName, input: Record<string, unknown>): Promise<CallToolResult>;
|
|
339
|
+
//#endregion
|
|
340
|
+
//#region src/server.d.ts
|
|
341
|
+
interface CreateOpenFairyGuiMcpServerOptions {
|
|
342
|
+
runtime?: OpenFairyGuiBackendRuntime;
|
|
343
|
+
name?: string;
|
|
344
|
+
version?: string;
|
|
345
|
+
}
|
|
346
|
+
declare function createOpenFairyGuiMcpServer(options?: CreateOpenFairyGuiMcpServerOptions): McpServer;
|
|
346
347
|
//#endregion
|
|
347
348
|
//#region src/prompt-definitions.d.ts
|
|
348
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"];
|
|
@@ -378,4 +379,4 @@ declare const OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS: readonly [{
|
|
|
378
379
|
declare const OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI = "openfairygui://backend/capabilities";
|
|
379
380
|
declare const OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES: readonly ["openfairygui://backend/session/{sessionId}", "openfairygui://backend/cache/{sessionId}", "openfairygui://backend/job/{sessionId}/{jobId}"];
|
|
380
381
|
//#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 };
|
|
382
|
+
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfairygui/mcp",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.3",
|
|
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,12 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
60
60
|
"zod": "^4.3.6",
|
|
61
|
-
"@openfairygui/backend": "0.2.0-alpha.
|
|
61
|
+
"@openfairygui/backend": "0.2.0-alpha.3"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"ava": "^7.0.0",
|
|
65
65
|
"tsx": "^4.0.0",
|
|
66
|
-
"@openfairygui/core": "0.2.0-alpha.
|
|
66
|
+
"@openfairygui/core": "0.2.0-alpha.3"
|
|
67
67
|
},
|
|
68
68
|
"ava": {
|
|
69
69
|
"extensions": {
|
package/src/index.ts
CHANGED
|
@@ -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 {
|
|
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:
|
|
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,9 +1,8 @@
|
|
|
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';
|
|
4
3
|
import { registerOpenFairyGuiBackendPrompts } from './prompt-definitions.js';
|
|
5
4
|
import { registerOpenFairyGuiBackendResources } from './resource-definitions.js';
|
|
6
|
-
import { callOpenFairyGuiBackendTool } from './tool-handler.js';
|
|
5
|
+
import { callOpenFairyGuiBackendTool, type OpenFairyGuiBackendRuntime } from './tool-handler.js';
|
|
7
6
|
import {
|
|
8
7
|
OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS,
|
|
9
8
|
type OpenFairyGuiBackendToolName,
|
|
@@ -12,7 +11,7 @@ import {
|
|
|
12
11
|
const PACKAGE_VERSION = process.env.npm_package_version ?? '0.2.0-alpha.0';
|
|
13
12
|
|
|
14
13
|
export interface CreateOpenFairyGuiMcpServerOptions {
|
|
15
|
-
runtime?:
|
|
14
|
+
runtime?: OpenFairyGuiBackendRuntime;
|
|
16
15
|
name?: string;
|
|
17
16
|
version?: string;
|
|
18
17
|
}
|
package/src/tool-handler.ts
CHANGED
|
@@ -2,6 +2,23 @@ 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
|
+
| 'closeSession'
|
|
14
|
+
| 'getEvents'
|
|
15
|
+
| 'getJob'
|
|
16
|
+
| 'listJobs'
|
|
17
|
+
| 'cancelJob'
|
|
18
|
+
| 'getCacheSnapshot'
|
|
19
|
+
| 'refreshCache'
|
|
20
|
+
>;
|
|
21
|
+
|
|
5
22
|
function jsonResult(payload: unknown, isError = false): CallToolResult {
|
|
6
23
|
return {
|
|
7
24
|
content: [
|
|
@@ -25,7 +42,7 @@ function isBackendFailure(value: unknown): boolean {
|
|
|
25
42
|
}
|
|
26
43
|
|
|
27
44
|
export async function callOpenFairyGuiBackendTool(
|
|
28
|
-
runtime:
|
|
45
|
+
runtime: OpenFairyGuiBackendRuntime,
|
|
29
46
|
name: OpenFairyGuiBackendToolName,
|
|
30
47
|
input: Record<string, unknown>,
|
|
31
48
|
): Promise<CallToolResult> {
|