Skip to content

Add support for Model Context Protocol (MCP) #1546

@martin-fleck-at

Description

@martin-fleck-at

Summary

Add support for the Model Context Protocol (MCP) to Eclipse GLSP, enabling integration with AI assistants and language models for enhanced diagram editing capabilities. This feature will allow external AI tools to interact with GLSP diagram editors as instrumented tools, providing contextual information about diagrams, models, and editing operations.

The Model Context Protocol (MCP) is an open standard that enables secure connections between host applications and AI models. By implementing MCP support in GLSP, we can provide AI assistants with contextual information about diagrams, models, and the current editing state, enabling more intelligent assistance for diagram creation, modification, and analysis.

Example Use Cases

Use Cases

Use Case 1: Diagram Analysis and Suggestions

Feature: AI-Powered Diagram Analysis

As an external AI tool
I want to analyze the current diagram structure through the MCP server
So that I can provide intelligent suggestions for improvements

Scenario: Analyzing diagram complexity
  Given an external AI tool is connected to the GLSP MCP server
  When the AI tool requests the current diagram context
  Then the MCP server should return the diagram structure, elements, and relationships
  And the AI tool can analyze layout efficiency and suggest optimizations

Use Case 2: Context-Aware Element Creation

Feature: AI-Assisted Element Creation

As an external AI tool
I want to create diagram elements based on context
So that I can assist users in building meaningful diagrams

Scenario: Creating contextually appropriate elements
  Given a diagram with existing elements
  When the AI tool analyzes the current selection and diagram state
  Then the AI tool should suggest appropriate new elements
  And execute creation commands through the MCP server

Use Case 3: Model Validation and Error Detection

Feature: Enhanced Model Validation

As an external AI tool
I want to access model validation context
So that I can provide intelligent error detection and fixes

Scenario: Detecting and fixing validation errors
  Given a diagram with validation issues
  When the AI tool requests validation context through MCP
  Then the MCP server should provide current validation state
  And the AI tool can suggest and execute fixes

Architecture Overview

┌─────────────────┐    ┌──────────────────┐    ┌─────────────────┐
│   AI Assistant  │◄──►│   MCP Client     │◄──►│  GLSP Editor    │
│   (Claude, etc) │    │ (Theia/VS Code)  │    │   (Frontend)    │
└─────────────────┘    └──────────────────┘    └─────────────────┘
                                │                        │
                                ▼                        ▼
                       ┌──────────────────┐    ┌─────────────────┐
                       │   GLSP MCP       │◄──►│  GLSP Server    │
                       │   Server         │    │   (Backend)     │
                       └──────────────────┘    └─────────────────┘

Acceptance Criteria

  • MCP server can be started as a GLSP backend service (opt-in), cf. implementation in Theia 1
  • External AI tools can connect and discover available tools and resources
  • Context providers expose real-time diagram and model state
  • Tools can execute GLSP operations (create, modify, delete elements)
  • Integration works seamlessly with existing GLSP editors (Theia, VS Code, Standalone)
  • Adopters can register custom MCP tools on the server side through contribution points
  • Comprehensive documentation provided for adopters

Footnotes

  1. Theia MCP Implementation: eclipse-theia/theia#15824

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions