Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/workflow-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"dependencies": {
"@eclipse-glsp/layout-elk": "2.6.0-next",
"@eclipse-glsp/server": "2.6.0-next",
"@eclipse-glsp/server-mcp": "2.6.0-next",
"inversify": "^6.1.3"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
ContextMenuItemProvider,
DiagramConfiguration,
EdgeCreationChecker,
GLSPServer,
GLSPServerInitContribution,

Check failure on line 24 in examples/workflow-server/src/common/workflow-diagram-module.ts

View workflow job for this annotation

GitHub Actions / Test

Module '"@eclipse-glsp/server"' has no exported member 'GLSPServerInitContribution'.

Check failure on line 24 in examples/workflow-server/src/common/workflow-diagram-module.ts

View workflow job for this annotation

GitHub Actions / Build

Module '"@eclipse-glsp/server"' has no exported member 'GLSPServerInitContribution'.

Check failure on line 24 in examples/workflow-server/src/common/workflow-diagram-module.ts

View workflow job for this annotation

GitHub Actions / Lint

Module '"@eclipse-glsp/server"' has no exported member 'GLSPServerInitContribution'.
GModelDiagramModule,
InstanceMultiBinding,
LabelEditValidator,
Expand Down Expand Up @@ -57,13 +57,13 @@
import { TaskEditValidator } from './taskedit/task-edit-validator';
import { WorkflowDiagramConfiguration } from './workflow-diagram-configuration';
import { WorkflowEdgeCreationChecker } from './workflow-edge-creation-checker';
import { WorkflowGLSPServer } from './workflow-glsp-server';
import { CustomArgsInitContribution } from './workflow-glsp-server';
import { WorkflowPopupFactory } from './workflow-popup-factory';

@injectable()
export class WorkflowServerModule extends ServerModule {
protected override bindGLSPServer(): BindingTarget<GLSPServer> {
return WorkflowGLSPServer;
protected override configureGLSPServerInitContributions(binding: MultiBinding<GLSPServerInitContribution>): void {
binding.add(CustomArgsInitContribution);
}
}

Expand Down
25 changes: 16 additions & 9 deletions examples/workflow-server/src/common/workflow-glsp-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,32 @@
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
import { Args, ArgsUtil, DefaultGLSPServer, InitializeResult, Logger, MaybePromise } from '@eclipse-glsp/server';
import {
ArgsUtil,
GLSPServer,
GLSPServerInitContribution,

Check failure on line 19 in examples/workflow-server/src/common/workflow-glsp-server.ts

View workflow job for this annotation

GitHub Actions / Test

Module '"@eclipse-glsp/server"' has no exported member 'GLSPServerInitContribution'.

Check failure on line 19 in examples/workflow-server/src/common/workflow-glsp-server.ts

View workflow job for this annotation

GitHub Actions / Build

Module '"@eclipse-glsp/server"' has no exported member 'GLSPServerInitContribution'.

Check failure on line 19 in examples/workflow-server/src/common/workflow-glsp-server.ts

View workflow job for this annotation

GitHub Actions / Lint

Module '"@eclipse-glsp/server"' has no exported member 'GLSPServerInitContribution'.
InitializeParameters,
InitializeResult,
Logger,
MaybePromise
} from '@eclipse-glsp/server';
import { inject, injectable } from 'inversify';

@injectable()
export class WorkflowGLSPServer extends DefaultGLSPServer {
export class CustomArgsInitContribution implements GLSPServerInitContribution {
MESSAGE_KEY = 'message';
TIMESTAMP_KEY = 'timestamp';

@inject(Logger)
protected override logger: Logger;
@inject(Logger) protected logger: Logger;

protected override handleInitializeArgs(result: InitializeResult, args: Args | undefined): MaybePromise<InitializeResult> {
if (!args) {
initializeServer(server: GLSPServer, params: InitializeParameters, result: InitializeResult): MaybePromise<InitializeResult> {
if (!params.args) {
return result;
}
const timestamp = ArgsUtil.get(args, this.TIMESTAMP_KEY);
const message = ArgsUtil.get(args, this.MESSAGE_KEY);
const timestamp = ArgsUtil.get(params.args, this.TIMESTAMP_KEY);
const message = ArgsUtil.get(params.args, this.MESSAGE_KEY);

this.logger.debug(`${timestamp}: ${message}`);
this.logger.info(`${timestamp}: ${message}`);
return result;
}
}
9 changes: 5 additions & 4 deletions examples/workflow-server/src/node/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
import 'reflect-metadata';

import { configureELKLayoutModule } from '@eclipse-glsp/layout-elk';
import { createAppModule, GModelStorage, Logger, SocketServerLauncher, WebSocketServerLauncher } from '@eclipse-glsp/server/node';
import { GModelStorage, Logger, SocketServerLauncher, WebSocketServerLauncher, createAppModule } from '@eclipse-glsp/server/node';
import { Container } from 'inversify';

import { configureMcpModule } from '@eclipse-glsp/server-mcp';
import { WorkflowLayoutConfigurator } from '../common/layout/workflow-layout-configurator';
import { WorkflowDiagramModule, WorkflowServerModule } from '../common/workflow-diagram-module';
import { createWorkflowCliParser } from './workflow-cli-parser';
Expand All @@ -40,14 +41,14 @@ async function launch(argv?: string[]): Promise<void> {

const elkLayoutModule = configureELKLayoutModule({ algorithms: ['layered'], layoutConfigurator: WorkflowLayoutConfigurator });
const serverModule = new WorkflowServerModule().configureDiagramModule(new WorkflowDiagramModule(() => GModelStorage), elkLayoutModule);

const mcpModule = configureMcpModule();
if (options.webSocket) {
const launcher = appContainer.resolve(WebSocketServerLauncher);
launcher.configure(serverModule);
launcher.configure(serverModule, mcpModule);
await launcher.start({ port: options.port, host: options.host, path: 'workflow' });
} else {
const launcher = appContainer.resolve(SocketServerLauncher);
launcher.configure(serverModule);
launcher.configure(serverModule, mcpModule);
await launcher.start({ port: options.port, host: options.host });
}
}
Expand Down
3 changes: 3 additions & 0 deletions examples/workflow-server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
{
"path": "../../packages/server"
},
{
"path": "../../packages/server-mcp"
},
{
"path": "../../packages/layout-elk"
}
Expand Down
12 changes: 12 additions & 0 deletions packages/server-mcp/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
extends: '../../.eslintrc.js',
rules: {
'import/no-unresolved': [
'error',
{
ignore: ['^@modelcontextprotocol/sdk/']
}
]
}
};
62 changes: 62 additions & 0 deletions packages/server-mcp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"name": "@eclipse-glsp/server-mcp",
"version": "2.6.0-next",
"description": "Extension of the GLSP Node Server for the Model Context Protocol",
"keywords": [
"eclipse",
"graphics",
"diagram",
"modeling",
"visualization",
"glsp",
"diagram editor",
"mcp"
],
"homepage": "https://www.eclipse.org/glsp/",
"bugs": "https://github.com/eclipse-glsp/glsp/issues",
"repository": {
"type": "git",
"url": "https://github.com/eclipse-glsp/glsp-server-node.git"
},
"license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
"author": {
"name": "Eclipse GLSP"
},
"contributors": [
{
"name": "Eclipse GLSP Project",
"email": "[email protected]",
"url": "https://projects.eclipse.org/projects/ecd.glsp"
}
],
"main": "lib/index",
"types": "lib/index",
"files": [
"lib",
"src"
],
"scripts": {
"build": "tsc -b",
"clean": "rimraf lib *.tsbuildinfo coverage .nyc_output",
"generate:index": "glsp generateIndex src -f -s",
"lint": "eslint --ext .ts,.tsx ./src",
"test": "mocha --config ../../.mocharc \"./src/**/*.spec.?(ts|tsx)\"",
"test:ci": "yarn test --reporter mocha-ctrf-json-reporter",
"test:coverage": "nyc yarn test",
"watch": "tsc -w"
},
"dependencies": {
"@eclipse-glsp/server": "2.6.0-next",
"@modelcontextprotocol/sdk": "^1.25.1",
"express": "^5.2.1"
},
"devDependencies": {
"@types/express": "^5.0.6"
},
"peerDependencies": {
"inversify": "^6.1.3"
},
"publishConfig": {
"access": "public"
}
}
Loading
Loading