-
Notifications
You must be signed in to change notification settings - Fork 21
Add support for Model Context Protocol #271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ jobs: | |
| env: | ||
| STANDALONE_URL: 'file://${{ github.workspace }}/glsp-client/examples/workflow-standalone/app/diagram.html' | ||
| GLSP_SERVER_PORT: '8081' | ||
| GLSP_MCP_SERVER_PORT: '64577' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this added?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We do not, so I removed it again. |
||
| GLSP_SERVER_PLAYWRIGHT_MANAGED: 'false' | ||
| GLSP_WEBSOCKET_PATH: 'workflow' | ||
| THEIA_URL: 'http://localhost:3000' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,10 @@ | |
| function linkClient() { | ||
| echo "--- Link Client packages ---" | ||
| cd $2/glsp-client || exit | ||
| # Defensive: stale nested @eclipse-glsp copies from prior installs shadow the workspace | ||
| # symlinks via Node's nearest-node_modules-wins resolution → bundle fails. | ||
| # Remove them before re-linking. | ||
| find packages examples -path '*/node_modules/@eclipse-glsp' -type d -exec rm -rf {} + 2>/dev/null || true | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if it's worth maintaining this script any longer. We should probably update our repos accordingly.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, I think so too, should be done in a proper cleanup. |
||
|
|
||
| cd examples/workflow-glsp || exit | ||
| yarn $1 | ||
|
|
@@ -42,6 +46,9 @@ function linkClient() { | |
| linkNodeServer() { | ||
| echo $2/glsp-server-node | ||
| if [ -d $2/glsp-server-node ]; then | ||
| cd $2/glsp-server-node || exit | ||
| # Same defensive cleanup as linkClient — stale nested @eclipse-glsp copies shadow workspace links. | ||
| find packages examples -path '*/node_modules/@eclipse-glsp' -type d -exec rm -rf {} + 2>/dev/null || true | ||
| cd $2/glsp-server-node/packages/graph || exit | ||
| yarn $1 | ||
| cd ../layout-elk || exit | ||
|
|
@@ -84,13 +91,13 @@ if [[ "$2" != "--unlink" ]]; then | |
| cd $baseDir/glsp-theia-integration || exit | ||
| yarn link sprotty sprotty-protocol @eclipse-glsp/client @eclipse-glsp/protocol @eclipse-glsp/sprotty @eclipse-glsp-examples/workflow-glsp vscode-jsonrpc inversify | ||
| if [ -d $baseDir/glsp-server-node ]; then | ||
| yarn link @eclipse-glsp/server @eclipse-glsp/graph @eclipse-glsp/layout-elk @eclipse-glsp-examples/workflow-server @eclipse-glsp-examples/workflow-server-bundled | ||
| yarn link @eclipse-glsp/server @eclipse-glsp/server-mcp @eclipse-glsp/graph @eclipse-glsp/layout-elk @eclipse-glsp-examples/workflow-server @eclipse-glsp-examples/workflow-server-bundled | ||
| fi | ||
| yarn install --force | ||
| else | ||
| yarn unlink sprotty sprotty-protocol @eclipse-glsp/client @eclipse-glsp/protocol @eclipse-glsp/sprotty @eclipse-glsp-examples/workflow-glsp vscode-jsonrpc inversify | ||
| if [ -d $baseDir/glsp-server-node ]; then | ||
| yarn unlink @eclipse-glsp/server @eclipse-glsp/graph @eclipse-glsp/layout-elk @eclipse-glsp-examples/workflow-server @eclipse-glsp-examples/workflow-server-bundled | ||
| yarn unlink @eclipse-glsp/server @eclipse-glsp/server-mcp @eclipse-glsp/graph @eclipse-glsp/layout-elk @eclipse-glsp-examples/workflow-server @eclipse-glsp-examples/workflow-server-bundled | ||
| fi | ||
| yarn | ||
| yarn install --force | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /******************************************************************************** | ||
| * Copyright (c) 2019-2023 EclipseSource and others. | ||
| * Copyright (c) 2019-2026 EclipseSource and others. | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Eclipse Public License v. 2.0 which is available at | ||
|
|
@@ -14,6 +14,7 @@ | |
| * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
| ********************************************************************************/ | ||
| import { Args, MaybePromise } from '@eclipse-glsp/client'; | ||
| import { McpInitializeParameters } from '@eclipse-glsp/protocol'; | ||
|
Check failure on line 17 in examples/workflow-theia/src/browser/workflow-glsp-client-contribution.ts
|
||
| import { BaseGLSPClientContribution, WebSocketConnectionOptions } from '@eclipse-glsp/theia-integration/lib/browser'; | ||
| import { EnvVariablesServer } from '@theia/core/lib/common/env-variables'; | ||
| import { inject, injectable } from '@theia/core/shared/inversify'; | ||
|
|
@@ -32,6 +33,14 @@ | |
| readonly id = WorkflowLanguage.contributionId; | ||
| readonly fileExtensions = WorkflowLanguage.fileExtensions; | ||
|
|
||
| protected override async createInitializeParameters(): Promise<McpInitializeParameters> { | ||
| const mcpPort = await this.getMcpServerPortFromEnv(); | ||
| return { | ||
| ...(await super.createInitializeParameters()), | ||
| mcpServer: { name: 'glsp-workflow', ...(mcpPort !== undefined && { port: mcpPort }) } | ||
| }; | ||
| } | ||
|
martin-fleck-at marked this conversation as resolved.
|
||
|
|
||
| protected override createInitializeOptions(): MaybePromise<Args | undefined> { | ||
| return { | ||
| ['timestamp']: new Date().toString(), | ||
|
|
@@ -61,4 +70,16 @@ | |
| } | ||
| return undefined; | ||
| } | ||
|
|
||
| protected async getMcpServerPortFromEnv(): Promise<number | undefined> { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could probably align this into one
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good idea! |
||
| const envVar = await this.envVariablesServer.getValue('GLSP_MCP_SERVER_PORT'); | ||
| if (envVar && envVar.value) { | ||
| const mcpServerPort = Number.parseInt(envVar.value, 10); | ||
| if (isNaN(mcpServerPort) || mcpServerPort < 0 || mcpServerPort > 65535) { | ||
| throw new Error('Value of environment variable GLSP_MCP_SERVER_PORT is not a valid port'); | ||
| } | ||
| return mcpServerPort; | ||
| } | ||
| return undefined; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CHANGELOG entry formatting changed from - (dash + 3 spaces) to - (dash + 1 space), which contradicts the style guide in SKILL.md line 84 that specifies "Entry prefix: - (dash + exactly 3 spaces)". If this is an intentional style migration,
the SKILL.md should be updated to match. If not, the CHANGELOG entry should retain the original format.
This might be related to the underlying version of prettier/eslint/markdown-lint that is used. I also experienced similar issues in other glsp projects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prettier actually enforces the 1 space when we do
yarn format. I updated the skill for this as it proposes 3 spaces