@eclipse-glsp/server-mcp 2.7.0-next.9
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/LICENSE +642 -0
- package/README.md +57 -0
- package/lib/index.d.ts +23 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +41 -0
- package/lib/index.js.map +1 -0
- package/lib/prompts/handlers/describe-diagram-mcp-prompt-handler.d.ts +43 -0
- package/lib/prompts/handlers/describe-diagram-mcp-prompt-handler.d.ts.map +1 -0
- package/lib/prompts/handlers/describe-diagram-mcp-prompt-handler.js +96 -0
- package/lib/prompts/handlers/describe-diagram-mcp-prompt-handler.js.map +1 -0
- package/lib/prompts/handlers/suggest-improvements-mcp-prompt-handler.d.ts +43 -0
- package/lib/prompts/handlers/suggest-improvements-mcp-prompt-handler.d.ts.map +1 -0
- package/lib/prompts/handlers/suggest-improvements-mcp-prompt-handler.js +95 -0
- package/lib/prompts/handlers/suggest-improvements-mcp-prompt-handler.js.map +1 -0
- package/lib/prompts/index.d.ts +18 -0
- package/lib/prompts/index.d.ts.map +1 -0
- package/lib/prompts/index.js +34 -0
- package/lib/prompts/index.js.map +1 -0
- package/lib/resources/handlers/diagram-png-mcp-resource-handler.d.ts +81 -0
- package/lib/resources/handlers/diagram-png-mcp-resource-handler.d.ts.map +1 -0
- package/lib/resources/handlers/diagram-png-mcp-resource-handler.js +174 -0
- package/lib/resources/handlers/diagram-png-mcp-resource-handler.js.map +1 -0
- package/lib/resources/handlers/diagram-svg-mcp-resource-handler.d.ts +52 -0
- package/lib/resources/handlers/diagram-svg-mcp-resource-handler.d.ts.map +1 -0
- package/lib/resources/handlers/diagram-svg-mcp-resource-handler.js +96 -0
- package/lib/resources/handlers/diagram-svg-mcp-resource-handler.js.map +1 -0
- package/lib/resources/index.d.ts +20 -0
- package/lib/resources/index.d.ts.map +1 -0
- package/lib/resources/index.js +36 -0
- package/lib/resources/index.js.map +1 -0
- package/lib/resources/services/element-types-provider.d.ts +65 -0
- package/lib/resources/services/element-types-provider.d.ts.map +1 -0
- package/lib/resources/services/element-types-provider.js +81 -0
- package/lib/resources/services/element-types-provider.js.map +1 -0
- package/lib/resources/services/mcp-model-serializer.d.ts +78 -0
- package/lib/resources/services/mcp-model-serializer.d.ts.map +1 -0
- package/lib/resources/services/mcp-model-serializer.js +188 -0
- package/lib/resources/services/mcp-model-serializer.js.map +1 -0
- package/lib/server/glsp-mcp-server.d.ts +82 -0
- package/lib/server/glsp-mcp-server.d.ts.map +1 -0
- package/lib/server/glsp-mcp-server.js +140 -0
- package/lib/server/glsp-mcp-server.js.map +1 -0
- package/lib/server/index.d.ts +37 -0
- package/lib/server/index.d.ts.map +1 -0
- package/lib/server/index.js +57 -0
- package/lib/server/index.js.map +1 -0
- package/lib/server/lru-event-store.d.ts +53 -0
- package/lib/server/lru-event-store.d.ts.map +1 -0
- package/lib/server/lru-event-store.js +100 -0
- package/lib/server/lru-event-store.js.map +1 -0
- package/lib/server/mcp-diagram-handler-dispatcher.d.ts +144 -0
- package/lib/server/mcp-diagram-handler-dispatcher.d.ts.map +1 -0
- package/lib/server/mcp-diagram-handler-dispatcher.js +382 -0
- package/lib/server/mcp-diagram-handler-dispatcher.js.map +1 -0
- package/lib/server/mcp-diagram-module.d.ts +123 -0
- package/lib/server/mcp-diagram-module.d.ts.map +1 -0
- package/lib/server/mcp-diagram-module.js +186 -0
- package/lib/server/mcp-diagram-module.js.map +1 -0
- package/lib/server/mcp-diagram-prompt-handler-registry.d.ts +33 -0
- package/lib/server/mcp-diagram-prompt-handler-registry.d.ts.map +1 -0
- package/lib/server/mcp-diagram-prompt-handler-registry.js +76 -0
- package/lib/server/mcp-diagram-prompt-handler-registry.js.map +1 -0
- package/lib/server/mcp-diagram-resource-handler-registry.d.ts +35 -0
- package/lib/server/mcp-diagram-resource-handler-registry.d.ts.map +1 -0
- package/lib/server/mcp-diagram-resource-handler-registry.js +94 -0
- package/lib/server/mcp-diagram-resource-handler-registry.js.map +1 -0
- package/lib/server/mcp-diagram-tool-handler-registry.d.ts +57 -0
- package/lib/server/mcp-diagram-tool-handler-registry.d.ts.map +1 -0
- package/lib/server/mcp-diagram-tool-handler-registry.js +111 -0
- package/lib/server/mcp-diagram-tool-handler-registry.js.map +1 -0
- package/lib/server/mcp-handler-shared.d.ts +142 -0
- package/lib/server/mcp-handler-shared.d.ts.map +1 -0
- package/lib/server/mcp-handler-shared.js +199 -0
- package/lib/server/mcp-handler-shared.js.map +1 -0
- package/lib/server/mcp-http-transport.d.ts +93 -0
- package/lib/server/mcp-http-transport.d.ts.map +1 -0
- package/lib/server/mcp-http-transport.js +350 -0
- package/lib/server/mcp-http-transport.js.map +1 -0
- package/lib/server/mcp-id-alias-service.d.ts +70 -0
- package/lib/server/mcp-id-alias-service.d.ts.map +1 -0
- package/lib/server/mcp-id-alias-service.js +85 -0
- package/lib/server/mcp-id-alias-service.js.map +1 -0
- package/lib/server/mcp-input-schemas.d.ts +73 -0
- package/lib/server/mcp-input-schemas.d.ts.map +1 -0
- package/lib/server/mcp-input-schemas.js +67 -0
- package/lib/server/mcp-input-schemas.js.map +1 -0
- package/lib/server/mcp-label-provider.d.ts +45 -0
- package/lib/server/mcp-label-provider.d.ts.map +1 -0
- package/lib/server/mcp-label-provider.js +42 -0
- package/lib/server/mcp-label-provider.js.map +1 -0
- package/lib/server/mcp-log-level-registry.d.ts +54 -0
- package/lib/server/mcp-log-level-registry.d.ts.map +1 -0
- package/lib/server/mcp-log-level-registry.js +80 -0
- package/lib/server/mcp-log-level-registry.js.map +1 -0
- package/lib/server/mcp-logger.d.ts +59 -0
- package/lib/server/mcp-logger.d.ts.map +1 -0
- package/lib/server/mcp-logger.js +104 -0
- package/lib/server/mcp-logger.js.map +1 -0
- package/lib/server/mcp-mime-types.d.ts +28 -0
- package/lib/server/mcp-mime-types.d.ts.map +1 -0
- package/lib/server/mcp-mime-types.js +18 -0
- package/lib/server/mcp-mime-types.js.map +1 -0
- package/lib/server/mcp-options.d.ts +39 -0
- package/lib/server/mcp-options.d.ts.map +1 -0
- package/lib/server/mcp-options.js +53 -0
- package/lib/server/mcp-options.js.map +1 -0
- package/lib/server/mcp-progress-reporter.d.ts +48 -0
- package/lib/server/mcp-progress-reporter.d.ts.map +1 -0
- package/lib/server/mcp-progress-reporter.js +66 -0
- package/lib/server/mcp-progress-reporter.js.map +1 -0
- package/lib/server/mcp-prompt-handler.d.ts +120 -0
- package/lib/server/mcp-prompt-handler.d.ts.map +1 -0
- package/lib/server/mcp-prompt-handler.js +131 -0
- package/lib/server/mcp-prompt-handler.js.map +1 -0
- package/lib/server/mcp-request-context.d.ts +37 -0
- package/lib/server/mcp-request-context.d.ts.map +1 -0
- package/lib/server/mcp-request-context.js +37 -0
- package/lib/server/mcp-request-context.js.map +1 -0
- package/lib/server/mcp-resource-handler.d.ts +212 -0
- package/lib/server/mcp-resource-handler.d.ts.map +1 -0
- package/lib/server/mcp-resource-handler.js +298 -0
- package/lib/server/mcp-resource-handler.js.map +1 -0
- package/lib/server/mcp-server-launcher.d.ts +143 -0
- package/lib/server/mcp-server-launcher.d.ts.map +1 -0
- package/lib/server/mcp-server-launcher.js +355 -0
- package/lib/server/mcp-server-launcher.js.map +1 -0
- package/lib/server/mcp-server-module.d.ts +143 -0
- package/lib/server/mcp-server-module.d.ts.map +1 -0
- package/lib/server/mcp-server-module.js +249 -0
- package/lib/server/mcp-server-module.js.map +1 -0
- package/lib/server/mcp-session.d.ts +44 -0
- package/lib/server/mcp-session.d.ts.map +1 -0
- package/lib/server/mcp-session.js +18 -0
- package/lib/server/mcp-session.js.map +1 -0
- package/lib/server/mcp-tool-handler.d.ts +259 -0
- package/lib/server/mcp-tool-handler.d.ts.map +1 -0
- package/lib/server/mcp-tool-handler.js +355 -0
- package/lib/server/mcp-tool-handler.js.map +1 -0
- package/lib/tools/handlers/count-elements-mcp-tool-handler.d.ts +46 -0
- package/lib/tools/handlers/count-elements-mcp-tool-handler.d.ts.map +1 -0
- package/lib/tools/handlers/count-elements-mcp-tool-handler.js +76 -0
- package/lib/tools/handlers/count-elements-mcp-tool-handler.js.map +1 -0
- package/lib/tools/handlers/create-edges-mcp-tool-handler.d.ts +112 -0
- package/lib/tools/handlers/create-edges-mcp-tool-handler.d.ts.map +1 -0
- package/lib/tools/handlers/create-edges-mcp-tool-handler.js +190 -0
- package/lib/tools/handlers/create-edges-mcp-tool-handler.js.map +1 -0
- package/lib/tools/handlers/create-nodes-mcp-tool-handler.d.ts +81 -0
- package/lib/tools/handlers/create-nodes-mcp-tool-handler.d.ts.map +1 -0
- package/lib/tools/handlers/create-nodes-mcp-tool-handler.js +123 -0
- package/lib/tools/handlers/create-nodes-mcp-tool-handler.js.map +1 -0
- package/lib/tools/handlers/delete-elements-mcp-tool-handler.d.ts +52 -0
- package/lib/tools/handlers/delete-elements-mcp-tool-handler.d.ts.map +1 -0
- package/lib/tools/handlers/delete-elements-mcp-tool-handler.js +73 -0
- package/lib/tools/handlers/delete-elements-mcp-tool-handler.js.map +1 -0
- package/lib/tools/handlers/diagram-model-mcp-tool-handler.d.ts +59 -0
- package/lib/tools/handlers/diagram-model-mcp-tool-handler.d.ts.map +1 -0
- package/lib/tools/handlers/diagram-model-mcp-tool-handler.js +78 -0
- package/lib/tools/handlers/diagram-model-mcp-tool-handler.js.map +1 -0
- package/lib/tools/handlers/element-types-mcp-tool-handler.d.ts +97 -0
- package/lib/tools/handlers/element-types-mcp-tool-handler.d.ts.map +1 -0
- package/lib/tools/handlers/element-types-mcp-tool-handler.js +155 -0
- package/lib/tools/handlers/element-types-mcp-tool-handler.js.map +1 -0
- package/lib/tools/handlers/get-selection-mcp-tool-handler.d.ts +43 -0
- package/lib/tools/handlers/get-selection-mcp-tool-handler.d.ts.map +1 -0
- package/lib/tools/handlers/get-selection-mcp-tool-handler.js +68 -0
- package/lib/tools/handlers/get-selection-mcp-tool-handler.js.map +1 -0
- package/lib/tools/handlers/layout-mcp-tool-handler.d.ts +43 -0
- package/lib/tools/handlers/layout-mcp-tool-handler.d.ts.map +1 -0
- package/lib/tools/handlers/layout-mcp-tool-handler.js +71 -0
- package/lib/tools/handlers/layout-mcp-tool-handler.js.map +1 -0
- package/lib/tools/handlers/modify-edges-mcp-tool-handler.d.ts +78 -0
- package/lib/tools/handlers/modify-edges-mcp-tool-handler.d.ts.map +1 -0
- package/lib/tools/handlers/modify-edges-mcp-tool-handler.js +136 -0
- package/lib/tools/handlers/modify-edges-mcp-tool-handler.js.map +1 -0
- package/lib/tools/handlers/modify-nodes-mcp-tool-handler.d.ts +92 -0
- package/lib/tools/handlers/modify-nodes-mcp-tool-handler.d.ts.map +1 -0
- package/lib/tools/handlers/modify-nodes-mcp-tool-handler.js +125 -0
- package/lib/tools/handlers/modify-nodes-mcp-tool-handler.js.map +1 -0
- package/lib/tools/handlers/query-elements-mcp-tool-handler.d.ts +102 -0
- package/lib/tools/handlers/query-elements-mcp-tool-handler.d.ts.map +1 -0
- package/lib/tools/handlers/query-elements-mcp-tool-handler.js +158 -0
- package/lib/tools/handlers/query-elements-mcp-tool-handler.js.map +1 -0
- package/lib/tools/handlers/redo-mcp-tool-handler.d.ts +45 -0
- package/lib/tools/handlers/redo-mcp-tool-handler.d.ts.map +1 -0
- package/lib/tools/handlers/redo-mcp-tool-handler.js +73 -0
- package/lib/tools/handlers/redo-mcp-tool-handler.js.map +1 -0
- package/lib/tools/handlers/save-model-mcp-tool-handler.d.ts +55 -0
- package/lib/tools/handlers/save-model-mcp-tool-handler.d.ts.map +1 -0
- package/lib/tools/handlers/save-model-mcp-tool-handler.js +91 -0
- package/lib/tools/handlers/save-model-mcp-tool-handler.js.map +1 -0
- package/lib/tools/handlers/session-info-mcp-tool-handler.d.ts +65 -0
- package/lib/tools/handlers/session-info-mcp-tool-handler.d.ts.map +1 -0
- package/lib/tools/handlers/session-info-mcp-tool-handler.js +108 -0
- package/lib/tools/handlers/session-info-mcp-tool-handler.js.map +1 -0
- package/lib/tools/handlers/set-selection-mcp-tool-handler.d.ts +60 -0
- package/lib/tools/handlers/set-selection-mcp-tool-handler.d.ts.map +1 -0
- package/lib/tools/handlers/set-selection-mcp-tool-handler.js +103 -0
- package/lib/tools/handlers/set-selection-mcp-tool-handler.js.map +1 -0
- package/lib/tools/handlers/set-view-mcp-tool-handler.d.ts +110 -0
- package/lib/tools/handlers/set-view-mcp-tool-handler.d.ts.map +1 -0
- package/lib/tools/handlers/set-view-mcp-tool-handler.js +142 -0
- package/lib/tools/handlers/set-view-mcp-tool-handler.js.map +1 -0
- package/lib/tools/handlers/undo-mcp-tool-handler.d.ts +45 -0
- package/lib/tools/handlers/undo-mcp-tool-handler.d.ts.map +1 -0
- package/lib/tools/handlers/undo-mcp-tool-handler.js +74 -0
- package/lib/tools/handlers/undo-mcp-tool-handler.js.map +1 -0
- package/lib/tools/handlers/validate-diagram-mcp-tool-handler.d.ts +66 -0
- package/lib/tools/handlers/validate-diagram-mcp-tool-handler.d.ts.map +1 -0
- package/lib/tools/handlers/validate-diagram-mcp-tool-handler.js +0 -0
- package/lib/tools/handlers/validate-diagram-mcp-tool-handler.js.map +1 -0
- package/lib/tools/index.d.ts +34 -0
- package/lib/tools/index.d.ts.map +1 -0
- package/lib/tools/index.js +50 -0
- package/lib/tools/index.js.map +1 -0
- package/lib/util/index.d.ts +18 -0
- package/lib/util/index.d.ts.map +1 -0
- package/lib/util/index.js +34 -0
- package/lib/util/index.js.map +1 -0
- package/lib/util/markdown-util.d.ts +20 -0
- package/lib/util/markdown-util.d.ts.map +1 -0
- package/lib/util/markdown-util.js +45 -0
- package/lib/util/markdown-util.js.map +1 -0
- package/lib/util/mcp-util.d.ts +22 -0
- package/lib/util/mcp-util.d.ts.map +1 -0
- package/lib/util/mcp-util.js +29 -0
- package/lib/util/mcp-util.js.map +1 -0
- package/package.json +63 -0
- package/src/index.ts +24 -0
- package/src/prompts/handlers/describe-diagram-mcp-prompt-handler.ts +89 -0
- package/src/prompts/handlers/suggest-improvements-mcp-prompt-handler.ts +86 -0
- package/src/prompts/index.ts +18 -0
- package/src/resources/handlers/diagram-png-mcp-resource-handler.ts +181 -0
- package/src/resources/handlers/diagram-svg-mcp-resource-handler.ts +89 -0
- package/src/resources/index.ts +20 -0
- package/src/resources/services/element-types-provider.ts +105 -0
- package/src/resources/services/mcp-model-serializer.ts +211 -0
- package/src/server/glsp-mcp-server.spec.ts +73 -0
- package/src/server/glsp-mcp-server.ts +196 -0
- package/src/server/index.ts +42 -0
- package/src/server/lru-event-store.spec.ts +121 -0
- package/src/server/lru-event-store.ts +112 -0
- package/src/server/mcp-diagram-handler-dispatcher.spec.ts +231 -0
- package/src/server/mcp-diagram-handler-dispatcher.ts +459 -0
- package/src/server/mcp-diagram-module.ts +248 -0
- package/src/server/mcp-diagram-prompt-handler-registry.ts +59 -0
- package/src/server/mcp-diagram-resource-handler-registry.ts +73 -0
- package/src/server/mcp-diagram-tool-handler-registry.ts +97 -0
- package/src/server/mcp-handler-shared.spec.ts +53 -0
- package/src/server/mcp-handler-shared.ts +247 -0
- package/src/server/mcp-http-transport-e2e.spec.ts +151 -0
- package/src/server/mcp-http-transport.spec.ts +385 -0
- package/src/server/mcp-http-transport.ts +368 -0
- package/src/server/mcp-id-alias-service.spec.ts +106 -0
- package/src/server/mcp-id-alias-service.ts +104 -0
- package/src/server/mcp-input-schemas.ts +82 -0
- package/src/server/mcp-label-provider.ts +52 -0
- package/src/server/mcp-log-level-registry.spec.ts +75 -0
- package/src/server/mcp-log-level-registry.ts +90 -0
- package/src/server/mcp-logger.spec.ts +227 -0
- package/src/server/mcp-logger.ts +91 -0
- package/src/server/mcp-mime-types.ts +31 -0
- package/src/server/mcp-options.ts +43 -0
- package/src/server/mcp-progress-reporter.spec.ts +93 -0
- package/src/server/mcp-progress-reporter.ts +67 -0
- package/src/server/mcp-prompt-handler.ts +157 -0
- package/src/server/mcp-request-context.ts +39 -0
- package/src/server/mcp-resource-handler.ts +389 -0
- package/src/server/mcp-server-launcher.spec.ts +173 -0
- package/src/server/mcp-server-launcher.ts +369 -0
- package/src/server/mcp-server-module.ts +287 -0
- package/src/server/mcp-session.ts +45 -0
- package/src/server/mcp-tool-handler.spec.ts +182 -0
- package/src/server/mcp-tool-handler.ts +431 -0
- package/src/server/raw-http.spec.ts +59 -0
- package/src/tools/handlers/count-elements-mcp-tool-handler.spec.ts +99 -0
- package/src/tools/handlers/count-elements-mcp-tool-handler.ts +66 -0
- package/src/tools/handlers/create-edges-mcp-tool-handler.spec.ts +196 -0
- package/src/tools/handlers/create-edges-mcp-tool-handler.ts +205 -0
- package/src/tools/handlers/create-nodes-mcp-tool-handler.spec.ts +197 -0
- package/src/tools/handlers/create-nodes-mcp-tool-handler.ts +131 -0
- package/src/tools/handlers/delete-elements-mcp-tool-handler.ts +73 -0
- package/src/tools/handlers/diagram-model-mcp-tool-handler.ts +66 -0
- package/src/tools/handlers/element-types-mcp-tool-handler.ts +151 -0
- package/src/tools/handlers/get-selection-mcp-tool-handler.ts +54 -0
- package/src/tools/handlers/layout-mcp-tool-handler.ts +56 -0
- package/src/tools/handlers/modify-edges-mcp-tool-handler.ts +148 -0
- package/src/tools/handlers/modify-nodes-mcp-tool-handler.ts +140 -0
- package/src/tools/handlers/query-elements-mcp-tool-handler.spec.ts +210 -0
- package/src/tools/handlers/query-elements-mcp-tool-handler.ts +161 -0
- package/src/tools/handlers/redo-mcp-tool-handler.ts +62 -0
- package/src/tools/handlers/save-model-mcp-tool-handler.ts +71 -0
- package/src/tools/handlers/session-info-mcp-tool-handler.spec.ts +152 -0
- package/src/tools/handlers/session-info-mcp-tool-handler.ts +97 -0
- package/src/tools/handlers/set-selection-mcp-tool-handler.spec.ts +118 -0
- package/src/tools/handlers/set-selection-mcp-tool-handler.ts +90 -0
- package/src/tools/handlers/set-view-mcp-tool-handler.ts +162 -0
- package/src/tools/handlers/undo-mcp-tool-handler.ts +61 -0
- package/src/tools/handlers/validate-diagram-mcp-tool-handler.ts +0 -0
- package/src/tools/index.ts +34 -0
- package/src/tools/tool-annotations.spec.ts +141 -0
- package/src/util/index.ts +18 -0
- package/src/util/markdown-util.ts +44 -0
- package/src/util/mcp-util.ts +25 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
*
|
|
9
|
+
* This Source Code may also be made available under the following Secondary
|
|
10
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
* with the GNU Classpath Exception which is available at
|
|
13
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
********************************************************************************/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.DefaultMcpDiagramModule = exports.AbstractMcpDiagramModule = void 0;
|
|
19
|
+
const server_1 = require("@eclipse-glsp/server");
|
|
20
|
+
const resources_1 = require("../resources");
|
|
21
|
+
const element_types_provider_1 = require("../resources/services/element-types-provider");
|
|
22
|
+
const mcp_model_serializer_1 = require("../resources/services/mcp-model-serializer");
|
|
23
|
+
const tools_1 = require("../tools");
|
|
24
|
+
const mcp_diagram_prompt_handler_registry_1 = require("./mcp-diagram-prompt-handler-registry");
|
|
25
|
+
const mcp_diagram_resource_handler_registry_1 = require("./mcp-diagram-resource-handler-registry");
|
|
26
|
+
const mcp_diagram_tool_handler_registry_1 = require("./mcp-diagram-tool-handler-registry");
|
|
27
|
+
const mcp_id_alias_service_1 = require("./mcp-id-alias-service");
|
|
28
|
+
const mcp_label_provider_1 = require("./mcp-label-provider");
|
|
29
|
+
const mcp_prompt_handler_1 = require("./mcp-prompt-handler");
|
|
30
|
+
const mcp_resource_handler_1 = require("./mcp-resource-handler");
|
|
31
|
+
const mcp_tool_handler_1 = require("./mcp-tool-handler");
|
|
32
|
+
/**
|
|
33
|
+
* Per-GLSP-client-session DI module for the MCP server. Loaded inside `configureDiagramModule`
|
|
34
|
+
* so each `ClientSession.container` gets its own instance of session-scoped services.
|
|
35
|
+
*
|
|
36
|
+
* Binds the {@link McpIdAliasService}, the {@link McpModelSerializer}, the
|
|
37
|
+
* {@link ElementTypesProvider}, and the diagram-scope handler-constructor multi-bindings
|
|
38
|
+
* (`McpDiagram*HandlerConstructor`). Adopters subclass and override the `bind*` hooks to swap
|
|
39
|
+
* single-instance services and the `configure*` hooks to extend the multi-binding handler sets.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* class WorkflowMcpDiagramModule extends DefaultMcpDiagramModule {
|
|
44
|
+
* // Single-instance binding: return the class.
|
|
45
|
+
* protected override bindModelSerializer(): BindingTarget<McpModelSerializer> {
|
|
46
|
+
* return WorkflowMcpModelSerializer;
|
|
47
|
+
* }
|
|
48
|
+
* // Multi-binding: extend or rebind the default set.
|
|
49
|
+
* protected override configureToolHandlers(binding) {
|
|
50
|
+
* super.configureToolHandlers(binding);
|
|
51
|
+
* binding.add(WorkflowExtraTool);
|
|
52
|
+
* binding.rebind(CreateNodesMcpToolHandler, WorkflowCreateNodesMcpToolHandler);
|
|
53
|
+
* }
|
|
54
|
+
* }
|
|
55
|
+
* new WorkflowServerModule().configureDiagramModule(
|
|
56
|
+
* new WorkflowDiagramModule(...),
|
|
57
|
+
* elkLayoutModule,
|
|
58
|
+
* new WorkflowMcpDiagramModule()
|
|
59
|
+
* );
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
class AbstractMcpDiagramModule extends server_1.GLSPModule {
|
|
63
|
+
configure(bind, _unbind, isBound, rebind) {
|
|
64
|
+
this.bind = bind;
|
|
65
|
+
this.rebind = rebind;
|
|
66
|
+
const context = { bind, isBound };
|
|
67
|
+
(0, server_1.applyBindingTarget)(context, mcp_id_alias_service_1.McpIdAliasService, this.bindIdAliasService()).inSingletonScope();
|
|
68
|
+
(0, server_1.applyBindingTarget)(context, mcp_label_provider_1.McpLabelProvider, this.bindLabelProvider()).inSingletonScope();
|
|
69
|
+
(0, server_1.applyBindingTarget)(context, mcp_model_serializer_1.McpModelSerializer, this.bindModelSerializer()).inSingletonScope();
|
|
70
|
+
(0, server_1.applyBindingTarget)(context, element_types_provider_1.ElementTypesProvider, this.bindElementTypesProvider()).inSingletonScope();
|
|
71
|
+
this.configureMultiBinding(new server_1.InstanceMultiBinding(mcp_tool_handler_1.McpDiagramToolHandlerConstructor), binding => this.configureToolHandlers(binding));
|
|
72
|
+
this.configureMultiBinding(new server_1.InstanceMultiBinding(mcp_resource_handler_1.McpDiagramResourceHandlerConstructor), binding => this.configureResourceHandlers(binding));
|
|
73
|
+
this.configureMultiBinding(new server_1.InstanceMultiBinding(mcp_prompt_handler_1.McpDiagramPromptHandlerConstructor), binding => this.configurePromptHandlers(binding));
|
|
74
|
+
this.configureHandlerRegistries();
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Bind the per-GLSP-session handler registries, factories, and {@link ClientSessionInitializer}s
|
|
78
|
+
* that populate the registries at session-open. Adopters typically don't override.
|
|
79
|
+
*
|
|
80
|
+
* Each kind (tool / resource / prompt) follows the same shape:
|
|
81
|
+
* - `Registry` — singleton-per-session, holds instantiated handlers keyed by `name`.
|
|
82
|
+
* - `Factory` — `dynamicValue` that calls `ctx.container.resolve(constructor)`, so the
|
|
83
|
+
* handler's `@inject(...)` fields resolve against the live `ClientSession.container`.
|
|
84
|
+
* - `RegistryInitializer` — at session-open, reads the constructor multi-binding (added by
|
|
85
|
+
* adopter `configure*Handlers` overrides) and instantiates each via the factory.
|
|
86
|
+
* Picked up by Inversify alongside core's own `ClientSessionInitializer`s
|
|
87
|
+
* (`OperationHandlerRegistryInitializer` etc.).
|
|
88
|
+
*/
|
|
89
|
+
configureHandlerRegistries() {
|
|
90
|
+
this.bind(mcp_diagram_tool_handler_registry_1.McpDiagramToolHandlerRegistry).toSelf().inSingletonScope();
|
|
91
|
+
this.bind(mcp_diagram_tool_handler_registry_1.McpDiagramToolHandlerFactory).toDynamicValue(ctx => (constructor) => ctx.container.resolve(constructor));
|
|
92
|
+
this.bind(mcp_diagram_tool_handler_registry_1.McpDiagramToolHandlerRegistryInitializer).toSelf().inSingletonScope();
|
|
93
|
+
this.bind(server_1.ClientSessionInitializer).toService(mcp_diagram_tool_handler_registry_1.McpDiagramToolHandlerRegistryInitializer);
|
|
94
|
+
this.bind(mcp_diagram_resource_handler_registry_1.McpDiagramResourceHandlerRegistry).toSelf().inSingletonScope();
|
|
95
|
+
this.bind(mcp_diagram_resource_handler_registry_1.McpDiagramResourceHandlerFactory).toDynamicValue(ctx => (constructor) => ctx.container.resolve(constructor));
|
|
96
|
+
this.bind(mcp_diagram_resource_handler_registry_1.McpDiagramResourceHandlerRegistryInitializer).toSelf().inSingletonScope();
|
|
97
|
+
this.bind(server_1.ClientSessionInitializer).toService(mcp_diagram_resource_handler_registry_1.McpDiagramResourceHandlerRegistryInitializer);
|
|
98
|
+
this.bind(mcp_diagram_prompt_handler_registry_1.McpDiagramPromptHandlerRegistry).toSelf().inSingletonScope();
|
|
99
|
+
this.bind(mcp_diagram_prompt_handler_registry_1.McpDiagramPromptHandlerFactory).toDynamicValue(ctx => (constructor) => ctx.container.resolve(constructor));
|
|
100
|
+
this.bind(mcp_diagram_prompt_handler_registry_1.McpDiagramPromptHandlerRegistryInitializer).toSelf().inSingletonScope();
|
|
101
|
+
this.bind(server_1.ClientSessionInitializer).toService(mcp_diagram_prompt_handler_registry_1.McpDiagramPromptHandlerRegistryInitializer);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* {@link McpIdAliasService} binding. Override to swap in a custom alias strategy. Bind the
|
|
105
|
+
* shipped `NullMcpIdAliasService` (passthrough) to expose raw GLSP ids on the wire — useful
|
|
106
|
+
* for diagnostic readability or when token cost isn't a concern.
|
|
107
|
+
*/
|
|
108
|
+
bindIdAliasService() {
|
|
109
|
+
return mcp_id_alias_service_1.DefaultMcpIdAliasService;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* {@link McpLabelProvider} binding. Override to teach MCP about adopter-specific label
|
|
113
|
+
* locations (e.g., labels nested in header components or compartments). One override here
|
|
114
|
+
* covers every read-side echo and every write-side label-edit operation.
|
|
115
|
+
*/
|
|
116
|
+
bindLabelProvider() {
|
|
117
|
+
return mcp_label_provider_1.DefaultMcpLabelProvider;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* {@link McpModelSerializer} binding. Override to swap in a diagram-type-specific serializer
|
|
121
|
+
* (e.g. one that emits JSON, or knows the adopter's element schema). Per-session scope means
|
|
122
|
+
* each diagram type provides its own serializer without a server-level rebind.
|
|
123
|
+
*/
|
|
124
|
+
bindModelSerializer() {
|
|
125
|
+
return mcp_model_serializer_1.MarkdownMcpModelSerializer;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* {@link ElementTypesProvider} binding. Override to ship a constant-value list of creatable
|
|
129
|
+
* element types for the adopter's diagram type instead of the default impl that scrapes
|
|
130
|
+
* {@link OperationHandlerRegistry} (noisy for non-trivial diagrams).
|
|
131
|
+
*/
|
|
132
|
+
bindElementTypesProvider() {
|
|
133
|
+
return element_types_provider_1.DefaultElementTypesProvider;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Override to add or replace diagram-scope tool handlers. Adopters typically
|
|
137
|
+
* `super.configureToolHandlers(binding)` to keep the defaults, then `binding.add(MyTool)`
|
|
138
|
+
* for additions or `binding.rebind(StandardTool, MyTool)` for overrides.
|
|
139
|
+
*/
|
|
140
|
+
configureToolHandlers(binding) {
|
|
141
|
+
binding.add(tools_1.CreateNodesMcpToolHandler);
|
|
142
|
+
binding.add(tools_1.CreateEdgesMcpToolHandler);
|
|
143
|
+
binding.add(tools_1.DeleteElementsMcpToolHandler);
|
|
144
|
+
binding.add(tools_1.SaveModelMcpToolHandler);
|
|
145
|
+
binding.add(tools_1.ValidateDiagramMcpToolHandler);
|
|
146
|
+
binding.add(tools_1.DiagramModelMcpToolHandler);
|
|
147
|
+
binding.add(tools_1.QueryElementsMcpToolHandler);
|
|
148
|
+
binding.add(tools_1.CountElementsMcpToolHandler);
|
|
149
|
+
binding.add(tools_1.ModifyNodesMcpToolHandler);
|
|
150
|
+
binding.add(tools_1.ModifyEdgesMcpToolHandler);
|
|
151
|
+
binding.add(tools_1.UndoMcpToolHandler);
|
|
152
|
+
binding.add(tools_1.RedoMcpToolHandler);
|
|
153
|
+
binding.add(tools_1.GetSelectionMcpToolHandler);
|
|
154
|
+
binding.add(tools_1.SetSelectionMcpToolHandler);
|
|
155
|
+
binding.add(tools_1.SetViewMcpToolHandler);
|
|
156
|
+
// Auto-skips at session-open via `canRegister()` when no `LayoutEngine` is bound.
|
|
157
|
+
binding.add(tools_1.LayoutMcpToolHandler);
|
|
158
|
+
}
|
|
159
|
+
/** See {@link configureToolHandlers}. */
|
|
160
|
+
configureResourceHandlers(binding) {
|
|
161
|
+
binding.add(resources_1.DiagramPngMcpResourceHandler);
|
|
162
|
+
binding.add(resources_1.DiagramSvgMcpResourceHandler);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* See {@link configureToolHandlers}. No diagram-scope prompts ship by default — the shipped
|
|
166
|
+
* `describe-diagram` and `suggest-improvements` prompts are diagram-type-agnostic and bound
|
|
167
|
+
* server-scope. Adopters add their own diagram-type-specific prompts here.
|
|
168
|
+
*/
|
|
169
|
+
configurePromptHandlers(_binding) {
|
|
170
|
+
// empty by default
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
exports.AbstractMcpDiagramModule = AbstractMcpDiagramModule;
|
|
174
|
+
/**
|
|
175
|
+
* Default {@link AbstractMcpDiagramModule} entry point. Adopters who don't need overrides
|
|
176
|
+
* use it directly: `new DefaultMcpDiagramModule()`. Adopters with customizations subclass
|
|
177
|
+
* `AbstractMcpDiagramModule` (or this class) and override the `bind*` / `configure*` hooks.
|
|
178
|
+
*
|
|
179
|
+
* @experimental The MCP integration is under active development. Option names, schema shapes,
|
|
180
|
+
* and handler contracts MAY change in minor releases until the feature graduates from
|
|
181
|
+
* experimental status.
|
|
182
|
+
*/
|
|
183
|
+
class DefaultMcpDiagramModule extends AbstractMcpDiagramModule {
|
|
184
|
+
}
|
|
185
|
+
exports.DefaultMcpDiagramModule = DefaultMcpDiagramModule;
|
|
186
|
+
//# sourceMappingURL=mcp-diagram-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-diagram-module.js","sourceRoot":"","sources":["../../src/server/mcp-diagram-module.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
import { Args, ClientSessionInitializer, Registry } from '@eclipse-glsp/server';
|
|
17
|
+
import { McpDiagramScopedInput } from './mcp-input-schemas';
|
|
18
|
+
import { AbstractMcpDiagramPromptHandler, McpDiagramPromptHandlerConstructor } from './mcp-prompt-handler';
|
|
19
|
+
/** See {@link McpDiagramToolHandlerFactory} — same lifecycle pattern, applied to prompt handlers. */
|
|
20
|
+
export type McpDiagramPromptHandlerFactory = (constructor: McpDiagramPromptHandlerConstructor) => AbstractMcpDiagramPromptHandler<McpDiagramScopedInput>;
|
|
21
|
+
export declare const McpDiagramPromptHandlerFactory: unique symbol;
|
|
22
|
+
/** See {@link McpDiagramToolHandlerRegistry} — same lifecycle pattern, applied to prompt handlers. */
|
|
23
|
+
export declare class McpDiagramPromptHandlerRegistry extends Registry<string, AbstractMcpDiagramPromptHandler<McpDiagramScopedInput>> {
|
|
24
|
+
registerHandler(handler: AbstractMcpDiagramPromptHandler<McpDiagramScopedInput>): boolean;
|
|
25
|
+
}
|
|
26
|
+
/** See {@link McpDiagramToolHandlerRegistryInitializer} — same lifecycle pattern, applied to prompt handlers. */
|
|
27
|
+
export declare class McpDiagramPromptHandlerRegistryInitializer implements ClientSessionInitializer {
|
|
28
|
+
protected factory: McpDiagramPromptHandlerFactory;
|
|
29
|
+
protected constructors: McpDiagramPromptHandlerConstructor[];
|
|
30
|
+
protected registry: McpDiagramPromptHandlerRegistry;
|
|
31
|
+
initialize(_args?: Args): void;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=mcp-diagram-prompt-handler-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-diagram-prompt-handler-registry.d.ts","sourceRoot":"","sources":["../../src/server/mcp-diagram-prompt-handler-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,IAAI,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,+BAA+B,EAAE,kCAAkC,EAAE,MAAM,sBAAsB,CAAC;AAE3G,qGAAqG;AACrG,MAAM,MAAM,8BAA8B,GAAG,CACzC,WAAW,EAAE,kCAAkC,KAC9C,+BAA+B,CAAC,qBAAqB,CAAC,CAAC;AAC5D,eAAO,MAAM,8BAA8B,eAA2C,CAAC;AAEvF,sGAAsG;AACtG,qBACa,+BAAgC,SAAQ,QAAQ,CAAC,MAAM,EAAE,+BAA+B,CAAC,qBAAqB,CAAC,CAAC;IACzH,eAAe,CAAC,OAAO,EAAE,+BAA+B,CAAC,qBAAqB,CAAC,GAAG,OAAO;CAG5F;AAED,iHAAiH;AACjH,qBACa,0CAA2C,YAAW,wBAAwB;IAC/C,SAAS,CAAC,OAAO,EAAE,8BAA8B,CAAC;IAI1F,SAAS,CAAC,YAAY,EAAE,kCAAkC,EAAE,CAAM;IAEzB,SAAS,CAAC,QAAQ,EAAE,+BAA+B,CAAC;IAE7F,UAAU,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI;CAYjC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
*
|
|
9
|
+
* This Source Code may also be made available under the following Secondary
|
|
10
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
* with the GNU Classpath Exception which is available at
|
|
13
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
********************************************************************************/
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.McpDiagramPromptHandlerRegistryInitializer = exports.McpDiagramPromptHandlerRegistry = exports.McpDiagramPromptHandlerFactory = void 0;
|
|
28
|
+
const server_1 = require("@eclipse-glsp/server");
|
|
29
|
+
const inversify_1 = require("inversify");
|
|
30
|
+
const mcp_prompt_handler_1 = require("./mcp-prompt-handler");
|
|
31
|
+
exports.McpDiagramPromptHandlerFactory = Symbol('McpDiagramPromptHandlerFactory');
|
|
32
|
+
/** See {@link McpDiagramToolHandlerRegistry} — same lifecycle pattern, applied to prompt handlers. */
|
|
33
|
+
let McpDiagramPromptHandlerRegistry = class McpDiagramPromptHandlerRegistry extends server_1.Registry {
|
|
34
|
+
registerHandler(handler) {
|
|
35
|
+
return this.register(handler.name, handler);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.McpDiagramPromptHandlerRegistry = McpDiagramPromptHandlerRegistry;
|
|
39
|
+
exports.McpDiagramPromptHandlerRegistry = McpDiagramPromptHandlerRegistry = __decorate([
|
|
40
|
+
(0, inversify_1.injectable)()
|
|
41
|
+
], McpDiagramPromptHandlerRegistry);
|
|
42
|
+
/** See {@link McpDiagramToolHandlerRegistryInitializer} — same lifecycle pattern, applied to prompt handlers. */
|
|
43
|
+
let McpDiagramPromptHandlerRegistryInitializer = class McpDiagramPromptHandlerRegistryInitializer {
|
|
44
|
+
constructor() {
|
|
45
|
+
this.constructors = [];
|
|
46
|
+
}
|
|
47
|
+
initialize(_args) {
|
|
48
|
+
for (const constructor of this.constructors) {
|
|
49
|
+
try {
|
|
50
|
+
this.registry.registerHandler(this.factory(constructor));
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
throw new Error(`Failed to instantiate MCP diagram prompt handler '${constructor.name}': ${err.message}. ` +
|
|
54
|
+
'Check your DiagramModule bindings.');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
exports.McpDiagramPromptHandlerRegistryInitializer = McpDiagramPromptHandlerRegistryInitializer;
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, inversify_1.inject)(exports.McpDiagramPromptHandlerFactory),
|
|
62
|
+
__metadata("design:type", Function)
|
|
63
|
+
], McpDiagramPromptHandlerRegistryInitializer.prototype, "factory", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, inversify_1.inject)(mcp_prompt_handler_1.McpDiagramPromptHandlerConstructor),
|
|
66
|
+
(0, inversify_1.optional)(),
|
|
67
|
+
__metadata("design:type", Array)
|
|
68
|
+
], McpDiagramPromptHandlerRegistryInitializer.prototype, "constructors", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, inversify_1.inject)(McpDiagramPromptHandlerRegistry),
|
|
71
|
+
__metadata("design:type", McpDiagramPromptHandlerRegistry)
|
|
72
|
+
], McpDiagramPromptHandlerRegistryInitializer.prototype, "registry", void 0);
|
|
73
|
+
exports.McpDiagramPromptHandlerRegistryInitializer = McpDiagramPromptHandlerRegistryInitializer = __decorate([
|
|
74
|
+
(0, inversify_1.injectable)()
|
|
75
|
+
], McpDiagramPromptHandlerRegistryInitializer);
|
|
76
|
+
//# sourceMappingURL=mcp-diagram-prompt-handler-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-diagram-prompt-handler-registry.js","sourceRoot":"","sources":["../../src/server/mcp-diagram-prompt-handler-registry.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,iDAAgF;AAChF,yCAAyD;AAEzD,6DAA2G;AAM9F,QAAA,8BAA8B,GAAG,MAAM,CAAC,gCAAgC,CAAC,CAAC;AAEvF,sGAAsG;AAE/F,IAAM,+BAA+B,GAArC,MAAM,+BAAgC,SAAQ,iBAAwE;IACzH,eAAe,CAAC,OAA+D;QAC3E,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;CACJ,CAAA;AAJY,0EAA+B;0CAA/B,+BAA+B;IAD3C,IAAA,sBAAU,GAAE;GACA,+BAA+B,CAI3C;AAED,iHAAiH;AAE1G,IAAM,0CAA0C,GAAhD,MAAM,0CAA0C;IAAhD;QAKO,iBAAY,GAAyC,EAAE,CAAC;IAgBtE,CAAC;IAZG,UAAU,CAAC,KAAY;QACnB,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YAC1C,IAAI,CAAC;gBACD,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;YAC7D,CAAC;YAAC,OAAO,GAAY,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CACX,qDAAqD,WAAW,CAAC,IAAI,MAAO,GAAa,CAAC,OAAO,IAAI;oBACjG,oCAAoC,CAC3C,CAAC;YACN,CAAC;QACL,CAAC;IACL,CAAC;CACJ,CAAA;AArBY,gGAA0C;AACD;IAAjD,IAAA,kBAAM,EAAC,sCAA8B,CAAC;;2EAAmD;AAIhF;IAFT,IAAA,kBAAM,EAAC,uDAAkC,CAAC;IAC1C,IAAA,oBAAQ,GAAE;;gFACuD;AAEf;IAAlD,IAAA,kBAAM,EAAC,+BAA+B,CAAC;8BAAqB,+BAA+B;4EAAC;qDAPpF,0CAA0C;IADtD,IAAA,sBAAU,GAAE;GACA,0CAA0C,CAqBtD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
import { Args, ClientSessionInitializer, Logger, Registry } from '@eclipse-glsp/server';
|
|
17
|
+
import { McpDiagramScopedInput } from './mcp-input-schemas';
|
|
18
|
+
import { AbstractMcpDiagramResourceHandler, McpDiagramResourceHandlerConstructor } from './mcp-resource-handler';
|
|
19
|
+
/** See {@link McpDiagramToolHandlerFactory} — same lifecycle pattern, applied to resource handlers. */
|
|
20
|
+
export type McpDiagramResourceHandlerFactory = (constructor: McpDiagramResourceHandlerConstructor) => AbstractMcpDiagramResourceHandler<McpDiagramScopedInput>;
|
|
21
|
+
export declare const McpDiagramResourceHandlerFactory: unique symbol;
|
|
22
|
+
/** See {@link McpDiagramToolHandlerRegistry} — same lifecycle pattern, applied to resource handlers. */
|
|
23
|
+
export declare class McpDiagramResourceHandlerRegistry extends Registry<string, AbstractMcpDiagramResourceHandler<McpDiagramScopedInput>> {
|
|
24
|
+
registerHandler(handler: AbstractMcpDiagramResourceHandler<McpDiagramScopedInput>): boolean;
|
|
25
|
+
}
|
|
26
|
+
/** See {@link McpDiagramToolHandlerRegistryInitializer} — same lifecycle pattern, applied to resource handlers. */
|
|
27
|
+
export declare class McpDiagramResourceHandlerRegistryInitializer implements ClientSessionInitializer {
|
|
28
|
+
protected factory: McpDiagramResourceHandlerFactory;
|
|
29
|
+
protected constructors: McpDiagramResourceHandlerConstructor[];
|
|
30
|
+
protected registry: McpDiagramResourceHandlerRegistry;
|
|
31
|
+
protected clientId: string;
|
|
32
|
+
protected logger: Logger;
|
|
33
|
+
initialize(_args?: Args): void;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=mcp-diagram-resource-handler-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-diagram-resource-handler-registry.d.ts","sourceRoot":"","sources":["../../src/server/mcp-diagram-resource-handler-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,IAAI,EAAY,wBAAwB,EAAE,MAAM,EAAE,QAAQ,EAAuB,MAAM,sBAAsB,CAAC;AAEvH,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,iCAAiC,EAAE,oCAAoC,EAAE,MAAM,wBAAwB,CAAC;AAEjH,uGAAuG;AACvG,MAAM,MAAM,gCAAgC,GAAG,CAC3C,WAAW,EAAE,oCAAoC,KAChD,iCAAiC,CAAC,qBAAqB,CAAC,CAAC;AAC9D,eAAO,MAAM,gCAAgC,eAA6C,CAAC;AAE3F,wGAAwG;AACxG,qBACa,iCAAkC,SAAQ,QAAQ,CAAC,MAAM,EAAE,iCAAiC,CAAC,qBAAqB,CAAC,CAAC;IAC7H,eAAe,CAAC,OAAO,EAAE,iCAAiC,CAAC,qBAAqB,CAAC,GAAG,OAAO;CAG9F;AAED,mHAAmH;AACnH,qBACa,4CAA6C,YAAW,wBAAwB;IAC/C,SAAS,CAAC,OAAO,EAAE,gCAAgC,CAAC;IAI9F,SAAS,CAAC,YAAY,EAAE,oCAAoC,EAAE,CAAM;IAEzB,SAAS,CAAC,QAAQ,EAAE,iCAAiC,CAAC;IAE/E,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE7B,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IAEzC,UAAU,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI;CAsBjC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
*
|
|
9
|
+
* This Source Code may also be made available under the following Secondary
|
|
10
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
* with the GNU Classpath Exception which is available at
|
|
13
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
********************************************************************************/
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.McpDiagramResourceHandlerRegistryInitializer = exports.McpDiagramResourceHandlerRegistry = exports.McpDiagramResourceHandlerFactory = void 0;
|
|
28
|
+
const server_1 = require("@eclipse-glsp/server");
|
|
29
|
+
const inversify_1 = require("inversify");
|
|
30
|
+
const mcp_resource_handler_1 = require("./mcp-resource-handler");
|
|
31
|
+
exports.McpDiagramResourceHandlerFactory = Symbol('McpDiagramResourceHandlerFactory');
|
|
32
|
+
/** See {@link McpDiagramToolHandlerRegistry} — same lifecycle pattern, applied to resource handlers. */
|
|
33
|
+
let McpDiagramResourceHandlerRegistry = class McpDiagramResourceHandlerRegistry extends server_1.Registry {
|
|
34
|
+
registerHandler(handler) {
|
|
35
|
+
return this.register(handler.name, handler);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.McpDiagramResourceHandlerRegistry = McpDiagramResourceHandlerRegistry;
|
|
39
|
+
exports.McpDiagramResourceHandlerRegistry = McpDiagramResourceHandlerRegistry = __decorate([
|
|
40
|
+
(0, inversify_1.injectable)()
|
|
41
|
+
], McpDiagramResourceHandlerRegistry);
|
|
42
|
+
/** See {@link McpDiagramToolHandlerRegistryInitializer} — same lifecycle pattern, applied to resource handlers. */
|
|
43
|
+
let McpDiagramResourceHandlerRegistryInitializer = class McpDiagramResourceHandlerRegistryInitializer {
|
|
44
|
+
constructor() {
|
|
45
|
+
this.constructors = [];
|
|
46
|
+
}
|
|
47
|
+
initialize(_args) {
|
|
48
|
+
// See {@link McpDiagramToolHandlerRegistryInitializer.initialize} for the probe rationale.
|
|
49
|
+
const isProbe = this.clientId === server_1.TEMPORARY_CLIENT_ID;
|
|
50
|
+
for (const constructor of this.constructors) {
|
|
51
|
+
let handler;
|
|
52
|
+
try {
|
|
53
|
+
handler = this.factory(constructor);
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
throw new Error(`Failed to instantiate MCP diagram resource handler '${constructor.name}': ${err.message}. ` +
|
|
57
|
+
'Check your DiagramModule bindings.');
|
|
58
|
+
}
|
|
59
|
+
if (!handler.canRegister()) {
|
|
60
|
+
if (!isProbe) {
|
|
61
|
+
this.logger.warn(`Skipping MCP diagram resource handler '${handler.name}': canRegister() returned false.`);
|
|
62
|
+
}
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
this.registry.registerHandler(handler);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
exports.McpDiagramResourceHandlerRegistryInitializer = McpDiagramResourceHandlerRegistryInitializer;
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, inversify_1.inject)(exports.McpDiagramResourceHandlerFactory),
|
|
72
|
+
__metadata("design:type", Function)
|
|
73
|
+
], McpDiagramResourceHandlerRegistryInitializer.prototype, "factory", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, inversify_1.inject)(mcp_resource_handler_1.McpDiagramResourceHandlerConstructor),
|
|
76
|
+
(0, inversify_1.optional)(),
|
|
77
|
+
__metadata("design:type", Array)
|
|
78
|
+
], McpDiagramResourceHandlerRegistryInitializer.prototype, "constructors", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, inversify_1.inject)(McpDiagramResourceHandlerRegistry),
|
|
81
|
+
__metadata("design:type", McpDiagramResourceHandlerRegistry)
|
|
82
|
+
], McpDiagramResourceHandlerRegistryInitializer.prototype, "registry", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, inversify_1.inject)(server_1.ClientId),
|
|
85
|
+
__metadata("design:type", String)
|
|
86
|
+
], McpDiagramResourceHandlerRegistryInitializer.prototype, "clientId", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, inversify_1.inject)(server_1.Logger),
|
|
89
|
+
__metadata("design:type", server_1.Logger)
|
|
90
|
+
], McpDiagramResourceHandlerRegistryInitializer.prototype, "logger", void 0);
|
|
91
|
+
exports.McpDiagramResourceHandlerRegistryInitializer = McpDiagramResourceHandlerRegistryInitializer = __decorate([
|
|
92
|
+
(0, inversify_1.injectable)()
|
|
93
|
+
], McpDiagramResourceHandlerRegistryInitializer);
|
|
94
|
+
//# sourceMappingURL=mcp-diagram-resource-handler-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-diagram-resource-handler-registry.js","sourceRoot":"","sources":["../../src/server/mcp-diagram-resource-handler-registry.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,iDAAuH;AACvH,yCAAyD;AAEzD,iEAAiH;AAMpG,QAAA,gCAAgC,GAAG,MAAM,CAAC,kCAAkC,CAAC,CAAC;AAE3F,wGAAwG;AAEjG,IAAM,iCAAiC,GAAvC,MAAM,iCAAkC,SAAQ,iBAA0E;IAC7H,eAAe,CAAC,OAAiE;QAC7E,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;CACJ,CAAA;AAJY,8EAAiC;4CAAjC,iCAAiC;IAD7C,IAAA,sBAAU,GAAE;GACA,iCAAiC,CAI7C;AAED,mHAAmH;AAE5G,IAAM,4CAA4C,GAAlD,MAAM,4CAA4C;IAAlD;QAKO,iBAAY,GAA2C,EAAE,CAAC;IA8BxE,CAAC;IAtBG,UAAU,CAAC,KAAY;QACnB,2FAA2F;QAC3F,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,KAAK,4BAAmB,CAAC;QACtD,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YAC1C,IAAI,OAAiE,CAAC;YACtE,IAAI,CAAC;gBACD,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACxC,CAAC;YAAC,OAAO,GAAY,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CACX,uDAAuD,WAAW,CAAC,IAAI,MAAO,GAAa,CAAC,OAAO,IAAI;oBACnG,oCAAoC,CAC3C,CAAC;YACN,CAAC;YACD,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;gBACzB,IAAI,CAAC,OAAO,EAAE,CAAC;oBACX,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,0CAA0C,OAAO,CAAC,IAAI,kCAAkC,CAAC,CAAC;gBAC/G,CAAC;gBACD,SAAS;YACb,CAAC;YACD,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;IACL,CAAC;CACJ,CAAA;AAnCY,oGAA4C;AACD;IAAnD,IAAA,kBAAM,EAAC,wCAAgC,CAAC;;6EAAqD;AAIpF;IAFT,IAAA,kBAAM,EAAC,2DAAoC,CAAC;IAC5C,IAAA,oBAAQ,GAAE;;kFACyD;AAEf;IAApD,IAAA,kBAAM,EAAC,iCAAiC,CAAC;8BAAqB,iCAAiC;8EAAC;AAErE;IAA3B,IAAA,kBAAM,EAAC,iBAAQ,CAAC;;8EAA4B;AAEnB;IAAzB,IAAA,kBAAM,EAAC,eAAM,CAAC;8BAAmB,eAAM;4EAAC;uDAXhC,4CAA4C;IADxD,IAAA,sBAAU,GAAE;GACA,4CAA4C,CAmCxD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
import { Args, ClientSessionInitializer, Logger, Registry } from '@eclipse-glsp/server';
|
|
17
|
+
import { McpDiagramScopedInput } from './mcp-input-schemas';
|
|
18
|
+
import { BaseMcpDiagramToolHandler, McpDiagramToolHandlerConstructor } from './mcp-tool-handler';
|
|
19
|
+
/**
|
|
20
|
+
* Per-GLSP-session factory that resolves a {@link McpDiagramToolHandlerConstructor} against the
|
|
21
|
+
* per-session Inversify container. Calls `container.resolve(ctor)` so `@inject(...)` fields on
|
|
22
|
+
* the handler are filled from the live `ClientSession.container` (alias service, model state,
|
|
23
|
+
* action dispatcher, etc.).
|
|
24
|
+
*
|
|
25
|
+
* Mirrors core's {@link OperationHandlerFactory} pattern in `DiagramModule`.
|
|
26
|
+
*/
|
|
27
|
+
export type McpDiagramToolHandlerFactory = (constructor: McpDiagramToolHandlerConstructor) => BaseMcpDiagramToolHandler<McpDiagramScopedInput>;
|
|
28
|
+
export declare const McpDiagramToolHandlerFactory: unique symbol;
|
|
29
|
+
/**
|
|
30
|
+
* Per-GLSP-session registry holding one {@link BaseMcpDiagramToolHandler} instance per
|
|
31
|
+
* `metadata.name`. Populated at GLSP-session-open by {@link McpDiagramToolHandlerRegistryInitializer},
|
|
32
|
+
* read at MCP-tool-call time by the launcher's dispatcher (looks up the right session, gets its
|
|
33
|
+
* registry, resolves the handler by name, invokes `createResult`).
|
|
34
|
+
*
|
|
35
|
+
* Bound singleton-per-session on the diagram container.
|
|
36
|
+
*/
|
|
37
|
+
export declare class McpDiagramToolHandlerRegistry extends Registry<string, BaseMcpDiagramToolHandler<McpDiagramScopedInput>> {
|
|
38
|
+
/** Convenience that derives the key from `handler.name` so callers don't repeat themselves. */
|
|
39
|
+
registerHandler(handler: BaseMcpDiagramToolHandler<McpDiagramScopedInput>): boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* {@link ClientSessionInitializer} that runs at GLSP-session-open. Reads the per-session
|
|
43
|
+
* constructor multi-binding ({@link McpDiagramToolHandlerConstructor}) and instantiates each
|
|
44
|
+
* handler via the {@link McpDiagramToolHandlerFactory}, registering the instance with the
|
|
45
|
+
* per-session {@link McpDiagramToolHandlerRegistry}.
|
|
46
|
+
*
|
|
47
|
+
* Same shape as core's `OperationHandlerRegistryInitializer`.
|
|
48
|
+
*/
|
|
49
|
+
export declare class McpDiagramToolHandlerRegistryInitializer implements ClientSessionInitializer {
|
|
50
|
+
protected factory: McpDiagramToolHandlerFactory;
|
|
51
|
+
protected constructors: McpDiagramToolHandlerConstructor[];
|
|
52
|
+
protected registry: McpDiagramToolHandlerRegistry;
|
|
53
|
+
protected clientId: string;
|
|
54
|
+
protected logger: Logger;
|
|
55
|
+
initialize(_args?: Args): void;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=mcp-diagram-tool-handler-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-diagram-tool-handler-registry.d.ts","sourceRoot":"","sources":["../../src/server/mcp-diagram-tool-handler-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,IAAI,EAAY,wBAAwB,EAAE,MAAM,EAAE,QAAQ,EAAuB,MAAM,sBAAsB,CAAC;AAEvH,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAEjG;;;;;;;GAOG;AACH,MAAM,MAAM,4BAA4B,GAAG,CACvC,WAAW,EAAE,gCAAgC,KAC5C,yBAAyB,CAAC,qBAAqB,CAAC,CAAC;AACtD,eAAO,MAAM,4BAA4B,eAAyC,CAAC;AAEnF;;;;;;;GAOG;AACH,qBACa,6BAA8B,SAAQ,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC,qBAAqB,CAAC,CAAC;IACjH,+FAA+F;IAC/F,eAAe,CAAC,OAAO,EAAE,yBAAyB,CAAC,qBAAqB,CAAC,GAAG,OAAO;CAGtF;AAED;;;;;;;GAOG;AACH,qBACa,wCAAyC,YAAW,wBAAwB;IAC/C,SAAS,CAAC,OAAO,EAAE,4BAA4B,CAAC;IAItF,SAAS,CAAC,YAAY,EAAE,gCAAgC,EAAE,CAAM;IAEzB,SAAS,CAAC,QAAQ,EAAE,6BAA6B,CAAC;IAEvE,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE7B,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IAEzC,UAAU,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI;CAwBjC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
*
|
|
9
|
+
* This Source Code may also be made available under the following Secondary
|
|
10
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
* with the GNU Classpath Exception which is available at
|
|
13
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
********************************************************************************/
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.McpDiagramToolHandlerRegistryInitializer = exports.McpDiagramToolHandlerRegistry = exports.McpDiagramToolHandlerFactory = void 0;
|
|
28
|
+
const server_1 = require("@eclipse-glsp/server");
|
|
29
|
+
const inversify_1 = require("inversify");
|
|
30
|
+
const mcp_tool_handler_1 = require("./mcp-tool-handler");
|
|
31
|
+
exports.McpDiagramToolHandlerFactory = Symbol('McpDiagramToolHandlerFactory');
|
|
32
|
+
/**
|
|
33
|
+
* Per-GLSP-session registry holding one {@link BaseMcpDiagramToolHandler} instance per
|
|
34
|
+
* `metadata.name`. Populated at GLSP-session-open by {@link McpDiagramToolHandlerRegistryInitializer},
|
|
35
|
+
* read at MCP-tool-call time by the launcher's dispatcher (looks up the right session, gets its
|
|
36
|
+
* registry, resolves the handler by name, invokes `createResult`).
|
|
37
|
+
*
|
|
38
|
+
* Bound singleton-per-session on the diagram container.
|
|
39
|
+
*/
|
|
40
|
+
let McpDiagramToolHandlerRegistry = class McpDiagramToolHandlerRegistry extends server_1.Registry {
|
|
41
|
+
/** Convenience that derives the key from `handler.name` so callers don't repeat themselves. */
|
|
42
|
+
registerHandler(handler) {
|
|
43
|
+
return this.register(handler.name, handler);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.McpDiagramToolHandlerRegistry = McpDiagramToolHandlerRegistry;
|
|
47
|
+
exports.McpDiagramToolHandlerRegistry = McpDiagramToolHandlerRegistry = __decorate([
|
|
48
|
+
(0, inversify_1.injectable)()
|
|
49
|
+
], McpDiagramToolHandlerRegistry);
|
|
50
|
+
/**
|
|
51
|
+
* {@link ClientSessionInitializer} that runs at GLSP-session-open. Reads the per-session
|
|
52
|
+
* constructor multi-binding ({@link McpDiagramToolHandlerConstructor}) and instantiates each
|
|
53
|
+
* handler via the {@link McpDiagramToolHandlerFactory}, registering the instance with the
|
|
54
|
+
* per-session {@link McpDiagramToolHandlerRegistry}.
|
|
55
|
+
*
|
|
56
|
+
* Same shape as core's `OperationHandlerRegistryInitializer`.
|
|
57
|
+
*/
|
|
58
|
+
let McpDiagramToolHandlerRegistryInitializer = class McpDiagramToolHandlerRegistryInitializer {
|
|
59
|
+
constructor() {
|
|
60
|
+
this.constructors = [];
|
|
61
|
+
}
|
|
62
|
+
initialize(_args) {
|
|
63
|
+
// Suppress the canRegister-false warn during core's `DefaultGlobalActionProvider`
|
|
64
|
+
// startup probe — that probe runs on a throwaway container with empty action-kind set,
|
|
65
|
+
// so `canRegister()` returning false there is structural, not a real opt-out.
|
|
66
|
+
const isProbe = this.clientId === server_1.TEMPORARY_CLIENT_ID;
|
|
67
|
+
for (const constructor of this.constructors) {
|
|
68
|
+
let handler;
|
|
69
|
+
try {
|
|
70
|
+
handler = this.factory(constructor);
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
throw new Error(`Failed to instantiate MCP diagram tool handler '${constructor.name}': ${err.message}. ` +
|
|
74
|
+
'Check your DiagramModule bindings.');
|
|
75
|
+
}
|
|
76
|
+
if (!handler.canRegister()) {
|
|
77
|
+
if (!isProbe) {
|
|
78
|
+
this.logger.warn(`Skipping MCP diagram tool handler '${handler.name}': canRegister() returned false.`);
|
|
79
|
+
}
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
this.registry.registerHandler(handler);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
exports.McpDiagramToolHandlerRegistryInitializer = McpDiagramToolHandlerRegistryInitializer;
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, inversify_1.inject)(exports.McpDiagramToolHandlerFactory),
|
|
89
|
+
__metadata("design:type", Function)
|
|
90
|
+
], McpDiagramToolHandlerRegistryInitializer.prototype, "factory", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
(0, inversify_1.inject)(mcp_tool_handler_1.McpDiagramToolHandlerConstructor),
|
|
93
|
+
(0, inversify_1.optional)(),
|
|
94
|
+
__metadata("design:type", Array)
|
|
95
|
+
], McpDiagramToolHandlerRegistryInitializer.prototype, "constructors", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, inversify_1.inject)(McpDiagramToolHandlerRegistry),
|
|
98
|
+
__metadata("design:type", McpDiagramToolHandlerRegistry)
|
|
99
|
+
], McpDiagramToolHandlerRegistryInitializer.prototype, "registry", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
(0, inversify_1.inject)(server_1.ClientId),
|
|
102
|
+
__metadata("design:type", String)
|
|
103
|
+
], McpDiagramToolHandlerRegistryInitializer.prototype, "clientId", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
(0, inversify_1.inject)(server_1.Logger),
|
|
106
|
+
__metadata("design:type", server_1.Logger)
|
|
107
|
+
], McpDiagramToolHandlerRegistryInitializer.prototype, "logger", void 0);
|
|
108
|
+
exports.McpDiagramToolHandlerRegistryInitializer = McpDiagramToolHandlerRegistryInitializer = __decorate([
|
|
109
|
+
(0, inversify_1.injectable)()
|
|
110
|
+
], McpDiagramToolHandlerRegistryInitializer);
|
|
111
|
+
//# sourceMappingURL=mcp-diagram-tool-handler-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-diagram-tool-handler-registry.js","sourceRoot":"","sources":["../../src/server/mcp-diagram-tool-handler-registry.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,iDAAuH;AACvH,yCAAyD;AAEzD,yDAAiG;AAapF,QAAA,4BAA4B,GAAG,MAAM,CAAC,8BAA8B,CAAC,CAAC;AAEnF;;;;;;;GAOG;AAEI,IAAM,6BAA6B,GAAnC,MAAM,6BAA8B,SAAQ,iBAAkE;IACjH,+FAA+F;IAC/F,eAAe,CAAC,OAAyD;QACrE,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;CACJ,CAAA;AALY,sEAA6B;wCAA7B,6BAA6B;IADzC,IAAA,sBAAU,GAAE;GACA,6BAA6B,CAKzC;AAED;;;;;;;GAOG;AAEI,IAAM,wCAAwC,GAA9C,MAAM,wCAAwC;IAA9C;QAKO,iBAAY,GAAuC,EAAE,CAAC;IAgCpE,CAAC;IAxBG,UAAU,CAAC,KAAY;QACnB,kFAAkF;QAClF,uFAAuF;QACvF,8EAA8E;QAC9E,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,KAAK,4BAAmB,CAAC;QACtD,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YAC1C,IAAI,OAAyD,CAAC;YAC9D,IAAI,CAAC;gBACD,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACxC,CAAC;YAAC,OAAO,GAAY,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CACX,mDAAmD,WAAW,CAAC,IAAI,MAAO,GAAa,CAAC,OAAO,IAAI;oBAC/F,oCAAoC,CAC3C,CAAC;YACN,CAAC;YACD,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;gBACzB,IAAI,CAAC,OAAO,EAAE,CAAC;oBACX,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,sCAAsC,OAAO,CAAC,IAAI,kCAAkC,CAAC,CAAC;gBAC3G,CAAC;gBACD,SAAS;YACb,CAAC;YACD,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;IACL,CAAC;CACJ,CAAA;AArCY,4FAAwC;AACD;IAA/C,IAAA,kBAAM,EAAC,oCAA4B,CAAC;;yEAAiD;AAI5E;IAFT,IAAA,kBAAM,EAAC,mDAAgC,CAAC;IACxC,IAAA,oBAAQ,GAAE;;8EACqD;AAEf;IAAhD,IAAA,kBAAM,EAAC,6BAA6B,CAAC;8BAAqB,6BAA6B;0EAAC;AAE7D;IAA3B,IAAA,kBAAM,EAAC,iBAAQ,CAAC;;0EAA4B;AAEnB;IAAzB,IAAA,kBAAM,EAAC,eAAM,CAAC;8BAAmB,eAAM;wEAAC;mDAXhC,wCAAwC;IADpD,IAAA,sBAAU,GAAE;GACA,wCAAwC,CAqCpD"}
|