Skip to content

Commit b90724a

Browse files
Document Model Context Protocol (MCP) support
- Add an MCP documentation section covering enablement, architecture, tool-platform integration, and security, linking to the server-mcp docs - Include a high-level MCP architecture diagram (SVG) - Document the experimental mcpServer opt-in on InitializeParameters and the announced server URL on InitializeResult - Add the generic export pipeline (RequestExportAction/ExportResultAction with PNG support) and deprecate the SVG-only export actions - Add the OriginViewportAction and MoveViewportAction viewport actions - Add GetEditorContextAction/EditorContextResult and note server-to-client requests Fixes #1673
1 parent aa774ef commit b90724a

4 files changed

Lines changed: 373 additions & 0 deletions

File tree

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
+++
2+
fragment = "content"
3+
weight = 100
4+
5+
title = "Model Context Protocol (MCP)"
6+
7+
[sidebar]
8+
sticky = true
9+
+++
10+
11+
The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) is an open standard that lets AI agents and LLM-based tools interact with external systems through a uniform interface.
12+
GLSP can optionally expose a GLSP server as an MCP server, so that AI clients (such as an IDE chat assistant) can inspect and edit diagram models using the same standardized interface they use for any other MCP integration.
13+
14+
> ⚠️ **Experimental.** MCP support is under active development.
15+
> Option names, schema shapes, and handler contracts may still change in minor releases until the feature graduates from its experimental status.
16+
> MCP support is currently provided by the [node-based GLSP server](https://github.com/eclipse-glsp/glsp-server-node) only; support for the Java server is tracked in [eclipse-glsp/glsp#1672](https://github.com/eclipse-glsp/glsp/issues/1672).
17+
18+
### What it provides
19+
20+
A GLSP MCP server surfaces the active diagrams through the three MCP capability kinds:
21+
22+
* 🛠️ **Tools** — read/query operations to inspect diagram elements, and write operations to create, modify, delete, validate, and navigate them (as well as to query the active sessions). Write tools dispatch regular GLSP [operations]({{< relref "modelOperations" >}}), so they go through the same model-modification logic as a human user.
23+
* 📦 **Resources** — URI-addressable, read-only data. In the default ship-set this is the rendered diagram screenshot (`diagram-png`); other read endpoints are exposed as plain tools because in-the-wild MCP clients support tools more reliably than resources.
24+
* 💬 **Prompts** — user-invokable templates that frame multi-step agent tasks against the diagram.
25+
26+
Each connecting MCP client gets its own MCP session that runs a preconfigured agent persona (the *GLSP Modeling Agent*) guiding the AI client toward correct and safe use of the modeling tools.
27+
The integration targets the MCP `2025-06-18` specification and communicates over the Streamable HTTP transport.
28+
29+
### Enabling MCP
30+
31+
MCP is **opt-in** and disabled by default.
32+
An MCP-aware GLSP client enables it by including an `mcpServer` configuration in the `initialize` request — the mere presence of the key is the opt-in signal.
33+
Once started, the resolved server URL is reported back in the `InitializeResult` (and as a tagged `[GLSP-MCP-Server]:Ready.` line on the server's stdout) so that integrations can pick it up automatically.
34+
35+
See the [GLSP Protocol]({{< relref "protocol" >}}) page for the `mcpServer` configuration and result types.
36+
37+
### Architecture
38+
39+
<p align="center">
40+
<img src="mcp-architecture.svg" alt="High-level GLSP MCP architecture" width=700/>
41+
<br/>
42+
<b>High-level MCP architecture: the GLSP server starts an MCP server when a client opts in</b>
43+
</p>
44+
45+
The MCP server runs *inside* each GLSP server, which itself is created per connecting application.
46+
One GLSP server therefore corresponds to one MCP server listening on one port, and all diagrams of that GLSP server are surfaced through it, multiplexed per client session.
47+
48+
The MCP server is not started eagerly: the GLSP server spawns it lazily the first time a GLSP client connects with an `mcpServer` opt-in in its `initialize` request, and disposes it together with the GLSP server.
49+
The resolved URL is then announced back to the client (and as a tagged line on the server's stdout), so the tool-platform integration can register it with the MCP client.
50+
By default a random free port is chosen; adopters can pin a fixed port when an external MCP client needs a stable URL.
51+
52+
The shipped defaults work on any GLSP model, but produce deliberately generic output.
53+
Adopters get measurably better LLM-driven results by binding diagram-specific implementations (a model serializer, a label provider, and an element-types provider) and by registering language-specific tools, resources, and prompts on their diagram module.
54+
The workflow example server is the canonical reference for this wiring.
55+
56+
### Tool platform integration
57+
58+
How the announced MCP server URL reaches the AI client depends on the platform:
59+
60+
* **Eclipse Theia** — the [`@eclipse-glsp/theia-mcp-integration`](https://github.com/eclipse-glsp/glsp-theia-integration/tree/master/packages/theia-mcp-integration) package ships a contribution that automatically registers every GLSP server's MCP URL with [`@theia/ai-mcp`](https://github.com/eclipse-theia/theia) on startup. No adopter wiring is needed beyond installing the package.
61+
* **VS Code** — the [`@eclipse-glsp/vscode-integration`](https://github.com/eclipse-glsp/glsp-vscode-integration) exposes a `GlspMcpServerProvider` (a `vscode.McpServerDefinitionProvider`). Adopters declare an `mcpServerDefinitionProviders` contribution in their extension, register the provider, and feed it the GLSP `InitializeResult`.
62+
* **Standalone / external clients** — external MCP clients (e.g. Claude Desktop or the MCP Inspector) are configured by the user with a stable URL. Pin a fixed port and document it in your setup guide.
63+
64+
### Security
65+
66+
The shipped defaults assume a single trusted local process reaching the MCP server over loopback — the typical desktop-IDE deployment.
67+
The server binds to loopback only by default and performs the spec-mandated `Host`/`Origin` validation to defeat DNS rebinding, but ships with **no authentication**.
68+
Widening the bind beyond loopback is an explicit, acknowledged deploy-time decision and requires an external authenticating layer (e.g. a reverse proxy).
69+
The server is not hardened for hostile multi-tenant or public-internet exposure.
70+
71+
### Further reading
72+
73+
* [`@eclipse-glsp/server-mcp` README](https://github.com/eclipse-glsp/glsp-server-node/blob/main/packages/server-mcp/README.md) — integration quickstart for adopters
74+
* [`@eclipse-glsp/server-mcp` Architecture & Extension Guide](https://github.com/eclipse-glsp/glsp-server-node/blob/main/packages/server-mcp/ARCHITECTURE.md) — architecture, security model, configuration surface, and the extension cookbook
75+
* [GLSP MCP feature request (eclipse-glsp/glsp#1546)](https://github.com/eclipse-glsp/glsp/issues/1546) — background and rationale

content/documentation/mcp/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
+++
2+
title = "Model Context Protocol (MCP)"
3+
weight = 85
4+
+++
Lines changed: 49 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)