Jonas Helming, Maximilian Koegel and Philip Langer co-lead EclipseSource, specializing in consulting and engineering innovative, customized tools and IDEs, with a strong …
Teaching Diagrams to Talk: GLSP Meets the Model Context Protocol
June 18, 2026 | 7 min ReadDiagram editors show structure to people. With Model Context Protocol (MCP) integration, Eclipse GLSP editors now show that structure to AI agents and let them act on it. An assistant can answer questions, suggest improvements, make changes you describe in plain language, or validate the model, all through a standard protocol that MCP-aware clients (Claude, VS Code Copilot, Theia AI, the MCP Inspector, and others) speak.
We’ve supported AI integration with GLSP for a few years now, but earlier approaches required custom agents and tools for each use case. With MCP, this becomes much easier and more versatile: any MCP-aware AI client can work with your diagrams out of the box, and the generic MCP foundation means you write the integration once instead of per-agent. As diagrams are often domain-specific, custom extensions to the generic MCP basis is a first-class concept though.
What an Agent Can Do with Your Diagram
The GLSP MCP server exposes three kinds of capabilities:
- Tools: the verbs. Agents can inspect the model (serialized to compact Markdown), query and count elements, list the element types they may create, create / modify / delete nodes and edges, validate the diagram, auto-layout it, navigate (move the viewport, set the selection), undo / redo, and save.
- Resources: read-only, URI-addressable views, including rendered PNG and SVG snapshots the agent can actually “look at”.
- Prompts: reusable, multi-step task templates (e.g. describe this diagram, suggest improvements) that adopters can extend.
The reference write tools are built on top of GLSP’s existing operations. create-nodes dispatches a CreateNodeOperation, and so on. Because they operate in the same command stack as human edits, they get undo/redo, model integrity checks, and validation for free. validate-diagram returns exactly the markers a developer sees in the IDE’s Problems view. There’s also no generic “apply arbitrary operation” tool exposed by default. This is a deliberate convention of the provided handlers rather than a hard constraint: adopters write their own explicit handlers and may implement them differently, but following the operation-based pattern is what keeps agent edits consistent with what a human could do in the editor.
In this showcase, we start from the classic coffee-machine workflow and simply ask: “After the coffee is brewed, add a manual ‘Clean machine’ step that loops back to the temperature check, then tidy up the layout and show me what changed.” The agent creates the node and edges, validates the result, auto-layouts the graph, and pans the camera to highlight its work.
The Big Picture
On the left sits the AI side: an AI agent / LLM drives an MCP client (Theia, VS Code, or a desktop client like Claude), which talks to the GLSP client (diagram editor). On the right is the GLSP server process, hosting one MCP server per GLSP server alongside the client sessions (one per open diagram).
Two protocols meet here. The MCP client and MCP server communicate over MCP / HTTP, while the diagram editor and its client sessions keep speaking the regular GLSP protocol. The MCP server then operates on those same sessions, so when an agent asks to inspect or change a diagram, it acts on the exact model the user has open, through the same channels a human edit would take.
For the full breakdown of session lifetimes, transport, and ID aliasing, see the server architecture notes.
How It Works
One MCP server runs per GLSP server instance, multiplexing all open diagram sessions over a single endpoint. GLSP client sessions and MCP sessions have independent lifetimes. A few design choices make it pleasant to work with:
- Per-session ID aliasing. Verbose UUIDs and structural paths consume LLM tokens and clutter prompts. The integration swaps them for short, sequential aliases on the wire, keeping context windows lean and responses more reliable. Aliasing is per diagram session, so IDs from one diagram never leak into another.
- Built-in modeling agent persona. Connecting MCP clients receive agent-persona instructions tuned for safe, effective diagram manipulation, so the LLM starts with sensible guardrails even before any custom prompting.
- Structured outputs. Tools return typed
structuredContentalongside a human-readable summary, so clients get machine-parseable results. - Logs, progress and resumable streaming. Handler logs flow to both GLSP and the MCP client; long operations emit best-effort progress; the SSE transport supports
Last-Event-IDrecovery.
Adopters can extend everything: add custom tools, resources, and prompts for domain-specific actions, or override the built-in handlers when the defaults don’t fit. Here’s what adding a custom tool looks like:
@injectable()
export class SessionCountMcpToolHandler extends AbstractMcpToolHandler<SessionCountInput> {
static readonly NAME = 'session-count';
readonly name = SessionCountMcpToolHandler.NAME;
readonly description = 'Count active GLSP sessions, optionally filtered by diagram type.';
readonly inputSchema = SessionCountInputSchema;
@inject(ClientSessionManager) protected clientSessionManager: ClientSessionManager;
protected createResult({ diagramType }: SessionCountInput): McpToolResult {
const sessions = this.clientSessionManager.getSessions();
const filtered = diagramType
? sessions.filter(s => s.diagramType === diagramType)
: sessions;
return this.success(`${filtered.length} session(s)`, { count: filtered.length });
}
}
// Register it in your module
class MyMcpServerModule extends DefaultMcpServerModule {
protected override configureToolHandlers(binding: McpHandlerMultiBinding<McpToolHandler>): void {
super.configureToolHandlers(binding);
binding.add(SessionCountMcpToolHandler);
}
}
The same pattern applies to resources and prompts.
Across the Whole GLSP Stack
The integration spans the entire GLSP stack, and enabling it is minimal (the GLSP MCP documentation walks through each integration in detail):
glsp-server-node ships the MCP server packages and the reference handlers.
Client: add an
mcpServerobject to the initialize request. An empty object enables MCP with defaults; omit it and MCP is fully disabled.Theia: zero configuration required. The Theia integration auto-registers every GLSP server’s MCP endpoint with Theia AI on startup (see demo above).
VS Code: the provider of the GLSP VS Code extension registers an MCP server provider alongside their GLSP editor, which can then be used in VS Code copilot or other AI extensions operating in VS Code.
- Standalone: the GLSP node launcher announces the MCP endpoint, which can then be configured in clients, such as Claude Code or any other MCP-enabled AI client.
- Browser: run the portable Fetch handler inside a Web Worker, reachable same-origin via a Service Worker, with no Node server at all. See the
server-mcpREADME for details.
Making It Speak Your Language
Out of the box, the generic services work for any GLSP language and produce generic output about diagram state, etc. To optimize your results, you should, however, subclass three small providers: the model serializer, the label provider, and the element-types provider, to teach the agent how your diagram language works. The Workflow example does exactly this: it renders the diagram as ordered Markdown and advertises rich, described element types (Manual Task, Decision Node, Weighted Edge, and others).
A Note on Security
By default, the server binds to loopback only and validates the Host header to defeat DNS rebinding, but it ships no authentication. It’s built for trusted local processes. Widening the bind address is an explicit, eyes-open opt-in.
Learn More
Need Support?
If you have questions about Eclipse GLSP or need specific features, get in touch with us. EclipseSource provides support for building custom diagram editors using Eclipse GLSP, for adding custom features to GLSP, and for building custom IDEs or tools based on VS Code or Eclipse Theia.
Stay Updated with Our Latest Articles
Want to ensure you get notifications for all our new blog posts? Follow us on LinkedIn and turn on notifications:
- Go to the EclipseSource LinkedIn page and click "Follow"
- Click the bell icon in the top right corner of our page
- Select "All posts" instead of the default setting