|
| 1 | +# Eclipse Plug-In Developer Extension for Model Context Protocol Services |
| 2 | + |
| 3 | +The [org.eclipse.mcp.modelContextProtocolServer extension point](https://eclipse-agents.github.io/eclipse-agents/org.eclipse.agents.docs/modelContextProtocolServer.html) can be used to declare and instantiate Model Context Protocol (MCP) services such as Resources, Tools and Prompts. They run on a single MCP server that runs within Eclipse IDE's VM. This enables interactivity between Eclipse based experiences and LLM-powered Agentic experiences running within or outside of the Eclipse IDE. |
| 4 | + |
| 5 | +It provides a simple mechanism to contribute MCP Tools and Resources to an MCP server running inside Eclipse. |
| 6 | + |
| 7 | +Uses [MCP Annotations](https://github.com/spring-ai-community/mcp-annotations) to annotate MCP java contributions. |
| 8 | + |
| 9 | +These annotations can abstract away the underlying usage of [modelcontextprotocol/java-sdk](https://github.com/modelcontextprotocol/java-sdk), though elements from the sdk are still available. |
| 10 | + |
| 11 | +Provides a centralized location for users customize Eclipse MCP capabilities and preferences. |
| 12 | + |
| 13 | +The built-in MCP Server makes available a suite MCP resources, templates and tools accessing the Eclipse platform, enabling agents to interact with your Eclipse IDEs workspace files, editors, consoles, problems and tasks. |
| 14 | + |
| 15 | +## Documentation |
| 16 | + |
| 17 | +- [Extension Point Documentation](https://eclipse-agents.github.io/eclipse-agents/org.eclipse.agents.docs/modelContextProtocolServer.html) |
| 18 | +- [Plugin Java Docs](https://eclipse-agents.github.io/eclipse-agents/org.eclipse.agents.docs/javadocs/org/eclipse/mcp/package-summary.html) |
| 19 | +- Summaries of Platform MCP contributions: |
| 20 | + - [Platform MCP Tools](https://eclipse-agents.github.io/eclipse-agents/org.eclipse.agents.docs/javadocs/org/eclipse/mcp/platform/Tools.html) |
| 21 | + - [Platform Resource Templates and Template Completions](https://eclipse-agents.github.io/eclipse-agents/org.eclipse.agents.docs/javadocs/org/eclipse/mcp/platform/ResaourceTemplates.html) |
| 22 | + - [Platform Resource Controller](https://eclipse-agents.github.io/eclipse-agents/org.eclipse.agents.docs/javadocs/org/eclipse/mcp/platform/ResourceController.html) |
| 23 | + |
| 24 | +To expose an aspect of your IDE plugin as an MCP tool, do the following: |
| 25 | + |
| 26 | +## Getting Started: Lets create an MCP Tool using an Annotated method |
| 27 | + |
| 28 | +1. Add plugins `org.eclipse.mcp` and `io.modelcontextprotocol` as dependencies to your plugin |
| 29 | +2. On you project's Java Compiler preference page, check the option "Store information about method parameters (usable via reflection). |
| 30 | +3. Create a method that uses [MCP Annotations](https://github.com/spring-ai-community/mcp-annotations) to annotate MCP tool contribution. An example from the platform package is: |
| 31 | + |
| 32 | +```java |
| 33 | + @McpTool (name = "openEditor", |
| 34 | + description = "open an Eclipse IDE editor on a file URI and set an initial text selection", |
| 35 | + annotations = @McpTool.McpAnnotations( |
| 36 | + title = "Open Editor")) |
| 37 | + public Editor openEditor( |
| 38 | + @McpToolParam( |
| 39 | + description = "Eclipse workspace file uri") |
| 40 | + String fileUri, |
| 41 | + @McpToolParam( |
| 42 | + description = "offset of the text selection", |
| 43 | + required = false) |
| 44 | + int selectionOffset, |
| 45 | + @McpToolParam( |
| 46 | + description = "length of the text selection", |
| 47 | + required = false) |
| 48 | + int selectionLength) { |
| 49 | + |
| 50 | + // implementation |
| 51 | + } |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +These annotations in combination with Jackson JSON annotations on the input and output parameters are used to create the MCP tool spec shared with MCP clients: |
| 56 | + |
| 57 | +```json |
| 58 | + { |
| 59 | + "name": "openEditor", |
| 60 | + "description": "open an Eclipse IDE editor on a file URI and set an initial text selection", |
| 61 | + "inputSchema": { |
| 62 | + "type": "object", |
| 63 | + "properties": { |
| 64 | + "fileUri": { |
| 65 | + "type": "string", |
| 66 | + "description": "Eclipse workspace file uri" |
| 67 | + }, |
| 68 | + "selectionOffset": { |
| 69 | + "type": "integer", |
| 70 | + "format": "int32", |
| 71 | + "description": "offset of the text selection" |
| 72 | + }, |
| 73 | + "selectionLength": { |
| 74 | + "type": "integer", |
| 75 | + "format": "int32", |
| 76 | + "description": "length of the text selection" |
| 77 | + } |
| 78 | + }, |
| 79 | + "required": [ |
| 80 | + "fileUri" |
| 81 | + ] |
| 82 | + }, |
| 83 | + "outputSchema": { |
| 84 | + "type": "object", |
| 85 | + "properties": { |
| 86 | + "editor": { |
| 87 | + "$ref": "#/$defs/ResourceLink" |
| 88 | + }, |
| 89 | + "file": { |
| 90 | + "$ref": "#/$defs/ResourceLink" |
| 91 | + }, |
| 92 | + "isActive": { |
| 93 | + "type": "boolean" |
| 94 | + }, |
| 95 | + "isDirty": { |
| 96 | + "type": "boolean" |
| 97 | + }, |
| 98 | + "name": { |
| 99 | + "type": "string" |
| 100 | + } |
| 101 | + }, |
| 102 | + "$schema": "https://json-schema.org/draft/2020-12/schema", |
| 103 | + "$defs": { |
| 104 | + "ResourceLink": { |
| 105 | + "type": "object", |
| 106 | + "properties": { |
| 107 | + "annotations": { |
| 108 | + ... |
| 109 | + }, |
| 110 | + "description": { |
| 111 | + "type": "string" |
| 112 | + }, |
| 113 | + "meta": { |
| 114 | + "type": "object" |
| 115 | + }, |
| 116 | + "mimeType": { |
| 117 | + "type": "string" |
| 118 | + }, |
| 119 | + "name": { |
| 120 | + "type": "string" |
| 121 | + }, |
| 122 | + "size": { |
| 123 | + "type": "integer", |
| 124 | + "format": "int64" |
| 125 | + }, |
| 126 | + "title": { |
| 127 | + "type": "string" |
| 128 | + }, |
| 129 | + "uri": { |
| 130 | + "type": "string" |
| 131 | + } |
| 132 | + } |
| 133 | + } |
| 134 | + } |
| 135 | + }, |
| 136 | + "annotations": { |
| 137 | + "title": "Open Editor", |
| 138 | + ... |
| 139 | + } |
| 140 | + } |
| 141 | +``` |
| 142 | + |
| 143 | +3. Implement the logic for your tool. |
| 144 | +4. Implement a org.eclipse.mcp.IFactoryProvider that returns your tool in method getAnnotatedObjects() |
| 145 | + |
| 146 | +## Declare your tool as an extension in your plugin.xml |
| 147 | + |
| 148 | +1. Using the Plugin Manifest Editor, add to your plugin.xml |
| 149 | + 1. Add the 'org.eclipse.mcp.modelContextProtocolServer' extension |
| 150 | + 2. Add the the extension a contributor |
| 151 | + 3. Add to the contributor a factory |
| 152 | + 4. Add an activity |
| 153 | + 1. The activity can be used to enable/disable contributions from your extension |
| 154 | + |
| 155 | +Example: |
| 156 | + |
| 157 | +```xml |
| 158 | + <extension |
| 159 | + point="org.eclipse.mcp.modelContextProtocolServer" |
| 160 | + id="foo.com.my.extension.id" |
| 161 | + name="My MCP Extension"> |
| 162 | + |
| 163 | + <contributor |
| 164 | + activityId="foo.com.my.activity.id"> |
| 165 | + <factory class = "foo.com.MyToolFactoryProvider"/> |
| 166 | + </contributor> |
| 167 | + </extension> |
| 168 | +``` |
| 169 | + |
| 170 | +Thats all that is required. Upon startup, MCP servers will start up and serve content over HTTP for the registered tools. Calls to tools will be delegated to your instances of IMCPTool |
| 171 | + |
| 172 | +1. The infrastructure will handle generation of JSON input and output schema and conversion between JSON and basic Java types. |
| 173 | +2. Use jackson JSON annotations such as @JsonProperty and @JsonPropertyDescription as necessary |
| 174 | +3. Register your toolFactory using an org.eclipse.mcp.modelContextProtocolServer extension in your plugin.xml |
| 175 | + |
| 176 | +### References |
| 177 | + |
| 178 | +- [Model Context Protocol](https://www.anthropic.com/news/model-context-protocol) |
| 179 | +- [java sdk](https://github.com/modelcontextprotocol/java-sdk) |
| 180 | +- [mcp-annotations](https://github.com/spring-ai-community/mcp-annotations) |
| 181 | + |
| 182 | +### Examples of Agentic IDE Tooling |
| 183 | + |
| 184 | +- [Claude Code API Applied to other IDEs](https://github.com/anthropics/claude-code/issues/1234) |
| 185 | +- [Windsurf Flow Awareness](https://windsurf.com/blog/windsurf-wave-9-swe-1) |
| 186 | +- [The Hidden Algorithms Powering Your Coding Assistant](https://diamantai.substack.com/p/the-hidden-algorithms-powering-your?utm_campaign=post) |
| 187 | + |
| 188 | +### Committers Setup |
| 189 | + |
| 190 | +- Use and Eclipse package with PDE and Git. I use [Eclipse J2EE package](https://www.eclipse.org/downloads/packages/release/2025-09/r/eclipse-ide-enterprise-java-and-web-developers) |
| 191 | +- Add git repo to Git Repositories view |
| 192 | +- Import all projects into workspace |
| 193 | +- In Preference page Plug-in Development / Target Platform: |
| 194 | + - Select or add the target platform you want to work with |
| 195 | + - Hit Edit button for the target platform |
| 196 | + - In the "Edit Target Definition" dialog, hit Add… |
| 197 | + - Select "Target File" in the Add Content dialog and continue |
| 198 | + - In the Location: field enter: file:///${workspace_loc:/eclipse-mcp}/target-platforms/latest.target |
| 199 | + - Finish changes and apply and close the changes |
| 200 | +- Create a new Run Configuration of type Eclipse Application and Run it. |
| 201 | +select "Eclipse Agent config targeting current stable Eclipse release" |
| 202 | + |
0 commit comments